> Synerise Documentation — Use Cases (Part 1 of 3)
>
> This is part 1 of 3 of the "Use Cases" section. To reconstruct the full section, fetch all 3 parts in order (part 1, part 2, …) and concatenate them. Each article begins with a top-level "# " heading. The manifest listing all sections is at https://hub.synerise.com/llms-full.txt
# Adding Gmail Promotions Annotation
Gmail allows highlighting your messages in the “Promotions” tab with Gmail Promotions Annotation.
Those annotations let you enhance the visibility of your emails and engage your recipients more effectively. With this feature, you can include a header, image, your company logo, the promotion's end date, and a variety of other details to make your emails stand out.
This use case demonstrates how to integrate the Gmail Promotions Annotation feature into email communication sent from Synerise. It provides a predefined HTML insert, making it easier to customize the Promotions Annotation in the Config tab in the code editor.
This feature is supported only for mailboxes associated with the gmail.com domain for individual users. This feature will work if the following conditions are met:
- The recipient opens the message using the Gmail mobile app.
- The message is delivered to the 'Promotions' tab.
- Annotations will only appear for one-time emails; subsequent messages with the same subject will be grouped into a thread and may not display properly.
## Prerequisites
---
- Configure a [sender account](/docs/campaign/e-mail/configuring-email-account).
- The domain must have SPF, DKIM, and DMARC configured.
- [Create an email etmplate](/docs/campaign/e-mail/creating-email-templates).
## Updating the template
---
1. Go to **Experience Hub > Email**.
2. On the left pane, click **Templates** and search for the template you prepared as a part of prerequisites.
**Result:** You are redirected to the code editor.
3. In the code editor, go to the **HTML** section and in the head section after the `` tag, add the code below:
This will add the following fields in the **Config** section:
The config form for adding Gmail Promotions Annotation
### Edit the form in the Config tab
The form in the Config tab is pre-filled with default values, which you can modify to suit your business needs.
1. In the **Company name** field, enter the name of your company.
2. In the **Company image** field, you can provide a link to an image.
3. In the **Subject line** field, you can type the subject you want to display.
4. In the **Description** field, you can type the text that displays with the deal badge.
5. In the **Code** field, you can type the discount or promotion code for the offer.
6. In the **Start date** field, you can type the date and time when the offer begins in [ISO 8601 format](https://support.google.com/merchants/answer/7055760).
7. In the **End date** field, you can type the end date and time of the promotion in [ISO 8601 format](https://support.google.com/merchants/answer/7055760).
8. If the template is ready, click **Save** in the upper right corner.
Configured Gmail Promotions Annotation with corresponding fields from the config form
## What's next
---
Now you can use this template in emails you sent through the Experience Hub and Automation Hub.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [template configuration](https://app.synerise.com/campaigns/email/content-manager/template/153289) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1).
## Read more
---
- [Email campaigns](/docs/campaign/e-mail)
- [Google's Guide](https://developers.google.com/gmail/promotab/overview) to the Gmail Promotions Annotation function
# Date-Driven and Transaction-Based Email Banners for Customer Segments
In today's fast-paced digital landscape, email marketing has evolved into a powerful tool for businesses to connect with their customers. The effectiveness of email campaigns often hinges on personalization. The ability to tailor content, products, and offers to individual recipients can significantly impact Key Performance Indicators (KPIs) and enhance the overall user experience.
Email personalization goes beyond addressing the recipient by their first name; it's about delivering content that speaks directly to their interests, needs, and preferences. Such personalization can be done based on any attributes or activities of the customer, such as, for example, the customer's club status, transaction history, age in combination with any other variables, such as even the day of the month/week. The number of possible scenarios is huge, making it a great place to implement the most daring ideas.
This use case describes a scenario in which customers receive email banners tailored to the following criteria:
- **Current Day of the Month:** Depending on the day, customers receive banners with special promotions relevant to that day.
- **Transaction History:** Customers are segmented into two groups based on whether they have made a transaction in the last 180 days or not.
**Assumptions:**
- The email is part of a specific marketing campaign scheduled for a particular month.
- All banner graphics and their links are stored in a catalog, with each day of the month having its own banner graphic for the respective audience.
**Scenarios:**
Group 1: Customers with recent transactions
For customers who have made at least one transaction in the last 180 days:
- **Days 1-15:** They receive Banner 1, offering a special promotion.
- **Days 16-31:** They receive Banner 2, featuring a different special promotion.
Group 2: Customers with no recent transactions
For customers who have not made any transactions in the last 180 days:
- **Days 1-15:** They receive Banner 1, offering a specific discount for a particular product category.
- **Days 16-31:** They receive Banner 2, with a different discount for another product category.
## Prerequisites
---
- Implement [Synerise tracking code](/developers/web/installation-and-configuration#creating-a-tracking-code) on your website.
- Permissions that allow access to Catalogs section and adding new catalogs.
- Implement the [transaction events](/developers/web/transactions-sdk) using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- Configure a [sender account](/docs/campaign/e-mail/configuring-email-account).
- Prepare a CSV file with banner graphics and corresponding links assigned to a specific day of the month and customer segment.
The file used in this use case contains the following columns:
- `DayOfTheMonth` - column that contains the days of the month (this column will be used as a catalog key)
- `Group1banners` - column that contains banners dedicated to Group 1 (customers who have made at least one transaction in the last 180 days)
- `Group2banners` - a column that contains banners dedicated to Group 2 (customers who have not made any transaction in the last 180 days)
- `link1` - column that contains links to banners dedicated for Group 1
- `link2` - column that contains links to banners dedicated to Group 2
Example file
Sample file
## Process
---
1. [Create a catalog](/use-cases/dynamic-email-campaign#create-a-catalog) with banners assigned to specific days of the week and customer segments.
2. [Create an aggregate](/use-cases/dynamic-email-campaign#create-an-aggregate) showing whether a customer has made a transaction in the last 180 days.
3. [Create a jinjava](/use-cases/dynamic-email-campaign#create-a-jinjava-insert) insert to be used in the email template.
4. [Create an email template](/use-cases/dynamic-email-campaign#create-an-email-template).
## Create a catalog
---
In this part of the process, create a catalog and import there your CSV file you prepared as a part of prerequisites.
1. Go to **Data Modeling Hub > Catalogs > New Catalog**.
2. Enter the name of the catalog and confirm it by clicking **Apply**.
Don't use diacritical letters and spaces.
3. Click the catalog on the list and click **Import Local File**.
If you prepared a CSV file in Excel, open it in a text editor to check whether commas are used as separators. If not, replace them with commas.
4. Click the **Upload a new file** button and select the file to be uploaded, then click **Next** button.
5. You will see the information that your file has been successfully uploaded. Click **Next** button to continue the import process.
6. In the **Primary key** field, type the name of the column whose values are treated as the key. In this case it will be `DayOfTheMonth`. Click **Next** button to continue the process.
Catalog primary key configuration
7. In the next screen you will find the summary of your import. If no changes are needed click **Run import** button.
Import success
## Create an aggregate
---
Create an aggregate that show whether a customer has made a transaction in the last 180 days. The ID of this aggregate will be later used in the Jinjava code.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Click **Analyze profiles by** and select **Exists**.
4. From the **Choose event** dropdown list, select the **transaction.charge** event.
5. Set the period from which the aggregate will analyze the results to the last **180 days**.
6. Save the aggregate.
Configuration of the aggregate
## Create a Jinjava insert
---
In this part of the process, prepare a Jinjava insert that will be used in the email template to display the relevant banner from the current day of the month to the appropriate customer segment.
Below you can find the jinjava insert used in this use case.
There is the list of used values that you need to replace to tailor this Jinjava to your campaign:
- replace `insert_aggregate_ID` with the ID of your aggreagate
- replace `insert_aggregate_name` with any unique aggregate name
- replace `insert_catalog_name ` with your catalog name
- in the `{{ catalog_result.link1 }}`, `{{ catalog_result.link2 }}` and `{{ catalog_result.Group1banners }}`, `{{ catalog_result.Group2banners }}` replace the `link1`, `link2` and `Group1banners`, `Group2banners` with the names of respective columns from the created catalog.
Check the Jinjava code
<!-- The purpose of the following part of Jinjava is to calculate the day of the month that corresponds to the current date plus 1 hour and save it as a string.).--> {% set now = (unixtimestamp(null)|plus_time(1, 'hours'))|unixtimestamp() %} {% set now_sec = now|divide(1000) %} {% set current_date = (now_sec|int*1000)|datetimeformat('%d.%m.%y') %} {% set current_date_array = current_date|split('.') %} {% set today = current_date_array[0] %} {% set todayString = today|int|string %} <!-- The logic behind the remaining part of Jinjava determines which set of HTML elements to generate based on the value of the aggregate result and the relevant links and image data from the catalog. This part divides customers into 2 groups based on their transaction activity (customers who have or have not made any transaction in the last 180 days).--> {% aggregate insert_aggregate_ID %} {% set insert_aggregate_name = aggregate_result|last %} {%if insert_aggregate_name =='true' %} {% catalogitemv2.insert_catalog_name(todayString) %} <a href="{% preparelink %}{{ catalog_result.link1 }}{% endpreparelink %}"> <img src="{{ catalog_result.Group1banners }}"> </a> {% endcatalogitemv2 %} {% else %} {% catalogitemv2.insert_catalog_name(todayString) %} <a href="{% preparelink %}{{ catalog_result.link2 }}{% endpreparelink %}"> <img src="{{ catalog_result.Group2banners }}"> </a> {% endcatalogitemv2 %} {% endif %} {% endaggregate %}
## Create an email template
---
In this part of the process, create an email template. You can use a predefined template or create your own template from scratch. In this case, we will use the predefined template.
1. Go to **Experience Hub > Email**.
2. On the left pane, click **Templates** and from the list of template folders, select **Predefined simple templates**.
3. Select any template that mostly fits the campaign assumptions.
**Result:** You are redirected to the code editor.
4. Edit the template according to your needs and add the row dedicated to the banner section.
5. Add **HTML** from the **Content** section to the created row and insert the Jinjava code you created in the previous step.
6. After you make changes to the template, you can check the preview.
1. Click the **Preview Contexts** button on the upper left side.
2. Enter the ID of a customer.
3. Click **Apply**.
7. If the template is ready, in the upper right corner, click the arrow next to **Next**, and from the dropdown select **Save as**.
8. On the pop-up:
1. In the **Template name field**, enter the name of the template.
2. From the **Template folder** dropdown list, select the folder where the template will be saved.
3. Confirm by clicking **Save**.
Below you can find an example of email context preview.
Email context preview
## What's next
---
You can use this template in an email campaign by sending it manually or setting it up in Automation Hub as part of your business scenario.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1).
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of each step directly in the Synerise Demo workspace:
- [Catalog](https://app.synerise.com/assets/catalogs/182804)
- [Aggregate](https://app.synerise.com/analytics/aggregates/860f507b-b2db-3b71-b98e-63a040183502)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
# Post-purchase receipt with personalized recommendations and store coupon via in-app message
Bridging the gap between offline purchases and digital engagement is a key challenge for omnichannel retailers. When a customer completes a transaction in a physical store, the experience typically ends at the checkout counter. However, this moment represents a valuable opportunity to deepen the relationship by delivering a rich, personalized follow-up directly in the customer's mobile app.
This use case describes how to generate **a personalized digital receipt displayed as an in-app message** shortly after an offline purchase. The receipt consolidates multiple data sources into a single view. The generated receipt includes:
- **Personalized greeting** with the customer's first name
- **Store name** based on the location where the purchase was made
- **Transaction details:** order ID, date, list of purchased products with images, names, SKUs, prices, and total amount
- **Loyalty program status:** current points balance and membership tier with a visual progress bar
- **AI-driven cross-sell recommendations** ("Recommended for you") based on the purchased products
- **Store-specific promotional coupon** with a tap-to-copy code, description, and expiration date
The entire payload is assembled using [Brickworks](/docs/assets/brickworks), which combines customer attributes, aggregates, expressions, external data, AI recommendations, and catalog lookups into a ready-to-render template.
The workflow is triggered by the `transaction.charge` event (indicating an offline purchase), waits briefly via a delay node, and then sends a silent mobile push that triggers the in-app message display. The in-app template renders a receipt-style layout with all the personalized data.
Example of the personalized digital receipt displayed as an in-app message
## Prerequisites
---
- [Implement Synerise SDK in your mobile app](/developers/mobile-sdk).
- Implement the [transaction events](/developers/web/transactions-sdk) using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction). The `transaction.charge` event must include a `storeId` parameter identifying the physical store.
- Import a product feed to Synerise. You can find instructions [here](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-search). Check the [use case](/use-cases/import-product-feed-to-catalog).
- [Configure AI engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations) for recommendations; enable the cross-sell recommendation type.
- Have a [loyalty program](/use-cases/loyalty-programs-basics) configured in Synerise with points and tiers.
- Create a [catalog](/docs/assets/catalogs/introduction-to-catalogs) mapping store IDs to promotion UUIDs. Each record in this catalog should contain at minimum: a key matching the `storeId` and a `promotion` attribute holding the UUID of the promotion assigned to that store.
- Create [promotions](/docs/ai-hub/promotions/creating-promotions) in Synerise that will serve as store-specific coupons to be displayed on the receipt.
- Create [API keys](/docs/settings/tool/api#adding-api-keys) with appropriate permissions for the Brickworks external data fields (access to activities API and promotions API).
## Process
---
In this use case, you will go through the following steps:
1. [Create aggregates for transaction data](#create-aggregates-for-transaction-data).
2. [Create an expression for loyalty points balance](#create-an-expression-for-loyalty-points-balance).
3. [Create an expression for loyalty level](#create-an-expression-for-loyalty-level).
4. [Create an AI recommendation for cross-sell products](#create-an-ai-recommendation-for-cross-sell-products).
5. [Create a Brickworks schema](#create-a-brickworks-schema) combining all data sources.
6. [Create the Brickworks record](#create-the-brickworks-record).
7. [Create an in-app campaign](#create-an-in-app-campaign) with the receipt template.
8. [Create a workflow to trigger the in-app via silent push](#create-a-workflow).
## Create aggregates for transaction data
---
In this part of the process, you will create aggregates that retrieve the details of the customer's most recent transaction. These aggregates will be used as default values in the Brickworks schema fields.
### Expression for transaction date
Before creating the aggregate, you need an expression that extracts a human-readable date from the `transaction.charge` event's timestamp. This expression applies a regular expression (Regexp) to the `TIMESTAMP` event attribute of the `transaction.charge` event to parse the date value.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression, for example `date [transaction.charge]`.
3. Set **Expressions for** to **Event**.
4. From the event dropdown list, select `transaction.charge`.
5. In the **Formula definition** section, build the following formula presented on the screen below.
6. **TIMESTAMP** is an **Event attribute** of type `TIMESTAMP` from the `transaction.charge` event, and the Regexp pattern extracts the date portion from the timestamp.
7. Save the expression.
Configuration of the date expression for transaction.charge
### Aggregate for last transaction date
This aggregate returns the date of the customer's most recent `transaction.charge` event, using the expression created above.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `Last transaction.charge lifetime - date`.
4. Click **Analyze profiles by** and select **Last**.
5. From the **Choose event** dropdown list, select the `transaction.charge` event.
6. As the event parameter, select the expression `date [transaction.charge]` created in the [previous step](#expression-for-transaction-date).
7. Define the period to **Lifetime**.
8. Save the aggregate.
Configuration of the last transaction date aggregate
### Aggregate for last transaction order ID
This aggregate returns the order ID from the customer's most recent `transaction.charge` event.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `Last transaction.charge lifetime - $orderId`.
4. Click **Analyze profiles by** and select **Last**.
5. From the **Choose event** dropdown list, select the `transaction.charge` event.
6. As the event parameter, select `$orderId`.
7. Define the period to **Lifetime**.
8. Save the aggregate.
Configuration of the last transaction order ID aggregate
### Aggregate for last transaction amount
This aggregate returns the total amount from the customer's most recent `transaction.charge` event.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `Last transaction.charge lifetime - $totalAmount`.
4. Click **Analyze profiles by** and select **Last**.
5. From the **Choose event** dropdown list, select the `transaction.charge` event.
6. As the event parameter, select `$totalAmount`.
7. Define the period to **Lifetime**.
8. Save the aggregate.
Configuration of the last transaction amount aggregate
### Aggregate for last transaction timestamp
This aggregate returns the timestamp of the customer's most recent `transaction.charge` event. The timestamp is used in the in-app template to calculate a time window (±50 seconds) for retrieving the exact `product.buy` events belonging to that transaction via the external data field.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `Last transaction.charge lifetime - timestamp`.
4. Click **Analyze profiles by** and select **Last**.
5. From the **Choose event** dropdown list, select the `transaction.charge` event.
6. As the event parameter, select `timeSent`.
7. Define the period to **Lifetime**.
8. Save the aggregate.
Configuration of the last transaction timestamp aggregate
### Aggregate for last store ID
This aggregate returns the store ID from the customer's most recent transaction. It is used in the workflow as an additional parameter in the silent push, enabling the in-app message to display the correct store name and store-specific coupon.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `Last transaction storeId`.
4. Click **Analyze profiles by** and select **Last**.
5. From the **Choose event** dropdown list, select the `transaction.charge` event.
6. As the event parameter, select `storeId`.
7. Define the period to **Lifetime**.
8. Save the aggregate.
## Create an expression for loyalty points balance
---
Create an expression that calculates the current loyalty points balance for the customer. The expression sums up all points earned (from transactions, registration, and manual additions) and subtracts all points spent (from promotion activations and manual deductions).
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression, for example `Loyalty points balance`.
3. In the description, enter `Expression shows current amount of points that user is able to use`.
4. Set **Expressions for** to **Attribute**.
5. In the **Formula definition** section, build the following formula presented on the screen below.
Where each component is a **Profile**-type aggregate:
- **Transaction points sum**: Aggregate **Sum** of the `points.loyalty` event, parameter `points`, period **Lifetime**.
- **Points for registration sum**: Aggregate **Sum** of the `points.register` event, parameter `points`, period **Lifetime**.
- **Manually added points sum**: Aggregate **Sum** of the `points.upcharge` event, parameter `points`, period **Lifetime**.
- **Points for promotion activation sum**: Aggregate **Sum** of the `client.activatePromotion` event, parameter `promotionRequireRedeemedPoints`, period **Lifetime**.
- **Manually deducted points sum**: Aggregate **Sum** of the `points.downcharge` event, parameter `points`, period **Lifetime**.
6. Save the expression.
Formula definition of the loyalty points balance expressionConfiguration of the Transaction points sum aggregate within the expressionConfiguration of the Points for registration sum aggregate within the expressionConfiguration of the Manually added points sum aggregate within the expressionConfiguration of the Points for promotion activation sum aggregate within the expressionConfiguration of the Manually deducted points sum aggregate within the expression
The exact event names and parameter names for the loyalty points aggregates depend on your loyalty program configuration. The names listed above correspond to the Synerise Demo workspace loyalty setup. Adjust them to match your implementation.
## Create an expression for loyalty level
---
Create an expression that returns the customer's current loyalty tier based on conditional logic. The expression evaluates a series of segmentations — each representing a loyalty tier — and returns the corresponding label (for example, "Base member", "Silver member", "Gold member", or "Premium member").
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression, for example `[UC] Loyalty level`.
3. Set **Expressions for** to **Attribute**.
4. In the **Formula definition** section, build a nested conditional (If) formula with the following logic:
`If( [UC] Loyalty level - Base, "Base member", If( [UC] Loyalty level - Silver, "Silver member", If( [UC] Loyalty level - Gold, "Gold member", If( [UC] Loyalty level - Premium, "Premium member", null ) ) ) )`
Each green node (`[UC] Loyalty level - Base`, `[UC] Loyalty level - Silver`, `[UC] Loyalty level - Gold`, `[UC] Loyalty level - Premium`) is a **segmentation** that checks whether the customer falls into the corresponding loyalty tier based on their points balance. The expression evaluates them in order and returns the first matching tier label. If none matches, it returns `null`.
5. Save the expression.
Formula definition of the loyalty level expression
The segmentations referenced in this expression (for example, `[UC] Loyalty level - Gold`) define the point thresholds for each tier. You need to create these segmentations separately in **Decision Hub > Segmentations** before building this expression. Each segmentation should use a condition based on the customer's loyalty points sum (for example, "points sum ≥ 4000 AND points sum < 10000" for the Gold tier). Adjust the thresholds to match your loyalty program requirements.
## Create an AI recommendation for cross-sell products
---
In this part of the process, you will configure a cross-sell (complementary products) recommendation. This recommendation suggests products related to what the customer has just purchased and is displayed in the "Recommended for you" section of the receipt.
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation, for example `Recommending complementary products`.
3. In the **Type & Items feed** section, click **Define**.
1. From the **Items Feed** dropdown list, select the item catalog which you configured as a part of [prerequisites](#prerequisites).
2. In the **Type** section, choose the **Cross-sell** recommendation type.
3. Confirm the settings by clicking **Apply**.
4. In the **Items** section, click **Define**.
1. Define the items slot configuration according to your needs.
2. Confirm by clicking **Apply**.
5. In the **Slots and items ordering** section, click **Define**.
1. Set **Slots and items ordering** to **Arrange items in slot order**.
2. Set **Items sorting method within slots** to **Sort by score**.
3. Confirm by clicking **Apply**.
6. Optionally, define the **Boosting** factors.
7. In the **Additional settings** section, click **Define**.
1. Enable **Exclude already bought products** with the **Elastic** option and set the period to **180 days**.
2. Set **Item context from analytics (aggregate, expression)** to an aggregate or expression that returns the SKU of the last purchased product (for example, `Last 1 product.buy sku`).
3. Confirm by clicking **Apply**.
8. In the upper right corner, click **Save**.
## Create a Brickworks schema
---
In this part of the process, you will [create a Brickworks schema](/docs/assets/brickworks/quick-start/creating-a-schema) that serves as a structured container for all the data displayed on the personalized receipt. The schema combines customer attributes, aggregates, expressions, AI recommendations, external API data, and catalog lookups into a single renderable payload.
1. Go to **Data Modeling Hub > Brickworks > New schema**.
2. Choose **Simple Schema**.
3. Enter a name for the schema, in **Display name** for example `Receipt Intelligence`. **API name** is pre-filled with the value from Display name.
4. Optionally, fill in the **Description** field.
### Add Firstname field
5. Click **Add new field** and choose **Customer attribute**.
6. Complete the fields:
- **Display name**: `Firstname`
- **API name**: `firstname` (pre-filled automatically)
7. Configure the field to return the customer's `firstname` attribute.
8. To save your changes, click **Apply**.
Configuration of the Firstname field
### Add Points balance field
5. Click **Add new field** and choose **Expression**.
6. Complete the fields:
- **Display name**: `Points balance`
- **API name**: `pointsBalance` (pre-filled automatically)
7. In **Configuration**, enable **Default value** and select the expression `Loyalty points balance [LOYALTY-DEMO]` created in the [previous step](#create-an-expression-for-loyalty-points-balance).
8. Enable **Return null when object is missing** to prevent rendering errors if the expression returns no data.
9. To save your changes, click **Apply**.
Configuration of the Points balance field
### Add Loyalty level field
5. Click **Add new field** and choose **Expression**.
6. Complete the fields:
- **Display name**: `Loyalty level`
- **API name**: `loyaltyLevel` (pre-filled automatically)
7. In **Configuration**, enable **Default value** and select the expression `[UC] Loyalty level` created in the [previous step](#create-an-expression-for-loyalty-level).
8. Enable **Return null when object is missing**.
9. To save your changes, click **Apply**.
Configuration of the Loyalty level field
### Add Cross-sell reco field
5. Click **Add new field** and choose **AI Recommendations**.
6. Complete the fields:
- **Display name**: `Cross-sell reco`
- **API name**: `crossSellReco` (pre-filled automatically)
7. In **Configuration**, enable **Default value** and select the AI recommendation `Recommending complementary products` created in the [previous step](#create-an-ai-recommendation-for-cross-sell-products).
8. The **Item context** field can be left empty or configured with a Jinjava expression if you want to pass a specific product context for the cross-sell recommendation.
9. To save your changes, click **Apply**.
Configuration of the Cross-sell reco field
### Add product buy field (External Data)
This field uses an external API call to retrieve the `product.buy` events that belong to the customer's most recent transaction. It uses the transaction timestamp (passed via context) with a ±50 seconds window to identify the exact products from that transaction.
5. Click **Add new field** and choose **External data**.
6. Complete the fields:
- **Display name**: `product buy`
- **API name**: `productBuy` (pre-filled automatically)
7. In **Configuration**, select the external data source (in this example named `Transactions`).
The external data source makes the following API call:
8. To save your changes, click **Apply**.
Configuration of the product buy external data field
The `dateFrom` and `dateTo` context parameters are calculated dynamically in the in-app template code by taking the last transaction timestamp and adding/subtracting 50000 milliseconds (~50 seconds). This ensures only the `product.buy` events belonging to that specific transaction are returned.
### Add Promotion list field (External Data)
This field uses an external API call to retrieve the list of active and assigned promotions for the current customer. The in-app template then matches the promotion UUID (retrieved from the store-to-promotion catalog) against this list to display the correct store-specific coupon.
5. Click **Add new field** and choose **External data**.
6. Complete the fields:
- **Display name**: `Promotion list`
- **API name**: `promotionDetails` (pre-filled automatically)
7. In **Configuration**, select the external data source (in this example named `Promotion list`).
The external data source makes the following API call:
curl -X GET "https://api.synerise.com/v4/promotions/v2/promotion/get-for-client/clientId/{{customer.id}}?status=ACTIVE,ASSIGNED&fields=code,name,expireAt,discountType,discountValue,uuid,description,expireAt" \
-H "Authorization: Basic USERNAME:PASSWORD"
8. To save your changes, click **Apply**.
Configuration of the Promotion list external data field
### Add Last transaction date field
5. Click **Add new field** and choose **Expression**.
6. Complete the fields:
- **Display name**: `Last transaction date`
- **API name**: `lastTransactionDate` (pre-filled automatically)
7. In **Configuration**, enable **Default value** and select the aggregate `Last transaction.charge lifetime - date` created in the [earlier step](#aggregate-for-last-transaction-date).
8. To save your changes, click **Apply**.
Configuration of the Last transaction date field
### Add Last transaction orderId field
5. Click **Add new field** and choose **Expression**.
6. Complete the fields:
- **Display name**: `Last transaction orderId`
- **API name**: `lastTransactionOrderId` (pre-filled automatically)
7. In **Configuration**, enable **Default value** and select the aggregate `Last transaction.charge lifetime - $orderId` created in the [earlier step](#aggregate-for-last-transaction-order-id).
8. To save your changes, click **Apply**.
Configuration of the Last transaction orderId field
### Add Last transaction amount field
5. Click **Add new field** and choose **Expression**.
6. Complete the fields:
- **Display name**: `Last transaction amount`
- **API name**: `lastTransactionAmount` (pre-filled automatically)
7. In **Configuration**, enable **Default value** and select the aggregate `Last transaction.charge lifetime - $totalAmount` created in the [earlier step](#aggregate-for-last-transaction-amount).
8. To save your changes, click **Apply**.
Configuration of the Last transaction amount field
### Add Last transaction timestamp field
5. Click **Add new field** and choose **Expression**.
6. Complete the fields:
- **Display name**: `Last transaction timestamp`
- **API name**: `lastTransactionTimestamp` (pre-filled automatically)
7. In **Configuration**, enable **Default value** and select the aggregate `Last transaction.charge lifetime - timestamp` created in the [earlier step](#aggregate-for-last-transaction-timestamp).
8. To save your changes, click **Apply**.
Configuration of the Last transaction timestamp field
### Overview of all schema fields
Overview of all fields in the Receipt Intelligence Brickworks schema
### Set up the Audience & Settings
1. Click the **Audience & Settings** tab.
2. In the **Audience** section, click **Define**.
3. Choose the schema recipients, in this case, choose **Everyone**.
4. Click **Apply**.
5. In the upper-right corner, click **Save**.
## Create the Brickworks record
---
[Creating a record](/docs/assets/brickworks/quick-start/creating-a-record) fills the schema with actual values. In this case, the record uses dynamic context to resolve all fields at render time based on the requesting customer and their latest transaction.
1. Go to **Data Modeling Hub > Data collections > Select schema**.
2. Choose the [schema created in the previous step](#create-a-brickworks-schema).
3. Click **Add record**.
4. Add a name for the record.
5. Add a slug for the record. Slug is a unique, URL-friendly version of the name. In this case, it is `receiptSimpleSchema1`.
6. The record fields will inherit default values from the schema configuration:
- **Firstname**: `firstname` (customer attribute)
- **Points balance**: [Loyalty points balance [LOYALTY-DEMO]](https://app.synerise.com/analytics/expressions/ff12ecbd-b89f-4e8f-b85e-6854f7fea9c0) (expression)
- **Loyalty level**: `[UC] Loyalty level` (expression)
- **Cross-sell reco**: [Recommending complementary products](https://app.synerise.com/ai-v2/recommendations/ly321Pc82ALq) (AI recommendation)
- **product buy**: `Transactions` (external data)
- **Promotion list**: `Promotion list` (external data)
- **Last transaction date**: [Last transaction.charge lifetime - date](https://app.synerise.com/analytics-v2/aggregates/97739400-4da7-350c-9111-757ff57ac17b) (aggregate)
- **Last transaction orderId**: [Last transaction.charge lifetime - $orderId](https://app.synerise.com/analytics-v2/aggregates/058e59ef-74f1-3073-871b-9377721d91a1) (aggregate)
- **Last transaction amount**: [Last transaction.charge lifetime - $totalAmount](https://app.synerise.com/analytics-v2/aggregates/ef870a4c-1743-3d73-aa85-fae786ff1f42) (aggregate)
- **Last transaction timestamp**: [Last transaction.charge lifetime - timestamp](https://app.synerise.com/analytics-v2/aggregates/6ce58d75-bbe6-3040-94b3-b532138d42a8) (aggregate)
7. Click **Publish** to publish your record.
### Previewing records
After publishing the record, you can [preview the record](/docs/assets/brickworks/quick-start/creating-a-record#previewing-records) for the context of a selected user. This context-driven approach enables your records to adapt dynamically based on the requesting customer and their transaction history.
1. Go to **Data Modeling Hub > Records**.
2. In the header, from the **Select schema** dropdown list, select the schema created previously.
3. Find the record which you want to preview.
4. Enter the record configuration.
5. Click the **Preview context**.
6. From the dropdown list, find a profile for whom you want to generate the record preview.
7. Click **Add parameter** and add the context parameters:
- `storeId` - the ID of the store (for example, `1`)
- `locale` - the locale (for example, `pl-PL`)
- `dateFrom` - the start of the time window for product.buy events (timestamp in milliseconds)
- `dateTo` - the end of the time window for product.buy events (timestamp in milliseconds)
- `currency` - the currency code (for example, `PLN`)
**Result**: You will see a dynamic preview with the customer's first name, loyalty data, transaction details, cross-sell recommendations, and available promotions.
## Create an in-app campaign
---
In this part of the process, you [create an in-app campaign](/docs/campaign/in-app-messages/create-inapp-message) that displays the personalized receipt. The in-app is triggered by a silent push notification sent from the workflow after a purchase.
1. Go to **Experience Hub > In-app messages > Create new**.
2. Enter the name of the in-app, for example `Receipt Intelligence`.
### Define the audience
---
1. In the **Audience** section, click **Define**.
2. Click **Everyone**.
3. To save the audience, click **Apply**.
### Define content
---
In this part of the process, you will create the in-app template from scratch using the code editor. The template is written in HTML, CSS, and JavaScript with Jinjava inserts that dynamically resolve data from the Brickworks schema at render time.
1. In the **Content** section, click **Define**.
2. Click **Create message**.
3. Create a new template.
4. Choose a **code editor**.
**Result:** You are redirected to the code editor where you can write the HTML, CSS, and JavaScript code for the receipt template.
The template code uses Jinjava to assemble the receipt from multiple data sources. Below is a description of the key parts of the template logic and the Jinjava inserts used in each part.
#### Retrieving the store-specific promotion UUID
The template first looks up the promotion UUID assigned to the store where the purchase was made. It does this by querying a catalog that maps store IDs to promotion UUIDs. The store ID is passed as a parameter (`lastStoreId`) via the silent push from the workflow.
{% catalogitemv2.CATALOG_ID(key) %}
{% do promoId.append(catalog_result.promotion) %}
{% endcatalogitemv2 %}
#### Calculating the transaction time window
The template uses the [aggregate for last transaction timestamp](#aggregate-for-last-transaction-timestamp) to retrieve the timestamp of the most recent purchase. It then calculates a ±50 second window around this timestamp. This window is passed as `dateFrom` and `dateTo` context parameters to the Brickworks external data field, ensuring that only the `product.buy` events from that specific transaction are returned.
{% aggregate 6ce58d75-bbe6-3040-94b3-b532138d42a8 %}
{% set date1 = aggregate_result[0] - 50000 %}
{% set date2 = aggregate_result[0] - (-50000) %}
#### Generating the Brickworks payload
The template calls the `brickworksgeneratevar` Jinjava tag, passing the schema ID, record ID, and a dynamic context object. This triggers the Brickworks engine to resolve all fields in the schema (customer attributes, expressions, aggregates, AI recommendations, and external data) and return the result as a single `brickworks_result` object.
#### Rendering the receipt sections
The template accesses the resolved data through the `brickworks_result` object and renders each section of the receipt:
- `brickworks_result.firstname` — customer's first name for the greeting
- `brickworks_result.pointsBalance` — loyalty points balance
- `brickworks_result.loyaltyLevel` — loyalty tier label
- `brickworks_result.lastTransactionOrderid` — order ID
- `brickworks_result.lastTransactionDate` — transaction date
- `brickworks_result.lastTransactionAmount` — total amount
- `brickworks_result.productBuy.data` — array of purchased products (iterated with `{% for product in brickworks_result.productBuy.data %}`)
- `brickworks_result.crossSellReco.data` — array of recommended products
- `brickworks_result.promotionDetails.data` — array of available promotions
#### Matching and displaying the store-specific coupon
The template iterates through the list of promotions returned by the external data field and matches the promotion UUID from the catalog lookup. Only the promotion matching the store is displayed to the customer.
The rendered template includes the following visual sections:
- **Header**: Store name, thank-you message, personalized greeting with the customer's first name
- **Transaction details**: Order ID and transaction date
- **Loyalty strip**: Points balance and loyalty tier with a visual progress bar
- **Purchase details**: List of products from the transaction with images, names, SKUs, and prices
- **Total amount**: Sum of the transaction
- **Recommendations**: Horizontally scrollable cross-sell product cards with images, names, and prices
- **Coupon**: Store-specific promotion with a tap-to-copy coupon code, description, and expiration date
- **Footer**: Call-to-action to visit again with the store name
Preview of the in-app receipt message with all personalized sections
#### JavaScript for coupon copy functionality
The code includes JavaScript that enables a tap-to-copy functionality for the coupon code:
5. After completing the template, click **Save this template > Save as**.
6. On the pop-up:
1. In the **Template name** field, enter the name of the template.
2. From the **Template folder** dropdown list, select the folder where the template will be saved.
3. Confirm by clicking **Apply**.
7. To continue the process of configuring the in-app campaign, click **Next**.
8. To save your content changes, click **Apply**.
### Select events that trigger the in-app message display
---
The in-app message is triggered by the silent push notification sent from the workflow. Configure the trigger event according to the content identifier used in the silent push.
1. In the **Trigger events** section, click **Define**.
2. Configure the trigger event to match the silent push content identifier. In our case it will be `transaction.charge`.
3. Click **Apply**.
### Schedule the message and configure display settings
---
1. In the **Schedule** section, click **Define** and set the time when the message will be active.
2. In the **Display Settings** section, click **Change**.
3. Define the **Delay display**, **Priority index** and enable the **Frequency limit** toggle to manage the frequency of the in-app message display.
4. Click **Apply**.
5. Optionally, you can define the UTM parameters and additional parameters for your in-app campaign.
6. Click **Activate**.
## Create a workflow
---
Create a workflow that triggers the in-app receipt display after an offline purchase. The workflow listens for `transaction.charge` events with a `storeId` parameter, waits for a short delay, and then sends a silent mobile push that activates the in-app message with the necessary context parameters.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow, for example `Trigger in-app via silent push after purchase`.
### Define the Profile Event trigger node
---
1. As the first node of the workflow, add **Profile Event**. In the configuration of the node:
1. From the **Choose event** dropdown menu, choose the `transaction.charge` event.
2. Click the **+ where** button, from the **Choose parameter** dropdown menu, choose `storeId`.
3. From the **Choose operator** dropdown, choose **Exist**.
2. Confirm by clicking **Apply**.
Configuration of the Profile Event node
### Configure the Delay node
---
1. As the next node, add **Delay**.
2. Set the delay duration according to your business needs (for example, a few minutes to allow all transaction data to be processed and indexed).
3. Confirm by clicking **Apply**.
### Configure the Send Mobile Push node
---
1. As the next node, add **Send Mobile Push**. In the configuration of the node:
1. In the **Mobile push type** section, click **Change** and select **Silent push**.
2. In the **Content** section, click **Change** and select the in-place content linked to the in-app campaign.
3. In the **Additional parameters** section, add two custom parameters:
- **Parameter**: `campaignName`, **Value**: `[UC] Receipt Intelligence`
- **Parameter**: `lastStoreId`, **Value**: Insert the [aggregate for last store ID](#aggregate-for-last-store-id) created earlier. The value uses the Jinjava aggregate insert to dynamically resolve the store ID for each customer.
4. Confirm by clicking **Apply**.
Configuration of the Send Mobile Push node with additional parameters
The `lastStoreId` parameter is critical — it is passed to the in-app template as context and used to look up the store name and the store-specific promotion UUID from the catalog. The value is retrieved dynamically using the aggregate that returns the last `storeId` from the `transaction.charge` event.
### Add the finishing node
---
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
The complete workflow: Profile Event → Delay → Send Mobile Push → End
## What's next
---
After implementing this use case, you can extend the receipt experience in several ways:
- Add a **store locator** link in the footer to help customers find the store for their next visit.
- Include a **feedback survey** link to gather post-purchase satisfaction data.
- Extend the template with **loyalty program milestones** (for example, showing how many points until the next tier).
- Reuse the Brickworks schema across other channels such as email or web push for a consistent post-purchase experience.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of each step directly in the Synerise Demo workspace:
- [Aggregate: Last transaction.charge lifetime - timestamp](https://app.synerise.com/analytics-v2/aggregates/6ce58d75-bbe6-3040-94b3-b532138d42a8)
- [Aggregate: Last transaction.charge lifetime - $totalAmount](https://app.synerise.com/analytics-v2/aggregates/ef870a4c-1743-3d73-aa85-fae786ff1f42)
- [Aggregate: Last transaction.charge lifetime - $orderId](https://app.synerise.com/analytics-v2/aggregates/058e59ef-74f1-3073-871b-9377721d91a1)
- [Aggregate: Last transaction.charge lifetime - date](https://app.synerise.com/analytics-v2/aggregates/97739400-4da7-350c-9111-757ff57ac17b)
- [Expression: Loyalty points balance [LOYALTY-DEMO]](https://app.synerise.com/analytics/expressions/ff12ecbd-b89f-4e8f-b85e-6854f7fea9c0)
- [AI Recommendation: Recommending complementary products](https://app.synerise.com/ai-v2/recommendations/ly321Pc82ALq)
- [Brickworks schema and record](https://app.synerise.com/assets/brickworks/schemas/480b5a15-8b55-4645-9fc2-13962e88f551/records/18d3296f-8016-4933-b0aa-9ead88243bac)
- [In-app campaign](https://app.synerise.com/communications/in-app/0cabb677-bcda-4f97-b46d-127d1106e0b2/content-manager/template/editor?variant=0)
- [Workflow](https://app.synerise.com/automations/workflows/automation-diagram/da894e1f-c44a-4f6b-81e5-053803cb73b7)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 15 events per profile that completes the flow:
[`transaction.charge`](/docs/assets/events/event-reference/items#transactioncharge) (~1), [`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~2), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`push.send`](/docs/assets/events/event-reference/mobile-push#pushsend) (~1), [`inApp.show`](/docs/assets/events/event-reference/inapp#inappshow) (~1), [`inApp.click`](/docs/assets/events/event-reference/inapp#inappclick) (~1), [`brickworks.generated`](/docs/assets/events/event-reference/brickworks#brickworksgenerated) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Brickworks](/docs/assets/brickworks)
- [AI Recommendations](/docs/ai-hub/recommendations-v2)
- [Catalogs](/docs/assets/catalogs/introduction-to-catalogs)
- [Expressions](/docs/crm/expressions)
- [In-app messages](/docs/campaign/in-app-messages)
- [Automation Hub](/docs/automation)
- [Loyalty programs](/use-cases/loyalty-programs-basics)
- [Mobile push](/docs/campaign/Mobile/mobile_campaign)
- [Promotions](/docs/ai-hub/promotions/creating-promotions)
# Handle non-existing phrases in search engine
With Synerise AI search, you can effectively control how your search engine processes queries. You can manage the behavior of the search engine by telling it to promote specific products, replace the query or a word in the query or remove a word from it in specific circumstances.
This use case describes the process of replacing a specified phrase used in the search query with a new one, defined by us, in case there are no results for a phrase because it does not appear in the catalog.
## Prerequisites
---
- Enable [The Search Engine](/docs/ai-hub/ai-search/introduction-to-ai-search) for your workspace and create an [index](/docs/ai-hub/ai-search/create-index).
- [Implement AI search](https://hub.synerise.com/api-reference/ai-search) in any of your channels (mobile app, website etc.).
## Add rules
---
In this use case, you replace query: 'NYC' and 'the city that never sleeps' with new query. When a customer types any of these words into a search engine, it will return 'New York' as a relevant search result.
1. Go to **AI Hub > Indexes**.
2. Select an index from the list.
3. Click the **Rules** tab.
4. On the right side of the screen, click **Add rule**.
5. Name the rule.
6. To adjust the query conditions, in the **Conditions** section, click **Define**.
1. Choose the **Query** tab.
2. Next to **If query** choose **is** from the dropdown list.
3. In the field **Type word** in the **Phrase** section, type a word (or a phrase) in a singular form, that doesn't exist in the search engine catalog.
4. You can add more phrases.
5. Click **Apply**.
Example of conditions the query needs to meet so the rule can be triggered
7. To define how the search engine reacts to the defined conditions, in the **Consequences** section, click **Define**.
1. Click **Add consequence** and choose **Replace query** from the dropdown list.
2. Enter a query replacement.
3. Click **Apply**.
Example of what happens if the conditions are fulfilled
8. You can define when the query rule applies, in the **Schedule** section.
8. Click **Save & Publish**.
## Check the use case set up on the Synerise Demo workspace
---
You can also check the query rules configuration directly in Synerise Demo workspace at this [link](https://app.synerise.com/ai-v2/search/indices/50b0e2ac14e8e7643da4965e6631242e1729069084/query-rules/33482).
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 2 events per profile that completes the flow:
[`item.search`](/docs/assets/events/event-reference/search#itemsearch) (~1), [`item.search.click`](/docs/assets/events/event-reference/search#itemsearchclick) (~1).
## Read more
---
- [Configuring AI Search](/docs/ai-hub/ai-search/introduction-to-ai-search#configuring-ai-search).
- [Creating rules](/docs/ai-hub/ai-search/query-rules)
# Boost High-Margin Products in Personalized Recommendations
It's hard to disagree that the ultimate goal of business is to make a profit. To achieve specific profit margin targets, marketers need to create an effective plan to achieve these goals. One of the ways to increase profits is to recommend higher-margin items to customers than the average margin of items typically purchased by customers while personalizing the results of product recommendations. This approach can streamline sales efforts without involving high costs.
## Prerequisites
---
- [Create items catalog](/docs/ai-hub/recommendations-v2/item-feed-requirements). The item catalog must include an attribute which will be used to denote (in this use case, it's the `margin` attribute, which contains the margin value for each product).
- [Configure an item catalog for recommendations](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations). Enable personalized recommendations.
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
When implementing transaction events, remember to add a `margin` parameter, which will contain the value of the margin on the sold product.
## Process
---
1. [Create an aggregate](/use-cases/boost-higher-margin-products#create-an-aggregate).
2. [Create recommendation](/use-cases/boost-higher-margin-products#create-a-recommendation).
## Create an aggregate
---
In this part of the process, create an aggregate that returns the average margin value of the products bought by an individual customer.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Average**.
4. From the **Choose event** dropdown list, select the **product.buy** event.
5. As the event parameter, select **margin**.
6. Define the period from which data will be analyzed.
7. Save the aggregate.
Configuration of the aggregate
## Create a recommendation
---
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. In the top left corner, enter the name of your recommendation.
3. In the **Type & Items feed** section, click **Define**.
4. From the **Items feed** dropdown menu, choose the provided feed.
5. Choose the **Personalized** recommendation type.
Configuraion of the catalog and recommendation type section
6. Click **Apply**.
7. In the **Items** section, click **Define**.
1. Click **Add slot**.
2. Define the minimum and maximum number of items that will be recommended to the user in each slot.
3. Confirm by clicking **Apply**.
8. In the **Boosting** section:
1. Click **Define**.
2. Click **Add rule**.
3. Click **Define rule** and select **Visual Builder**.
**Result**: The Visual Builder window opens.
4. From the **Select attribute** dropdown list, select the **margin** attribute.
You can use the search field.
5. From the **Operator** dropdown list, select **More than**.
6. Click the value type icon () and choose **Aggregate**.
7. From the **Choose aggregate** dropdown list, select an aggregate created in [the previous step](/use-cases/boost-higher-margin-products#create-an-aggregate).
The configured filter allows you to boost items with a margin higher than the one returned in the created aggregate.
8. Click **Apply**.
Boosting items with margins higher than the average margin of products purchased by the customer
9. In the **Promote/Demote** selector, select **Promote** (default value).
10. Use the slider to adjust how much you want the rule to affect the results.
11. Save the **Boosting** section settings by clicking **Apply**.
12. Optionally, you can define the settings in the **Additional settings** section.
13. Save the recommendation.
## What's next
---
You can display the recommendation to customers in several ways, for example by using the [recommendation insert](/developers/inserts/recommendations-v2) in [dynamic content](/docs/campaign/dynamiccontent/creating-dynamic-content) or in a mobile app using documents - [iOS SDK](/developers/mobile-sdk/displaying-recommendations/content-widget/ios), [Android SDK](/developers/mobile-sdk/displaying-recommendations/content-widget/android).
If you decide to implement recommendations through dynamic content then you need to implement [Synerise JS SDK](/developers/web/installation-and-configuration) and [OG tags](/developers/web/og-tags) into your website. Alternatively, you can also implement campaigns through [API](https://hub.synerise.com/api-reference/ai-recommendations#operation/GetRecommendationsByCampaignV2).
## Check the use case set up on the Synerise Demo workspace
---
You can also check the [aggregate](https://app.synerise.com/analytics/aggregates/f8a165a0-1deb-3ab8-8e20-9b1a520ebe72) and [AI recommendation](https://app.synerise.com/ai-v2/recommendations/Pk2EKr9IlyTw) configuration directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Creating aggregates](/docs/crm/aggregates/creating-profile-aggregates)
- [Creating recommendations](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign)
- [Filters in recommendations](/docs/ai-hub/recommendations-v2/recommendation-filters)
- [Requirements for item feed](/docs/ai-hub/recommendations-v2/item-feed-requirements)
# Excluding category of recently purchased products in recommendations
Personalized product recommendations are incredibly effective because they use your customers' search, browsing, and purchase history to recommend products that are tailored to their specific requirements and preferences. To create even better communication, you can exclude from recommendations the categories of items recently bought by a customer.
In this use case, you will learn how to create a personalized recommendation campaign which uses an aggregate to exclude the categories of recently purchased products.
## Prerequisites
---
- Configure an [item feed](/docs/ai-hub/recommendations-v2/item-feed-requirements).
- [Configure an item catalog for recommendations](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations). Enable the personalized recommendation model.
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
## Process
---
1. [Create an aggregate](/use-cases/reco-excluding-recently-purchased-category#create-an-aggregate) of recently purchased products' categories to exclude them from personalized recommendation campaign.
2. [Create a recommendation](/use-cases/reco-excluding-recently-purchased-category#create-a-recommendation).
## Create an aggregate
---
In this part of the process, create an aggregate that will return categories of products already bought by the customer.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last Multi**.
4. Select **Consider only distinct occurrences of the event parameter**.
5. In the **Size** field, enter the number of returned categories.
5. Select the **product.buy** event.
6. Select the **category** parameter.
7. Define the period from which the aggregate will return products from the event.
This period will affect which purchases are included when checking for categories to exclude from the recommendation.
8. Save the aggregate.
Configuration of the aggregate
## Create a recommendation
---
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
3. In the top left corner, enter the name of your recommendation.
4. In the **Type & Items feed** section, click **Define**.
5. From the **Items feed** dropdown menu, choose the provided feed.
6. Choose the **Personalized** recommendation type.
7. Click **Apply**.
Configuraion of the catalog and recommendation type section
8. In the **Items** section, click **Define**.
1. Click **Add slot**.
2. Define the minimum and maximum number of items that will be recommended to the user in each slot. In our example, one slot returns 4 products. In the **Items** section, click the **Define** button. Click the plus button to add more slots. This will allow you to define new slots for your recommendation setup. In the slot settings, specify the minimum and maximum number of items to be recommended to the user within this slot.
3. Click **Static filter**.
Learn about the difference between [elastic, static](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#select-conditions-of-displaying-items), and [distinct](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#distinct-filter) filters.
4. From the dropdown list, choose **Visual Builder**.
2. Click **Select attribute**.
3. From the dropdown list, choose the **category** attribute.
4. Click **Operator**.
5. From the dropdown list, choose **Does not equal**.
6. Click the value type icon () and choose the aggregate icon from the list.
7. From the dropdown list, choose [the aggregate you have created](/use-cases/reco-excluding-recently-purchased-category#create-an-aggregate).
8. In the **Level range** input area that appear, you can choose how you want to select your category level. Choose: **Whole category.**
If your products categories have a `X > Y > Z` structure, level 0 will be `X > Y > Z`. Level 1 will be `X > Y` and so on. Here, you define how granular the category recommendations will be. For example, if you are selling shoes, you will have an `Outdoor > Sport > Running` category and an `Outdoor > Sport > Football` category. If level 0 is selected, the two categories are excluded. If level 1 is provided, the `Outdoor > Sport` category and any of its subcategories will be excluded.
14. Click **Apply**.
Example of static filter conditions
9. In the **Items** section, click **Apply**.
10. Optionally, you can define the settings in the **Boosting** and **Additional settings** sections.
Learn more about [boosting](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-the-boosting-factors) and [additional settings](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#additional-settings).
11. Save the recommendation.
## What's next
---
You can display the recommendation to customers in a number of ways. For example by using the [recommendation insert](/developers/inserts/recommendations-v2) in [dynamic content](/docs/campaign/dynamiccontent/creating-dynamic-content), or in mobile application with content widget, both on [Android](/developers/mobile-sdk/displaying-recommendations/content-widget/android) and [iOS](/developers/mobile-sdk/displaying-recommendations/content-widget/ios).
## Check the use case set up on the Synerise Demo workspace
---
You can also check [the aggregate](https://app.synerise.com/analytics/aggregates/474a464f-175e-34e4-9890-ce922955390e) and [recommendation configuration](https://app.synerise.com/ai-v2/recommendations/wWmX7O8uxptZ) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Creating aggregates](/docs/crm/aggregates/creating-profile-aggregates)
- [Creating recommendations](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign)
- [Filters in recommendations](/docs/ai-hub/recommendations-v2/recommendation-filters)
- [Requirements for item feed](/docs/ai-hub/recommendations-v2/item-feed-requirements)
# Promotion for the first transaction after joining the loyalty program
It is very important to engage new users who have just joined your in-app loyalty program and encourage them to make purchases. For this purpose, you can use a push notification that will automatically notify them about a promotion in the application that will give them a discount on their first purchase. This is a good way to generate profits, especially if the promotion is time limited and the first purchases must be made within a certain period.
This approach can lead to boosting customer satisfaction, increasing revenue and customer loyalty to your business.
In this use case, we will create a promotion for new loyalty program members and a workflow which will send a mobile push notification with the information about the special promotion in the mobile app (10% discount for the whole cart). The promotion will be available for 14 days from the date of joining the loyalty program and can be used only once.
## Prerequisites
---
- [Implement Synerise SDK in your mobile app](/developers/mobile-sdk).
- [Implement promotions in your mobile application](/developers/mobile-sdk/loyalty) and through [API](https://hub.synerise.com/api-reference/loyalty-and-engagement#operation/profileLogin).
- Implement mobile pushes in your mobile application: [iOS](/developers/mobile-sdk/configuring-push-notifications/ios), [Android](/developers/mobile-sdk/configuring-push-notifications/android).
- Collect the [custom event](/developers/mobile-sdk/event-tracking) which sends information to Synerise about joining a loyalty program (for example `account.status` with parameter `accountStatus` equal to `active`). Such an event with the appropriate status should be sent each time the membership status changes (when the customer resigns from the program or joins again).
In this case, when a customer joins the loyalty program, a custom event is generated on their card. However, these conditions and the scenario can be adapted to your business needs, for example, you can count the customers who joined the loyalty program using the registration event in the mobile application.
## Process
---
In this use case, you will go through the following steps:
1. [Create aggregates](/use-cases/discount-promotion-for-first-transaction#create-aggregates) which return the time of joining the loyalty program and current status of customer's membership.
2. [Create a segmentation](/use-cases/discount-promotion-for-first-transaction#create-a-segmentation) of customers who have your mobile app and joined the loyalty program during last 14 days.
3. [Create a promotion](/use-cases/discount-promotion-for-first-transaction#create-a-promotion).
4. [Prepare a mobile push notification](/use-cases/discount-promotion-for-first-transaction#prepare-a-mobile-push-notification) with information about the promotion.
5. [Create a workflow](/use-cases/discount-promotion-for-first-transaction#create-a-workflow) to send the mobile push.
## Create aggregates
---
### Time of joining the loyalty program
Start with creating an aggregate that returns the time of the first occurrence of the `account.status` event.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **First**.
4. Select the event `account.status`.
5. As a parameter choose **Timestamp**.
6. Select the **accountStatus**.
7. Use operator **equal** and add as the value `active`.
8. Define the period for the event as **Lifetime**.
9. **Save** the aggregate.
Configuration of the aggregate
### Current status of the membership
Create the second aggregate analyzing the current status of the customer's membership.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last**.
4. Select the event **account.status**.
5. As a parameter choose **accountStatus**.
6. Define the period for the event as **Lifetime**.
7. To save the aggregate, click **Save**.
Configuration of the aggregate
## Create a segmentation
---
In this part of the process, you create a segmentation of customers who installed your mobile app and joined the loyalty program during last 14 days.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of segmentation.
3. Choose **Add condition** and find the [aggregate counting the time of joining the loyalty program](/use-cases/discount-promotion-for-first-transaction#time-of-joining-the-loyalty-program), created in the previous step.
4. Choose option **Custom** and select the date range as last 14 days. This way we can be sure that we analyze only the customers who joined the loyalty club for the first time during last 14 days (time in which the promotion is available), and we exclude the customers who join the club, resign and try to join another time to use the promotion for the second time.
5. Choose **Add condition** and find the [aggregate analyzing the active status of the customer's membership](/use-cases/discount-promotion-for-first-transaction#current-status-of-the-membership), created in the previous step.
6. As an operator, choose **Equal** and add the value `active`.
7. Save the aggregate.
The segmentation settings
## Create a promotion
---
Create a promotion for customers who joined the loyalty program.
The promotion gives a 10% discount for the entire transaction and is valid only once per user. It will be targeted for the audience created in the previous step.
1. Go to **AI Hub > Regular Promotions > Add promotion**.
2. Select the **For entire cart** option.
3. In the **Audience** section, select the segmentation created in [this step](/use-cases/discount-promotion-for-first-transaction#create-a-segmentation). Your promotion will be activated only for this group of customers. Confirm your selection, by clicking **Apply**.
4. In the **Content** section, define the name, description, and an image of the promotion. Confirm the settings by clicking **Apply**.
5. In the **Limit per profile** field, enter `1` to make sure that this discount can be used only once.
6. In **Type & limits** section:
1. As a Discount type, choose **Percentage**.
2. In the Cart section, as the minimum value, enter `10`, and click **Apply**.
6. In the **Schedule** section, define the distribution period.
7. **Optional**: In the **Stores** section, specify stores where the promotion is available.
This is possible only if the list of stores is imported into a [catalog](/docs/assets/catalogs).
8. In **Items** section, choose the main product catalog with all products a customer can buy with this discount. If you want to narrow down the list of categories a customer can choose from, use one of the options presented below (Selected items/Filtered items). If discount should be active for all products, choose **Entire catalog**.
9. In **Exclude items** section, you can exclude a specific product or categories for which the discount is not active.
10. To apply all changes and run the promotion, click **Publish**.
Once the promotion is published, it will be visible immediately to all customers defined in the **Audience** section in your mobile app (users who joined loyalty program during last 14 days).
## Prepare a mobile push notification
---
1. Go to **Experience Hub > Mobile > Templates**.
2. Create your mobile push in the code editor.
For more information on creating a simple mobile push, visit our [User Guide](/docs/campaign/Mobile/creating-mobile-push).
Example of mobile push notification
## Create a workflow
---
In this part of the process, prepare a workflow that notifies customers who joined loyalty program about the promotion in the mobile app.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
3. As the first node of the workflow, add **Profile Event**, and choose the event which signifies joining the loyalty program.
4. As the next node, choose **Delay**. In the settings of the node, set the delay period to 10 minutes.
5. Add **Profile Filter** to check if the user made a transaction during last 10 minutes. To do it, select the `transaction.charge` event and set up the time range as last 10 minutes. Mark this filter as not matched.
6. As the last node, add **Send Mobile Push** for users who matched used Profile Filter. In the configuration of the **Send Mobile Push** node:
1. Select the type of the mobile push notification..
2. Select the push template created in [this part](/use-cases/discount-promotion-for-first-transaction#prepare-a-mobile-push-notification) of the process.
6. Set up the Action limit for the Send Mobile Push as one time per workflow.
7. Set the capping for the workflow to make sure that it will be available once for every user (choose very distant date for example, once in 1000 months).
7. Confirm the settings by clicking **Apply**.
7. Add the **End** node to finish the workflow.
8. Click **Save & Run**.
Workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
In the Synerise Demo workspace, you can check:
- [Segmentation](https://app.synerise.com/analytics-v2/segmentations/e87b4f75-803a-4593-9649-9c35bae5b377)
- [Aggregate returning the time of joining the loyalty program](https://app.synerise.com/analytics/aggregates/9b862d15-7301-31c1-a830-ea6b5c3e392d)
- [Aggregate returning current status of membership](https://app.synerise.com/analytics/aggregates/4538a92b-b5e7-338e-a7f0-a4c690b63272).
- [Promotion](https://app.synerise.com/campaigns/promotions/de7a11c5-795f-4eda-ade6-cc45f021022c)
- [Workflow](https://app.synerise.com/automations/automation-diagram/3b673608-34c4-4013-8d60-99f01b0a8cf1)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 9 events per profile that completes the flow:
`account.status` (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`push.send`](/docs/assets/events/event-reference/mobile-push#pushsend) (~1), [`push.view`](/docs/assets/events/event-reference/mobile-push#pushview) (~1), [`push.click`](/docs/assets/events/event-reference/mobile-push#pushclick) (~1).
## Read more
---
- [Creating promotions](/docs/ai-hub/promotions)
- [Loyalty programs basics](/use-cases/loyalty-programs-basics)
- [Mobile push notifications](/docs/campaign/Mobile)
- [Workflow](/docs/automation/creating-automation)
# Send a message encouraging replenishment on WhatsApp
WhatsApp is a trusted platform by millions of users worldwide, making it a valuable channel for customer communication. It's a channel where you can get closer to your customers by forming personalized communication with them, building a stronger bond with your brand, and increasing loyalty. Thanks to Synerise's integration with WhatsApp, you have unlimited possibilities to customize your communication with customers. You can take advantage of all the insights you collect in Synerise and use them effectively to deliver the greatest value to your customers.
This use case shows a scenario with a replenishment campaign. You will learn how to perform a simple integration with WhatsApp to send a personalized message to customers encouraging them to reorder a product from a specific category, additionally incentivizing the reorder by giving them a discount code for that purchase.
## Prerequisites
---
- Make sure you meet all [prerequisites](/docs/automation/integration/whats-app/send-template-message#prerequisites) to work with the **Send Template Message** node.
- Implement transaction events either through [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- Create [item feed](/docs/ai-hub/recommendations-v2/item-feed-requirements)
- Create a [voucher pool](/docs/assets/code-pools). The ID of this voucher pool will be used as a dynamic value during the message creation process, allowing discount codes to be assigned to each customer participating in this scenario.
## Process
---
1. [Create an aggregate](/use-cases/send-replenishment-message-on-whats-app#create-an-aggregate) which returns the SKU of the last purchased product from the specified category.
2. [Create a message template in the Meta portal](/use-cases/send-replenishment-message-on-whats-app#create-a-message-template-in-the-meta-portal)
3. [Create a workflow to send a message to customers on WhatsApp](/use-cases/send-replenishment-message-on-whats-app#create-a-workflow-to-send-message-to-customers-on-whatsapp)
## Create an aggregate
---
In this part of the process, create an aggregate that returns the SKU of the last purchased product from the `Coffee` category.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last**.
4. From the **Choose event** dropdown list, select the `product.buy` event.
4. As the event parameter, select **$sku**.
5. Next to the **$sku**, click **+where**.
6. From the dropdown list, select **$category**.
7. As the operator, choose **Equal**.
9. In the text field, enter the value of the category you want to use in replenishment campaign - in this use case, it will be `Coffee`.
8. Define the period analyzed in the aggregate.
9. Save the aggregate.
Configuration of the aggregate
## Create a message template in the Meta portal
---
Create a message template in the Meta portal that you will use in the next part of the process. In the body of the message, mark places where the dynamic elements will be added.
In addition, if you would like to add a CTA at the end of the message, you can add a button and define its copy. The page to which the customer will be redirected after clicking the button can be defined in Synerise.
The example message used in this use case:
`Hello {{1}}, it looks like you’re almost out of Coffee! Make an order for {{2}} now before it’s too late. Use the {{3}} code to get your 20% discount on your next purchase.`
Where `{{1}}, {{2}}` and `{{3}}` are markers that will be replaced with the dynamic values. This step will be done in Synerise.
The screen below shows an example of creating a template message in the Meta portal:
An example of body section configuration in Meta platform
In the following screen, you can see how a button can be defined in the Meta portal:
An example of button section configuration in Meta platform
## Create a workflow to send message to customers on WhatsApp
---
The workflow will be triggered by the `product.buy` event from the selected product category. The delay is defined up to 30 days. If a customer does not make another purchase from the defined category after that period, we will send a WhatsApp message with the recommended products from the defined category.
1. In Synerise, go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the trigger node
3. As the trigger node, add **Profile Event**. In the configuration of the node, select the event that triggers the workflow. In this use case, it's a `product.buy` event.
4. Click **+ where** and choose **$category**.
5. As the logical operator, select **Equal**.
6. In the text field, enter `Coffee`.
4. Confirm by clicking **Apply**.
Configuration of the Profile Event node
### Configure the Delay node
1. Add the **Delay** node. In the node settings:
1. In the **Delay** field, type `30`.
2. From the dropdown list, choose **Day**.
2. Click **Apply**.
### Define the profile filter node
As the next node, choose **Profile Filter** to check if customers have bought a product from the Coffee category during last 30 days. To do this:
1. Choose the `product.buy` event.
2. As the parameter, choose **$category**.
5. As the logical operator, select **Equal**.
6. In the text field, enter `Coffee`.
3. Set the time range to last 30 days.
4. Click **Apply**.
7. To the **Matched** path, add the **End** node.
Configuration of the Profile Filter node
### Define the Send Template Mesage node
8. To the **Not matched** path, add the WhatsApp **Send Template Message** node.
1. Click **Select connection**.
2. From the dropdown list, select the connection.
- If no connections are available or you want to create a new one, see [Create a connection](/docs/automation/integration/whats-app/send-template-message#create-a-connection).
- If you selected an existing connection, proceed to defining the integration settings.
3. In the **Sender ID** field, enter the phone number ID from which the message will be sent.
[You can find more information about phone number ID here](https://developers.facebook.com/docs/whatsapp/cloud-api/get-started/add-a-phone-number).
4. In the **Receiver** field, enter the phone number of the customer who will receive this message.
We recommend using the `{% customer phone %}` insert, which inserts the phone number of an individual customer who goes through this node.
5. In the **Message template** field, enter the name of the [message template](/use-cases/send-replenishment-message-on-whats-app#create-a-message-template-in-the-meta-portal) you created earlier in the Meta portal.
6. From the **Language code** dropdown list, select the language used in the message.
7. In the **Message components** field, insert the object that contains the dynamic values in the order defined in the message template.
The example of object used in this use case:
The aggregate and voucher pool IDs are used as examples for the purpose of this use case.
9. Click **Apply**.
The following table explains all the inserts used in the body, button and header sections shown above.
| Section | Insert value | Insert explanation |
|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| body | `{% customer firstname %}` | The value of this insert is used as the value of `{{1}}`, so the name of a customer can be displayed in the message. |
| body | `{% aggregate c37acfe7-08a1-345c-a3e7-da795bb6a326 %} {% for item in aggregate_result %} {% catalog.store-1(item).name %} {% endfor %} {% endaggregate %}` | The value of this insert is used as the value of `{{2}}` to return a product that the customer bought the last time and did not purchase again within the estimated time period. |
| body | `{% voucher %} 8c3c8fd3-e7e9-487d-ba89-0b7824f65f33 {% endvoucher %}` | The value of this insert is used as the value of `{{3}}`. In this example, we assign a voucher code from the voucher pool to an individual customer. |
| button | `{% aggregate c37acfe7-08a1-345c-a3e7-da795bb6a326 %}{% for item in aggregate_result %}{% catalogvar.store-1(item).url %}{{ catalog_result\|replace('https://yourshop.com', '') }}{% endcatalogvar %}{% endfor %}{% endaggregate %}` | The value of this insert is used to return product url. Here we specify the URL omitting the domain, because we define the domain in the Meta platform, as you can see in the screenshot with the [button creation](/use-cases/send-replenishment-message-on-whats-app#create-a-message-template-in-the-meta-portal). |
| header | `{% aggregate c37acfe7-08a1-345c-a3e7-da795bb6a326 %}{% for item in aggregate_result %}{% catalogvar.store-1(item).image %}{{ catalog_result }}{% endcatalogvar %}{% endfor %}{% endaggregate %}` | This value of insert is used to return the url to the product image in header. |
Workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the [aggregate](https://app.synerise.com/analytics/aggregates/c37acfe7-08a1-345c-a3e7-da795bb6a326) and the [workflow](https://app.synerise.com/automations/automation-diagram/998f1dc1-932d-4636-bb98-d1d823b00af6) directly in our Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 8 events per profile that completes the flow:
[`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`voucherCode.assigned`](/docs/assets/events/event-reference/loyalty#vouchercodeassigned) (~1), [`whatsapp.sendTemplateMessage`](/docs/assets/events/event-reference/integration#whatsappsendtemplatemessage) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Automation Hub](/docs/automation)
- [Jinjava inserts](/developers/inserts)
- [Recommendations](/docs/ai-hub/recommendations-v2)
- [WhatsApp **Send Template Message** node](/docs/automation/integration/whats-app/send-template-message)
# Predict replenishment
Recurring purchases are those purchases that are usually made with some frequency and regularity, such as the purchase of coffee, printer paper, hygiene products, etc. Products purchased on a regular basis fill the greater part of most customers' shopping baskets. That's why it's so important to provide customers with the best experience when making such purchases, reminding them of an upcoming purchase and encouraging them to return more often for these products in your store.
The prediction created in this case is based entirely on analytics and calculates the average time between purchases for customers who have made at least three transactions in a given category, so we can calculate when a customer may make the next purchase, anticipating their intention by sending them an email reminder of the upcoming purchase. The described process consists of two automations, where one calculates the average interval between purchases and the other sends an email to the customer at the appropriate time to encourage to replenishment.
## Prerequisites
---
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- [Create an email account](/docs/campaign/e-mail/configuring-email-account).
- [Create an email template](/docs/campaign/e-mail/creating-email-templates) to be used in the email campaign.
We recommend including an [insert](/developers/inserts/recommendations-v2) in the email template with a product recommendation from the specific category to make the buying decision process easier for customers. You can refer to [this use case](/use-cases/personalized-category-reco#create-a-recommendation) to see how to build recommendations filtered to the product category.
## Process
---
1. [Create an event expression](/use-cases/repetitive-purchases#create-an-expression) that converts the time of transaction to a number.
2. [Create an aggregate](/use-cases/repetitive-purchases#create-an-aggregate) that returns the timestamps of the purchased products from the specific category.
3. [Create a workflow](/use-cases/repetitive-purchases#create-a-workflow-to-predict-purchase-time) that calculates the average number of days between a customer's purchases of a product in a specific category and calculates the date of the next purchase based on that number.
4. [Create a workflow](/use-cases/repetitive-purchases#create-a-workflow-to-encourage-a-purchase) that is responsible for sending a reminder to a customer about the next recurring purchase.
## Create an expression
---
In this part of the process, you need to create an event expression that converts the timestamp of transaction to a number. This expression will be used later to create an aggregate.
1. Go to **Behavioral Data Hub > Expression > New expression**.
2. Enter the name of the expression.
3. Set the **Expression for** option to **Event**.
4. From the drop-down list, select **product.buy**.
5. In the **Formula definition** section, click **Select**.
6. From the list that opens, select **Function > To number**.
7. In the brackets, click the **Select** button and from the list, select **Event attribute**.
8. Click the **Unnamed** node that appeared.
9. At the bottom of the page, click **Choose parameter**.
10. In the list of attributes, find and select **TIMESTAMP**.
11. Save the expression.
An expression that converts the timestamp to a number
## Create an aggregate
---
In this part of the process, you create a dynamic aggregate that returns timestamps of purchases from a specific category. The aggregate will return timestamps (as numbers) from **product.buy** events.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter a meaningful name of the aggregate.
3. Click **Analyze profiles by** and select **Last Multi** and size `15`.
This is the maximum number of a customer's past transactions to be used in the calculation. You can change the number according to your business needs.
4. Select **Consider only distinct occurences of the event parameter**.
5. Select the **product.buy** event.
6. From the **Choose event** drop-down list, select the expression you created [in the previous step](/use-cases/repetitive-purchases#create-an-expression).
7. Click the **+ where** button and from the **Choose parameter** drop-down menu, choose **category**.
8. From the **Choose operator** drop-down, choose **Equal**.
9. Enter the name of the product category.
In our example, it's `coffee`.
10. Define the time range as **Last 365 days**.
11. Confirm by clicking **Apply**.
The final configuration of an aggregate
## Create a workflow to predict purchase time
---
You need to create a workflow that calculates the average number of days between a customer's purchases from a given category. The result is used to calculate the customer's next purchase probability.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Profile Event trigger node
At this stage you will configure the conditions that will trigger the workflow. As a trigger, you will use the `product.buy` event for the coffee category.
1. As the first node of the workflow, add **Profile Event**. In the configuration of the node:
1. From the **Choose event** drop-down menu, choose the **product.buy** event.
2. Click the **+ where** button and from the **Choose parameter** drop-down menu, choose **category**.
3. From the **Choose operator** drop-down, choose **Equal**.
4. Enter the name of the product category for which you want to predict the time of the customer's next purchase.
In our case, it's `coffee`.
5. Confirm by clicking **Apply**.
### Define the Profile Filter node
In this part of the process, you need to identify customers for whom the workflow calculates the date of next purchase. It takes into consideration customers who have made at least three separate transactions (**transaction.charge** event) with products from the "coffee" category.
1. Add the **Profile Filter** node.
2. Click the node to open its settings.
3. Click the **Choose filter** button and choose the **product.buy** event.
4. Click the **+ where** button and from the **Choose parameter** drop-down menu, choose **category**.
5. From the **Choose operator** drop-down, choose **Equal**.
6. Enter the name of the product category for which you want to predict the time of the customer's next purchase.
In our case it's `coffee`.
7. Click **+ Add funnel step** button and repeat steps 3-6.
8. Set the time range to **Last 365 days before 1 days**.
9. Click the **Choose filter** button and choose the **transaction.charge** event.
10. Click **+ Add funnel step** button and another **transaction.charge** event.
11. Set the time range to **Last 365 days before 1 days**.
12. Confirm by clicking **Apply**.
13. For the **Not matched** path, add the **End** node.
The Profile Filter node configuration
### Define the Generate Event node
At this stage, an event is generated on the customer's profile, returning the number of days between purchases and the date when the customer may make the next purchase. It contains the following parameters:
- **category** - the category of products for which the calculation is made,
- **itemId** - the ID of last product bought from the specific category,
- **predictedTime** - calculated date of the next purchase from the specific category,
- **predictedTimeInDays** - average number of days between purchases from the specific category.
1. To the **Matched** path of the **Profile Filter** node created earlier, add a **Generate Event** node. In the configuration of the node:
1. In the **Event name**, enter the name of the event that will be generated on the customer's profile. In this case, it is `product.purchasePredictedTime`
3. Add the JSON body of the event. You can use the example below.
Example jinjava code
{ "category": "coffee", "itemId": "{{ event.params.$sku }}", "predictedTime": "{% set avgTime = [] %}{% aggregate PASTE_AGGREGATE_ID_HERE %}{%set timeDiff = []%}{% for item in range(aggregate_result|length-1) %}{%set diff = aggregate_result[loop.index] - aggregate_result[loop.index-1]%}{% do timeDiff.append(diff)%}{% endfor %}{% set temp = timeDiff|sum/(aggregate_result|length-1) %}{% do avgTime.append(temp) %}{{ datetimeformat(unixtimestamp(null) + avgTime[0], '%Y-%m-%d') }}{% endaggregate %}", "predictedTimeInDays": "{{avgTime[0]/86400000}}" }
The above jinjava code contains the logic of calculating the average number of days between purchases from the specific category and calculating the date of a next purchase. It can be copied 1:1 into the Generate Event node. However, remember to replace the ID of aggregate in this code with the [ID of the aggregate created earlier in the process](/use-cases/repetitive-purchases#create-an-aggregate).
4. Confirm by clicking **Apply**.
Configuration of the Generate Event node
Example of a generated **product.purchasePredictedTime** event:
Example of a generated event
### Add final settings to your workflow
1. Add the **End** node.
2. Launch the workflow by clicking **Save & Run**.
Configuration of the workflow
## Create a workflow to encourage a purchase
---
With the above workflow in place, you can create another workflow in which you send a message reminding the customer of the next purchase. This workflow starts each day for a group of customers whose expected purchase date is the current day.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Audience node
In this stage, you create an Audience that checks for the presence of the **product.purchasePredictedTime** event on a user's card in the last 30 days with a specific product category (in our case, coffee), where the predicted purchase date is on the current day. In addition, the Audience filter includes only those customers who have agreed to receive communications.
1. Start the workflow with the **Audience** node and open the node's settings.
2. In **Define audience**, choose **New Audience** and click **Define conditions**.
3. From the **Choose filter** drop-down menu, choose the **product.purchasePredictedTime** event.
4. Click the **+ where** button and from the **Choose parameter** drop-down menu, choose **predictedTime**.
5. From the **Choose operator** drop-down menu, select **Date > Current date > Matches current day**.
6. Click the **+ where** button and from the **Choose parameter** drop-down menu, choose **predictedTime**.
7. From the **Choose operator** drop-down menu, select **Date > Current date > Matches current month**.
8. Click the **+ where** button and from the **Choose parameter** drop-down menu, choose **predictedTime**.
9. From the **Choose operator** drop-down menu, select **Date > Current date > Matches current year**.
10. Click the **+ where** button and from the **Choose parameter** drop-down menu, choose **category**.
11. From the **Choose operator** drop-down, choose **Equal**.
12. Type the name of the product category - `coffee`.
13. Define the time range to the **Last 30 days**.
14. From the **Choose filter** drop-down, choose the **newsletter_agreement** parameter.
15. From the **Choose operator** drop-down, choose **Equal** and and specify the condition as **enabled**.
16. Confirm by clicking **Apply**.
Configuration of the Audience node
### Define the Send Email node
In this step, choose an email template for the upcoming purchase.
1. To the **Matched** path, add the **Send Email** node and open its settings.
2. In the **Sender details** section, choose the email account from which the email is sent.
3. In the **Content** section, select the template that you prepared as a part of the prerequisites.
4. **Optional**: In the **UTM & URL parameters** section, define the UTM parameters added to the links included in the email.
5. In the **Additional parameters** section, optionally describe campaigns with [additional parameters](/docs/campaign/e-mail/creating-email-campaigns#adding-custom-parameters).
6. Click **Apply**.
### Add final settings to your workflow
1. Add the **End** node.
2. Launch the workflow by clicking **Save & Run**.
Configuration of the workflow
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of each step directly in the Synerise Demo workspace:
- [Expression](https://app.synerise.com/analytics/expressions/04e342d8-5e14-4d7b-be39-a6bf117c1bff)
- [Aggregate](https://app.synerise.com/analytics/aggregates/0b329a23-4a80-3522-8938-981254f92150)
- [Workflow for purchasing time calculations](https://app.synerise.com/automations/automation-diagram/44c9e618-f72a-4720-8dbc-774f8752ad30)
- [Workflow for sending a mailing communication](https://app.synerise.com/automations/automation-diagram/dfaf267d-c186-40c3-965f-810646b4a982)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 12 events per profile that completes the flow:
[`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~2), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~2), `product.purchasePredictedTime` (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Automation Hub](/docs/automation)
- [Email campaigns](/docs/campaign/e-mail)
- [Expressions](/docs/crm/expressions)
- [Segmentation](/docs/analytics/segmentations)
# Send offline conversion to Google Ads
With Synerise, businesses can optimize their marketing strategies and bridge the gap between digital advertising and brick-and-mortar sales. By integrating online and offline operations, you can accurately track conversions from Google Ads when customers purchase through an ad and choose in-store pickup and payment. Thanks to Synerise's integration with Google Ads, you can automate the process of sending offline conversions to your Google Ads account. This seamless attribution of offline conversions to specific ad campaigns empowers businesses to optimize their marketing strategies and successfully connect digital advertising with brick-and-mortar sales. It's important to note that an offline conversion can encompass various offline events, such as visiting a store, restaurant, or any other conversion event your business recognizes.
In this use case, we will create a workflow to send offline conversion data to Google Ads. The workflow will be triggered by a custom event - purchase through an ad with in-store pickup and payment.
## Prerequisites
---
- [Implement SDK to a website](/developers/web/installation-and-configuration) to which a profile is referred after clicking the ad.
- [Implement sending events about completing offline conversion](https://hub.synerise.com/api-reference/data-management#operation/CustomEvent). It can include `value` and `currency` parameters (there is an option to send these additional parameters to Google Ads)
- Create a Google Ads account.
- Launch an ad campaign through Google Ads.
- [Create an event expression](/docs/automation/integration/google-ads/google-ads-send-offline-conversions#create-an-expression) to extract the `gclid` parameter from the URL of visited website.
- [Create an aggregate](/docs/automation/integration/google-ads/google-ads-send-offline-conversions#create-an-aggregate) that retrieves the value of the `gclid` parameter from the latest page visit to your website (or according to your business needs).
In this case, the conversion will be attributed to the last clicked ad before the conversion. This attribution is configurable, allowing you to determine which clicked ad should be associated with the conversion. You can configure these settings by specifying the date or other conditions, or by changing the aggregator from "last" to "first."
## Create a workflow to send conversion data to Google Ads
---
Create a workflow which sends offline conversion data to Google Ads, after a customer pays for an order in a brick-and-mortar store.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the trigger node
As a trigger, we will use the `offline.transaction` custom event for a transaction made in brick-and-mortar store when picking up an order.
1. As the first node of the workflow, add **Profile Event**.
2. In the configuration of the node, from the **Choose event** dropdown menu, choose `offline.transaction` event.
2. Click **Apply**.
### Configure the Send Offline Conversion node
1. As the next node, add **Google Ads > Send Offline Conversion**.
2. In the configuration of the node, from the dropdown list, select the connection.
- If no connections are available or you want to create a new one, see [Create a connection](/docs/automation/integration/google-ads/google-ads-send-offline-conversions#create-a-connection).
- If you selected an existing connection, proceed to next step.
2. In the **Google Ads customer ID** field, enter the ID of the Google Ads account. It can't contain dashes. [Learn how to find this number](https://support.google.com/google-ads/answer/1704344?hl=en).
2. In the **The Google click ID (GCLID) associated with this conversion** field, enter the part of the URL that starts with `?gclid=`.
For that purpose, you can enter a Jinjava tag that inserts the value of the [aggregate you created as the part of the prerequisites](#prerequisites): `{% aggregate AGGREGATE_ID %}{{ aggregate_result[0] }}{% endaggregate %}`. Replace the `AGGREGATE_ID` with an actual ID of the aggregate, you can find it in the URL while previewing the aggregate.
5. In the **Conversion action ID** field, enter the ID of the conversion. You can find it in the Google Ads panel. When you go to conversion action details, the URL contains the `ctId` parameter (for example, `ctId=123456789`) whose value is the conversion action ID. [Learn more about conversion action in Google Ads](https://support.google.com/google-ads/answer/6032150?hl=en).
6. In the **Conversion time** field, enter the time of the conversion in the following format: `yyyy-mm-dd hh:mm:ss+|-hh:mm`.
For that purpose, you can use [a Jinjava code](/developers/inserts/automation) that inserts date of conversion dynamically, from the trigger, that is, offline conversion. For example, `{{ event.params.time|timestamp_to_time|datetimeformat('%y-%m-%d %H:%M:%S+2:00') }}`.
7. Optionally, in the **Conversion value for the advertiser** field, enter the value. For that purpose, you can use [a Jinjava code](/developers/inserts/automation) that inserts the value dynamically based on the event context from the trigger, that is, offline conversion. For example, `{{ event.params.value }}`.
8. Optionally, in the **Currency associated with the conversion value** field, enter the currency. For that purpose, you can use [a Jinjava code](/developers/inserts/automation) that inserts the value dynamically based on the event context from the trigger, that is, offline conversion `{{ event.parmas.currency }}`.
9. In **Customer match consent import script** type jinjava script to import customer match consent from your database. You can use constant value.
10. In **Ad Personalization consent import source** type jinjava script to import ad personalization consent from your database. You can use sonstant value.
9. Confirm the settings by clicking **Apply**.
Configuration of the Send Offline Conversion node
### Add the finishing node
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
**Result**:
Workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
In Synerise Demo workspace, you can check the configuration of:
- [expression](https://app.synerise.com/analytics/expressions/3e366c6a-f4a4-4013-8c92-e3b22274e296)
- [aggregate](https://app.synerise.com/analytics/aggregates/8ebdd493-0d08-3ad0-9aa8-d87c616ca286)
- [workflow](https://app.synerise.com/automations/automation-diagram/4bac04d4-f883-4800-8b83-215b9a123a43)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per profile that completes the flow:
`offline.transaction` (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~1), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`googleAds.sendOfflineConversion`](/docs/assets/events/event-reference/integration#googleadssendofflineconversion) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Automation Hub](/docs/automation)
- [Expressions](/docs/crm/expressions)
- [Google Ads integration](/docs/automation/integration/google-ads)
- [Reusing event context from preceding nodes](/developers/inserts/automation)
# In-app survey
Understanding user preferences from the start is essential for creating a personalized app experience. A well-timed in-app survey after a user's first visit can capture valuable insights into their interests, expectations, and reasons for downloading the app. This direct engagement helps businesses tailor their offerings, improve user satisfaction, and foster long-term engagement.
In this specific use case, we plan to introduce a first-time user survey triggered after the app's introductory tour.
This use case provides instructions on how to implement a ready-made survey template designed to gather key user insights and enhance the overall experience.
## Prerequisites
---
- [Implement Synerise SDK in your mobile app](/developers/mobile-sdk).
- Implement a dedicated custom event that is sent to the customer's profile when they first enter the mobile app. This event should be sent only one time, during the first visit to the mobile application. In this use case, we use the `app.firstVisit` event.
## Create an in-app message
---
Create an in-app campaign triggered by the `app.firstVisit` event for customers who logged into the mobile application for the first time. We will use a predefined template for this message, so there is no need to create a template from scratch.
1. Go to **Experience Hub > In-app messages> Create in-app**.
2. Enter the name of the in-app.
### Define the audience
---
As the first step, define the target group of customers for the in-app message. In this use case, segmentation based on the [`inApp.show` event](/docs/assets/events/event-reference/inapp#inappshow) acts as an additional security measure that helps to include only people who have never seen this in-app message before.
The accuracy of this segmentation depends on the retention set for the **inApp.show** event.
1. In the **Audience** section, click **Define**.
2. Click **New Audience** and then **Define conditions**.
3. Click **Add condition**, from the dropdown list, select the **inApp.show** event.
4. Next to the **inApp.show**, click **+where**.
5. From the dropdown list, select **id**.
6. As the operator, choose **Equal**.
7. Enter the In-app campaign ID in the text field. You can locate the ID in the campaign's URL link.
For instance, in the URL https://app.synerise.com/communications/in-app/d7c03448-a586-4f18-ad9b-cff063c65aef the ID is `d7c03448-a586-4f18-ad9b-cff063c65aef`.
8. Change **matching** condition to **not matching** to find all profiles that don't meet the defined condition.
9. Use the time filter to define analysed time period.
10. Click **Apply**.
11. To save the audience, click **Apply**.
Audience configuration
### Define content
---
In the next step, you will create the content of the in-app message that will appear in the mobile application with the help of ready-made template.
1. In the **Content** section, click **Define**.
2. Click **Create message** and from the list of template folders, select **Predefined templates**.
3. Select the **Survey form** template.
**Result:** You are redirected to the code editor.
4. Edit the template according to your needs. In the Configuration panel, you'll find a comprehensive list with descriptions of the core components that make up your survey.
Config panel
The configuration of the questions and answers themselves happens in JavaScript panel.
There is an object that you have to fill, according to the example given. It is an array of questions, where each question has its answers and settings depending on the type.
Javascript object with questions and answers
**Example:** You want to add/edit question
To add an additional question to the **QUESTIONS** array, you'll want to follow the pattern established by the existing questions. Each question is an object that may contain different properties depending on its type (single, multi, scale, text). Here's a step-by-step guide on how to do it:
Decide on the question you want to add and the type of question it will be. The type determines what properties the question object should have. For instance:
- `single` and `multi` types need question, `answers`, and `type`.
- `scale` needs `question`, `type`, and `length`.
- `text` needs `question`, `type`, and optionally `limit` for the character limit.
Construct the question object according to the type you've chosen.
Add the new question object to the `QUESTIONS` array.
Here's an example of how you can add a new question that asks about a favorite color (a single type question with predefined answers):
const QUESTIONS = [
{
"type": "single",
"question": "What motivated you to download our app?",
"answers": [
"To browse products",
"To make a purchase",
"To explore exclusive offers",
"To compare prices",
{ "answer": "Other (please specify):", "options": { "isOpen": true, "limit": 20 } },
],
"shuffleAnswers": false,
"required": true
},
{
"type": "multi",
"question": "What types of products or services are you most interested in?",
"answers": [
"Fashion",
"Electronics",
"Home and Kitchen",
"Health and Beauty",
"Sports and Outdoors",
{ "answer": "Other (please specify):", "options": { "isOpen": true, "limit": 20 } }
],
"shuffleAnswers": false,
"required": true
},
{
"type": "single",
"question": "How do you prefer to shop?",
"answers": [
"I like to browse and explore new products",
"I prefer targeted recommendations based on my preferences",
"I usually know what I want and search directly",
"I’m mainly looking for deals and offers",
],
"shuffleAnswers": false,
"required": true
},
{
"type": "multi",
"question": "What factors influence your purchasing decisions the most?",
"answers": [
"Product quality",
"Price",
"Brand reputation",
"Customer reviews",
"Sustainability",
{ "answer": "Other (please specify):", "options": { "isOpen": true, "limit": 20 } }
],
"shuffleAnswers": false,
"required": true
},
{
"type": "scale",
"question": "How likely would you recommend our company to your friends and known ones?",
"length": 10,
"required": true,
},
];
5. After customising your survey, save the template.
### Select events that trigger the in-app message display
---
In this part of the process, you will define the event triggering the display of the in-app message.
1. In the **Trigger events** section, click **Define**.
2. Select **Add event...** and from the dropdown list, choose `app.firstVisit` event.
3. Click the **+ where** button and select `source`.
4. As the logical operator, select **Equal**.
5. In the text field enter **MOBILE_APP**.
5. Click **Apply**.
### Schedule the message and configure display settings
---
As the final part of the process, you will set the display settings of the in-app message such as schedule, capping, priority of the message among other in-app messages.
1. In the **Schedule** section, click **Define** and set the time when the message will be active.
2. In the **Display Settings** section, click **Define**.
1. Define the **Delay display**, **Priority index**, **Frequency limit** and/or **Capping limit**.
2. In our case, we want to display the message once per user. To do this, switch on **Capping limit**, and in the **Show maximum** section text field type `1`.
4. Click **Apply**.
5. Optionally, you can define the UTM parameters, additional parameters or test your in-app campaign.
6. Click **Activate**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [in-app message](https://app.synerise.com/communications/in-app/6d39ca33-542c-4c18-950c-0620ca5c486e) configuration directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 4 events per profile that completes the flow:
`app.firstVisit` (~1), [`inApp.show`](/docs/assets/events/event-reference/inapp#inappshow) (~1), [`inApp.click`](/docs/assets/events/event-reference/inapp#inappclick) (~1), [`form.submit`](/docs/assets/events/event-reference/web-and-app#formsubmit) (~1).
## Read more
---
- [In-app messages](/docs/campaign/in-app-messages)
- [Mobile campaigns](/docs/campaign/Mobile)
- [Using in-app template builder](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template)
# Promote Complementary Products in Search Using Contextual Rules
AI Search allows you to improve the search experience of your users by customizing search results to individual requirements by setting rules. The possibilities are endless.
Define a rule condition and consequence which tailors results based on the context of the search, so customers can find the products they're looking for easier and faster than ever before.
This use case describes the process of creating a rule in AI search which promotes mobile chargers when a customer searches for `charger` from a mobile device.
## Prerequisites
- An item feed must be provided.
- Enable [the search engine](/docs/ai-hub/ai-search/introduction-to-ai-search) for your workspace and create an [index](/docs/ai-hub/ai-search/create-index).
- [Implement AI search](https://hub.synerise.com/api-reference/ai-search#operation/profileLogin) in any of your channels (mobile app, website etc.).
- Implement the context parameter with value mobile to search request. It should be added when your customer enters the query on the mobile device.
## Create rules
---
1. Go to **AI Hub > Indexes**.
2. Select an index from the list.
3. Go to the **Rules** section.
4. On the right side of the screen, click **Add rule**.
5. Enter the name of the rule.
6. To adjust the query conditions, in the **Conditions** section, click **Define**.
1. On the **Query** tab, to define the method of checking the query, choose the **is** condition.
The **is** condition means the rule works only if a customer searches exactly for the phrase defined in the rule.
2. In the text field, enter: `charger`
3. In the **Context (optional)** field, enter: `mobile`.
This means that the rule only works when the search request has the `context = mobile` parameter.
Example of query conditions
1. Confirm the settings by clicking the **Apply** button.
7. To define how the search engine reacts to the defined conditions, in the **Consequences** section, click **Define**.
1. Click **Add consequence**.
2. From the dropdown list, select the **Filter query results** consequence.
3. Click **Add filter**.
4. Select attribute that corresponds to **product type**.
5. In the field next to the attribute name, enter the value that denotes mobile phone chargers or select it from the dropdown list.
Please note that the attribute name and its value depends on the rules used in the implementation process.
8. Toggle the **Mark as elastic** switch on.
9. Confirm by clicking **Apply**.
10. To save and enable the query rule, click **Publish**.
Search context promotion settings
## Check the use case set up on the Synerise Demo workspace
---
You can check the [rule configuration](https://app.synerise.com/ai-v2/search/indices/1c7fac97ddd2c12b7cf1e71d7b4489261657270872/query-rules/14432) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 2 events per profile that completes the flow:
[`item.search`](/docs/assets/events/event-reference/search#itemsearch) (~1), [`item.search.click`](/docs/assets/events/event-reference/search#itemsearchclick) (~1).
## Read more
---
- [Configuring AI Search](/docs/ai-hub/ai-search/introduction-to-ai-search#configuring-ai-search)
- [Creating rules in AI Search](/docs/ai-hub/ai-search/query-rules)
# Group customers by purchase days
In this use case, you will learn how to create a segmentation that allows you to divide your customers into segments based on the time of week on which they bought a product. You may use that information further for targeted communication.
## Prerequisites
---
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
## Create a segmentation
---
Create a segmentation that organizes customers into two groups:
- Weekend - It gathers the customers who bought products on weekends,
- Week days - It gathers the customers who bought products on week days.
1. Go to **Decision Hub > Segmentations > New Segmentation**.
2. Enter the name of the segmentation.
3. Name the first segment, in our case `Weekend`
4. To add the first step to the segment, click the **Performed event...** button.
5. From the dropdown list, select the `product.buy` event.
6. For the event parameter, click the **+ where** button and select `TIMESTAMP`.
7. As the logical operator, select **Custom** date.
8. Click **Start date -> End date**:
1. In the **Relative date range** section, click **Custom**, type 365 and from the the dropdown list, select **Days**.
2. In the **Filter** section, click **Add filter** and then **Every week**.
3. Select **Sat** and **Sun**.
4. Click **Add time**.
4. Click **Apply**.
Conditions of the date range
9. Click **Apply**.
10. In the calendar in the right bottom of the page:
1. In the **Relative date range** section, click **Custom**, type 365 and from the the dropdown list, select **Days**.
2. Click **Apply**.
Conditions of the segment
11. Create the second segment by duplicating the one you have just created.
12. Name this segment `Week days`.
13. Change the date range:
1. In the **Filter** section, click **Change** .
2. Click on **Select all** and clear selection of **Sat** and **Sun**.
4. Click **Add time**.
3. Click **Apply**.
Conditions of the date range
14. Click **Apply**.
Conditions of the segment
15. In the calendar in the right bottom of the page:
1. In the **Relative date range** section, click **Custom**, type 365 and from the the dropdown list, select **Days**.
2. Click **Apply**.
16. Click **Save**. The segments are saved and can be viewed in **Preview** where you can preview how your customer base splits according to the defined conditions.
## What's next
---
To use this segments in **Experience Hub**:
1. Click **Define** in the **Audience** section.
2. Click **New Audience**.
3. Click **Define conditions**.
1. Click **Choose filter** and from the dropdown list choose the segmentation you have created in [this step](/use-cases/number-of-transactions-weekend-vs-workdays#create-a-segmentation).
2. Choose operator **Equal**.
3. Type the name of the segment.
Depending on whether you want to send the communication to customers who buy on the weekend, enter the name of the segment `Weekend`, and if to those who buy during week days - `Week days`.
4. Click **Apply**.
4. Click **Apply**.
Example of audience
## Check the use case set up on the Synerise Demo workspace
---
You can also check the [segmentation configuration](https://app.synerise.com/analytics-v2/segmentations/0d06b767-6168-4e8f-8c08-9bfb2ad6544c) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case does not generate any events.
## Read more
---
- [Segmentations](/docs/analytics/segmentations)
# Automate Sending NPS Survey Results to Google BigQuery
Integrating Synerise with Google BigQuery enables you to easily export data from Synerise to BigQuery tables using the **Upload Data to Table** node. This connection can be used to export various types of data, such as NPS survey data.
By integrating with Google BigQuery, Synerise sends data to be directly uploaded into BigQuery tables, facilitating easy exportation and further analysis. The uploaded data can also be used in other Google tools, such as Google Analytics.
In this use case, we will create a workflow which sends information with NPS survey data to Google BigQuery using a dedicated node in our Automation.
## Prerequisites
---
- Implement a custom event for NPS survey data, which will be available in the customer profile. In this example, the event is called `nps.send`. Implement custom events in your [mobile application](/developers/mobile-sdk/event-tracking#basic-custom-event) or website [Web](/developers/web/event-tracking#declarative-tracking-custom-events). You can learn more about NPS survey in [this use case](/use-cases/dynamic-nps).
- Check [the requirements](/docs/automation/integration/google-bigquery/upload-data-to-bigquery#prerequisites) you must meet to integrate Synerise with BigQuery.
## Create a workflow
---
Create a workflow which sends information with NPS survey data to Google BigQuery. Every time the `nps.send` event is generated, the data from the event is sent automatically to BigQuery.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Profile Event trigger node
---
At this stage, we will configure conditions that launch the workflow. As a trigger, we will use the `nps.send` event.
1. As the first node of the workflow, add **Profile Event**. In the configuration of the node:
1. Enter the following title to the node: `nps survey`.
2. From the **Choose event** dropdown menu, choose the `nps.send` event.
2. Confirm by clicking **Apply**
Click here to see example event and its parameters for an example customer
### Configure the Upload Data to Table node
---
At this stage, we will configure the BigQuery node.
1. As the next node, add **Google BigQuery > Upload Data to Table**.
2. Click **Select connection**.
3. From the dropdown list, select the connection.
- If no connections are available or you want to create a new one, see [Create a connection](/docs/automation/integration/google-bigquery/upload-data-to-bigquery#create-a-connection).
- If you selected an existing connection, proceed to defining the integration settings.
4. In the configuration of the node:
1. In the **Project ID** field, enter the unique identifier of your project in Google BigQuery.
You can learn how to find the project ID [here](https://support.google.com/googleapi/answer/7014113).
2. In the **Dataset ID** field, enter the unique identifier of the dataset in the BigQuery project.
3. In the **Table ID** field, enter the unique identifier of the table in the dataset.
4. In the **Rows** field, enter JSON that extracts name, surname, location and the contents of feedback from the event selected in the **Profile Event** node. The example body contains the [Automation inserts](/developers/inserts/automation) that retrieve data from the event included in the **Profile Event** node.
In this JSON you define only those parameters you want to send to BigQuery.
### Add the finishing node
---
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
The workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
You can check the [workflow configuration](https://app.synerise.com/automations/automation-diagram/c1765019-5e46-46c9-bf5d-2def3b13d2c2) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per profile that completes the flow:
`nps.send` (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~1), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`bigQuery.uploadData`](/docs/assets/events/event-reference/integration#bigqueryuploaddata) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Uploading data to BigQuery](/docs/automation/integration/google-bigquery/upload-data-to-bigquery)
# Search engine for a brand with multiple languages and currencies
AI search is not difficult tool to use, especially when we use one language. A lot of our customers are operating in many markets and want to use search in different languages. It is hard to avoid a situation where a user enters a different language when searching certain categories in his language on the website. We can accept it and the fact that he will find a blank page with no results, but on the other hand we can set up the search process and, based on that, show him the products he is looking for no matter which language he uses.
**Challenge**
Our client had one e-commerce platform that uses different variants depending on the region chosen by customers, currencies available on the chosen region and website language. Additionally, each market had its own product stock. So, in fact we had several e-commerce operations under one domain.
Our customer wanted to have all the data in one place and execute all campaigns from the one place as well. He was also interested in creating AI search which makes it possible to search for products in different languages.

## Prerequisites
---
- Synerise [tracking code](/docs/settings/tool/tracking_codes), to collect all necessary events from the website.
- [Product feed](/developers/product-feed) implemented.
- [OG tags](/developers/web/og-tags).
- Collecting [transactional events](/docs/automation/actions/synerise-integrations/import-events).
## Process
---
1. [Prepare product feeds](/use-cases/search-multiple-languages#prepare-product-feeds) for each market.
2. [Prepare a search ranking](/use-cases/search-multiple-languages#prepare-a-search-ranking).
3. [Set up AI search](/use-cases/search-multiple-languages#set-up-ai-search) - query rules and synonyms.
## Prepare product feeds
---
1. **Create separated product feeds** for each market with additional information about those languages on the website which we want to use in our search - every attribute like description, title, type, category should be added in two languages. Everything in the Google merchant format. Thanks to that, even if the customer is on the English version of the website, he can search using Arabic words as well.
2. Every search for each region has to be built on the basis of separate product feeds. So, we have to prepare **different indexes for such an AI search**. Thanks to that we can choose, based on which product feed we want to build our models on. As you can see below, we can choose one of the imported product catalogs and later use it to prepare the appropriate campaign.

## Prepare a search ranking
---
In the case of a search engine, the most important step of setting it up is to **prepare a search ranking**. This means you have to indicate which attributes around the product have to be searchable and assign their importance.

As you can see here, we have a lot of attributes from the product feed, from this customer, but the most important are searchable attributes which will be search at the beginning. In our case it will be:
- Category
- itemID
- attributes.product_type_ar – second language
- brand
- title
In medium and low importance, we have also the next attributes from the product; description, gender, attributes.title_ar, attributes.description_ar, and more of them in the low importance (e.g. size, pattern etc.).
## Set up AI Search
---
### Query rules
Synerise lets you optimize search using our query rules. It also allows us to prepare seven better search results.
Based on this, in just a few steps you can decide that if somebody enters a query, you can replace it with a different phrase and show him specific content.
We can prepare such query rules in AI Hub – Indexes - New index, clicking button “create new” in query rules.
We have to complete 3 sections:
- Conditions
- Consequences
- Schedule

Let’s say that we want to prepare a query for when someone enters “dress” - we would like to show him products from the dress category in the Arabic language “فستان”.
So, we choose the title from the first steps subpage and add it to the consequences section. In this way we will define that if somebody enters “dress” we would like to replace this query with a new query, which is dress in Arabic.
### Synonyms
You can also use synonyms to make the search more effective. To do this, add new synonym in the synonym section. Choose if it should work in one way or two ways.

It can be helpful if a lot of similar words for your category exist (sweatshirt and hoodie) or a lot of different products are in the same category e.g. beach accessories, where you can find towels, bags, umbrellas etc.
You can always check the **zero page results section** in your search configurator to see what kind of words are often entered by your customers. It may be that some categories or product names are entered by mistake and you can automatically replace them with the proper word.
## Generated events
This use case generates approximately 2 events per profile that completes the flow:
[`item.search`](/docs/assets/events/event-reference/search#itemsearch) (~1), [`item.search.click`](/docs/assets/events/event-reference/search#itemsearchclick) (~1).
## Read more
---
- [AI search](/docs/ai-hub/ai-search/introduction-to-ai-search)
- [Catalogs](/docs/assets/catalogs/creating-catalogs)
- [Product Search API documentation](https://hub.synerise.com/api-reference/ai-search)
# Send Automated Slack Messages Based on Metric Results
You can integrate Synerise with Slack using a dedicated node to build a variety of business scenarios. One of them is building a workflow that sends messages to a Slack channel based on metrics, expressions, reports or any other analyses created in Synerise.
This particular use case reuses a metric (which is a part of an analytical dashboard) that counts the number of customers who signed up for the video call the day before. The message to the channel contains information with the value of the metric.
Slack integration
## Prerequisites
---
- Create [an incoming webhook in Slack](https://api.slack.com/messaging/webhooks).
- Implement [an event](/docs/assets/events/event-definitions) that you want to use in the metric whose result will be sent in a message to a Slack channel.
In this use case, we track data from the form that enables to sign up for the video call using [SDK form tracking method](/developers/web/tracking-form-data/tracking-form-data-sdk). This method generates a `form.submit` event which we will later used in the metric. Learn more about other ways to implement events using [web SDK](/developers/web/event-tracking#declarative-tracking-custom-events), [mobile SDK](/developers/mobile-sdk/event-tracking) or [API](https://hub.synerise.com/api-reference/data-management#operation/CustomEvent).
## Process
---
1. [Create a metric in Synerise](/use-cases/slack-integration#create-a-metric-in-synerise).
3. [Create a workflow in Synerise](/use-cases/slack-integration#create-a-workflow-in-synerise).
## Create a metric in Synerise
---
In this step, we will create a metric whose result will be later sent in the Slack message. The configuration is exemplary, it may vary depending on your implementation of events.
1. In Synerise, go to **Decision Hub > Metrics > New metric**.
2. Leave the metric kind at default (**Simple**).
3. Leave the metric type at default (**Event**)
2. From the **Choose event** dropdown list, select the **form.submit** event.
3. As the event parameter, select the **formType**.
4. As a logical operator, select **Equal (String)**.
5. In the text field, enter `videocall`.
Configuration of the metric that calculates the number of sign-ups for a video call the day before
In this use case, the metric is included in the [analytical dashboard](/docs/analytics/analytics-dashboard) which is later linked in the alert message in Slack.
## Create a workflow in Synerise
---
In this part of the process, you will create a workflow that sends a message to a Slack channel with the number of customers who signed up for a video call. The message will contain the metric result and the link to the analytical dashboard that contains the metric.
1. In Synerise, go to **Automation Hub > Workflows > New workflow**.
2. Start with the **Scheduled Run** node. In the configuration of the node:
1. Set the **Run trigger** option to **all time**.
2. Select the **Everyday** tab.
3. Select the time zone.
3. Select the time when the workflow will be launched.
4. Confirm by clicking **Apply**.
Configuration of the workflow that sends alert messages with the metric results to the Slack channel
### Configure Slack Integration node
In this step, you will configure the settings of the outgoing integration that sends the message to a Slack channel.
#### Create a connection
1. On the **Scheduled Run** node, click **THEN**.
2. From the dropdown list, select **Slack > Send Channel Message**.
3. In the configuration of the node:
- If you already create a connection, select the connection from the list.
- If you haven't created any connection yet:
1. At the top of the dropdown list, click **Add connection**.
2. In the **Incoming Webhook URL** field, enter the incoming webhook URL you created as a part of [prerequisites](/use-cases/slack-integration#prerequisites).
3. Click **Next**.
4. In the **Connection name** field, enter the name for the connection you created.
5. Click **Apply**.
**Result**: A connection is created and selected.
#### Define the integration parameters
1. In the **Type of message** field, choose **interactive message (JSON)**.
2. Below add JSON body of message which should be sent to Slack channel.
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Number of people signed in for the videocall: `{% metricsvar metric_id:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX %}{{ metric_result }}{% endmetricsvar %}`\nNumber of people having the videocall today: `{% metricsvar metric_id:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX %}{{ metric_result }}{% endmetricsvar %}`"
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "check dashboard",
"emoji": true
},
"url": "https://app.synerise.com/spa/modules/dashboards/analytics/dashboards/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
}
}
]
}
In the JSON body:
- Insert the ID of the metric you created in the [previous step](/use-cases/slack-integration#create-a-metric-in-synerise).
- Optionally, if you want to refer users to the analytical dashboard, for the `url` parameter, insert the link to the dashboard. If you choose not to, remove the `accessory` object from the JSON body.
3. Confirm by clicking **Apply**.
5. Add the **End** node.
6. Launch the workflow by clicking **Save&Run**.
Configuration of the workflow that sends alert messages based on the metric results to the Slack channel
**Result**: The message is sent to the Slack channel.
Message on the Slack channel
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of use case in Synerise Demo workspace:
- [Metric](https://app.synerise.com/analytics/metrics/b4a6958d-7f86-47d6-a8c8-c89fe1c76aba)
- [Workflow configuration](https://app.synerise.com/automations/workflows/automation-diagram/3509dfae-73b4-4333-9e16-c3d957568748)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 4 events per workflow execution:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~1), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`slack.sendChannelMessage`](/docs/assets/events/event-reference/integration#slacksendchannelmessage) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Integration](/docs/automation/integration)
- [Inserts](/developers/inserts)
# Import transactional data from Google Cloud Storage to Synerise
Synerise allows you to collect data from any customer touchpoint. Using Synerise's seamless integration with Google Cloud Storage (GCS), you can transfer any data stored in the GCS directly to Synerise and use it in the platform.
In this use case, we will import a file with transactional data and purchase history from Google Cloud Storage.
## Prerequisites
---
- You must have a Google Cloud account.
- Create a project in Google Cloud.
## Prepare a workflow
---
Create a workflow which performs a single import of the file with transactional data and purchase history from Google Cloud Storage to Synerise.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Scheduled Run trigger node
---
At this stage, we will configure conditions that launch the workflow. As a trigger, we will use the **Scheduled Run** node.
3. As the trigger node, add **Scheduled Run**.
4. In the configuration of the node:
1. Change the **Run trigger** option to **one time**.
2. Select **Immediately**.
4. Confirm by clicking **Apply**.
The configuration of the Scheduled Run node
### Configure the Get File node
---
In this step, to allow the data exchange, establish a connection between Synerise and Google Cloud Storage.
1. Add **Google Cloud Storage > Get File** node.
2. Click **Select connection**.
3. From the dropdown list, select the connection.
- If no connections are available or you want to create a new one, see [Create a connection](/docs/automation/integration/google-cloud-storage/get-file-from-gcs).
- If you selected an existing connection, proceed with the integration settings.
1. In the **Project ID** field, enter the unique identifier of your project in Google Cloud.
You can learn how to find the project ID [here](https://support.google.com/googleapi/answer/7014113).
2. In the **Bucket** field, enter the name of an existing bucket (container) from which you will download a file with data.
3. In the **Path to directory** field, enter the path from which the file will be downloaded.
4. In the **File name** field, enter the name of the file you want to download from the storage. If the file already exists, the contents of the file will be overwritten.
5. From the **File format** dropdown list, select the format of the file which will be downloaded.
6. Confirm by clicking **Apply**.
The configuration of the Get File node
### Add Import Transactions node
---
In this step, add the **Import Transactions** node to import the file with transactions directly to Synerise.
1. Choose **Synerise** node.
2. From the list that opens, select **Synerise > Import Transactions**.
### Add the finishing node
12. Add the **End** node.
13. In the upper right corner, click **Save & Run**.
The workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the [workflow](https://app.synerise.com/automations/automation-diagram/79b22158-ca02-4d10-8e03-e26bc7839b3a)in this use case on our Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 8 events per workflow execution:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), `googleCloudStorage.getFile` (~1), [`transaction.charge`](/docs/assets/events/event-reference/items#transactioncharge) (~1), [`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~2).
## Read more
---
- [Get File](/docs/automation/integration/google-cloud-storage/get-file-from-gcs)
- [Workflows](/docs/automation)
# Dynamic remarketing with AI recommendations
---
Not all potential customers that come to your website purchase right away. You need to continue to influence them not only from your website, but also across Google’s display network. Segmenting visitors and remarketing to those that have ‘Abandoned the Shopping Cart’ or ‘Visited A Product Page” may not be enough. If you want to beat your competitors you should take your **remarketing campaign** a step further, **using our AI recommendation engine** and showing customers the most relevant products.
## Example of use - Home appliances industry
**Challenge**
A client from the home appliance industry decided to use AI recommendation campaigns outside their website with Google remarketing. They wanted to show customers personalized recommendations based on their behavior. They already had such a campaign on their homepage and they wanted to display those products to customers while they browsed the Internet.
To do this, they added Google Data Layer events to the script with a recommendations campaign to get the ID of products recommended to each customer. In this way they were able to **display their campaigns with personalized products on external websites** as remarketing to customers who previously visited their page.

## Requirements
---
1. Basic elements of AI integration:
- Tracker
- Product feed, filled with appropriate custom attributes
- Transactional events
- OG tags
2. Google Data Layer implemented on the website
## How to do it
---
You need to send a dataLayer.push event to every visitor of your website. Add the script below in the java script section in the dynamic content with the recommendation campaign:
Where:
- `product_id`- recommended product ID
- `event_name`- name of the event, by which you will recognize AI recommendation's campaign
- `campaign_name`- optionally, name of the recommendation campaign. Very useful if you send to the Data Layer products from more than one AI campaign a time
Remember that you need to send a separate event for every product.
## Generated events
This use case generates approximately 5 events per profile that completes the flow:
[`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- Read more about [AI](/docs/ai-hub/recommendations-v2/recommendation-types#personalized)
- Read more about [creating metrics](/docs/analytics/metrics)
- Read more about [dynamic content](/docs/campaign/dynamiccontent)
- Read more about [recommendation types](/docs/ai-hub/recommendations-v2)
# Email with the products most frequently visited by a customer
It is worth remembering how important it is to analyze what users view on the website, what subpages they visit and how much time they spend there. Behavioral data is the basis for creating a specific marketing strategy and appropriate personalization.
Remember that even if the users do not add anything to the basket, they can be reminded of the products they most often visited by sending them a personalized email.
## Example of use - Electronic industry
A client from the electronics industry decided to make use of information about the products customers viewed. However, instead of sending them the products they viewed recently, they were sent most viewed products in general.
Email with top products
If the customers were on the site but did not add anything to the cart, after the session ended, they would receive an email with the products they visited more than once - ordered from the most to the least frequently visited.
## Prerequisites
---
To implement this use case, you have to:
- Implement [tracking code](/docs/settings/tool/tracking_codes) on your website.
- Implement [OG Tags](/developers/web/og-tags).
- Import [product feed](/developers/product-feed).
- Create [product catalog](/docs/assets/catalogs).
- Integrate [transaction events](/developers/web/transactions-sdk).
- Have [add to cart event](/docs/assets/events/event-definitions).
- Create and set up your [email account](/docs/campaign/e-mail/configuring-email-account).
- Import your [subscriber's database](/docs/automation/actions/synerise-integrations/import-customers) to Synerise.
## Process
---
To create an email with products most frequently visited, perform the steps in the following order:
1. [Prepare the aggregate](/use-cases/email-with-products-most-frequently-visited#prepare-the-aggregate).
2. [Prepare a product catalog](/use-cases/email-with-products-most-frequently-visited#prepare-a-product-catalog)
2. [Prepare the workflow](/use-cases/email-with-products-most-frequently-visited#prepare-the-workflow).
## Prepare the aggregate
---
Build an aggregate that collects the SKUs of the most frequently visited products.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **TOP MULTI**.
3. In the Size field, enter the number of recent events (for example, 10).
4. Select the event `page.visit` and the `retailer_part_no`.
5. Click button + where and add the condition that the `product:retailer_part_no` parameter is true. This will give us confidence that we only take into account the visited product pages.
5. Save your aggregate.
The aggregate with recently viewed product
## Prepare a product catalog
---
The event page.visit contains the most important information about the product - its ID in the product:retailer_part_no parameter.
To add additional information about the product in the email template, such as a photo, price, link, you need a product catalog.
You can import your feed following these [instructions](/docs/assets/imports) or you can use Snrs-product-ogTag catalog which is automatically built from the product page og tags.
## Prepare the workflow
---
1. Go to **Automation Hub > Workflows > New workflow**.
2. Add an **Profile Event** as a trigger node.
3. Select the **session.end** event.
Configuration of the Profile Event node
4. Click **Delay** to define the duration of delay - after the session ends, the system waits for the time defined in the Delay node before the email is sent.
Configuration of the Delay node
Remember that event session.end appears 30 minutes after the last user activity on the website.
5. Add the **Generate Event** node. It generates an event on the customer's profile. In this case, the event will contain ID of the most frequently viewed products by a customer.
1. In the **Event name**, enter the name, for example `topvisited.products`.
3. In the **Body**, enter the Jinjava code available below. Replace AGGREGATE_HASH with the hash of the aggregate you in the previous step. As a result you will analyze the products that the user has viewed, sort them in order of the most frequently viewed to the least viewed (products that have been viewed at least two times) and return them to the user’s card in this event.
Generate Event
An event created in this way will return all the products that the user saw at least twice within the time specified in your aggregate. The event with parameter will be returned in the form of the sku listed after the decimal point, e.g.: top: sku1, sku2, sku3.
CHECK JINJA CODE
{ "top": "{% set skus = [] %} {% set counter = [] %} {% set skusTmp = [] %} {% set skuDict = [] %} {% set sortDict = [] %} {% aggregate AGGREGATE_HASH %} {% for sku in aggregate_result|unique %}{% set k = [] %}{% for tmp in aggregate_result %}{% if sku == tmp %}{% do k.append('+') %}{% endif %}{% endfor %}{% do skuDict.append({'sku':sku,'counter':k|length }) %}{% endfor %}{% endaggregate %}{% for dictItem in skuDict %}{% do counter.append(dictItem.counter)%}{% endfor %}{% set sortCounter = counter|sort() %}{% for count in sortCounter %}{% for dictItem in skuDict %}{% if dictItem.counter == count && dictItem.sku in skusTmp == false %}{% do skusTmp.append(dictItem.sku) %}{% do sortDict.append(dictItem) %}{% endif %}{% endfor %}{% endfor %}{% set top = [] %}{% set len = sortDict|length + 1 %} {% for i in range(len) %}{% set ind = sortDict|length - i %}{% set item = sortDict[ind] %}{% if sortDict[ind].counter > 1 %}{% do top.append(sortDict[ind].sku) %}{% endif %}{% endfor %}{{ top|join(',')|trim }}" }
Effect after implementing jinjava
6. Add **Profile Event Filter**. This node allows you to wait for the event sent in the previous node. When the event appears on the customer's profile, it will be possible to refer to its parameters in the next node - here in **send.email**, you will refer to the "Top" parameter via `{{event.params.top}}`
Configuration of the Profile Event Filter node
7. Add the **Send Email** node. In the message template, we can use {{event.params.top}} which will return the "top" parameter of the last event we sent. For example, sku1, sku2, sku3 which can then be converted into an array using the | split (',') function and use in the template structure.
{% set topProducts = event.params.top %}
{% set skus = topProducts|split(',') %}
Additionally - to add the most visited products , you will have to use Jinjava and add your own CSS. If you want to display all objects that are under the key products, follow the instruction:
<!-- Opening the tag that retrieves the value from the aggregate prepared in point 1 -->
{% aggregate XXXXXXXXXXX %}
<!-- In the section {% for r in aggregate_result %} ... {% endfor %} there is access to product:retailer_part_no of the 10 most visited products -->
{% for r in aggregate_result %}
next item:
{{r}}
<!-- r is a single product:retailer_part_no and can be used as the key: {% catalog.Snrs-produktu-ogTag(r).og:XXX %} downloads additional data from a catalog built on the basis of og tags - which information about the product you want to add in the template depends on you. If you want to add the product name, photo, link, price in the e-mail - you can take it from the catalog -->
{% catalog.Snrs-produktu-ogTag(r).og:image %}
{% catalog.Snrs-produktu-ogTag(r).og:title %}
{% catalog.Snrs-produktu-ogTag(r).product:price:amount %}
{% catalog.Snrs-produktu-ogTag(r).og:url %}
{% endfor %}
<!-- Closing of the tag that gets the value from the aggregate prepared in point 1 -->
{% endaggregate %}
To find the aggregate ID to replace XXX in the code, simply navigate to the aggregate in the Synerise application. The ID is the part of the URL that comes after /aggregates/, for example: **bfba46b4-e0d6-3ea9-8ae6-c7a2495c54c7** in the URL `https://app.synerise.com/analytics-v2/aggregates/bfba46b4-e0d6-3ea9-8ae6-c7a2495c54c7`. Copy this ID and use it in your code where needed.
8. Add final settings:
- Add the End nodes where the workflow should finish for users.
- Specify capping (here 1 for 1 day).
- Optionally add titles to each node so the workflow will be more understandable for your colleagues.
- Name the automation and Save it or Save & Run.
- Save your workflow.
**Results:**
Workflow
**It will result in an array:**
skus = [sku1, sku2, sku3] which we can then use to build a template - we can, for example, download items from the product catalog and simply display them in our email or download similiar recommendations for the most viewed item (skus [0])
Based on this workflow, you can also extract the user's favorite brand (by creating an aggregate that collects the brand parameter transferred in page visits, adding products to the cart or transactions).
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of each step directly in the Synerise Demo workspace:
- [Aggregate](https://app.synerise.com/analytics/aggregates/bfba46b4-e0d6-3ea9-8ae6-c7a2495c54c7)
- [Workflow](https://app.synerise.com/automations/workflows/automation-diagram/e2685ff9-390e-47c7-805f-377f35f49bc4)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 11 events per profile that completes the flow:
[`session.end`](/docs/assets/events/event-reference/web-and-app#sessionend) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~4), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), `topvisited.products` (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates/creating-profile-aggregates)
- [Email template](/docs/campaign/e-mail/creating-email-templates)
- [Jinjava inserts](/developers/inserts/insert-usage)
- [Product feed to catalogs](/use-cases/import-product-feed-to-catalog)
- [Workflow](/docs/automation/creating-automation)
# Recommendations of similar products with item context
Similar item recommendations are a valuable tool for online retailers, offering customers product suggestions closely aligned with their current interests or past purchases. These recommendations serve a dual purpose: helping customers uncover new items they may have otherwise missed, while also boosting seller revenue by highlighting products that align with customer preferences.
To take these recommendations to the next level, you can add extra context by tailoring them to individual customer interests and needs. One example of this is considering the products a customer has added to their favorites.
This use case explores the scenario of creating a dynamic content (DC) campaign featuring similar recommendations enriched with the context of customers' favorite items. This approach enables you to provide a more personalized browsing experience for your customers, while also introducing them to a wider array of products similar to their favorites.
## Prerequisites
---
- [Configure an item catalog for recommendations](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations). Enable Similar recommendations.
- [Configure AI engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations).
- Implement a custom event for adding a product to favorites, which will be available in the customer profile.
In this example, the event is called `product.addToFavorite`.
Implement custom events in your [mobile application](/developers/mobile-sdk/event-tracking#product-added-to-favorites) or [website](/developers/web/event-tracking#declarative-tracking-custom-events).
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate](/use-cases/dynamic-content-item-context-recommendation#create-an-aggregate) that returns products added to favorites.
1. [Prepare AI recommendations](/use-cases/dynamic-content-item-context-recommendation#prepare-ai-recommendations).
2. [Create dynamic content](/use-cases/dynamic-content-item-context-recommendation#create-dynamic-content-campaign) with similar item recommendations using the predefined dynamic content web layer template.
## Create an aggregate
---
In this part of the process, create an aggregate that will return the products customers added to favorites.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. AClick **Analyze profiles by** and select **Last**.
4. Select the **product.addToFavorite** event.
5. Select the **sku** parameter.
6. Define the period from which the aggregate will return products from the event.
7. Save the aggregate.
Configuration of the aggregate
## Prepare AI recommendations
---
In this part of the process, you will configure a similar items recommendation with context of items that customers added to their favorites. This recommendation will be later used in the dynamic content.
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation (it is only visible on the list of recommendation).
3. In the **Type & Items feed** section, click **Define**.
4. From the **Items feed** dropdown list, select an item feed.
5. In the **Type** section, choose the **Similar items** recommendation type.
6. Confirm the settings by clicking **Apply**.
7. In the **Items** section, click **Define**.
1. Click **Add slot**.
2. Define the minimum and maximum number of items that will be recommended to the customer in each slot.
3. Optionally, define [Static filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#static-filters) and [Elastic filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#elastic-filters).
4. Confirm by clicking **Apply**.
8. Optionally, you can define the **Boosting** factors.
9. In the **Additional settings** section click **Define**.
1.Enable the **Item context from analytics (aggregate, expression)** switch.
2. From the dropdown list select the created you created [in this part of the process](/use-cases/dynamic-content-item-context-recommendation#create-an-aggregate).
3. Click **Apply**.
9. In the right upper corner, click **Save**.
## Create dynamic content campaign
---
Create a dynamic content campaign with recommendations of similar products to those added to favorites using the predefined web layer dynamic content template. This dynamic content will be displayed as a pop-up on your site for the customers who have added products to their favorites.
1. Go to **Experience Hub > Dynamic content > Create new**.
2. Enter the name of the dynamic content.
3. Choose the **Web layer** type.
4. In the **Audience** section, click **Define**.
1. In the **New Audience** section, click **Define conditions**.
2. From **Choose filter** dropdown menu, choose **product.addToFavorite** event.
3. Define the period from which the segmentation will return customers.
4. Confirm the settings by clicking **Apply**.
5. Confirm the settings by clicking **Apply**.
### Define content
5. In the **Content** section, click **Define**.
6. In the **Content** tab, click **Create Message**.
7. From the list of template folders, select a folder with the predefined **Web layer templates**.
**Result**: You are redirected to the list of predefined templates.
Web layer templates folder
8. Select the **Recommendations** template.
**Result**: You are redirected to the template builder.
You can edit the template in two ways, by editing the code of the template ([add inserts](/docs/campaign/dynamiccontent/creating-dynamic-content-templates/dynamic-content-template-builder#adding-a-snippet-to-the-template-code), [add variables](/docs/campaign/dynamiccontent/creating-dynamic-content-templates/dynamic-content-template-builder#adding-a-variable)) and/or by [filling out the form in the Config tab](/use-cases/dynamic-content-item-context-recommendation#edit-the-form-in-the-config-tab). In this use case, we will use the capabilities of the predefined Config tab.
#### Edit the form in the Config tab
The form in the **Config** tab is already filled in with default values. You can keep them or change them to fit your business needs.
1. From the **Recommendation campaign** dropdown list, select the ID of recommendation campaign you created [in the previous step](/use-cases/dynamic-content-item-context-recommendation#prepare-ai-recommendations). You can find it by typing its name or ID in the search box.
2. In the **Header text** field, define the header text to appear in the popup message.
3. In the **Currency** field, specify the currency in which you want to display the prices of the recommended products.
4. In the **Bottom text** field, define the copy you want to appear in this section.
5. In the **Font** field, define the font of all text displayed in the dynamic content.
6. Define the colors in the **Bottom bar background** and **Bottom bar text color** fields.
7. Choose the most suitable carousel scrolling method for you by enabling one or all toggles at the same time:
- **Carousel autoplay**: activation of this toggle allows automatic scrolling of items in the carousel;
- **Carousel loop**: activation of this toggle allows users to navigate to the first article in the carousel by clicking the arrow after the last article displayed in the carousel;
- Enabling these two options at the same time will combine these functionalities. In this case, the recommendation carousel will scroll automatically and return to the first item automatically after displaying the last one.
- If you don't activate any of the toggles, users will have to scroll through the carousel on their own, and when they get to the last item, it won't automatically redirect them to the beginning of the carousel.
8. In the following fields, define the item amount that you would like to display in small, medium, large and extra large screens.
7. After you make changes to the template, you can check the preview.
1. Click the **Preview Contexts** button on the upper left side.
2. Enter the ID of a customer and define the product context.
3. Click **Apply**.
If you are using custom attributes in your product feed, you need to replace the names of the standard attributes used in the template code with the names of the attributes used in your feed. In our case, we changed the names of following attributes (according to the custom attribute names used in our product feed):
- `link` -> `productUrl`
- `imageLing` -> `image`
- `title` -> `name`
- `item.price.value`-> `item.price`
- `item.salePrice.value` -> `item.salePrice`
4. If the template is ready, in the upper right corner click **Save this template > Save as**.
5. On the popup:
1. In the **Template name field**, enter the name of the template.
2. From the **Template folder** dropdown list, select the folder where the template will be saved.
3. Confirm by clicking **Apply**.
6. To continue the process of configuring the dynamic content campaign, click **Next**.
7. To save your content changes, click **Apply**.
### Define schedule and display settings
1. In the **Schedule** section, click **Define** and set the time when the message will be active.
2. In the **Display Settings** section, click **Define**.
3. Specify circumstances for dynamic content to be displayed. Optionally, you can also define the Advanced options. In our case, we will define the frequency of dynamic content to be displayed to **Once per day**. You can also define the type of device you want to show your dynamic content.
4. Click **Apply**.
5. Optionally, you can define the UTM parameters and additional parameters for your dynamic content campaign.
Dynamic content configuration
6. Click **Activate**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of each step from this use case in our Synerise Demo workspace:
- [Aggregate](https://app.synerise.com/analytics/aggregates/8b2c2e9e-24e0-30ff-aca6-a9f024a99306)
- [AI Recommendation](https://app.synerise.com/ai-v2/recommendations/CWP9JaQ05YAB)
- [Dynamic content](https://app.synerise.com/campaigns/create/84798cba-0cc3-4810-9207-114bdcf7989c)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per profile that completes the flow:
[`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Dynamic content template builder](/docs/campaign/dynamiccontent/creating-dynamic-content-templates/dynamic-content-template-builder)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Integration with Accredible
You can integrate a full-service digital credentialing solution, Accredible, with Synerise to issue digital certificates, diplomas, badges, and many other credentials to the users based on their profiles and activity in Synerise.
This use case presents the integration used for the purposes of user certification in Synerise. The workflows include sending data of users who reached a certification level in Synerise to Accredible in order to issue their certificate and badge.
In this use case, we cover only the part of issuing the digital credentials.
Accredible integration
## Prerequisites
---
- Access to Accredible.
- If you want to [trigger the workflow](/use-cases/integration-with-accredible#create-a-workflow) by occurrence of a custom event, you must add one in Synerise in **Data Modeling Hub > Events** and implement it in your application. You can read more about adding events [here](/docs/assets/events/event-definitions).
- Create a schema that stores the certification questions in [Schema Builder](/docs/assets/schema-builder).
## Process
---
In this use case, you will go through the following steps:
1. [Create credentials in Accredible](/use-cases/integration-with-accredible#create-credentials-in-accredible).
3. [Create a catalog](/use-cases/integration-with-accredible#create-a-catalog).
4. [Create a workflow](/use-cases/integration-with-accredible#create-a-workflow).
5. [Test](/use-cases/integration-with-accredible#testing) your integration.
## Create credentials in Accredible
---
In this part of the process, in your Accredible account, create a group of credentials.
Groups in Accredible
You can find the full documentation [here](https://help.accredible.com/how-do-i-create-a-group).
A group receives a unique identifier.
ID of the group
## Create a catalog
---
In this part of the process, prepare a CSV file that contains Accredible group identifier and Synerise ID of the certificate level. Next, create a catalog to which you import the file.
1. Go to **Data Modeling Hub > Catalogs > Create new**.
2. Enter the name of the catalog.
Don't use diacritical letters and spaces.
3. Click **Import CSV**.
If you prepared a CSV file in Excel, open it in a text editor to check whether commas are used as separators. If not, replace them with commas.
4. Upload the file by clicking **Upload file**.
5. In the **Order key** field, type the name of the column which values are treated as the key - `syneriseID`.
The value of `syneriseID` is the ID of the schema created as a part of [prerequisites](#prerequisites).
6. Complete the process by clicking **Import**.
**Result**:
CSV file imported to catalog
## Create a workflow
---
In this part of the process, create a workflow that is triggered by receiving a certification. Then, a request is sent to Accredible to issue credentials for the user who received the required score.
1. In Synerise, go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
3. As the first node, add **Profile Event**. In the configuration of the node, select the event that triggers the workflow. In this use case, it's a custom event - `certification.acquired`.
If it suits your business scenario, you may use default Synerise events, or instead of **Profile Event**, you may use the **Audience** node to trigger the workflow for the selected group.
4. Confirm the settings by clicking **Apply**.
4. Add the **Outgoing integration** to the workflow. In the configuration of the node:
1. Change the webhook type to **Custom**.
2. As the connection type, select **No authentication**.
3. Click **Select connection** and select a connection.
If you want to create a connection, click **Add connection** and [create it](/docs/automation/actions/webhook-node#set-up-a-connection).
1. Select **Custom** and **no authentication**.
1. Enter the name of the node.
2. In the **Webhook name** field, enter the value of the `name` parameter of the event generated by this node.
3. In **Webhook event name**, click **Create event** and create a new event:
1. As **Name**, enter `accredible.userSent`
2. As **Display name**, enter `User sent to Accredible`
3. Select the **POST** method.
4. In the **URL** field, enter `https://api.accredible.com/v1/credentials`
You can find more information about this endpoint [here](https://docs.api.accredible.com/#tag/Credentials).
5. In the **Headers** section, use the following headers:
- Set `Content-type` to `application/json`.
- Set `Authorization` to `Token token=YOUR ACCREDIBLE API_KEY`
6. Enter the request body, you may reuse and modify the example request below according to your needs:
The example request contains three Jinjava inserts:
1. Customer's name sourced from Profile Event node, [read more about reusing information in nodes](/developers/inserts/automation)
2. Customer's email address according to the context
3. Reference to the catalog column
You can read more about inserts in Automation [here](/developers/inserts/automation).
Configuration of the Outgoing Integration node
8. Confirm by clicking **Apply**.
9. Add the **End** node.
10. Click **Save&Run**.
Final configuration of the workflow
## Testing
---
1. Use the API to send a test event and simulate a user completing a certification
2. Open the **Statistics** tab available in your workflow.
3. Click the **Outgoing Integration** node. If the **Entered** and **Executed** counters have incremented after you sent the test certification, your survey triggered the workflow and completed it.
4. Go to the profile of the test user, look for the `automation` event. Double-click it to see the details. If the `status` parameter is `200`, the workflow works.
Event generated on the customer's profile
You can use this webhook response to trigger further campaigns to the user as well as create analytical dashboards with clear information on how many users received their credentials.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of use case in Synerise Demo workspace:
- [Catalog](https://app.synerise.com/assets/catalogs/200765)
- [Workflow](https://app.synerise.com/automations/workflows/automation-diagram/d62c7285-1698-48a7-b5be-a6238679c78e)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per profile that completes the flow:
`certification.acquired` (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~1), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), `accredible.userSent` (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Integration](/docs/automation/integration)
# Early Access Discount for a Specific Product
Create a buzz around your product and draw attention to your store, while attracting a larger audience by offering significant discount for a limited time. Build anticipation and excitement among your loyalty and future customers with an early preview of the remarkable discount opportunity.
This use case describes how to create a high discount promotion for one product with an early preview. The customer will receive a 70% discount for a specific product three days in advance, which can be redeemed only on the weekend.
## Prerequisites
---
- Implement promotions in your [mobile application](/developers/mobile-sdk/loyalty), website or through [API](https://hub.synerise.com/api-reference/loyalty-and-engagement#operation/profileLogin)
- [Implement transactional events](/developers/web/methods-reference#tracking-transactions).
- [Import the product feed to a catalog](/use-cases/import-product-feed-to-catalog).
## Create a promotion
---
Create a straightforward weekend promotion for a specific product with a substantial discount rate (for example 70%). The promotion will be previewable three days prior to its activation.
1. Go to **AI Hub > Regular Promotions > Add Promotion**.
2. Enter a name for the promotion.
3. Select the **For selected items** type of promotion.
4. In the **Audience** section, choose **Everyone**.
5. In the **Content** section:
1. Define the name, descriptions, thumbnail, and image of the promotion.
3. Optionally, you can add tags to the promotion and JSON code with additional promotion parameters.
2. Confirm the settings by clicking **Apply**.
Content configuration
6. In the **Type and limits** section:
1. Leave **General** in the **Type section**.
1. In the **Type section** field, select **General** (default option).
2. In the **Priority**, enter a number that defines the priority of the promotion.
Priority defines the order of display in the customer’s view. 1 is the highest priority. If two or more promotions applicable to a customer have the same priority, the order of display is determined by the date of creation. The one that was created earlier takes the priority over the other promotion.
3. Select the **Single** tab (default choice).
4. In the **Limit per profile** field, type `1`.
5. From the **Discount type** dropdown list, select **Percentage**.
6. In **Discount mode**, leave the default option (**Static**).
7. In the **Value** field, type `70`.
8. Confirm the settings by clicking **Apply**.
Type and limits configuration
7. In the **Schedule** section:
1. In the **Display time** section, choose **Scheduled**.
2. Pick the dates in the **Start** and **End** fields, in this case the promotion should start three days before the weekend and end on Sunday.
3. In the **Activity time** section, deselect **Same as display time**.
4. Set a date range when the promotion can be activated. Pick the dates in the **Start** and **End** fields, in this case promotion should be active on a selected weekend.
3. In the **Lasting** field, you can enter the time (in seconds) that a promotion remains redeemable after it is activated. `0` is interpreted as infinity.
4. Confirm the settings by clicking **Apply**.
Schedule configuration
8. In the **Items** section:
1. From the **Source catalog** dropdown list, select a catalog of items.
2. In the **Include items** section, choose **Selected items**.
3. Click **Select items** and select the product you want the discount to apply to.
Items configuration
9. To apply configuration and run the promotion, click **Publish**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [promotion configuration](https://app.synerise.com/campaigns/promotions/90f3a031-7026-4313-af56-8538d7bea0d0) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 4 events per profile that completes the flow:
[`client.activatePromotion`](/docs/assets/events/event-reference/loyalty#clientactivatepromotion) (~1), [`transaction.charge`](/docs/assets/events/event-reference/items#transactioncharge) (~1), [`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~2).
## Read more
---
- [Catalogs](/docs/assets/catalogs/introduction-to-catalogs)
- [Promotions](/docs/ai-hub/promotions)
# Automated email campaign performance reports
Take your email performance tracking to the next level using the data context Jinjava tag. Automate the delivery of a detailed weekly report summarizing key metrics from your sent email campaigns, ensuring you stay informed and can take timely action.
An alert can be sent through any channel, for example as an email, SMS or to an external tool such as Microsoft Teams or Slack. This particular use case shows how to send once a week an alert with data referencing email performance in the form of an email. To streamline implementation, a ready-made email template is included for a quick setup.
## Prerequisites
---
- [Implement a tracking code](/docs/settings/tool/tracking_codes).
- [Configure email account](/docs/campaign/e-mail/configuring-email-account).
## Process
---
In this use case, you will go through the following steps:
1. [Create an email template](#create-an-email-template) with the HTML block with accurate Jinjava tag.
2. [Create a workflow](#create-a-workflow) sending the notification.
## Create an email template
---
You can use a [ready-made template with an HTML block](https://app.synerise.com/campaigns/email/content-manager/template/158990) (available on the Synerise Demo workspace) that inserts the data you want to send in a table format. Just copy it and edit according to your needs.
1. Click the table in the template, and then **Configure** on the right panel.
The configuration of the Email notification on email performance template
2. You can provide the name of the node and change the colors of the table in the configuration.
1. Click **Next**.
3. Edit the template according to your needs.
4. Click **Save as**.
5. On the pop-up, you can change the name and select the folder where the template will be saved.
**Result**: The template is saved in the selected folder.
If you want to make your own template, you can switch to the html editing mode of this ready-made template, where you will find an example of jinjava syntax using data reference
## Create a workflow
---
In this part of the process, prepare a workflow that sends an email message with a weekly report summarizing the key statistics of your sent email campaigns.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
## Define the trigger node
---
At this stage, we will configure the conditions that launch the workflow. We will create a scheduled workflow, that starts every week on Monday at 9:45 A.M.
1. As the first node of the workflow, add **Scheduled Run**. In the configuration of the node:
1. In the **Run trigger** section, leave the default **all time** option.
2. In the **Repeat runs** section, choose suitable timezone.
3. To launch the workflow every week at the defined time, click the **Every week** tab below.
4. Select the desired day, in our case **Monday**.
5. Click **Add time** and set it according to your needs, in our case to `9:45`.
5. Confirm by clicking **Apply**.
The configuration of the Scheduled Run node
## Configure the Get Statistics Node
---
As the next node, choose **Get Statistics** to retrieve email campaign statistics from a specified time range.
1. Click **Then** and add the **Get statistic** node. In the configuration of the node:
1. Select the **By time range** tab.
2. From the **Campaign type** dropdown list, select **Email**.
3. In the **Set time range** field, select the time range from which you would like to export the statistics. In our case, in the **Relative time range** section, select the **Last week** option.
5. The default setting includes statistics exclusively for campaigns sent through Experience Hub. If you also want to include statistics for campaigns launched through Automation Hub, enable the **Include automation statistics** option. If this option is selected, the output will include campaigns set up by Automation Hub that meet one of the following criteria:
- the date of creation is within the indicated time range,
- at least one sending event has occurred in the indicated time range.
6. Optionally, if you want to export variants of one campaign as separate records, enable the **Breakdown by variants** toggle.
By default, if statistics of a campaign selected for export contains more than one version (due to A/B testing), the statistics for each variant are a single aggregated record.
Campaign statistics data retrieved through the **Get Statistics** node before sending can be [transformed](/docs/automation/data-transformation-and-imports/introduction) to better align their format with specific requirements. To simplify building validation rules, you can download sample data in various formats (.csv, .json, .jsonl).
8. Confirm by clicking **Apply**.
The configuration of the Get Statistics node
## Define the Email Alert Node
---
1. Click **Then** and add the **Email Alert** node. In the configuration of the node:
1. In the **Content** section, select [the email template created in the previous step](#create-an-email-template) and in the **Subject** field, enter your message subject.
2. In the **Recipient** section, use the text field to find recipients or enter an email address to add recipients outside the contact base.
3. Confirm the selection by clicking **Add**.
4. Optionally, you can save the list by clicking **Save list**. This way you can use this list in the future.
3. Confirm by clicking **Apply**.
The configuration of the Email Alert Node
## Add the finishing node
---
5. Add the **End** node.
6. In the upper right corner, click **Save & Run**.
Workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of every element of this process directly in Synerise Demo workspace:
- [Configuration of the email template](https://app.synerise.com/campaigns/email/content-manager/template/158990),
- [Configuration of the workflow](https://app.synerise.com/automations/workflows/automation-diagram/bbb24d8a-f1ae-44ac-a614-36d1f6f37667).
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per workflow execution:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1).
## Read more
---
- [Automation Inserts](/developers/inserts/automation#data-context)
- [Creating email templates](/docs/campaign/e-mail/creating-email-templates)
- [Creating workflows](/docs/automation/creating-automation)
- [Get Statistics node](/docs/automation/actions/synerise-integrations/get-statistics)
# Web push with voucher and promotion for different categories
This use case highlights the functionality provided by Synerise through web push notifications - with a keen focus on user engagement and conversion, Synerise introduces a possibility to add two buttons to a web push campaign. These buttons not only act as navigation tools, directing users to the online store, but also serve as triggers, offering a tailored and interactive experience.
This campaign focuses on a targeted approach aimed at users, who have visited specific category, but have not yet made a purchase. The web push notification will highlight special active promotions in the women’s category, which, in our case, will include jewelry and watches. However, this targeting can be customized based on various criteria, such as previously viewed categories (e.g., men/women), where dynamic content placed on the page, which the web push button redirects to, adapts to show relevant promotions based on the visited category. It can also be tailored to other specific user segments, offering flexibility to match our needs.
The campaign described in this specific use case, involves adding two buttons, each associated with a unique listing of products: "watches" and "jewelry" for women. After clicking these buttons, users will go to a specific category page where dynamic content with the unique voucher will be displayed.
What is important you can enrich this use case using personalized recommendations, promotional recommendations or instead add the link to dedicated landing page with personalized promotions.
## Prerequisites
---
- [Implement a tracking code](/docs/settings/tool/tracking_codes).
- Create [voucher pools](/docs/assets/code-pools) for both promotions.
- [Configure web push notifications](/docs/campaign/Webpush/configuring-web-push)
- [Import your product feed to catalog](/use-cases/import-product-feed-to-catalog).
## Process
---
In this use case, you will go through the following steps:
1. [Create voucher pools](/use-cases/webpush-with-vouchers#create-voucher-pools).
2. [Prepare a web push template](/use-cases/webpush-with-vouchers#prepare-a-web-push-template).
3. [Create a dynamic content campaign](/use-cases/webpush-with-vouchers#create-a-dynamic-content-campaign) for each promotion.
4. [Prepare a workflow](/use-cases/webpush-with-vouchers#prepare-a-workflow) that will send a web push to customers who visited products of specific categories and didn't make a purchase within 24 hours after visiting the products.
## Create voucher pools
---
Create a voucher pool in Synerise for the promotion for women watches and jewelry.
1. Go to **Data Modeling Hub > Voucher Pools > Add pool**.
2. On the pop-up, fill in the following fields:
1. In the **Pool name** field, enter the name of the pool (the name is only visible on the list of the voucher pools).
2. Optionally, from the **Barcode** type dropdown list, select the type of codes which will be imported in the CSV file to Synerise.
The selection in the dropdown has no influence on the further process. It serves only informational purposes for the users.
3. Optionally, in the **Voucher prefix** field, enter a number that will be added to the beginning of each code.
4. In the **Emission start** and **Emmission end** fields, select the dates when the distribution of the codes starts and finishes, respectively.
5. Optionally, to limit the size of the pool, fill in the **Pool limit** field.
7. Optionally, in the **Description** field, enter the internal description of the pool that is visible only on the list of voucher pools.
3. Confirm by clicking **Save**.
4. Enter into the pool.
5. Using the **Import** button on the top of the screen, import the vouchers into the pool. Proceed according to [this instruction from step 3 (selecting the import method)](/docs/assets/imports/importing-vouchers#procedure).
**Result**: After importing vouchers, you will be able to see the codes in the pool. You will also see information about whether it is assigned or unassigned to any customer. You can also see the assignment date and the date of use.
Voucher pool
6. Repeat all the steps to create voucher pool for the other category.
Learn more how to build a monitoring system for all voucher pools you have in your workspace. The system can alert you when the number of codes in a voucher pool drops below a predetermined threshold (500 codes in a pool). This alert serves as a reminder for the business to replenish the pool with more codes, as well as an alert to customer service teams to communicate with customers to ensure they are aware of the updated balance. We encourage you to read [Voucher pool alert use case](/use-cases/voucherpools) and use this mechanism.
Do the same with the another voucher pool for watches category.
## Prepare a web push template
---
In this part of the process, you will create a web push template with two action buttons. Each of them will display different product category for which the voucher code can be used.
1. Go to **Experience Hub > Web Push > Templates**.
2. Click **New template**.
3. Enter the name of the template.
4. In the **Title** field, define the title you want to display in the web push.
5. In the **Message** field, define the main body you want to display in the web push.
9. In the **Image URL** field, enter the URL of the image you uploaded previously to the **Files** section in the **Data Modeling Hub**. [Image requirements](/docs/campaign/Webpush/creating-webpush-templates#image-requirements) are listed at the top of the article.
1. To get the URL of the image, go to **Data Modeling Hub > Files**.
2. Find the image on the list.
3. Hover the mouse cursor over the image on the list.
4. Click **Copy URL**.
5. Paste the URL in the **Image** field.
10. If you want the web push to remain visible until the recipient clicks or closes it, switch the **Require an action** toggle on.
The "requireInteraction" functionality used by this toggle is not supported by some browsers. For more details, go to [https://developer.mozilla.org/en-US/docs/Web/API/Notification/requireInteraction#browser_compatibility](https://developer.mozilla.org/en-US/docs/Web/API/Notification/requireInteraction#browser_compatibility).
11. To configure action buttons for your template, switch the **Action Buttons** toggle on.
1. Click **Add item**.
2. In the **Button Label** field, enter the text that will appear on the button.
2. In the **URL** field, enter the address to which a customer is redirected after clicking the button.
3. To add the second action button, click **Add item** and follow steps b and c.
In this scenario, we have two buttons labeled "watches" and "jewelry." Each button corresponds to a specific URL link:
- Clicking the "jewelry" button will redirect to: `https://demoshop.synerise.com/women/jewelry`
- Clicking the "watches" button will redirect to: `https://demoshop.synerise.com/women/watches`
These links will be employed later in the Dynamic Content (DC) configuration when choosing where to display the DC.
12. For saving the template in a folder of your choice, click **Save as** button and select the desired folder.
9. Save the template clicking the button **Save as**, and choose the folder in which template will be saved.
## Create a dynamic content campaign
---
Create a dynamic content campaign where you will display items using a predefined dynamic content template (insert object). This dynamic content will be displayed as a part of the site, only for customers who have clicked the web push.
1. Go to **Experience Hub > Dynamic Content > Create new**.
2. Enter the name of the content.
3. Choose **Insert object** type.
### Define Audience
1. In the **Audience** section, select **New Audience** and click **Define conditions**.
1. From **Choose filter** dropdown list, select the `webpush.click` event, `campaignTitle` parameter, choose operator `Equal (string)` and as the value add the exact title of the [Webpush campaign](/use-cases/webpush-with-vouchers#prepare-a-web-push-template) created in the previous step.
1. Click `+ where` and from the **Choose filter** dropdown list, select the **webpush.click** event.
2. Choose the `actionButton` parameter with the value `1`. It will be visible only for users who have clicked the first button in the webpush campaign.
2. Click the calendar in the right bottom of the page and choose the option **Lifetime**.
3. Click **Save**.
Audience configuration
8. To save the audience, click **Apply**.
### Define content
1. In the **Content** section, click **Create Message**.
2. From the list of template folders, select a folder with the predefined **Insert object templates**.
**Result:** You are redirected to the list of predefined templates.
3. You can also create your own template. In our case we choose predefined template: **Small message bar**.
4. In the **Text** field, add the copy for your message.
5. On the upper right side of the screen, click **Inserts**. From the dropdown list, choose **Pool** and select the voucher pool created in the previous part of the process. Click the voucher pool, copy the code and paste to your text box.
6. Additionally add background color, text color or add any other additional changes.
7. Click the **Use in communication** button.
8. Click **Apply**.
Content configuration
Create two dynamic contents: the first includes an insert from one voucher pool directing to the watches category, as previously described. For the second dynamic content, use an insert from the second voucher pool leading to the jewelry category.
### Define schedule and display settings
1. In the **Schedule** section, click **Define** and set the time when the message will be active.
2. In the **Display Settings** section, click **Define**.
3. Specify circumstances for dynamic content to be displayed. Optionally, you can also define the Advanced options. You can also define the type of device you want to show your dynamic content.
5. In the **Page targeting** section, choose **Others**, and in the **Display on pages** section, click **Add rule**.
10. Select **Page URL containing** and enter the address of the category page you defined in the first button in the web push template (for example, the main category page).
4. Click **Apply**.
5. Optionally, you can define the UTM parameters for your dynamic content campaign.
6. Click **Activate**.
7. Prepare another dynamic content template. Duplicate this campaign and add three changes:
- In the **Audience** section, change the value of the `actionButton` to `2`.
- In the **Content** section, add voucher pool for jewelry category.
- In the **Display settings**, select **Page URL containing** and enter the address of the category page you have defined for the second button in the web push template.
## Prepare a workflow
---
In this part of the process, create a workflow that will be run every 24 hours, and it will be triggered for the group of users who have visited women category in the last 24 hours but did not make any transaction.
### Define the Audience trigger node
1. Start the workflow with the **Audience** node.
2. Click the node to configure it.
3. In the **Run trigger** section, set the option to **repeatable**, every 24 hours.
Configuration of the Audience node
4. In the **Define audience** section, choose **New audience**.
1. Click **Define conditions**.
2. From the **Choose filter** dropdown list, select **page.visit**. As the parameter, select **URL** and add the URL for the watches category.
3. Click **Choose filter** and from the dropdown list, select **page.visit**. Choose the **URL** parameter and add the URL for the jewelry category.
4. Betwen those conditions choose operator **OR**.
2. Click **Choose filter** and from the dropdown list, select **transaction.charge**.
4. Betwen those conditions choose operator **AND**.
5. Set up time for each conditions as the **last 24 hours**.
6. Change filter from **matching** to **not matching**.
6. Click **Apply**
Configuration of the Audience node
### Configure Send Web Push node
In this part of the process you will define the Webpush message to be sent.
1. Add **Send Web Push**. In the configuration of the node:
1. In the **Content** section, from the **Webpush template** dropdown, select [the template you created in the previous step](/use-cases/webpush-with-vouchers#prepare-a-web-push-template).
2. In the **Schedule** section, set the **Webpush lifespan (TTL)** according to your business needs.
3. You can describe the campaign with [additional parameters](/docs/campaign/Webpush/creating-webpush-campaigns#adding-custom-parameters).
2. Click **Apply**.
### Add the finishing node
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
The workflow configuration
## What's more
---
To further enrich this use case and enhance user engagement, consider a few additional options:
- Incorporate personalized recommendations tailored to individual user preferences. You can dynamically suggest products within the "watches" and "jewelry" (or any other) categories that align with each user's interests e.g. showing personalized recommendations on the top of the page. These personalized recommendations can be implemented in multiple areas, such as the homepage, category pages, product detail pages, shopping cart, and even during the checkout process. This personalized touch not only captures attention but also increases the likelihood of users finding products they genuinely desire, boosting conversion rates.
[Read more about personalized recommendations](/docs/ai-hub/recommendations-v2)
- As an alternative strategy, incorporate a link to a dedicated landing page with personalized promotions. This landing page can feature curated product selections, exclusive discounts and codes, and a seamless shopping experience, further encouraging users to take advantage of the promotions in an environment designed to enhance their overall satisfaction.
[Read more about preparing a landing page with personalized products](/use-cases/landing-page-personalized)
## Check the use case set up on the Synerise Demo workspace
---
You can check the all the configurations directly in Synerise Demo workspace:
- [Dynamic content campaign 1](https://app.synerise.com/campaigns/dynamic-content/create/7de0bc34-cff3-43c7-b082-d235a1ed6e89)
- [Dynamic content campaign 2](https://app.synerise.com/campaigns/dynamic-content/create/1d95f14c-01ee-4804-9c5e-3cb726841e6c)
- [Webpush campaign template](https://app.synerise.com/campaigns/webpush/content-manager/template/126358)
- [Workflow](https://app.synerise.com/automations/automation-diagram/63b80690-139b-4c1d-90f2-47b5f77ac9d5)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 9 events per profile that completes the flow:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~1), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`webpush.send`](/docs/assets/events/event-reference/webpush#webpushsend) (~1), [`webpush.show`](/docs/assets/events/event-reference/webpush#webpushshow) (~1), [`webpush.click`](/docs/assets/events/event-reference/webpush#webpushclick) (~1), [`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`voucherCode.assigned`](/docs/assets/events/event-reference/loyalty#vouchercodeassigned) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Jinjava inserts](/developers/inserts)
- [Recommendations](/docs/ai-hub/recommendations-v2)
- [Web push](/docs/campaign/Webpush)
- [Voucher pools](/docs/assets/code-pools)
# Product Sets - Personalized Accessory Bundles with Ready-Made Template
---
To enhance the shopping experience and increase the average order value, we can use product sets to recommend complementary accessories alongside a main product. With our ready-made template, setting up these sets becomes much easier. The template is based on a single recommendation campaign that allows you to configure multiple slots, each representing a different category of products. Each slot can be customized with specific settings, such as the number of displayed products, price ranges, colors, and other relevant attributes. This enables a highly personalized shopping experience, tailored to individual user preferences.
This use case describes the process of implementing three accessory categories: glasses, plates, and vases, when a user visits the Glasses category. The recommendations will be dynamically adjusted based on the user’s behavior and preferences. Customers will have the flexibility to purchase the full set with a single click or manually select individual items from each category. This approach not only simplifies the decision-making process for customers but also drives higher engagement and conversions by presenting well-matched product combinations.
Product sets template
## Prerequisites
---
- [Personalized model trained](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations).
- Color, brand and additional attributes in the product feed – as custom attributes
- [Tracking code](/developers/web/installation-and-configuration#creating-a-tracking-code) on your website.
- Implemented [OG tags](/developers/web/og-tags):
- product:retailer_part_no which is the same as in the product feed
- og:category which is also the same as in the product feed - We recommend that your website has the add to cart function that can be implemented in JavaScript, using the product IDs from the product feed.
This use case only explains how to create the campaign and adjust the template, and it is important to set up your e-commerce system to handle the "Add to Cart" button correctly for adding selected products or the entire set to the shopping cart. Additionally, the template allows you to apply a discount to the full set (either as a percentage or a fixed value), visible in the product set view. However, integrating this discount at checkout requires specific technical setup on your end, depending on your e-commerce system, and our template ensures the discount is accurately calculated and displayed.
## Process
---
In this use case, you will go through the following steps:
1. [Preparation of AI recommendation](/use-cases/product_sets2#preparation-of-ai-recommendation).
2. [Preparation of dynamic content](/use-cases/product_sets2#preparation-of-dynamic-content).
## Preparation of AI recommendation
---
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation (it is only visible on the list of recommendations).
3. In the **Type & items feed** section, click **Define**.
4. From the **Items Feed** dropdown list, select a product feed for which the model training is completed.
To use the selected item feed for a given recommendation type, the model that drives the recommendation type works must be trained using the selected item feed. If the recommendation type is not available yet for the recommendation type, you can check the model training status. To learn more about it, read the ["Model status"](/docs/settings/configuration/ai-engine-configuration/model-status) article.
5. Click **Select model** and on the pop-up, select **Personalized**.
Configuraion of the catalog and recommendation type section
6. Confirm by clicking **Apply**.
7. In the **Items** section, click **Define**.
1. Define the minimum and the maximum number of products displayed in the slot according to your needs.
Learn more about the [recommendation settings](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#configure-item-slots).
2. In **Static filters**, set the following parameters:
- `category` - and choose the category from which products should be presented.
- additionally, you can use different filters based on your business needs.
3. Click **Add slot** and repeat steps b-d. In step d, select different category.
4. Confirm by clicking **Apply**.
8. Optionally, you can define the settings in the **Slots and items ordering**, **Boosting**, and **Additional settings** sections.
Learn more about [slots and items ordering](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-slot-and-item-ordering), [boosting](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-the-boosting-factors) and [additional settings](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#additional-settings)
9. Save the recommendation by clicking the **Save** button in the upper right corner.
## Preparation of dynamic content
---
When you finish configuring your AI recommendation, it’s time to display the recommendation results (product sets) on the website. You can do it using our pre-defined template available on the [Demo Profile](https://app.synerise.com/campaigns/dynamic-content/content-manager/template/168756). The template is ready to use.
To fully use the recommendation, you must:
- set up your e-commerce system to handle the add to cart actions and handle adding multiple items to the cart simultaneously
- configure applying the discount on the checkout process.
The template ensures only correct display and calculation of the discount.
1. Go to **Experience Hub > Dynamic content > Create new**. Choose **Insert** type of campaign.
2. Add meaningful name to your campaign.
3. In the **Audience** section, select the recipients of the dynamic content.
4. In the **Content** section, select **Create message**, then go to the Use Cases folder or just type the name of the template in the search box: **Product Sets**
Product sets template
5. In the **Config** tab:
1. In the **Product sku for preview field,** enter example product sku, that helps you see which products are displayed in the product set for this specific SKU.
2. In **Recommendation Id**, add the ID of [recommendation campaign](#preparation-of-ai-recommendation) created in the previous step.
3. If you want to give the user chance to add all the products together as a set, enable **Show add all products to cart button** .
4. If you want to apply discount, from the **Discount type** dropdown list, choose the discount type. The recommendation display reflects the item value after applying the promotion; however, the implementation of the discount during the checkout process is your responsibility.
4. In the upper right corner, click **Use in communication**.
5. Specify the CSS selector where you want to insert recommendations.
6. Click **Apply**.
7. In the **Schedule** section define the period when the dynamic content is active.
7. In **Display settings**, define the circumstances when the dynamic content will be triggered and the URLs on which it will be displayed. In this case, the dynamic content will be displayed on the URLs with the **Glasses** category.
8. In the upper right corner, click **Activate**.
## Check the use case set up on the Synerise Demo workspace
---
In the Synerise Demo workspace, you can check:
- [AI recommendation](https://app.synerise.com/ai-v2/recommendations/RKFGRSy1UV5k)
- [Dynamic content campaign](https://app.synerise.com/campaigns/dynamic-content/create/b7ead34c-5450-4ba9-92f8-93847278cb18)
- [Template](https://app.synerise.com/campaigns/dynamic-content/content-manager/template/168756)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 11 events per profile that completes the flow:
[`page.visit`](/docs/assets/events/event-reference/web-and-app#pagevisit) (~1), [`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~3), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1), [`product.addToCart`](/docs/assets/events/event-reference/items#productaddtocart) (~3).
## Read more
Learn how to build [AI recommendations](/docs/ai-hub/recommendations-v2)
# Sending TrustMate Survey Links via Email After Purchase
TrustMate is a tool that enables building online brand image through management of reviews of your online shop or company. You can integrate it with Synerise using dedicated node in Automation to build a variety of business scenarios. The node enables you to get two survey links - to rate the purchased product and to rate the company.
This use case describes the process of creating a workflow to generate a survey link from TrustMate and send it in email communication to encourage customers to leave their feedback about the purchased products. The link to the survey will be sent after 7 days from the day of purchase.
## Prerequisites
---
- Contact TrustMate to receive access key for API requests.
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- [Create an email account](/docs/campaign/e-mail/configuring-email-account).
- [Create an email template](/docs/campaign/e-mail/creating-email-templates).
## Process
---
1. [Create a workflow](/use-cases/trustmate-integration#create-a-workflow)
3. [Track survey answers](/use-cases/trustmate-integration#track-survey-answers)
## Create a workflow
---
Create a workflow that is triggered by every product purchase. In response to the purchase, the system sends a request to TrustMate with the details of the purchased products. In exchange, a link to the survey is saved to Synerise. After 7 days, the workflow sends an email to a customer.
Trustmate integration workflow that generates link to the survey
### Define the Profile Event trigger
---
1. In Synerise, go to **Automation Hub > Workflows > New workflow**.
2. Add the first node - **Profile Event**. In the node configuration:
1. Select an event that signifies a purchase of an item (in this use case it's `product.buy`).
2. Confirm by clicking **Apply**.
Configuration of the Profile Event node
### Configure TrustMate Integration node
---
In this part of the process, you will configure an action that workflow performs - outgoing integration that sends the details of purchased products to TrustMate and generates the `trustMate.getSurveyLinks` event with survey links. The values of the integration parameters are dynamic and they are sourced from the event trigger by using [inserts](/developers/inserts/automation).
1. On the **Profile Event** node, click the plus icon.
2. From the dropdown list, select **TrustMate**.
3. From the dropdown list, select **Get Survey Link**.
4. Click the node.
5. Click **Select connection**.
6. From the dropdown list, select the connection.
If you haven't established a connection yet, see [Create a connection](/use-cases/sending-events-facebook#create-a-connection).
#### Create a connection
Use an access key which allows you to send a request.
1. At the bottom of the **Select connection** dropdown list, click **Add connection**.
2. In the **Access key** field, enter the access key received from TrustMate.
3. Click **Next**.
4. In the **Connection name** field, enter the name for the connection you created.
5. Click **Apply**.
**Result**: A connection is created and selected.
#### Define the integration parameters
1. In the **Customer’s firstname** field, enter the insert that extracts the customer's first name from the customer's attribute: `{{ customer['firstname'] }}`
2. In the **Customer’s email** field, enter the insert that extracts the email of your customer from the customer's attribute: `{{ customer['email'] }}`
3. In the **Order Id** field, enter the insert that extracts the order ID of the purchase from the **Profile Event** trigger: `{{ event.params['$orderId'] }}`
4. In the **Product’s name** field, enter the insert that extracts the name of the purchased product from the **Profile Event** trigger: `{{ event.params['$name'] }}`
5. In the **Product’s category** field, enter the insert that extracts the category of the purchased product from the **Profile Event** trigger: `{{ event.params['$category']|join(' / ') }}`
TrustMate requires to separate categories path elements with `/`, ex. `clothes/dresses/pink-dresses`
1. In the **Product’s SKU** field, enter the insert that extracts the SKU of the purchased product from the **Profile Event** trigger: `{{ event.params['$sku'] }}`
2. In the **Product’s image URL** field, enter the image URL of the purchased product. Use the following insert to extract it from the profile event trigger: `{{ event.params['image-link'] }}`.
3. In the **Product’s URL** field, enter the insert that extracts the SKU of the purchased product from the **Profile Event** trigger: `{{ event.params['$url'] }}`
The names of the parameters you send in the transaction events may differ in your case, so make sure that Jinjava inserts correspond with the parameters' names you send in the transaction events.
If you do not pass some of the parameters required to configure TrustMate integration node in transaction events, try extracting them from [the product catalog](/use-cases/import-product-feed-to-catalog) using [inserts](/developers/inserts/insert-usage#extracting-items-from-catalogs-as-objects).
When the TrustMate node is launched, `trustMate.getSurveyLinks` event is generated on the customer's profile. There are links to surveys in event parameters.
Event generated on the customer's profile
### Configure the Event Filter node
This node enables you to make sure the link to survey is generated and keeps it as [the context for the workflow](/developers/inserts/automation#context).
4. Add **Event Filter**. In the configuration of the node:
3. In the **Define conditions** field, from the **Choose event** dropdown menu, choose `trustMate.getSurveyLinks` event.
4. Click **where** button.
5. From the dropdown menu, select the `body.product[0]` parameter.
6. From the **Choose operator** dropdown menu, select `Regular expression (String)`.
7. Enter the `.` value.
4. Confirm by clicking **Apply**.
Final configuration of the Event Filter node
### Configure the Delay node
---
Add the Delay node to define the lag between the purchase and sending an email with survey link. In this example it is 7 days.
1. On the **Get Survey Link** node, click the plus icon.
2. From the dropdown list, select **Delay**.
4. Click the node.
5. In the **Delay** field enter `7`.
6. From the **Unit** dropdown menu, select `Day`.
### Configure settings for email
1. As the next node, add **Send Email**. Configure it according to your business needs.
2. Configure the sender details section.
3. Configure the Content section.
1. In the **Subject** field, enter your message subject.
2. In the **Template** section, choose the template email template prepared earlier.
3. You can define **UTM & URL parameters**.
4. Confirm by clicking **Apply**.
You need to enrich your email template with the survey link generated in the TrustMate integration node. The link to survey about purchased product is stored in the `body.product[0]` parameter of the `trustMate.getSurveyLinks` event, so you can use the following [Jinjava code](/developers/inserts/automation#event-parameters) in your email template: `{{ event.params['body.product[0]'] }}`
9. Add the **End** node.
10. In the upper right corner, click **Save & Run**.
### Track survey answers
---
Optionally, you can level up your communication with customers based on the answers from the survey. To make it possible, configure a custom event that will be sent to Synerise through API and which will include the rate of a product. When a customer fills in the survey, this event will be sent to Synerise.
Exemplary event frame:
You can find the API method [here](https://hub.synerise.com/api-reference/data-management#operation/CustomEvent).
## Check the use case set up on the Synerise demo workspace
---
You can also check the workflow configuration directly in Synerise Demo workspace at this [link](https://app.synerise.com/automations/workflows/automation-diagram/4891c9c3-d4e4-40e6-9ff1-74afd2169b58).
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 11 events per profile that completes the flow:
[`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~4), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`trustmate.getSurveyLinks`](/docs/assets/events/event-reference/integration#trustmategetsurveylinks) (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1).
## Read more
---
- [Automation inserts](/developers/inserts/automation)
- [Creating workflows](/docs/automation/creating-automation)
- [Outgoing Integration](/docs/automation/actions/webhook-node)
# Pop-up with a reminder about abandoned products in the cart
An effective strategy for online businesses to retrieve lost sales is through an abandoned cart pop-up message. Such notifications serve as a reminder to customers about the products they have left in their shopping cart and urges them to finalize their purchase. They often include a personalized message, a list of items left in the cart, and a call-to-action button to encourage the customer to complete their purchase. By using this method, online businesses can potentially increase sales and improve customer engagement while being cost-efficient.
This use case describes the implementation of dynamic content (DC) with abandoned cart notification. With predefined dynamic content web layer templates, you can create such a DC much faster without having to create a template from scratch.
## Prerequisites
---
- [Implement a tracking code](/docs/settings/tool/tracking_codes).
- Implement the [transaction events](/developers/web/transactions-sdk) using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- [Implement the `cart.status` event](/developers/web/cart), which stores the current status of the basket in the form of an event on the profile's card. The event has to be sent to Synerise after every change in the cart status.
- Collect [product.addToCart event](/docs/assets/events/event-definitions).
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate](#create-an-aggregate) that returns the products in the cart for every individual customer.
2. [Create a dynamic content](#create-a-dynamic-content) with the contents of the abandoned cart using the predefined template.
## Create an aggregate
---
In this step, create an aggregate that returns the list of products in a cart. The result of the aggregate will be used to display products in your dynamic content.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last**.
5. From the **Choose event** dropdown list, select the `cart.status` event.
6. As the event parameter, select **products**.
7. Set the period from which the aggregate will analyze the results to **Lifetime**.
12. Save the aggregate.
Configuration of the aggregate
## Create a dynamic content
---
Create a dynamic content campaign with abandoned cart items using a predefined web dynamic content layer template. This dynamic content will be displayed as a pop-up on your site for customers who haven't made a transaction within an hour from adding the product to cart.
1. Go to **Experience Hub > Dynamic Content > Create new**.
2. Enter the name of the content.
3. Choose **Web layer** type.
### Define Audience
1. In the **Audience** section, select **New Audience** and click **Define conditions**.
1. From the **Choose filter** dropdown list, select the `product.addToCart` event.
2. Click the calendar in the right bottom of the page.
1. In the **Relative date range** section, define the analyzed period. In this case, choose **Today**.
2. Click **Apply**.
3. Click **Choose filter**, from the dropdown list, select the `product.addToCart` event.
4. Click **add funnel step**.
5. From the **Choose event** dropdown list, select the `transaction.charge` event.
6. Change **matching** to **not matching**.
7. Click the calendar in the right bottom of the page.
1. In the **Relative date range** section, define the analyzed period. In this case, choose **Today**.
2. Click **Apply**.
8. Click the clock next to the calendar.
1. Type `1` and from the dropdown list, select **Hours**.
2. Click **Apply**.
Audience configuration
8. To save the audience, click **Apply**.
### Define content
1. In the **Content** section, click **Create Message**.
2. From the list of template folders, select a folder with the predefined **Web layer templates**.
**Result:** You are redirected to the list of predefined templates.
Web layer templates folder
3. Select the **Abandoned cart** template.
**Result:** You are redirected to the template builder.
You can edit the template in two ways, by editing the code of the template ([add snippets](/docs/campaign/dynamiccontent/creating-dynamic-content-templates/dynamic-content-template-builder#adding-a-snippet-to-the-template-code), [add variables](/docs/campaign/dynamiccontent/creating-dynamic-content-templates/dynamic-content-template-builder#adding-a-variable) and/or by filling out the form in the Config tab. In this use case, we will use the capabilities of the predefined Config tab.
#### Edit the form in the Config tab
The form in the Config tab is already filled in with default values. You can keep them or change them to fit your business needs.
1. From the **Aggregate with products left in the cart** dropdown list, select the ID of the aggregate you created [in the previous step](#create-an-aggregate). You can find it by typing its name or ID in the search box.
2. In the **Header text** field, define the header you want to display in the pop-up message.
3. In the **Currency** field, specify the currency in which you want to display the prices of the items.
4. In the **Bottom text** field, define the copy you want to appear on the bottom of the page.
5. In the **Font** field, define the font of all text displayed in the dynamic content.
6. Define the colors in the **Bottom bar background** and **Bottom bar text color**.
7. Choose the most suitable carousel scrolling method for you by enabling one or all toggles the same time:
- **Carousel autoplay**: activation of this toggle allows automatic scrolling of items in the carousel;
- **Carousel loop**: activation of this toggle allows users to navigate to the first article in the carousel by clicking the arrow after the last article displayed in the carousel;
- Enabling these two options at the same time will combine these functionalities. In this case, the recommendation carousel will scroll automatically and return to the first item automatically after displaying the last one.
- If you don’t activate any of the toggles, users will have to scroll through the carousel on their own, and when they get to the last item, it won’t automatically redirect them to the beginning of the carousel
8. In the following fields, define the item amount that you would like to display in small, medium, large and extra large screens.
9. After you make changes to the template, you can check the preview.
1. Click the **Preview** button on the upper left side.
2. Enter the ID of a customer.
Select a customer who has the `product.addToCart` event in their activity list in **Behavioral Data Hub > Profiles**.
3. Click **Apply**.
If you are using custom attributes in your product feed, you need to replace the names of the standard attributes used in the template code with the names of the attributes used in your feed.
10. If the template is ready, in the upper right corner, click **Save this template > Save as**.
11. On the popup:
1. In the **Template name** field, enter the name of the template.
2. From the **Template folder** dropdown list, select the folder where the template will be saved.
3. Confirm by clicking **Apply**.
12. To continue the process of configuring the dynamic content campaign, click **Next**.
13. To save your content changes, click **Apply**.
### Define schedule and display settings
1. In the **Schedule** section, click **Define** and set the time when the message will be active.
2. In the **Display Settings** section, click **Define**.
3. Specify circumstances for dynamic content to be displayed. Optionally, you can also define the Advanced options. In our case, we will define the frequency of dynamic content to be displayed to **Once per day**. You can also define the type of device you want to show your dynamic content.
4. Click **Apply**.
5. Optionally, you can define the UTM parameters and additional parameters for your dynamic content campaign.
6. Click **Activate**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the the configuration of each step from this use case in our Synerise Demo workspace:
- [Aggregate](https://app.synerise.com/analytics/aggregates/17d214c4-5644-33b1-b0c6-9fab96b26b3e)
- [Dynamic Content](https://app.synerise.com/campaigns/create/3cbc322f-74e4-4fb8-8897-8ef9d96fdd9c)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 4 events per profile that completes the flow:
[`product.addToCart`](/docs/assets/events/event-reference/items#productaddtocart) (~1), [`cart.status`](/docs/assets/events/event-reference/items#cartstatus) (~1), [`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Dynamic content template builder](/docs/campaign/dynamiccontent/creating-dynamic-content-templates/dynamic-content-template-builder)
- [Snippets](/docs/assets/snippets)
# Welcome Promotion and Instant Bonus for Loyalty Club Members
Engaging loyalty program users right after they join is crucial to turn a new signup into an active customer. One effective approach is to assign a welcome promotion right after they join. If they don’t use it within the specific time, you send a reminder email to nudge them. If they do use the promotion, you reward them with a second incentive — an instant bonus, automatically assigned.
This automated sequence keeps new users engaged, increases the chance of repeated purchases, and builds stronger loyalty through timely and relevant communication.
In this specific use case, we will implement an automated process for managing a welcome promotion and follow-up bonus for loyalty program users.
- When a user joins the loyalty program, they are automatically assigned a welcome promotion (20% discount).
- The promotion can only be used once.
- If the user does not use the promotion in 7 days, they will receive a reminder email.
- If the user uses the welcome promotion and made a transaction in 7 days, a new promotion (called instant bonus) is assigned automatically.
- If the instant bonus will not be used, one reminder will be sent.
## Prerequisites
---
- Add [product Feed](/developers/product-feed).
- Implement [transaction events](/developers/web/transactions-sdk).
- [Create an email account](/docs/campaign/e-mail/creating-email-campaigns).
- [Integrate Synerise promotions](/docs/ai-hub/promotions/introduction-to-promotions) and create first promotions in Synerise.
- Implement the [custom event](/developers/mobile-sdk/event-tracking) which sends information to Synerise about joining a loyalty program (for example `client.register`). Such an event should be sent each time the the user will join the loyalty program.
## Process
---
In this use case, you will go through the following steps:
1. [Create a welcome promotion segmentation](/use-cases/welcome-promo#create-welcome-promotion-segmentation).
2. [Create an instant bonus promotion segmentation](/use-cases/welcome-promo#create-instant-bonus-promotion-segmentation).
1. [Create a welcome promotion](/use-cases/welcome-promo#create-welcome-promotion) for new members of the loyalty program.
2. [Create instant bonus promotion](/use-cases/welcome-promo#create-instant-bonus-promotion) for loyalty member users who used the welcome promotion in the last 14 days.
5. [Create a workflow](/use-cases/discount-promotion-for-first-transaction#create-a-workflow) to manage the process of sending:
- welcome promotions,
- reminder if the user does not use the promotion in the specific time,
- the bonus for those who used the welcome promotion.
## Create welcome promotion segmentation
---
In this part of the process, create a segmentation which will be used as a target of the first welcome promotion.
1. Go to **Decision Hub > Segmentation > New Segmentation**.
2. Enter the name of segmentation.
3. On the canvas, click **Add condition**.
4. From the dropdown list, select the event **client.register**.
7. If we want to set a time limit for the promotion's validity, we can set the time range e.g. last 14 days
9. Click **Save**.
The final configuration of the segmentation
## Create instant bonus promotion segmentation
---
In this part of the process, create a segmentation which will be used as a target of the instant bonus promotion.
1. Go to **Decision Hub > Segmentation > New Segmentation**.
2. Enter the name of segmentation.
3. On the canvas, click **Add condition**.
4. From the dropdown list, select the event **client.removePoints**.
5. Choose from the attributes parameter **promotionUuid**.
6. As the value set up the ID of the welcome [promotion](#create-welcome-promotion).
7. If we want to set a time limit for the promotion's validity, we can set the time range e.g. last 14 days
9. Click **Save**.
Remember to change the name and choose the unique name of the [promotion](/docs/ai-hub/promotions/creating-promotions) which you will create in the next step, for example, **Instant bonus promotion**.
The final configuration of the segmentation
## Create welcome promotion
---
In this part of the process, you create a [promotion](/docs/ai-hub/promotions/creating-promotions) assigned to users immediately after joining the loyalty program.
1. Go to **AI Hub > Regular Promotions > Add promotion**.
2. Select the **For selected items** option.
3. As the name of the promotion choose the same name as you have added to the [segmentation, created in the previous step](#create-welcome-promotion-segmentation).
3. In the **Audience** section of the promotion, select the segmentation created in [this step](#create-welcome-promotion-segmentation). Your promotion will be activated only for this group of customers, for whom the event with the code of this promotion will be generated. Confirm your selection, by clicking **Apply**.
4. In the **Content** section, define the name, description, and an image of the promotion. Confirm the settings by clicking **Apply**.
Save the promotion code from this section because it will be used later in the workflow.
5. Choose the **Single** type of promotion.
5. In the **Limit per profile** field, enter `1` to make sure that this discount can be used only once.
6. In **Type & limits** section:
1. As **Discount type**, choose **Percentage**.
2. As the value, enter `20`, and click **Apply**.
6. In the **Schedule** section, define the distribution period.
7. In **Items** section, choose the main product catalog with all products a customer can buy with this discount. If you want to narrow down the list of categories a customer can choose from, use one of the options presented below (Selected items/Filtered items).
9. In **Exclude items** section, you can exclude a specific product or categories for which the discount is not active.
10. To apply all changes and run the promotion, click **Publish**.
## Create instant bonus promotion
----
Create an instant bonus promotion for loyalty members who used the welcome promotion within the last 14 days.
This promotion will be sent 14 days after the first promotion was sent.
1. Go to **AI Hub > Regular Promotions > Add promotion**.
2. Select the **For selected items** option.
3. As the name of the promotion choose the same name as you have added to the [segmentation, created in the previous step](#create-instant-bonus-promotion-segmentation).
3. In the **Audience** section of the promotion, select the segmentation created in [this step](#create-instant-bonus-promotion-segmentation). Your promotion will be activated only for this group of customers, for whom the event with the code of this promotion will be generated. Confirm your selection, by clicking **Apply**.
4. In the **Content** section, define the name, description, and an image of the promotion. Confirm the settings by clicking **Apply**.
Save the promotion code from this section because it will be used later in the workflow.
5. Choose the **Single** type of promotion.
5. In the **Limit per profile** field, enter `1` to make sure that this discount can be used only once.
6. In **Type & limits** section:
1. As a Discount type, choose **Percentage**.
2. As the value, enter `10`, and click **Apply**.
6. In the **Schedule** section, define the distribution period.
7. In **Items** section, choose the main product catalog with all products a customer can buy with this discount. If you want to narrow down the list of categories a customer can choose from, use one of the options presented below (Selected items/Filtered items).
9. In **Exclude items** section, you can exclude a specific product or categories for which the discount is not active.
10. To apply all changes and run the promotion, click **Publish**.
## Create a workflow
---
Create a workflow to manage the entire process: assigning the welcome promotion, sending a reminder if it’s not used, and assigning the instant bonus.
This workflow monitors promotion usage and controls the timing of follow-up communications and actions.
### Profile event node
---
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
3. As the first node of the workflow, add **Profile event node**, and choose the parameter/event which signifies joining the loyalty program. In our case, it will be the `client.register` event.
Workflow configuration
### Add the Send Email node
---
1. Add the **Send Email** node. In the node settings:
1. In the **Sender details** section, choose the email account from which the email will be sent.
2. In the **Content** section, type the **Subject** and from the **Template** dropdown, select or directly create a short welcoming message for a new members in loyalty program.
3. Click **Apply** to save your changes.
### Configure the Event Filter node
This node lets a customer check if promotion has been used in the last 7 days. This setting is just an example and can be configured according to your business needs.
1. As the next node, add **Event Filter**. In the configuration of the node:
1. In the **Check** field, from the dropdown menu choose **for period of time**.
2. Set the time range. In our case, it is 1 week.
3. In the **Define conditions** field, from the **Choose event** dropdown menu, choose `client.removePoints` event.
4. As a parameter choose **promotionName** and use the exact name of the promotion crested in the [previous step](#create-welcome-promotion).
2. Confirm by clicking **Apply**.
Event Filter configuration
### Send Email node
---
1. Add the **Send Email** node to the **Not matched** path. In the node settings:
1. In the **Sender details** section, choose the email account from which the email will be sent.
2. In the **Content** section, type the **Subject** and from the **Template** dropdown, select or directly create a message with the reminder about promotion. The email will be send only to users with this promotion assigned.
3. Click **Apply** to save your changes.
### Configure the Event Filter node
This node lets a customer check if promotion has been used in the last 7 days.
1. As the next node, add **Event Filter**.
2. You can duplicate the exact settings of the [Event Filter node, created earlier](#configure-the-event-filter-node)
## Merge Paths
---
To the **Not matched** path from the second **Event filter node** and to the **Matched** path from the first **Event filter node** add **Merged path node**.
### Add Send email node with the instant bonus promotion
---
1. Add the **Send Email** node. In the node settings:
1. In the **Sender details** section, choose the email account from which the email will be sent.
2. In the **Content** section, type the **Subject** and from the **Template** dropdown, select or directly create a message with the link to instant bonus promotion.
3. Click **Apply** to save your changes.
2. Additionally you can add another **Event Filter** to check if the instant bonus result in using the promotion or not. If not - you can send email reminder once again.
### Configure the Event Filter node
This node lets a customer check if instant bonus promotion has been used in the last 7 days.
1. As the next node, add **Event Filter**. In the configuration of the node:
1. In the **Check** field, from the dropdown menu choose **for period of time**.
2. Set the time range. In our case, it is 1 week.
3. In the **Define conditions** field, from the **Choose event** dropdown menu, choose `client.removePoints` event.
4. As a parameter choose **promotionName** and use the exact name of the promotion crested in the [previous step](#create-instant-bonus-promotion).
2. Confirm by clicking **Apply**.
Event Filter configuration
### Add Send email node with the instant bonus promotion
---
1. Add the **Send Email** node to the **Not matched** path. In the node settings:
1. In the **Sender details** section, choose the email account from which the email will be sent.
2. In the **Content** section, type the **Subject** and from the **Template** dropdown, select or directly create a message with the link to instant bonus promotion.
3. Click **Apply** to save your changes.
2. Additionally you can add another **Event Filter** to check if the instant bonus result in using the promotion or not. If not - you can send email reminder once again.
### Final settings
---
7. Set the capping for the workflow to make sure that entrance to the process will be available once for every user (choose very distant date for example, once in 1000 months).
7. Confirm the settings by clicking **Apply**.
7. Add the **End** node to finish the workflow.
8. Click **Save & Run**.
Workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
In the Synerise Demo workspace, you can check:
- [Segmentation for welcome message](https://app.synerise.com/analytics-v2/segmentations/f6d38a7e-fae6-430d-a439-e0bce4e0f66f)
- [Segmentation for instant bonus](https://app.synerise.com/analytics-v2/segmentations/8cf011f4-8237-4b0a-a50b-ef4985938f56)
- [Promotion with welcome message](https://app.synerise.com/campaigns/promotions/b823b86a-5ea9-4234-bfa5-10d9f5885b1b)
- [Promotion with instant bonus](https://app.synerise.com/campaigns/promotions/79f50e74-622e-496b-bd2f-821002779dee)
- [Workflow](https://app.synerise.com/automations/workflows/automation-diagram/412fa7df-338e-4f13-aa33-f75d827cc8d5)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 24 events per profile that completes the flow:
[`client.register`](/docs/assets/events/event-reference/profiles#clientregister) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~5), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~2), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~2), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~2), [`client.activatePromotion`](/docs/assets/events/event-reference/loyalty#clientactivatepromotion) (~2), [`client.removePoints`](/docs/assets/events/event-reference/loyalty#clientremovepoints) (~2), [`transaction.charge`](/docs/assets/events/event-reference/items#transactioncharge) (~2), [`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~4).
## Read more
---
- [Creating promotions](/docs/ai-hub/promotions)
- [Loyalty programs basics](/use-cases/loyalty-programs-basics)
- [Workflow](/docs/automation/creating-automation)
# WhatsApp abandoned cart message
Businesses should understand the importance of personalized communication and aim to provide a seamless shopping experience for their customers. With Synerise, you can leverage your business using WhatsApp to send personalized messages to customers who have abandoned their shopping carts. Sending customized messages through WhatsApp may increase your sales and reduce cart abandonment rates. You can use this integration to ensure that your customers receive timely reminders about their abandoned carts, with personalized offers and incentives to encourage them to complete their purchase.
In this use case, you will create a workflow sending a personalized message on WhatsApp encouraging customers who abandoned their cart to complete the transaction.
## Prerequisites
---
- Make sure you meet [all prerequisites](/docs/automation/integration/whats-app/send-template-message#prerequisites) to work with the **Send Template Message** node.
- Implement the [transaction events](/developers/web/transactions-sdk) using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- [Implement the `cart.status` event](/developers/web/cart), which stores the current status of the basket in the form of an event on the customer's card. The event has to be sent to Synerise after every change in the cart status.
- Collect [product.addToCart event](/docs/assets/events/event-definitions).
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate](#create-an-aggregate) with abandoned products.
2. [Create a message template in the Meta portal](#create-a-message-template-in-the-meta-portal)
3. [Create a workflow to send message to customers on WhatsApp](#create-a-workflow-to-send-message-to-customers-on-whatsapp)
## Create an aggregate
---
In this part of the process, create an aggregate that returns the list of the abandoned products. You will use the result of the aggregate as an insert to display products from the abandoned cart in your WhatsApp message.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last**.
5. From the **Choose event** dropdown list, select the `cart.status` event.
6. As the event parameter, select **products**.
7. Set the analyzed period to **Lifetime**.
12. Save the aggregate.
Configuration of the aggregate
## Create a message template in the Meta portal
---
Create a message template in the Meta portal that you will use in the next part of the process. In the body of the message, mark places where the dynamic elements will be added.
In addition, if you would like to add a CTA at the end of the message, you can add a button and define its copy. The page to which the customer will be redirected after clicking the button can be defined in Synerise.
The example message used in this use case:
`*{{1}}* Hi {{2}}, it looks like you forgot something. Go on and complete your purchase!`
Where `{{1}}` and `{{2}}` are markers that will be replaced with the dynamic values. This step will be done in Synerise.
The screen below shows an example of creating a template message in the Meta portal:
Configuration of the message
In the following screen, you can see how a button can be defined in the Meta portal:
An example of button section configuration in the Meta platform
## Create a workflow to send message to customers on WhatsApp
---
The workflow will be triggered by the `product.AddToCart` event. The delay is defined up to 1 day. If a customer does not make a transaction within one day, we will send a WhatsApp message with a reminder to buy products left in the cart.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the trigger node
---
1. As the first node, add the **Profile Event**. In the settings of the node, select the **productAddToCart** event.
2. Click **Apply**.
### Configure the Delay node
---
1. Add the **Delay** node. In the node settings:
1. In the **Delay** field, type `1`.
2. From the dropdown list, choose **Day**.
2. Click **Apply**.
### Define the Profile Filter node
---
As the next node, choose **Profile Filter** to check if a customer have made a transaction in the last 24 hours.
1. Add the **Profile Filter** node. In the node settings:
1. From the **Choose filter** dropdown, select the `transaction.charge` event.
3. Set the date range to the last 1440 minutes.
Use 1440 minutes instead of 1 day – use smaller granulation, as in this case 1 day would take the time from current hour till the midnight, so such an analysis would not take into consideration all customers who meet the meet the filter conditions.
2. Click **Apply**.
### Define the Send a template mesage node
---
1. To the **Not matched** path, add the WhatsApp **Send Template Message** node.
2. Click **Select connection**.
3. From the dropdown list, select the connection.
- If no connections are available or you want to create a new one, see [Create a connection](/docs/automation/integration/whats-app/send-template-message#create-a-connection).
- If you selected an existing connection, proceed to defining the integration settings.
4. In the **Sender ID** field, enter the phone number ID from which the message will be sent.
[You can find more information about phone number ID here](https://developers.facebook.com/docs/whatsapp/cloud-api/get-started/add-a-phone-number).
5. In the **Receiver** field, enter the phone number of the customer who will receive this message.
We recommend using the `{% customer phone %}` insert, which inserts the phone number of an individual customer who goes through this node.
6. In the **Message template** field, enter the name of the [message template](#create-a-message-template-in-the-meta-portal) you created earlier in the Meta portal.
7. From the **Language code** dropdown list, select the language used in the message.
8. In the **Message components** field, insert the object that contains the dynamic values in the order defined in the message template.
The example of object used in this use case:
The aggregate ID is used as examples for the purpose of this use case.
9. Click **Apply**.
The following table explains all the inserts used in the body, button and header sections shown above.
| Section | Insert value | Insert explanation |
|--------- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| body | `{% aggregate 17d214c4-5644-33b1-b0c6-9fab96b26b3e %}{% for item in aggregate_result %}{% catalogvar.store-1(item).image %}{{ catalog_result }}{% endcatalogvar %}{% endfor %}{% endaggregate %}` | The value of this insert is used as the value of `{{1}}` to return a product that the customer left in the cart and did not purchase within the estimated time period. |
| body | `{% customer firstname %}` | The value of this insert is used as the value of `{{2}}`, so the name of a customer can be displayed in the message. |
| button | `{% aggregate 17d214c4-5644-33b1-b0c6-9fab96b26b3e %}{% for item in aggregate_result %}{% catalogvar.store-1(item).url %}{{ catalog_result\|replace('https://yourshop.com', '') }}{% endcatalogvar %}{% endfor %}{% endaggregate %}` | The value of this insert is used to return product url. Here we specify the URL omitting the domain, because we define the domain in the Meta platform, as you can see in the screenshot with the [button creation](#create-a-message-template-in-the-meta-portal). |
| header | `{% aggregate 17d214c4-5644-33b1-b0c6-9fab96b26b3e %}{% for item in aggregate_result %}{% catalogvar.store-1(item).image %}{{ catalog_result }}{% endcatalogvar %}{% endfor %}{% endaggregate %}` | The value of this insert is used to return the url to the product image in the header. |
### Add the finishing node
---
1. Add the **End** node to the **Send Template Message** node.
2. To the **Matched** path, add the **End** node.
3. In the upper right corner, click **Save & Run**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [aggregate](https://app.synerise.com/analytics/aggregates/17d214c4-5644-33b1-b0c6-9fab96b26b3e) and [workflow](https://app.synerise.com/automations/automation-diagram/7ea1d166-3125-4f70-ae45-659e2bfef5a3) configuration directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 7 events per profile that completes the flow:
[`product.addToCart`](/docs/assets/events/event-reference/items#productaddtocart) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`whatsapp.sendTemplateMessage`](/docs/assets/events/event-reference/integration#whatsappsendtemplatemessage) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Automation Hub](/docs/automation)
- [Jinjava inserts](/developers/inserts)
- [WhatsApp Send Template Message node](/docs/automation/integration/whats-app/send-template-message)
# Send campaign analytics and performance data to Google Sheets
Thanks to the data context Jinjava tag, you can export campaign performance data from Synerise to Google Sheets. Automate updating Google spreadsheet with detailed report summarizing key metrics from your campaigns, this integration opens up new possibilities for data analysis and informed decision-making.
This use case shows a workflow configuration that sends daily data referencing webpush campaigns from Synerise to Google Spreadsheets.
## Prerequisites
---
- Check the [requirements](/docs/automation/integration/google-sheets/upload-data-to-spreadsheets#prerequisites) you must meet to integrate Synerise with Google Spreadsheets.
- Prepare a Google Spreadsheet to which you want to send the data.
## Create a workflow
---
In this part of the process, prepare a workflow that sends statistics to a spreadsheet.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the trigger node
---
At this stage, we will configure the conditions that launch the workflow. We will create a scheduled workflow, that starts every week on Monday at 9:45 A.M.
1. As the first node of the workflow, add **Scheduled Run**. In the configuration of the node:
1. In the **Run trigger** section, leave the default **all time** option.
2. In the **Repeat runs** section, choose suitable timezone.
3. To launch the workflow every week at the defined time, click the **Every week** tab below.
4. Select the desired day, in our case **Monday**.
5. Click **Add time** and set it according to your needs, in our case to `9:45`.
5. Confirm by clicking **Apply**.
The configuration of the Scheduled Run node
### Configure the Get Statistics Node
---
As the next node, choose **Get Statistics** to retrieve webpush campaign statistics from a specified time range.
1. Select the **By time range** tab.
2. From the **Campaign type** dropdown list, select **Webpush**.
3. In the **Set time range** field, select the time range from which you would like to export the statistics. In our case, in the **Relative time range** section, select the **Last week** option.
5. The default setting includes statistics exclusively for campaigns sent through Experience Hub. If you also want to include statistics for campaigns launched through Automation Hub, enable the **Include automation statistics** option. If this option is selected, the output will include campaigns set up by Automation Hub that meet one of the following criteria:
- the date of creation is within the indicated time range,
- at least one sending event has occurred in the indicated time range.
6. Optionally, if you want to export variants of one campaign as separate records, enable the **Breakdown by variants** toggle.
By default, if statistics of a campaign selected for export contains more than one version (due to A/B testing), the statistics for each variant are a single aggregated record.
Campaign statistics data retrieved through the **Get Statistics** node before sending can be [transformed](/docs/automation/data-transformation-and-imports/introduction) to better align their format with specific requirements. To simplify building validation rules, you can download sample data in various formats (.csv, .json, .jsonl).
7. Name your node `Campaigns sent yesterday` so it corresponds with [the Jinjava in the next step](#configure-integration-and-add-the-finishing-node).
8. Confirm by clicking **Apply**.
Configuration of the Get Statistics Node
### Configure Upload Data to Spreadsheet node
---
- You must have an account in Google Sheets.
- Your account must have permissions to edit the spreadsheet you want to update.
1. Click **Then** and add the **Upload Data to Spreadsheet** node. In the configuration of the node:
1. Click **Select connection**.
2. From the dropdown list, select the connection.
- If no connections are available or you want to create a new one, click the **Select connection** dropdown list, and the **Add connection**. Find how to do it [here](/docs/automation/integration/google-sheets/upload-data-to-spreadsheets#create-a-connection).
- If you selected an existing connection, proceed to the [Configure integration and add the finishing node](#configure-integration-and-add-the-finishing-node) step.
#### Configure integration and add the finishing node
In this step, fill in the form that allows you to send data from Synerise to a table in Google Sheets.
1. In the **Spreadsheet ID** field, enter the ID of the spreadsheet to which you want to upload data.
You can find the ID in the URL of the spreadsheet.
2. In the **Range** field, define the range of cells to which the data will be uploaded. The values will be appended to the first empty cell available within the indicated range. The value in this field must be given in the A1 notation, for example `Sheet1!A4:A`, then the data will be added in a column to A4 and A5 cells in the `Sheet1` Spreadsheet.
3. As the **Dimension**, select **Rows**.
4. In the **Values** field, paste the Jinjava that loops over the results of the **Get Statistics** node:
The configuration of the Upload Data to Spreadsheet Node
5. Click **Apply**.
6. After the **Upload Data to Spreadsheet** node, add the **End** node.
7. Confirm by clicking **Save**.
8. In the upper right corner, click **Save & Run**.
The configuration of the Workflow
## Check the use case set up on the Synerise Demo workspace
---
You can check the [workflow configuration](https://app.synerise.com/automations/workflows/automation-diagram/88a74673-e053-4ebc-8181-28f0eaf80f68) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per workflow execution:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`googleSheets.uploadData`](/docs/assets/events/event-reference/integration#googlesheetsuploaddata) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Automation inserts](/developers/inserts/automation#data-context)
# Banner with a discount for subscribing to a newsletter
Getting people to actually subscribe to a mailing list is very important but at the same time it definitely isn’t easy. Increasing the number of subscribers is key when it comes to the effectiveness of your email marketing programs. Most people check their email every day, and it is an important place to maximize your conversion opportunities.
If you want people to subscribe to your newsletter, you need to **make the benefits clear to them**. Offering a discount can be an incentive to sign up.
Remember that the moment you send the invitation is also very important.
It’s better to send it when customers view your products or spend time on your website since it’s unlikely that a visitor will decide immediately after visiting your home page to sign up to a newsletter.
One option is to put the sign-up box in a fixed position on the site, perhaps in the header or footer, so users know where to find it.
## Example of use - Retail industry
**Challenge**
A client from the retail industry wanted to increase newsletter sign-ups. For signing up for the newsletter, they offered a discount on the first purchase. This information was available to everyone in the footer of the page.
However, they decided to make this information more visible to users who did not yet belong to the database. For this purpose, they prepared a scrollable banner that was displayed in the bottom corner of the screen only to people who hadn’t signed up yet and visited more than two products in the previous day. The message said "We have 40 PLN for you for your first shopping". If customer clicks this banner, a popup with a subscription form will be opened.

**Results**
Leads from this campaign were **13%** of the whole list of new monthly subscribers
## Requirements
---
To use this case, you have to meet a few conditions:
- Synerise Tracker
- Tagging forms
- Collecting marketing consents for the newsletter in Synerise
## How to do it
---
1. Prepare your dynamic content campaign
2. Create an appropriate segment of people in which two conditions will be met:
- attribute newsletter_agreement = disabled
- aggregate counting events visiting the product card will have a value greater than 2.
For this purpose, create an aggregate in advance, in which you will indicate event page visit, where OG tag retailer part number exists (retailer_part_no is true).

## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`form.submit`](/docs/assets/events/event-reference/web-and-app#formsubmit) (~1).
## Read more
---
- Read more about [dynamic content campaigns](/docs/campaign/dynamiccontent)
- Learn more about [aggregates](/docs/crm/aggregates)
- Learn more about [segmentation](/docs/analytics/segmentations/creating-segmentations)
# Decrease the cost of SMS campaigns using Propensity predictions
Instead of wasting your resources for SMS campaigns which don't bring satisfying results, you can use them for sending messages only to those customers who are most likely to make a purchase. This way you can lower the campaign costs and increase the revenue at the same time.
For this purpose, in Predictions, you can calculate propensity to buy items for the customers who has agreed to receive SMS communication and then prepare the segmentation that contains customers with the highest score (the highest tendency to buy). This way, you will find out who is almost ready to make a purchase and just need a small incentive.
## Prerequisites
---
- Implement a [tracking code](/developers/web/installation-and-configuration).
- [Enable the Propensity predictions](/docs/ai-hub/predictions/enabling-predictions#enabling-propensity-and-best-fit-predictions).
- In **Settings > AI Engine Configuration**, upload item feed.
- The attributes that you want to use for propensity predictions must be configured as [filterable attributes](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-propensity#selecting-filters). In this use case, this attribute is the availability of the item.
## Process
---
In this use case, you will go through the following steps:
1. [Create a prediction](/use-cases/decrease-sms-campaign-cost#create-a-prediction) to calculate the customers' propensity for purchase.
2. [Create an aggregate](/use-cases/decrease-sms-campaign-cost#create-an-aggregate) to enable using the result of the latest prediction as a customer attribute.
3. [Create a segmentation](/use-cases/decrease-sms-campaign-cost#create-a-segmentation-based-on-the-prediction-results) based on that attribute to set an audience for use in communication.
## Create a prediction
---
As the first part of the process, configure a Propensity (to buy) prediction to find the customers who are most likely to make a purchase among all the customers in your database who agreed to SMS communication.
The result of the prediction is a `snr.propensity.score` event on the profiles of customers (who agreed to SMS communication) for whom there is enough data to calculate scoring. The `percentile` parameter of the event will be used in the further parts of the process to create a group of customers with high score.
1. Go to **Predictions > New prediction**.
2. As the type of prediction, select **Propensity**.
3. In the **Audience** section, click **Define**.
1. Click **Choose segmentation**.
2. At the bottom of the dropdown list, select **Create new**.
3. Enter the name of the segmentation.
4. Click **Choose filter**.
5. From the dropdown list, select the attribute that signifies the SMS consent.
6. On the logical operator dropdown list, click the icon.
7. Select **Is true**.
The configuration of the segmentation
8. Click **Create segmentation**.
The Audience section configured
4. Click **Apply**.
5. In the **Item selection** section, click **Define**.
1. Click **Choose items feed**.
2. From the dropdown list, select the feed.
3. In the **Item filter** section, click **Define item filter**.
4. On the pop-up, click **Select attribute**.
5. Select the attribute that signifies availability of the items.
6. As the logical operator, select **Equal**.
5. As the value, select **in stock**.
This way, the customer's propensity for purchasing any available item will be calculated.
The configuration of the filter - it matches only items which are available
6. Click **Save**.
The final configuration of the Item selection section
6. Click **Apply**.
7. In the **Settings** section, click **Define**.
8. Select the **Set up recurring prediction calculation** checkbox.
9. As the model training frequency, select 30 days.
10. Click **Apply**.
## Create an aggregate
---
Based on the `snr.propensity.score` event, create an aggregate that returns for a customer the most recent value of the [percentile](/glossary/#percentiles) parameter.
In this step, you will need the ID of the prediction you created in previous part of the process. In the list of predictions, click the icon on the prediction and the ID will be available at the bottom of the context menu.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last**.
4. Click **Choose event**.
5. From the dropdown list, select **snr.prediction.score**.
6. As the parameter, select **percentile**.
7. Click **+ where**.
8. From the dropdown list, select **modelId**.
9. As the logical operator, select **Equal**.
10. In the text field, enter the ID of [the prediction you created](/use-cases/decrease-sms-campaign-cost#create-a-prediction) in the previous part of the process.
11. As the date range, select **Last 30 days**.
12. Confirm by clicking **Save**.
The final configuration of the aggregate
## Create a segmentation based on the prediction results
---
Create a segmentation of customers based on the results of [the aggregate you created](/use-cases/decrease-sms-campaign-cost#create-an-aggregate) in the previous part of the process. This segmentation contains 80% of customers with the highest scoring. The remaining 20% are customers with low scoring and no scoring (due to lack of data).
You can modify the segmentation by changing the percentile value depending on your business needs.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation.
3. Click **Choose filter**.
4. From the dropdown list, select the [aggregate you created before](/use-cases/decrease-sms-campaign-cost#create-an-aggregate).
5. As the logical operator, select **More than**.
6. In the text field, enter `20`.
7. Save the segmentation.
The final configuration of the segmentation
## What's next
---
Go to **Experience Hub > SMS** and create the SMS communication. As the audience of the communication, use [the segmentation you created](/use-cases/decrease-sms-campaign-cost#create-a-segmentation-based-on-the-prediction-results).
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of every element of this process directly in Synerise Demo workspace:
- [Propensity prediction](https://app.synerise.com/ai-v2/predictions/propensity/kubupuewqkbr)
- [Aggregate](https://app.synerise.com/analytics/aggregates/482a13ee-bafd-394a-ba4e-88e0a8c2b32d)
- [Segmentation](https://app.synerise.com/analytics-v2/segmentations/8d7bf3e9-9fb4-4153-80d1-c0031dcb97af)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates 1 event per profile that completes the flow:
[`snr.propensity.score`](/docs/assets/events/event-reference/predictions#snrpropensityscore) (~1).
## Read more
---
- [Prediction overview](/docs/ai-hub/predictions/predictions-introduction)
- [Propensity predictions](/docs/ai-hub/predictions/propensity)
- [Segmentation](/docs/analytics/segmentations)
- [SMS communication](/docs/campaign/SMS)
# Multiple metrics in one report
Answering a question such as *"Which campaigns drive engagement? Which stores perform best? How do loyalty tiers affect purchase behavior?"* usually requires building three or four separate reports and comparing them manually, or writing an API query.
A single report can include several metrics of the same type, displayed side by side and split by one dimension. Instead of exporting multiple CSV files and combining them in a spreadsheet, you get one report, multiple columns, and one table.
This applies to any scenario where you need three to four KPIs of the same type, split by a single dimension such as campaign, store, segment, or channel.
## Example - Campaign effectiveness
---
**Business question:** *"Which email campaigns drive the most opens AND clicks - and which just burn volume?"*
**Why this matters:** The number of messages sent does not indicate campaign quality on its own. A campaign with a high send volume but a low click-through rate may perform worse than a smaller campaign with strong engagement (for example, a campaign with 100k sends and a 1% CTR is less effective than one with 10k sends and a 20% CTR). By combining Sent, OR, CTR, and CTOR in a single report, you can evaluate the full performance of each campaign in one view, rather than analyzing each metric separately.
**What the report shows:**
- campaignName
- Sent - count of message.send
- OR - open rate in %
- CTR - click-through rate in %
- CTOR - click-to-open rate in %
Report preview with a chart and a breakdown table split by campaignName
**Based on this report, you can:**
- Reduce investment in campaigns with high send volumes but low engagement.
- Identify subject line or content patterns shared by the best-performing campaigns.
- Support decisions to pause or rework specific campaigns with data rather than assumptions.
The process below builds this campaign effectiveness report step by step. The same steps apply to other scenarios — only the metrics and the dimension change. For more examples, see [Other applications](#other-applications).
## Prerequisites
---
- The metrics you want to compare must be the **same type** — all profile-based or all event-based. Different metric types cannot be mixed in one report.
- You need a **dimension to split the results by**, for example `campaignName`, `retailStoreID`, `customerLoyaltyTier`, or `campaignId` - in this case, `campaignName`.
- The metrics you want to display must already exist in the workspace. For information on building metrics, see [Creating metrics](/docs/analytics/metrics). To reuse the rate metrics referenced in this use case (`Open Rate`, `CTR`, `CTOR`), see [Calculate CTR, OR, and CTOR based on unique event occurrences](/use-cases/calculate-ctr-or-ctor).
## Process
---
Configuration of the metrics and dimension
In this use case, you will go through the following steps:
1. Create the report.
2. Add the dimension `campaignName`.
3. Add the metrics using [existing formulas](/use-cases/calculate-ctr-or-ctor).
4. Rename columns and format as percentages.
5. Preview the results.
6. Save the report.
## What's Next
---
After saving the report, you can:
- Monitor it weekly on a dashboard.
- Share with your team inside and outside of Synerise.
- Export for analysis in other tools.
## Other applications
---
The same report-building steps apply to other analyses. Only the metrics and the dimension change. The scenarios below show common variations.
### Store Performance
**Business question:** *"Which physical stores sell the most - and which have the best basket quality?"*
**Why this matters:** A store with an average transaction count but a high Average Order Value (AOV) represents a different situation than a store with many transactions and a low Average Order Size (AOS). Analyzing all three metrics together provides the context needed to make accurate operational decisions.
Configuration of the metrics and dimension
Each metric describes a different aspect of store performance:
- Transaction count reflects traffic.
Configuration of the Number of transactions metric
- AOV reflects basket size.
Configuration of the AOV metric
- AOS reflects the number of items per purchase.
Configuration of the AOS metric
**What the report shows:**
Report preview with a chart and a breakdown table split by retailStoreID
**Based on this report, you can:**
- Identify stores that may benefit from upsell training (high traffic, low AOV).
- Recognize stores outperforming others in their region (high AOV and high AOS).
- Share a single report view with store operations teams, without exporting data to external tools.
### Loyalty Tier Analysis
**Business question:** *"Do loyalty members spend more than non-members, and is the program worth maintaining?"*
**Why this matters:** Without this comparison, the return on investment of a loyalty program is difficult to assess. Viewing Transactions, AOV, and AOS split by loyalty tier (basic, plus, and non-members) in a single table provides the data needed to support or challenge the program investment during business reviews.
Configuration of the metrics and dimension
**What the report shows:**
Report breakdown table split by customer loyalty tier
**Based on this report, you can:**
- Confirm or disprove that loyalty members generate higher basket value.
- Determine whether the program primarily drives purchase frequency (Transactions) or order value (AOV).
- Use the results to justify program costs or to support changes to the tier benefit structure.
## Generated events
This use case does not generate any events.
## Read more
---
- [Reports](/docs/analytics/reports)
- [Creating reports](/docs/analytics/reports/creating-reports)
- [Metrics](/docs/analytics/metrics)
- [Dashboards](/docs/analytics/analytics-dashboard/introduction-to-dashboards)
# Display seasonal promotions in a mobile application
Seasonal promotions are a great way to boost sales and engagement for your business during special occasions, such as Christmas. By creating specific promotions and marketing campaigns tailored to these holidays, you can catch the attention of your customers and encourage them to make a purchase.
The [Synerise Documents](/docs/assets/documents) feature facilitates distributing seasonal promotions in your mobile application thanks to the ability of grouping them into specific categories. For example, you can create multiple documents that contain Christmas promotions and assign them to a single `Seasonal` group, then create a [screen view campaign](/docs/campaign/screen-views/creating-screen-views) which will display all documents assigned to the `Seasonal` group. You can schedule this screen view campaign to be displayed in the specific time of year.
In this use case, we'll show you how to create two documents with Christmas promotions and adding them to the `Seasonal` group. This group will be used while creating a screen view campaign, presented for your all users of the mobile application.
## Prerequisites
---
- [Implement Synerise SDK in your mobile app](/developers/mobile-sdk).
- [Create Christmas promotions](/docs/ai-hub/promotions)
- [Meet the screen views requirements](/docs/campaign/screen-views/introduction-to-screen-views#requirements)
- [Meet the documents requirements](/docs/assets/documents/introduction-to-documents#requirements)
## Process
---
In this use case, you will go through the following steps:
1. [Create two documents](/use-cases/documents-promotion-groups#create-a-document) with basic Christmas promotion targeted to all application users, create a `Seasonal` group and add these two documents to this group.
2. [Create a screen view](/use-cases/documents-promotion-groups#create-a-screen-view) that will display the documents from the `Seasonal` group to all mobile application users.
## Create a document
---
As the first part of the process, you will create two documents with the promotions you created in Synerise. You will also create a `Seasonal` group and assign these two documents to this group.
1. Go to **Data Modeling Hub > Documents > Add document**.
2. Enter the name of your document.
2. In the **Audience** section, choose to whom the document will be displayed. Select **Everyone**.
3. In the **Configuration** section:
1. In the **Slug** field, enter the slug of the document, we recommend using the following name convention: `this-is-slug-name`.
2. In the **Priority** field, use a number to define the document priority. The order of documents is defined by the priority value (1 is the highest, 100 is the lowest).
3. From the **Group** dropdown list, click **Add group**.
4. On the pop-up, in the **Group name** field, enter `Seasonal`.
**Result**: The group is added and selected.
5. From the **Type** dropdown list, select a document type. Document type defines how the document is validated by your mobile application. To create a new type, from the dropdown list, click **Add type**.
Full explanation of the type is available [here](/docs/assets/documents/introduction-to-documents#terminology).
6. In the **Body** field, add the content of the promotion in the JSON format. Below you will find an easy examples of the document body that contains the promotion created in Synerise. You can add more elements to your JSON code like for example buttons, colors, tags, and so on.
Document configuration
7. Optionally, to check the document display for a specific customer, use **Preview body**.
8. To save your changes, click **Apply**.
1. In the **Schedule** section, set up when the document will be active.
2. Select the **Scheduled** tab.
3. Select the date and time when the document will be active.
2. Click **Apply** to save your changes.
3. Click **Activate**.
Document configuration
4. Create another document with the Christmas promotion in the same way as described previously. Change the visual project and JSON code for this document. Remember to add this promotion to the `Seasonal` group. Additionally, you can change the schedule for this second promotion, based on your business needs.
If you want to add the specific document to more than one group, duplicate it and then assign it to another group.
## Create a screen view
---
Create a screen view campaign for the group of documents created in the previous part of the process.
1. Go to **Experience Hub > Screen views > New Screen View**.
2. Enter the name of the screen view.
2. In the **Audience** section, choose to whom the message will be displayed. In this case, select **Everyone**.
5. Confirm your choice by clicking the **Apply** button.
6. To create the content of your screen view, in the **Content** section click the **Change** button.
1. In the **Screen views feed**, select the general feed to display.
2. Set up the **Priority**. If multiple screen views match the conditions, the one with the higher priority is displayed (1 is the highest, 100 is the lowest).
You can learn more about the order of displaying multiple screen views [here](/docs/campaign/screen-views/creating-screen-views#conflicts).
3. In the **Documents to display** section, click **Groups**.
4. Select the `Seasonal` group.
The configuration of the screen view
4. Confirm the choice by clicking **Add**.
4. To save your changes, click **Apply**.
6. Go to the **Schedule** section and click the **Change** button.
7. Set up when campaign will be active using the **Run immediately** option or schedule the display of the screen view using the **Scheduled** option.
8. To apply your changes, click **Save**.
5. To run your screen view campaign, click **Activate**.
The configuration of the screen view
## What's next
---
For a screen view to be visible in a mobile application, you must fetch it using the appropriate SDK method for:
- [iOS](/developers/mobile-sdk/method-reference/ios/content#generate-screen-view),
- [Android](/developers/mobile-sdk/method-reference/android/content#generate-screen-view),
- [React Native](/developers/mobile-sdk/method-reference/react-native/content#generate-screen-view)
- [Flutter](/developers/mobile-sdk/method-reference/flutter/content#generate-screen-view)
## Generated events
This use case does not generate any events.
## Read more
---
- [Documents](/docs/assets/documents)
- [Screen views](/docs/campaign/screen-views)
# Import Loyalty Program Customers from Amazon S3 to Synerise
Synerise allows you to collect data from any customer touchpoint. Using Synerise's seamless integration with Amazon S3, you can import any data stored in this storage and use it in the Synerise platform.
In this use case, we will perform a single import of customers from Loyalty Program from Amazon S3.
This file comprises users who are a part of loyalty program. By importing this file from the Amazon S3 Bucket to Synerise, you can create tailored marketing campaigns to retain these valuable customers, such as offering loyalty rewards, VIP promotions, or personalized product recommendations based on their previous purchases.
The file used in this use case is only an example. You can import any other files or different data types as needed.
## Prerequisites
---
You must have an account on AWS.
## Create a workflow
---
Create a workflow which downloads the customers' data from Amazon S3 to Synerise. The workflow will be triggered one time in order to import the loyal customer database to Synerise.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Scheduled Run trigger node
---
At this stage, we will configure conditions that launch the workflow. As a trigger, we will use the **Scheduled Run** node.
3. As the trigger node, add **Scheduled Run**.
4. In the configuration of the node:
1. Change the **Run trigger** option to **one time**.
2. Select **Immediately**.
4. Confirm by clicking **Apply**.
The configuration of the Scheduled Run node
### Configure the Get file node
---
In this step, to allow the data exchange, establish a connection between Synerise and Amazon S3 Bucket.
1. Click **Amazon S3 Bucket > Get File**.
2. Click **Select connection**.
3. From the dropdown list, select the connection.
- If no connections are available or you want to create a new one, see [Create a connection](/docs/automation/integration/amazon-s3-bucket/get-file-amazon-s3-bucket).
- If you selected an existing connection, proceed with the integration settings.
4. In the **Region** field, enter the region of your bucket.
5. In the **Bucket** field, enter the name of an existing container in your storage.
6. In the **Path to directory** field, enter the path to the existing bucket in which the file will be downloaded.
7. In the **File name** field, enter the name of the file you want to download from the storage.
8. From the **File format** dropdown list, select the format of the file which will be downloaded.
9. Confirm by clicking **Apply**.
The configuration of the Amazon S3 Get File node
### Add Import Profiles node
---
In this step, add Import Profiles node, to import the file with customers database directly to the **Behavioral Data Hub > Profiles** in Synerise.
1. On the **Get File** node, click **THEN**.
2. From the list that opens, select **Synerise > Import Profiles**.
### Add the finishing node
---
12. Add the **End** node.
13. In the upper right corner, click **Save & Run**.
The workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the [workflow](https://app.synerise.com/automations/automation-diagram/d5556b04-b373-489c-9eff-fda7dd1f9c88) created in this use case on our Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per workflow execution:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`client.add`](/docs/assets/events/event-reference/profiles#clientadd) (~1).
## Read more
---
- [Get File (Amazon S3 Bucket)](/docs/automation/integration/amazon-s3-bucket/get-file-amazon-s3-bucket)
- [Workflows](/docs/automation)
# Cleaning and Transforming Data for Optimal Business Performance
The better quality data you have at your disposal, the better the actions and analyses you perform on that data.
However, the data you have is not always in a state ready for analysis. The files may contain redundant or incorrect data. There may also be duplicate or missing values.
To make sure that the data you want to use in your activities and analyses is properly prepared, it is a good idea to clean data before using it. Automation Hub comes to your aid. It gives you the ability to perform a large number of operations on any data you need to modify.
This use case describes the process of transformation of a CSV file with electronic card transactions. The data transformations performed in this use case consist of:
- removing columns with missing data
- adding missing data
- removing structural errors by adding suffixes
- filtering rows
After transformation, the file will be transferred to an SFTP server.
## Prerequisites
---
- Save the file which you want to transform to your computer.
- You must have a target resource with which you transfer the data (in this use case, an SFTP server is used).
- Make a copy of the data file and remove rows from the copy until 10 are left. This copy will be used only as a sample for configuring the Data Transformation rules.
## Process
---
1. [Prepare data transformation](/use-cases/data-cleaning#create-data-transformation-rules) to modify the data to meet the requirements of the external resource data structure.
2. [Prepare a workflow](/use-cases/data-cleaning#prepare-a-workflow) that sends the data of customers from Synerise to the external resource.
## Create data transformation rules
---
In this part of the process, you define the rules of modifying data before sending it to the SFTP server, so the data is consistent. Each of the following sub-steps describes the individual changes performed on the file.
The data transformation diagram which is the output of this part of the process is used later to [automate sending the data](/use-cases/data-cleaning#prepare-a-workflow).
1. Go to **Automation Hub > Data Transformation > Create transformation**.
2. Enter the name of the transformation.
3. Click **Add input**.
### Add file with sample data
This node allows you to add a data sample. In further steps, you define how the data must be modified. Later, when this transformation is used in the workflow, the system uses the rules created with the sample data as a pattern for modifying actual data.
1. On the pop-up, click **Add example**.
2. Upload the file with the sample data.
3. Click **Generate**.
The configuration of the Data input node
### Remove irrelevant data
In this step, use the **Remove columns** node, to remove the columns that do not contain data, these are the columns named: **Series_title_3** and **Series_title_4**.
1. On the canvas, click the right mouse button.
2. From the dropdown list, select **Remove columns**.
3. Click the **Remove columns** node.
4. In the configuration of the node:
1. Leave the **Remove Columns** option selected in the dropdown menu.
2. Leave the default value in the dropdown as **Equal**.
3. In the text field, enter the name of the empty column you want to remove - `Series_title_3`.
4. Click **Add condition**.
5. Repeat steps **4.b-d** to define all the columns you want to delete.
The configuration of the Remove columns node
This resulted in the removal of columns **Series_title_3** and **Series_title_4**:
Output data after applying Remove columns node
6. Confirm by clicking **Apply**.
### Handle missing data
Use the **Edit values** node that allows you to perform basic actions on the dataset.
In this example, handle missing data in the **Suppressed** column by replacing its contents (in this example, the column is empty) with the value `false`.
1. On the canvas, click the right mouse button.
2. From the dropdown list, select **Edit values**.
3. Click the **Edit values** node.
4. In the configuration of the node:
1. Click **Add rule**.
2. Click **Add column**.
3. Select the **Suppressed** column.
4. Under **Edit values by**, from the dropdown list, select **Replacing**.
5. In the left dropdown, leave the **Value** option at default.
6. In the text field, enter `false`.
The configuration of the Edit values node
As a result, you will get an updated file:
The configuration of the Edit values node
7. Confirm by clicking **Apply**.
### Fix structural errors
Structural errors are when you notice strange naming conventions, typos, or incorrect capitalization when measuring or transmitting data.
Use **Edit values** node to make the format of the data in the column **Data_value** consistent. Currently, in the **Data_value** column, the data appears both as number `36422` and float `33317.4`. To make the data consistent, unify the data to float.
1. On the canvas, click the right mouse button.
2. From the dropdown list, select **Edit values**.
3. Click the **Edit values** node.
4. In the configuration of the node:
1. Click **Add rule**.
2. Click **Add column**.
3. Select the **Data_value** column.
4. Click on the three dots on the right side of the screen view; you'll see two options: Add value filter, Remove rule.
5. Click **Add value Filter**.
6. Under **If current value**, from the dropdown list, select **Not contain**.
7. In the text field, enter `.`.
8. Under **Edit values by**, from the dropdown list, select **Adding suffix**.
9. In the text field, enter `.0`.
The configuration of the Edit values node
As a result, you will get an updated file:
The configuration of the Edit values node
7. Confirm by clicking **Apply**.
### Filter records
To filter records from the data, use the **Filter Rows** node.
In this case, keep only records where the value of the **UNIT** column is equal to `Dollars`.
1. On the canvas, click the right mouse button.
2. From the dropdown list, select **Filter rows**.
3. Click the **Filter rows** node.
4. In the configuration of the node:
1. Click **Add rule**.
2. Click **Add column**.
3. Select the **UNITS** column.
4. Under **Matching condition**, from the dropdown list, select **Contain**.
5. In the text field, enter `Dollars`.
The configuration of the Filter rows node
As a result, you will get an updated file:
The configuration of the Filter rows node
6. Confirm by clicking **Apply**.
### Add the finishing node
This node lets you preview the output of the modifications to the sample data.
1. On the canvas, click the right mouse button.
2. From the dropdown list, select **Data output**.
3. To preview the results, click the **Data output** node.
The preview of modifications to the file
4. Close the preview
3. In the upper right corner, click **Save and publish**.
**Result**:
The diagram of data transformation
## Prepare a workflow
---
The scenario for this use case involves a one-time transformation of a file uploaded from the user's local storage. The transformed data will be exported to the external source using the SFTP protocol.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the launch date
3. As the trigger node, add **Scheduled Run**.
4. In the configuration of the node:
1. Change the **Run trigger** option to **one time**.
2. Select **Immediately**.
The configuration of the Scheduled Run node
3. Confirm by clicking **Apply**.
### Select file to export
1. Add a **Local File** node.
2. In the configuration of the node:
1. Upload the file in which you want to perform the transformation.
Local File transfer
2. Confirm by clicking **Apply**.
### Select the data transformation rules
1. Add a **Data Transformation** node.
2. In the configuration of the node, select the [data transformation you have created before](/use-cases/data-cleaning#create-data-transformation-rules).
The configuration of the Data Transformation node
3. Confirm by clicking **Apply**.
### Configure settings for SFTP protocol
1. Add the **Send File** node by clicking **THEN > SFTP**.
2. In the configuration of the node:
1. Enter the path to your server.
2. Select the port.
3. Enter the path to the directory.
4. Enter the name of the file that will be created.
5. If needed, in the **File name suffix**, select the suffix of the file name.
6. From the **File format** dropdown list, select the **CSV** format.
7. Verify and modify the delimiters if needed.
8. In the **Authentication** section, select the method of authentication.
The configuration of the SFTP node
9. Confirm by clicking **Apply**.
### Add the finishing node
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
The workflow configuration
You can monitor the flow of the workflow in the **Transformation logs** tab. It contains information about each execution of the workflow.
The logs for the workflow
## Check the use case set up on the Synerise Demo workspace
---
You can check the [data transformation rules](https://app.synerise.com/automations/data-transformation/bdf77aad-e443-4630-931d-af944f814db3) and [workflow](https://app.synerise.com/automations/automation-diagram/811d3a5b-64c4-4cba-9d93-64add71a7f23) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per workflow execution:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1).
## Read more
---
- [Data Transformation](/docs/automation/data-transformation-and-imports/introduction)
- [Workflow](/docs/automation)
# Dynamic content survey
Understanding customer satisfaction is key to business success. A well-structured survey can provide valuable insights into how customers perceive products and services, their overall experience, and their likelihood of recommending them to others. By gathering this data, businesses can identify strengths, address pain points, and refine their offerings to enhance customer loyalty. Whether measuring satisfaction, improving service quality, or benchmarking against competitors, customer feedback serves as a strategic tool for continuous improvement and long-term growth.
In this specific use case, we intend to introduce a dynamic content survey for customers who made a transaction in the last 30 days.
This use case provides you with an instruction how to use a ready-made dynamic content template that can be used 1:1 in a business scenario
## Prerequisites
---
- [Configure web push notifications](/docs/campaign/Webpush/configuring-web-push)
- [Implement SDK to a website](/developers/web/installation-and-configuration)
## Create a dynamic content
---
Create a dynamic content campaign targeted at customers who made a transaction in the last 30 days. We will use a predefined template for this message, so there is no need to create a template from scratch.
1. Go to **Experience Hub > Dynamic Content > Create new**.
2. Enter the name of the content.
3. Choose the **Web layer** type.
### Define audience
---
1. To select the recipients of the dynamic content, on the **Audience** tab, click **Define**.
3. Select **New Audience** and click **Define conditions**.
1. Choose **Add condition** and select the `transaction.charge` event.
5. In the calendar in the bottom right corner, leave **Last 30 days**.
7. Click **Apply**.
### Define content
---
In the next step, you will create the content of the dynamic content campaign with the help of a ready-made template.
1. In the **Content** section, click **Define**.
2. Click **Create message** and from the list of template folders, select **Predefined templates**.
3. Select the **Survey form** template.
**Result:** You are redirected to the code editor.
4. Edit the template according to your needs. In the Config tab, you'll find a comprehensive list with descriptions of the core components that make up your survey.
Config panel
The configuration of the questions and answers is in the JavaScript tab.
There is an object that you have to fill, according to the example given. The object is an array of questions, where each question has its answers and settings depending on the type.
Javascript object with questions and answers
**Example:** You want to add/edit question
To add a question to the **QUESTIONS** array, you'll want to follow the pattern established by the existing questions. Each question is an object that may contain different properties depending on its type (single, multi, scale, text). Here's a step-by-step guide on how to do it:
Decide on the question you want to add and the type of question it will be. The type determines the properties the question object will have. For instance:
- `single` and `multi` types need question, `answers`, and `type`.
- `scale` needs `question`, `type`, and `length`.
- `text` needs `question`, `type`, and optionally `limit` for the character limit.
Construct the question object according to the type you've chosen.
Add the new question object to the `QUESTIONS` array.
Here's an example of how you can add a new question about a favorite color (a single type question with predefined answers):
const QUESTIONS = [
{
"type": "single",
"question": "What motivated you to download our app?",
"answers": [
"To browse products",
"To make a purchase",
"To explore exclusive offers",
"To compare prices",
{ "answer": "Other (please specify):", "options": { "isOpen": true, "limit": 20 } },
],
"shuffleAnswers": false,
"required": true
},
{
"type": "multi",
"question": "What types of products or services are you most interested in?",
"answers": [
"Fashion",
"Electronics",
"Home and Kitchen",
"Health and Beauty",
"Sports and Outdoors",
{ "answer": "Other (please specify):", "options": { "isOpen": true, "limit": 20 } }
],
"shuffleAnswers": false,
"required": true
},
{
"type": "single",
"question": "How do you prefer to shop?",
"answers": [
"I like to browse and explore new products",
"I prefer targeted recommendations based on my preferences",
"I usually know what I want and search directly",
"I’m mainly looking for deals and offers",
],
"shuffleAnswers": false,
"required": true
},
{
"type": "multi",
"question": "Which factors influence your purchasing decisions the most?",
"answers": [
"Product quality",
"Price",
"Brand reputation",
"Customer reviews",
"Sustainability",
{ "answer": "Other (please specify):", "options": { "isOpen": true, "limit": 20 } }
],
"shuffleAnswers": false,
"required": true
},
{
"type": "scale",
"question": "How likely are you to recommend our company to your friends and acquaintances?",
"length": 10,
"required": true,
},
];
5. After customising your survey, save the template.
### Define schedule and display settings
---
As the final part of the process, you will define the display settings of the dynamic content such as schedule, triggers and delay.
1. In the **Schedule** section, click **Define** and set the time when the message will be active.
2. In the **Display Settings** section, click **Define**.
1. In the **Triggers** section, choose **On exit**.
2. Click **Advanced options**. In our case, we want to display the survey once per user. To do this, set the **Frequency** to **Once**, and in the **Stop ddisplay** section choose option **Dynamic content was shown to a viewer x times** and type `1`.
4. Click **Apply**.
5. Optionally, you can define the UTM parameters and additional parameters for your dynamic content campaign.
6. Click **Activate**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [dynamic content campaign](https://app.synerise.com/campaigns/dynamic-content/create/1aa85a47-18dd-49e8-8179-bb6be80be4e2) configuration directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`form.submit`](/docs/assets/events/event-reference/web-and-app#formsubmit) (~1).
## Read more
---
- [Dynamic content](/docs/campaign/dynamiccontent)
# Find best matching customers for an annual campaign
While selecting the right audience for an annual campaign, you can use the Predictions feature to find customers in your database who are similar to those customers who converted in the same campaign a year before.
The main action in this use case is comparison of a group of customers who visited the website in the last 90 days (target group) to the group of customers who made a purchase during the Christmas season 2020 (source group). The customers from the target group are featured by the `snr.lookalike.score` event on their profiles and the `score_label` parameter contains the value of similarity scale.
Based on this event, you can create a group of customers who received the highest score and will be the recipients of the campaign during Christmas season 2021. This way, you increase the chances of reaching those who are most likely to buy and only need a small incentive to make a purchase.
## Prerequisites
---
- [Enable the Lookalike prediction type](/docs/ai-hub/predictions/enabling-predictions#enabling-lookalikes).
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
## Create a lookalike prediction
---
1. Go to **AI Hub > (AI Predictions) Models > New prediction**.
2. In the **Select prediction type** window that appears, click **Lookalikes**.
3. Click **Apply**.
### Create a source segmentation
A source segmentation is a group of model customers to whom you compare the target group of customers in order to find similar customers in the target group.
1. In the **Audience** section, click **Define**.
2. In the **Source segmentation** subsection, click **Choose segmentation**.
3. On the dropdown list, click **Create new**.
4. In the **Segmentation name** field, enter a meaningful name of the segmentation.
5. Click **Choose filter**.
6. From the dropdown list, select the transaction event.
Events may have different labels between workspaces, but you can always find them by their action name (in this step, it’s transaction.charge).
7. Using the date picker in the lower-right corner, select the date ranges for Christmas season 2020.
Configuration of the source segmentation
9. Save the segmentation by clicking **Create segmentation**.
### Create a target segmentation
A target segmentation is a group of customers among which you want to find customers who are similar to those included in the source group.
1. In the **Audience** section, click **Define**.
2. In the **Target segmentation** subsection, click **Choose segmentation**.
3. On the dropdown list, click **Create new**.
4. In the **Segmentation name** field, enter a meaningful name of the segmentation.
5. Click **Choose filter**.
6. From the dropdown list, select the page visit event.
Events may have different labels between workspaces, but you can always find them by their action name (in this step, it’s page.visit).
7. Using the date picker in the lower-right corner, set the time range to **Relative time range > Custom > last 90 days**.
Configuration of the target segmentation
9. Save the segmentation by clicking **Create segmentation**.
10. Confirm the settings in the **Audience** section by clicking **Apply**.
### Configure further settings
1. In the **Settings** section, click **Change**.
2. Leave the calculation of the model at default (the prediction will be calculated only once).
3. Optionally, you can change the scale from 5 point scale to 2. The scale a customer reached will be available in the `snr.lookalike.score` event, as the `score_label` parameter.
snr.lookalike.score event
4. Confirm the changes in the **Settings** section by clicking **Apply**.
Final configuration of prediction to find matching customers for an annual campaign audience
5. Click **Save & Calculate**.
## What's next
---
Based on the `snr.lookalike.score event`, you can create a segmentation for the Christmas season 2021 campaign. To define the size of the recipient group, you can use the `score_label` parameter of the `snr.lookalike.score` with the `score` value set to high or use `percentiles` in order to address your communication to a specific percentage of target segment with the highest prediction score. Later you can use this segment in the following campaigns:
- [email](/docs/campaign/e-mail)
- [SMS](/docs/campaign/SMS)
- [web push](/docs/campaign/Webpush)
- [mobile push](/docs/campaign/Mobile)
- [dynamic content](/docs/campaign/dynamiccontent)
- [screen views](/docs/campaign/screen-views)
Email, SMS, web push and mobile push can be sent manually or you can launch them by means of [Automation Hub](/docs/automation).
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the [Propensity prediction](https://app.synerise.com/ai-v2/predictions/lookalike/iljrvaozvnir) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates 1 event per profile that completes the flow:
[`snr.lookalike.score`](/docs/assets/events/event-reference/predictions#snrlookalikescore) (~1).
## Read more
---
- [Lookalike predictions](/docs/ai-hub/predictions/lookalikes)
- [Predictions](/docs/ai-hub/predictions/predictions-introduction)
# Promote customer's favorite products in recommendations
Customers are looking for the most convenient solutions to make their experience smooth and intuitive, allowing them to find what they are looking for quickly.
Adding products to the favorites is an excellent enhancement that helps customers collect products they like while browsing the site and return to them later to make a purchase. It's also a perfect opportunity for marketers to use knowledge of customer preferences to promote products they've expressed interest in, encouraging visitors to return and increasing sales.
This use case describes creating personalized recommendations with filters that will boost products customers have added to their favorites.
## Prerequisites
---
- [Configure an item catalog for recommendations](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations). Enable personalized recommendations.
- Implement a custom event for adding a product to favorites, which will be available in the customer profile.
In this example, the event is called `product.addToFavorite`.
Implement custom events in your [mobile application](/developers/mobile-sdk/event-tracking#product-added-to-favorites) or [website](/developers/web/event-tracking#declarative-tracking-custom-events).
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate](/use-cases/boost-favorite-products#create-an-aggregate).
2. [Create a recommendation](/use-cases/boost-favorite-products#create-a-recommendation).
## Create an aggregate
---
In this part of the process, create an aggregate that will return the products the user added to favorites.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last Multi**.
4. Select **Consider only unique occurence of the event parameter**.
5. In the **Size** field, enter the number of returned SKUs.
6. Select the **product.addToFavorite** event.
7. Select the **sku** parameter.
8. Define the period from which the aggregate will return products from the event.
9. Save the aggregate.
Configuration of the aggregate
## Create a recommendation
---
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. In the top left corner, enter the name of your recommendation.
3. In the **Type & Items feed** section, click Define.
4. From the **Items feed** dropdown menu, choose the provided feed.
5. Choose the **Personalized** recommendation type.
Configuraion of the catalog and recommendation type section
6. Click **Apply**.
7. In the **Items** section, click **Define**.
1. Click **Add slot**.
2. Define the minimum and maximum number of items that will be recommended to the user in each slot.
In our example, one slot returns from 5 (minimum) to 10 (maximum) products.
3. Confirm by clicking **Apply**.
8. In the **Boosting** section:
1. Click **Define**.
2. Click **Add rule**.
3. Click **Define rule** and select **Visual Builder**.
**Result** The Visual Builder window opens.
4. From the **Select attribute** dropdown list, select the **itemId** attribute.
You can use the search field.
5. From the **Operator** dropdown list, select **Equals**.
6. Click the value type icon () a few times until it changes to the aggregate icon.
7. From the **Choose aggregate** drop-down list, select an aggregate created in [the previous step](/use-cases/boost-favorite-products#create-an-aggregate).
8. Click **Apply**.
Boosting items added to favorites
9. In the **Promote/Demote** selector, select **Promote** (default value).
10. Use the slider to adjust how much you want the rule to affect the results.
11. Save the **Boosting** section settings by clicking **Apply**.
The boosting strength slider
9. Optionally, you can define the settings in the **Additional settings** section.
10. Save the recommendation.
## What's next
---
You can display the recommendation to customers in several ways, for example by using the [recommendation insert](/developers/inserts/recommendations-v2) in [dynamic content](/docs/campaign/dynamiccontent/creating-dynamic-content) or in a mobile app using documents - [iOS SDK](/developers/mobile-sdk/displaying-recommendations/content-widget/ios), [Android SDK](/developers/mobile-sdk/displaying-recommendations/content-widget/android).
## Check the use case set up on the Synerise Demo workspace
---
You can also check the [AI recommendation configuration](https://app.synerise.com/ai-v2/recommendations/dqc05RBMvEwO) and [aggregate](https://app.synerise.com/analytics/aggregates/8b2c2e9e-24e0-30ff-aca6-a9f024a99306) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Creating aggregates](/docs/crm/aggregates/creating-profile-aggregates)
- [Creating recommendations](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign)
- [Filters in recommendations](/docs/ai-hub/recommendations-v2/recommendation-filters)
- [Requirements for item feed](/docs/ai-hub/recommendations-v2/item-feed-requirements)
# Customers who have their birthday in the current month
Synerise allows you to organize your customers into groups in terms of similarity. One of them may be the month of their birthday. Such segmentation can later be used for sending out birthday coupons to those customers who celebrate birthday in the current month to engage customers and strengthen your relationship with them.
## Prerequisites
---
- Implement [tracking code](/developers/web/installation-and-configuration#creating-a-tracking-code) on your website.
## Process
---
In this use case, you will go through the following steps:
1. [Create an expression](/use-cases/month-of-birth-expression#create-an-expression) which will function as the attribute of customers who have birthday in the current month.
2. [Create a segmentation](/use-cases/month-of-birth-expression#create-a-segmentation).
## Create an expression
---
In this part of the process, you create an expression which will function as the attribute of customers who have birthday in the current month.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression.
2. Leave the selection of the **Expression for** option at default (**Attribute**).
3. Create the following formula:
The formula of the expression
4. To complete the expression, click **Publish**.
5. To check the result of the expression for individual customers, click the **Preview tab**. In the search box, enter the email of a customer.
Preview of the expression: a customer has birthday in the current month
## Create a segmentation
---
In this part of the process, you create a segment of customers for whom the value of the expression you created in the previous part of the process is `true`.
1. Go to **Decision Hub > Segmentation > New segmentation**.
2. Enter the name of the segmentation.
3. Click **Choose filter**.
4. Select the **Clients** tab.
6. Select the **Expressions** tab.
7. Search for the expression you created.
8. From the logical operators dropdown list, click the icon.
7. Select **is true**.
8. Click **Save**.
Final configuration of the segmentation
## What's next
---
You can use this segmentation as the audience of a message in the following channels:
- email
- SMS
- mobile push
- web push
- dynamic content
The segmentation selected as the recipient group of a message with a coupon
## Check the use case set up on the Synerise Demo workspace
---
Check the [expression](https://app.synerise.com/analytics/expressions/c85239da-6546-40b7-81db-e78ad768f795) and [segmentation](https://app.synerise.com/analytics/segmentations/8ffae6c2-96bd-42aa-86c2-abd2c57612f9) settings in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case does not generate any events.
## Read more
---
- [Creating campaigns](/docs/campaign)
- [Expressions](/docs/crm/expressions)
- [Segmentation](/docs/analytics/segmentations)
# Visualizing Value Distribution with Quantiles in Dashboards
You can create a dashboard with quantile-type metrics to see how values is distributed and compare results between different cohorts and time periods.
In this example, you will create a dashboard that displays quantile values (0.25; 0.50; 0.75) and average values of transaction amounts made by male and female customers.
The use case can be modified easily by adding more metrics with other quantile values, or other conditions, such as using age groups or geographical location instead of sex, or using different events and attributes for the analysis.
The process consists of two stages:
- Creating eight metrics to include in the dashboard
- Creating the dashboard
## Prerequisites
---
- In this example, the customers' profiles must include information about their sex.
## Process
---
In this use case, you will go through the following steps:
1. [Create eight metrics](/use-cases/understand-distribution#create-metrics) for `transaction.charge` event.
2. [Create dashboards](/use-cases/understand-distribution#create-dashboard) presented all metrics.
## Create metrics
---
In this stage, you will create eight metrics for `transaction.charge` events. The procedure describes creating a single metric, you will need to repeat the steps for each metric separately, changing the conditions each time.
1. Go to **Decision Hub > Metrics > New metric**.
2. Give the metric a meaningful name.
For the purpose of this example, the first metric is for quantile 0,25 of transactions made by females.
3. Leave **Type** at **Event**.
4. Change the **Aggregator** to **Quantile**.
5. In the input field which appears next to the aggregator, type `0,25`
5. Leave **Occurrence type** at **All**.
6. Click **Choose event** and select **transaction.charge**.
Events may have different labels between workspaces, but you can always find them by their action name (in this step, it's **transaction.charge**).
6. Next to the event selector, click **Choose param** and select **$totalAmount**.
7. Click **Enable filter**.
8. Click **Choose filter** and use the **Search** field to find and select the **Sex** attribute.
9. In the text field, type `1`.
Contact filter to include only female customers
The values for this parameter mean:
- `0`: not specified
- `1`: female
- `2`: male
- `3`: other
1. Click **Apply**.
2. Save the metric.
A completed quantile metric
3. Create the remaining metrics:
- For females: quantiles 0.5 and 0.75, and average value (**Average** is one of the aggregators)
- For males: quantiles 0.25, 0.5, 0.75, and average value
- Optionally, add metrics for the `undefined` and `other` values of the `sex` attribute.
You can do this faster by clicking ** > Duplicate** next to a metric in the list of metrics and then modifying the conditions in the created duplicate.
## Create dashboard
---
In this stage, you create a dashboard to display the results of all metrics in one place for easier analysis.
1. Go to **Decision Hub > Dashboards > Add dashboard**.
1. Add the metrics to the dashboard:
1. Click .
2. Click the widget that appears.
3. From the **Metric** drop-down list, select one of the [metrics that you created previously](#create-metrics).
4. On the **Tab**, add two more decimal places to display (by default, none are displayed).
5. Repeat steps **2a-2d** until all the metrics are added.
2. Click **Save dashboard**.
**Result:**
You can now open the dashboard and use the **Date range** picker to check data for different periods.
A dashboard with eight metrics and an enabled date picker
To learn more about viewing, sharing, and formatting dashboards, see [this section of the User Guide](/docs/analytics/analytics-dashboard).
## Check the use case set up on the Synerise Demo workspace
---
You can all items created in this use case in our Synerise Demo workspace:
- [0,25 quantile of transactions made by females](https://app.synerise.com/analytics/metrics/75713c7f-1480-4377-b11a-0ab656660e08)
- [0,5 quantile of transactions made by females](https://app.synerise.com/analytics/metrics/22423a36-6c96-49d0-b3c3-e19cd9ecf6c0)
- [0,75 quantile of transactions made by females](https://app.synerise.com/analytics/metrics/7f0815d2-b6b4-445b-ad7d-386625a48ddd)
- [Average of transactions made by females](https://app.synerise.com/analytics/metrics/3f334b83-bffe-4d67-a053-83c607afdc1d)
- [0,25 quantile of transactions made by males](https://app.synerise.com/analytics/metrics/3192ab2d-35c4-4ad1-9de4-cdf9b75d9e02)
- [0,5 quantile of transactions made by males](https://app.synerise.com/analytics/metrics/257c9129-9849-45b0-b7dc-f8ebaa28f788)
- [0,75 quantile of transactions made by males](https://app.synerise.com/analytics/metrics/adc59fd7-c9c8-4b19-9921-97ec67e417c9)
- [Average of transactions made by males](https://app.synerise.com/analytics/metrics/465fda5a-61c5-430a-b82c-d0993e774fa8)
- [Dashboard with presented metrics](https://app.synerise.com/analytics/dashboards/836813e4-d660-49fa-969d-d7d866d8d90b)
- [Dynamic content campaign](https://app.synerise.com/campaigns/create/37c5fadb-8628-47a4-ad8c-61a5e2b4a46b)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case does not generate any events.
## Read more
---
- [Dashboards](/docs/analytics/analytics-dashboard)
- [Metrics](/docs/analytics/metrics)
# Report with top purchased products per store
Tracking top purchased products for each store offers a valuable way to understand customer behavior and optimize product exposure. This use case shows how to generate daily reports that calculate and display the 10 best-selling products for every individual store (represented as profiles in the CRM), based on transaction data.
The report is created dynamically and filtered with flexible business rules. Once generated, these results can be used for many purposes, for example:
– you might send the top products to an external tool and display them as personalized banners in a given store or use them in targeted campaigns.
- top-product reports can be used to adjust local inventory planning.
- items that perform well in a particular store can be positioned more prominently.
- you can create discounts offers based on each store's top performers.
Knowing what sells best in each store gives you an edge – not just for backend analytics, but for improving the customer journey. You can **highlight bestsellers on local pages, power in-store digital signage, or inform stock planning**. It enables better personalization and relevance across channels and improves business responsiveness to customer demand in specific locations.
This specific use case was used by our customer to present top 10 products per store in digital signage in offline stores. Displaying top-performing products on screens inside the store draws customer attention to popular items, reinforces social proof, and can drive impulse purchases.
## Prerequisites
---
- [Implement a tracking code](/docs/settings/tool/tracking_codes).
- Implement the [transaction events](/developers/web/transactions-sdk). Your transactions must be properly tracked and include identifiers of the shop (`StoreId`) to enable product-level reporting.
- Stores must be created as individual profiles in the CRM. Every store profile must include a `StoreId` parameter – this should be a unique identifier for each store. It is required to group transaction data and generate reports per store. Additionally we assign [profile tags](/docs/crm/customer-tag) to all stores (in our case, `store-top-products`) to make it easier to find and extract them.
To correctly identify the store in the system:
- Add a `custom_identify` field to the store’s profile with the same value as `StoreId`. In the Synerise platform, this will appear as Custom identifier.
- You can use Jinjava that references a store through the `custom_identify` parameter (for example, when sending events through an outgoing integration).
This setup ensures consistent and reliable store identification across processes.
- Create a workspace [API Key](/docs/settings/tool/api) and assign the following permissions:
- `ANALYTICS_BACKEND_REPORT_READ` - it lets you [retrieve a summary of all reports in the workspace](https://hub.synerise.com/api-reference/analytics-suite#operation/previewAllGroupingsCSVPOST_v4). Make sure the API Key used for sending events has the necessary event send permissions enabled.
- `API_BATCH_EVENTS_CREATE`
## Process
---
In this use case, you will go through the following steps:
1. [Create a metric](/use-cases/report-with-top-products#create-a-metric) which counts the number of transactions for each store. Thanks to setting a dynamic key, in the following steps we will be able to properly filter events within a given store.
2. [Create a report](/use-cases/report-with-top-products#create-a-report) based on the metric created earlier, which lists the top 10 purchased products per store.
3. [Create a workflow](/use-cases/report-with-top-products#create-a-workflow) that dynamically refers to the report, retrieves the top 10 products for each store based on defined business conditions (e.g., availability), and generates an event for each top product on the profile card of each store.
4. [Create a final metric](/use-cases/report-with-top-products#create-final-metric) based on events generated in the workflow.
4. [Create final report](/use-cases/report-with-top-products#create-final-report) based on the metric whose conditions are built on the events generated in the workflow.
## Create a metric
---
In this part of the process, create a metric which counts the number of transactions for each individual store.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As a metric kind, select **Simple metric**.
4. As the metric type, select **Event**.
3. As the aggregator, set **Count**.
4. As the occurrence type, set **All**.
5. From the **Choose event** dropdown list, select `product.buy`.
6. Click **+ where** button and from the dropdown list, choose `StoreId` parameter.
7. From the **Choose operator** dropdown, select **Contain (String)**.
8. Click the icon next to the **Equal** operator two times to find dynamic key icon
9. In the first box add `StoreId` and in the second add any value (in our case it might be `0`).
10. Define the period from which the metric will return products from the event as **7 days**.
11. Click **Save**.
Metric settings
## Create a report
---
In this part of the process, create a report to clearly show the list of top products purchased in the shops.
1. Go to **Decision Hub > Report > New report**.
2. Enter the name of the report.
3. Select the metric you created in [the previous part of the process](/use-cases/report-with-top-products#create-a-metric).
4. From the **Range** dropdown list, select the number of top (the most frequently added to favorites) products to be shown in the preview of the report. In this case it will be **TOP 100** products.
When creating a consolidated report of top-selling products across multiple stores, it is recommended to retrieve more than just the top 10 products (e.g., top 100 or more). This is because the combined list of bestsellers does not always reflect the top 10 products in each individual store. Some products that rank in the top 10 in specific stores might not appear in the overall top 10 list. By increasing the number of products included in the report, you ensure that local top-performing items are not missed and that it's possible to accurately identify the top 10 for each store.
5. In the **Dimension** section, from the dropdown list select **Events > Parameters**. To be able to show products name in the report, choose `$name`.
6. Click **Add dimension**.
7. From the list, choose `$sku`.
8. Below, add additional dimension - `StoreId`.
In this particular use case, we use three dimensions: name, storeID and SKU. This way, we will receive the SKU and name of the products in the report and information in which shop it was bought. You can use any number of dimensions based on your business needs.
6. In the date range, select the time that will be analyzed. In this case it will be **7 days**.
Select the same date range as you selected for the metric.
7. Save the report.
Report settings
## Create a workflow
---
In this part of the process, you will create the workflow which sends an event with the current top 10 products from each store.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Add the Audience node
In this step you will create the audience who will get the report you have created.
2. From the list of available triggers, select **Audience**.
3. Click the node.
4. Set the **Run trigger** to repeatable.
5. Define the frequency of launching the workflow (the **Interval** field) and when your workflow will be launched for the first time (the **Begin at** field).
4. In the **Define audience**, select the **New audience**. Choose the tag used to extract the group of stores - `store-top-products` created as a part of [prerequisites](#prerequisites).
5. As the parameter choose **Is true**.
5. Click **Apply**.
The Audience node settings
### Add the Outgoing Integration node
This webhook will be used to get the storeID from the report created in the [previous step](#create-a-report). We send here all top products, ID of the store and products.
We will make a request to [this endpoint](https://hub.synerise.com/api-reference/analytics-suite#tag/Reports/operation/analytics2-recalculate-report-override).
This step uses a webhook to automatically retrieve the contents of the report via API, based on the store’s ID. This is necessary because:
- reports in Synerise are calculated dynamically,
- store-specific filtering must happen at runtime, per each store profile in the audience,
- the API enables automation – instead of downloading and filtering data manually, each store profile receives its own filtered results based on the same report definition.
This makes the workflow scalable across hundreds of stores, ensures daily updates, and avoids manual effort.
1. Select the **Custom webhook** tab.
7. Select the method of authorization as **Synerise API key**.
2. Click **Select connection**.
3. From the dropdown list, select the connection.
- If no connections are available or you want to create a new one, see [Create a connection](/docs/automation/integration/azure-blob-storage/get-file-azure-blob-storage).
- If you selected an existing connection, proceed with the integration settings.
2. In the **Webhook name** field, enter `ReportTopProducts`.
4. Click on the **Event name** and choose **Create event**
5. In **Name**, enter `topProducts.webhook`.
6. In **Display name**, enter the label for the event.
3. Select the **POST** method.
4. Enter the endpoint: `https://hub.synerise.com/api-reference/analytics-suite#tag/Reports/operation/analytics2-recalculate-report-override` - Replace with the unique ID of your own report. You can find the report ID in the URL when you open the report in Synerise (e.g., https://app.synerise.com/analytics/reports/32bf9328fb8).
4. Leave the **content-type** at default (`application / json`).
5. In the request body, paste the code presented below.
Check the examplary JSON body of the report
If you want to send more information about the products and transactions, just add them to the code on your own, based on your business needs.
8. From the dropdown list, select the API key you created as a [part of prerequisites](#prerequisites).
7. Click **Apply**.
Webhook settings
### Define the Event Filter node
---
This node will wait for the webhook response.
1. As the next node, add **Event Filter**. In the configuration of the node:
1. Add the name of the node.
2. Set the **Check** option to **for period of time**.
2. Set the time range. In our case, it is **10 minutes**.
3. In the **Define conditions** section, from the **Choose event** dropdown menu, choose `topProducts.webhook` event.
4. Confirm by clicking **Apply**.
Event Filter node settings
### Add the Outgoing Integration node
To the **matched path** add the Outgoing Integration. In this node, we retrieve the results from reports generated by previous nodes in the workflow. The goal is to extract relevant product data (like SKU, name, URL, price, and brand) and construct a structured event that can be used downstream — for example, in product recommendations or messaging flows.
1. Select the **Custom webhook** tab.
7. Select the method of authorization as **Synerise API key**.
2. Click **Select connection**.
3. From the dropdown list, select the connection.
- If no connections are available or you want to create a new one, see [Create a connection](/docs/automation/integration/azure-blob-storage/get-file-azure-blob-storage).
- If you selected an existing connection, proceed with the integration settings.
2. In the **Webhook name** field, enter `Top products per store`.
4. Click on the Event name and choose **Create event**
5. Add the new event.
4. As the event name add `topBoughtProducts.perStore`.
6. In **Display name**, enter the label for the event.
3. Select the **POST** method.
4. Enter the endpoint: `https://hub.synerise.com/api-reference/data-management#tag/Events/operation/BatchSendEvents`
4. Leave the **content-type** at default (`application / json`).
5. In the request body, paste the code presented below.
Check the examplary JSON body of the report
{# Here we retrieve the results of reports from previous nodes #} {% set raport1 = automationPathSteps['data1'].event.params['body.data[0].values[0]'] %} {% set allRaports = [raport1] %} {# We iterate over retrieved reports and add arrays of skus of products from them to the skusArrays #} {% set skusArrays = [] %} {%- for raport in allRaports -%} {% set arr = [] %} {%- for entry in raport -%} {% do arr.append(entry.name[0]) %} {%- endfor -%} {% do skusArrays.append(arr) %} {%- endfor -%} {% set finalArr = [] %} {%- for skuArr in skusArrays -%} {%- for sku in skuArr -%} {%- if finalArr|length < 10 -%} {% catalogitemv2.store-1(sku) allowEmpty=True %} {% set prod = catalog_result %} {%- if prod.name and prod.brand -%} {#Here we can add conditions to check#} {%- do finalArr.append({ 'sku': sku, 'name': prod.name, 'productUrl': prod.productUrl, 'price': prod.price, 'brand': prod.brand.label }) -%} {%- endif -%} {% endcatalogitemv2 %} {%- endif -%} {%- endfor -%} {%- endfor -%} {% set data = [] %} {# Here we set the final object to send #} {%- for promotion in finalArr -%} {% do data.append({ "client": { "customId": "{% customer StoreId %}" }, "label": "Magic products", "action": "magic.products", "type": "custom", "params": promotion, }) %} {%- endfor -%} {# We convert the object to JSON and this is the body of our request #} {% if data|length > 0 %} {{ data|tojson }} {% else %} {{ [{ "client": { "customId": "{% customer StoreId %}" }, "label": "Magic products", "action": "magic.products", "type": "custom", "params": { "alert": "No products matched the conditions" } }] | tojson }} {% endif %}
This part of the workflow processes the top products per store:
- It retrieves the list of SKUs from the report results (fetched via the webhook from the previous step).
- For each SKU, it queries the catalog feed to enrich the product data with: additional parameters like e.g. name, price, brand, etc.
- It builds an array of up to 10 enriched product items, skipping those that are incomplete (e.g., missing name or brand).
- This webhook generates a custom event with action top.products, containing enriched product data (sku, name, price, etc.). This event becomes the source for the final metric and report that summarize the top products per store. It is also ready to be used in other systems (e.g., digital signage, product recommendations, banners, etc.).
Once the product data is collected, it’s structured into a standardized event format, with fields like label, action, type, and params, making it suitable for downstream use—such as powering features like **top.boughtproducts.perStore**.
As a safeguard, if no valid product data is found (for example, due to empty results or filtering logic), the system includes a clear message in the output indicating that no products were available, allowing for graceful fallback handling in the display or integration logic.
7. Click **Apply**.
Webhook settings
### Prepare the final settings
---
1. Add the **End** nodes.
2. Optionally, define capping.
3. Optionally, add titles to each node so the workflow will be more understandable to your colleagues.
4. Activate the workflow by clicking **Save & Run**.
Workflow settings
## Create final metric
---
In this part of the process, create the metric based on the events generated in the workflow.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As a metric kind, select **Simple metric**.
4. As the metric type, select **Event**.
3. As the aggregator, set **Count**.
4. As the occurrence type, set **All**.
5. From the **Choose event** dropdown list, select `top.products`.
6. Click **+ where** button and from the dropdown list, choose `sku` parameter.
7. From the **Choose operator** dropdown, select **Is not empty**.
6. In the date range, select the time that will be analyzed. In this case it will be **7 days**.
11. Click **Save**.
Metric settings
## Create final report
---
As the last step, create the final report, presenting the results of the report, created based on the events generated in workflow.
1. Go to **Decision Hub > Report > New report**.
2. Enter the name of the report.
3. Select the metric with top products you created in [the previous part of the process](#create-final-metric).
4. From the **Range** dropdown list, select the number of top (the most frequently added to favorites) products to be shown in the preview of the report. In this case it will be **TOP 100** products.
5. In the **Dimension** section, from the dropdown list select **Events > Parameters**. To be able to show products name in the report, choose `sku`.
6. Click **Add dimension**.
7. From the list, you can choose more dimensions - in our case it will be `brand` and `customIdentify`
6. In the date range, select the time that will be analyzed. In this case it will be **7 days**.
Select the same date range as you selected for the metric.
7. Save the report.
8. Click preview to see the results.
Report settings
## What's next
---
Information from this report might be used in the following campaigns:
1. **Integrate with in-store digital signage systems**
Once the daily top 10 product reports per store are generated, the data can be automatically pushed to digital signage platforms. This enables real-time, localized content that reflects actual customer behavior in each specific store.
Set up automated workflows to refresh signage content daily or as frequently as needed, ensuring that each store highlights its current bestsellers without manual intervention.
2. **Support merchandising decisions**
Use these insights to test different product placements and monitor their performance visually and analytically, linking digital presentation with physical outcomes.
3. **Extend to omnichannel experiences**
Consistent messaging across in-store signage, local landing pages, and mobile apps builds a seamless customer journey, with top products tailored to the customer's location.
You’re free to use it however you like—whether that means simply downloading it or sending it to other tools for external analysis.
There are a few ways to handle this:
- You can also export it as a file.
- You can send the data to an API.
- You can use our existing nodes and integrations to forward it to other tools—depending on the number of products, certain requirements may apply. In such cases, we recommend getting in touch with our CSI team if you plan to process the data externally.
Each method has its own limitations and constraints, so please remember to contact our CSI team beforehand to avoid issues.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [metric](https://app.synerise.com/analytics/metrics/e45130c3-8015-4e18-acb7-6d93e09182d4), [report](https://app.synerise.com/analytics/reports/71161920-de46-4d23-a0c6-4d3073f44cca) and [workflow configuration](https://app.synerise.com/automations/workflows/automation-diagram/552bdef6-6980-48f6-8398-eea112320e9f), [final metric](https://app.synerise.com/analytics/metrics/4d04834f-fda1-4dce-af5f-3160d5071d8d) and [final report](https://app.synerise.com/analytics/reports/63d98cfc-cacf-4f6c-a656-1134a5d9d076) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 17 events per profile that completes the flow:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), `topProducts.webhook` (~1), `topBoughtProducts.perStore` (~1), `magic.products` (~10).
## Read more
---
- [Automation Hub](/docs/automation)
- [Metrics](/docs/analytics/metrics)
- [Reports](/docs/analytics/reports)
# Present top suggestions to your customer tailored to last visited main category
Category recommendations allow you to shorten the conversion path, so customers reach products in fewer steps and are less likely to resign. By presenting top category recommendations, the path to the product is shortened significantly.
This use case illustrates how to dynamically display a recommendations related to the last main category visited by the user — for example, if the customer recently viewed "Electronics" furniture, a banner or content block can highlight top products from that specific category. This approach increases the chance of re-engagement and encourages return visits or immediate conversions by matching promotional content to current user interest.
In this use case, we return top recommendations based on the last visited main category by the user. However, the same configuration logic can be easily adapted to display category-specific recommendations directly on each category page.
To do this, you simply skip the use of segments and aggregates related to browsing history and instead implement static personalization rules per category. For example, on the “Electronics” category page, you display recommendations from electronics category. This approach allows for consistent and relevant recommendatons across the entire website structure.
## Prerequisites
---
- [Import your product feed to catalog](/use-cases/import-product-feed-to-catalog).
- [Configure an item catalog for recommendations](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations). Enable the personalized recommendation model.
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
## Process
---
1. [Create an aggregate](/use-cases/personalized-category-reco#create-an-aggregate) for the last visited category.
2. [Create a recommendation](/use-cases/personalized-category-reco#create-a-recommendation) for each category
## Create an aggregate
---
In this part of the process, create an aggregate that will return the category that the user last visited.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last**.
5. From the **Choose event** dropdown list, select the `page.visit` event.
6. As the event parameter, select **category**.
7. Add the value **product:retailer_part_no**.
8. As the value add **Is true**.
7. Set the period from which the aggregate will analyze the results to **Lifetime**.
12. Save the aggregate.
Configuration of the aggregate
## Create a recommendation
---
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
3. In the top left corner, enter the name of your recommendation.
4. In the **Type & Items feed** section, click **Define**.
5. From the **Items feed** dropdown menu, choose the provided feed.
6. Choose the **Top** recommendation type.
7. From the dropdown menu that appear at the bottom, choose your **Metadata catalog**.
8. Click **Apply**.
9. In the **Items** section, click **Define**.
11. Define the minimum and maximum number of brands that will be recommended to the user.
13. Define **Static filter**. Choose **Visual builder**.
6. From the **Select value** drop-down list, select **category**.
6. As an operator, choose **Equals**.
7. Click the icon which appeared next to the field with operator and from the dropdown list, select **Aggregate**.
8. Choose the [aggregate, created in the previous step](#create-an-aggregate)
13. In the **Category level** input area that appear, define the category level as a numeric value. In our case choose **Take first (1).**
If your products categories have a `X > Y > Z` structure, level 0 will be `X > Y > Z`. Level 1 will be `X > Y` and so on. Here, you define how granular the category recommendations will be. For example, if you are selling shoes, you will have a `Outdoor > Sport > Running` category and a `Outdoor > Sport > Football` category. If level 0 is provided, both categories can be recommended. If level 1 is provided `Outdoor > Sport` category will be recommended to the user.
13. Choose **Fail slot** - in this case, if the filter is missing the slot of recommendations will not be visible. So if the user does not have any last time visited category because it is his first visit, this slot of recommendations will not be visible for him.
Configuration of the recommendations
14. Click **Apply**.
15. In the **Items sorting method within slots** section, select your desired item sorting method within slots. In our case choose Items sorting method: **Page visit count in the last 30 days**.
1. In **Boosting**, you can enable [boosting](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-the-boosting-factors).
13. In **Additional settings**, optionally you can exclude already bought products and set a metric to sort by.
14. Save the recommendation by clicking **Save**.
15. In the top right corner, click **Save**
## What's next
---
You can display the recommendation on your home page by using [dynamic content](/docs/campaign/dynamiccontent).
1. Go to **Experience Hub > Dynamic content > New dynamic content**.
2. In the body of the dynamic content, use the promotion insert.
Read more about how to use promotion in inserts [here](/developers/inserts).
3. Add CSS and/or HTML to the dynamic content.
4. [Define the rest of the settings](/docs/campaign/dynamiccontent/creating-dynamic-content).
## Check the use case set up on the Synerise Demo workspace
---
You can check the [aggregate](https://app.synerise.com/analytics-v2/aggregates/78b590fc-88bd-3831-8419-5c080efceeec), and [recommendation configuration](https://app.synerise.com/ai-v2/recommendations/uBqe0jFEtUxK) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per profile that completes the flow:
[`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Import transactions to Synerise
With Synerise you can process transactional data in many different ways. You can prepare advanced analysis or build marketing scenarios basing on them. You can also use transactions as a data set for AI engine.
This use case describes the process of transformation of a `.CSV` file with transactional data. The transformations performed on the file involve:
- adding missing columns with currency code
- creating eventSalt for the transactions
The `eventSalt` parameter enables to deduplicate transactions when two or more are sent with the same eventSalt and time as the original transaction.
After the transformation, the entries in the file will be imported to Synerise as transaction events.
## Prerequisites
---
- Save the file with transactional data to your computer.
You can find the general requirements for the `.CSV` file format [here](/docs/assets/catalogs/creating-catalogs#requirements). Make sure your file contains [required columns](/docs/automation/actions/synerise-integrations/import-transactions#requirements). If any column is missing, it needs to be added later in the Data Transformation rules. Values of columns need to meet requirements of the transactional data structure used in Synerise.
- Make a copy of the data file and remove rows from the copy until few are left. This copy will be used only as a sample for configuring the Data Transformation rules.
Click to see a sample CSV file used in this use case
## Process
---
1. [Prepare a data transformation diagram](/use-cases/import-transactions-dt#create-data-transformation-rules) that will transform data from the `.CSV` file.
2. [Prepare a workflow](/use-cases/import-transactions-dt#prepare-a-workflow) that imports transactions to Synerise.
## Create data transformation rules
---
In this part of the process, you define the rules of modifying data.
The data transformation diagram which is the output of this part of the process is used later to [automate sending the data](/use-cases/import-transactions-dt#prepare-a-workflow).
The sample file is used to configure the data transformation diagram and preview its results. With a [library of nodes](/docs/automation/data-transformation-and-imports/transformations-and-data-operators), you can modify the file by adding, renaming, and merging columns, as well as editing the values in the rows, and so on.
In this example, we will use the **Add column** node to add columns with currency code and **Merge columns** to create eventSalt for the transactions
1. Go to **Automation Hub > Data Transformation > Create transformation**.
2. Enter the name of the transformation.
3. Click **Add input**.
### Add file with sample data
This node allows you to add a data sample. In further steps, you define how the data must be modified. Later, when this transformation is used in the workflow, the system uses the rules created with the sample data as a pattern for modifying actual data.
4. On the pop-up, click **Add example**.
5. Upload the file with the sample data.
6. Click **Generate**.
**Result:** The **Data input** view is filled with data from the sample.
Data input of the sample file
### Add columns
You can use the **Add column** node to create a new column to the file, with a defined value. In this example, there are no columns with currency codes in the input file so, [following the transactions import requirements](/docs/automation/actions/synerise-integrations/import-transactions#requirements), we will add following columns: **products.finalUnitPrice.currency**, **revenue.currency**, **value.currency**. All of them will have the defined value: `PLN`.
1. On the canvas, click the right mouse button.
2. From the dropdown list, select **Add column**.
3. Click the Add column node.
4. In the configuration of the node:
1. In the **Add column** field, enter the unique column name.
In our case: `products.finalUnitPrice.currency`.
2. Select the **Static value** option.
The rows in the new column will be filled with the value you define.
3. As the value, enter `PLN`
4. Confirm by clicking **Apply**.
5. Before you save the settings, you can check the preview of the file after changes on the **Output data** tab.
5. Add two more **Add column** nodes by repeating steps 1-4 with the following changes:
- as the second column, add `revenue.currency` and as the value to insert, enter `PLN`
- as the third column, add `value.currency` and as the value to insert, enter `PLN`
Final configuration of the last Add column node that adds the value.currency column
### Merge columns
You can use the **Merge columns** node to create a new column based on the values from other columns and to define the separator between the merged values. In this example, we want to add the `eventSalt` parameter to the transactions using this node. This parameter enables you to deduplicate transactions when two or more are sent with the same `eventSalt` and time as the original transaction. In our case, we will build this parameter by merging values of three columns: **orderId**, **client.email**, and **recordedAt**. We will add the `-` separator between the values.
We recommend to always use `eventSalt` parameter while importing transactional data.
1. Click **Add rule**.
3. Click **Add column**.
4. From the dropdown list, select the columns to be merged: **orderId**, **client.email** and **recordedAt**.
5. In the **New column name** field, enter `eventSalt`.
6. In the **Separator** field, enter `-`.
5. Before you save the settings, you can check the preview of the file after changes in the **Output data** tab.
5. Confirm the settings by clicking **Apply**.
Final configuration of the Merge column node
### Add the finishing node
This node ends the transformation and passes the modified data to the automation where the Data Transformation is used.
1. On the canvas, click the right mouse button.
2. From the dropdown list, select **Data output**.
3. In the upper right corner, click **Save and publish**.
**Result**:
The diagram of data transformation
After the data transformation diagram is published, you can use it in the Data Transformation node while preparing a workflow that imports the files.
## Prepare a workflow
---
The scenario for this use case involves a one-time transformation of a file uploaded from the user's local storage. The transformed data will be imported to Synerise as transaction events.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the launch date
3. As the trigger node, add **Scheduled Run**.
4. In the configuration of the node:
1. Change the **Run trigger** option to **one time**.
2. Select **Immediately**.
The configuration of the Scheduled Run node
3. Confirm by clicking **Apply**.
### Select file to export
1. Add a **Local File** node.
2. In the configuration of the node:
1. Upload the file in which you want to perform the transformation.
Local File transfer
2. Confirm by clicking **Apply**.
### Select the data transformation rules
1. Add a **Data Transformation** node.
2. In the configuration of the node, select the [data transformation you have created before](/use-cases/import-transactions-dt#create-data-transformation-rules).
The configuration of the Data Transformation node
3. Confirm by clicking **Apply**.
### Import transactions
1. Add the **Import Transactions** node.
2. Confirm by clicking **Apply**.
### Add the finishing node
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
**Result**:
The workflow configuration
You can monitor the flow of the workflow in the **Transformation logs** tab. It contains information about each execution of the workflow.
The logs for the workflow
The imported transaction events will be visible in the customers' profiles.
The transaction event visible in the customer's profile
This use case concerns one-time import of transaction events from the local storage. However, you can simply modify the flow and run import cyclically from external resource. Learn more how to set up the configuration of importing data from external resource at the following links: [import from SFTP](/docs/automation/integration/sftp-integrations/sftp-get-file), [import from HTTPS](/docs/automation/integration/http-integrations/http-get-file).
## Check the use case set up on the Synerise Demo workspace
---
You can also check [the Data Transformation diagram](https://app.synerise.com/automations/data-transformation/b92a97c3-6da7-4f84-8650-871df834a9ab) and [the workflow configuration](https://app.synerise.com/automations/automation-diagram/f9ffbda5-2509-4dbe-a5c3-3686f5312247) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 8 events per workflow execution:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`transaction.charge`](/docs/assets/events/event-reference/items#transactioncharge) (~1), [`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~2).
## Read more
---
- [Data Transformation](/docs/automation/data-transformation-and-imports/introduction)
- [Enriching events from catalogs](/docs/assets/events/adding-event-parameters#enriching-events-with-data-from-catalogs)
- [Behavioral Data Hub](/docs/crm)
- [Transactional data structure](https://hub.synerise.com/api-referenceClientManagement/ClientManagement.html#operation/ClientCompletedTransaction)
# In-app QR Code Scanner
In today’s retail environment, the boundaries between online and offline experiences are increasingly blurred. Mobile applications can bridge this gap by providing interactive tools that connect the physical store with digital personalization. One such solution is an **in-app QR code scanner** that directs customers to individualized promotions and recommendations based on their unique profile.
By enabling users to scan QR codes placed in physical locations—such as shelves, displays, or posters—brands can drive engagement, gather valuable behavioral data, and deliver a seamless omnichannel experience. Each scan automatically appends the user’s UUID (unique identifier) to the destination link, ensuring that the landing page content is fully personalized to that individual.
This use case demonstrates how to create an interactive in-app campaign featuring a built-in QR scanner that redirects customers to a personalized landing page with AI-driven recommendations. Using a **predefined template**, the setup process is quick and does not require building the scanner interface from scratch.
You will use a predefined template with the resize option, which appears permanently in the application as a top or bottom bar, providing easy access to the QR code scanner and simplifying its implementation.
The campaign targets users who interact with a brand in physical locations by scanning an in-store QR code to unlock exclusive discounts for the promoted brand and get product suggestions tailored to their preferences.
After scanning the code, the users are directed to a landing page, where they will find the personalized recommendations from 3 specific, promoted brands, costing more than 50$.
What is more, you can use this scanner in different scenarios by **letting the user scan QR codes in various placements** - in stores, on street banners, in magazines etc. Each time, you deliver personalized content and recommendations, avoiding sending the same content to everyone.
## Prerequisites
---
- [Implement Synerise SDK in your mobile app](/developers/mobile-sdk).
- If you plan to publish a landing page within your own domain, follow instructions from ["Requirements for custom domains" section](/docs/campaign/landing-page/creating-landing-page#requirements-for-custom-domains); if you choose to publish it on the Synerise domain, no additional requirements are necessary
- [Configure AI engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations) to be able to add personalized AI recommendations to your landing.
## Process
---
In this use case, you will go through the following steps:
1. [Create AI recommendations](#create-ai-recommendations) with personalized products.
2. [Create a landing page](#create-a-landing-page)
2. [Create an in-app campaign](#create-an-in-app-campaign) with QR code scanner using the predefined template.
## Create AI recommendations
---
In this step, create an AI attribute recommendation campaign showing products from specific, promoted brands.
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation (it is only visible on the list of recommendations).
3. In the **Type & Items feed** section, click **Define**.
4. From the **Items feed** dropdown list, select a product feed.
5. Select the **Attribute** recommendation type.
6. Confirm the recommendation type by clicking **Apply**.
6. In the **Items** section, click **Define**.
10. Click **Add slot**.
11. Define the minimum and maximum number of products that will be recommended to the user. In this example, it's from 3 to 5.
12. From the **Items attribute** dropdown menu, choose the **brand** attribute.
3. Click **Define filter** in the [Static filter](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#static-filters) section, and from the dropdown list choose **Visual Builder**.
4. From the **Select attribute** dropdown list, choose **brand**.
5. From the **Operator** dropdown list, select **In**.
7. From the **Select value** dropdown list, select the specific brands you want to promote.
8. Click **Apply**.
Configuration of the static filter
9. Optionally, define [Elastic filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#elastic-filters).
10. Click **Apply**.
13. Click **Apply**.
14. In the top right corner, click **Save**.
## Create a landing page
---
In this part of the process, you will create a landing page with personalized recommendations created in the [previous step](#create-ai-recommendations).
1. Go to **Experience Hub > Landing Page > Create new**.
2. Enter the name of the campaign.
### Define content
---
1. In the **Content** section, click **Create message**.
2. From the list of template folders, select the **Predefined templates** folder.
**Result:** You are redirected to the list of predefined templates.
3. Select the **QR Code Scanner** template.
**Result:** You are redirected to the code editor. The form in the **Config** tab is pre-filled with default values, which you can modify to suit your business needs.
5. In the **Main Recommendation ID** field, enter the ID of recommendations you created as a part of [previous step](#create-ai-recommendations).
6. Modify **Buttons, Hero, Footer** and other sections, and appearance of your landing page, including fonts, colors, and backgrounds, to ensure it matches your branding.
7. After you make changes to the template, you can check the preview.
1. Click the **Preview Contexts** button on the upper left side.
2. Enter the ID of a customer.
3. Click **Apply**.
8. If the template is ready, click **Use in communication** in the upper right corner.
### Define schedule settings
---
1. In the **Schedule** section, click **Define**.
1. Select the timezone.
2. Select the time when the landing page will be active - in this case, choose the start and end date.
6. Click **Apply**
### Define the SEO settings
---
In this part of the process you may define technical details concerning search engine optimization and increase the chances of placing high in search results.
### Set up the URL
---
In this part of the process, you will define the URL to your landing page.
### Adjust optional settings
---
1. In the **HTTP headers** section, you can add custom HTTP headers to your landing page. In the **Key** and **Value** fields, enter a header and its value, respectively.
2. In the **Customize** section:
- you can add CSS and scripts to your landing page
- you can define the URLs to external sources or paste the snippets
- in the JS section under the **Advanced options** option, to enable additional tracking on your landing page, you can paste the [tracking code](/developers/web/installation-and-configuration#adding-the-tracking-code-to-your-site).
### Save your campaign
---
1. After you make changes to the campaign, you can check the preview. Click the **Preview** button on the upper right side.
2. When your landing page is ready you can **Save it as a draft** or directly click **Publish**.
3. Generate a QR code using any reliable online QR code generator. Use the link for the [landing page](#create-a-landing-page) created before.
## Create an in-app campaign
---
In this part of the process, you will create an in-app campaign, which uses the resize feature, meaning it is displayed continuously in the app as a top or bottom bar, allowing quick and seamless access to the QR code scanner without additional steps.
We will use a predefined template for the QR code scanner, so there is no need to create a template from scratch.
1. Go to **Experience Hub > In-app messages > Create new**
2. Enter a meaningful name for the in-app campaign.
### Define the audience
---
1. In the **Audience** section, click **Define**.
2. Select the **Everyone** tab.
3. Click **Apply**.
### Define content
---
1. In the **Content** section click **Define**.
2. Click **Create message** and from the list of template folders, select **Predefined templates**.
3. Select **QR code scanner**.
**Result:** You are redirected to the code editor.
You can edit the template in two ways, by editing the code of the template ([add inserts](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-snippet-to-the-template-code), [add variables](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-variable)) and/or by filling out the form in the **Config** tab. In this use case, we will use the capabilities of the predefined **Config** tab.
#### Edit form in the Config tab
---
The **Config** tab already has default values filled in. You can keep them or change them to fit your business needs.
In-app configuration
1. In the **Bar settings** section set up the copy and style of the first banner. Choose the bar position (top or bottom bar).
2. In the **Content** section change the main title, subtitle and image.
2. In the **Button** section change the icon text, and style of the main button.
3. Fill the **Style** field, to personalize the visual of the in-app scanner.
4. Set up the **Message** section to personalize the success and the error message.
5. If you want to make it more personalized, you can use **HTML** tab to add changes directly in the code of the template.
8. After you make changes to the template, you can check the preview.
1. Click the **Preview** button on the upper left side.
2. Enter the ID of a customer or a product.
3. Click **Apply**.
Considering that the in-app is very interactive, the preview in the platform may not be enough to test the in-app performance. That's why we suggest checking how this campaign displays altogether directly in the mobile app.
9. If the template is ready, in the upper right corner, click **Save this template > Save as**.
10. On the pop-up:
1. In the **Template name** field, enter the name of the template.
2. From the **Template folder** dropdown list, select the folder where the template will be saved.
3. Confirm by clicking **Apply**.
11. Click **Next** to continue the process of configuring the in-app campaign.
12. Click **Apply** to save your content changes.
### Select events that trigger the in-app message display
---
In this part of the process, define the event that triggers the display of the in-app message. In this, case it will be visible for all users, immediately after opening the application.
1. In the **Trigger events** section, click **Define**.
2. Select **Add event** and from the dropdown list, choose `screen.view` event.
3. Click the **+ where** button and select `source`.
4. As the logical operator, select **Equals**.
5. As the value add **MOBILE**.
5. Click **Apply**.
In-app trigger event configuration
### Schedule the message and configure display settings
---
As the final part of the process, you need to set the schedule, display settings configuration, capping, priority of the message among other in-app messages.
1. In the **Schedule** section:
1. Click **Define**.
2. Choose **Run immediately** option.
3. Click **Apply**.
2. In the **Display settings** section:
1. Click **Define**.
2. Define the **Delay display** as **0** and **Priority index** as **1**.
5. Click **Apply**.
3. Optionally, you can define the UTM parameters in the **UTM & URL parameters** section. Otherwise, click **Skip step**.
4. Optionally, you can add the custom parameters in the **Additional parameters** section. Otherwise, click **Skip step**.
3. To start your campaign, click **Activate**.
## What's next
---
After launching the campaign, when the user taps the in-app message, the device camera will automatically open and the QR scanning mode will be activated. Once the QR code is successfully scanned, the user will be redirected to the dedicated landing page created for this campaign.
The system will automatically append the user’s UUID to the landing page link, allowing the platform to identify the customer. Based on this unique identifier, the AI engine will generate personalized product recommendations tailored specifically to that individual.
As a result, each user will see a unique, personalized product view on the landing page — no two users will see the same product set.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the campaign components directly in Synerise Demo workspace:
- [AI recommendation configuration](https://app.synerise.com/ai-v2/recommendations/wyjzJ4o2TsRa),
- [LP](https://app.synerise.com/campaigns/landing-pages/create/aaf21d3c-5c1f-4d7c-a780-a51f84a7b590:2025-10-24T11:47:37.992137883)
- [In-app campaign](https://app.synerise.com/communications/in-app/c1822d86-6053-4458-a6c4-904605688904)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 7 events per profile that completes the flow:
[`screen.view`](/docs/assets/events/event-reference/web-and-app#screenview) (~1), [`inApp.show`](/docs/assets/events/event-reference/inapp#inappshow) (~1), [`inApp.click`](/docs/assets/events/event-reference/inapp#inappclick) (~1), [`landingpage.visit`](/docs/assets/events/event-reference/landing-page#landingpagevisit) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [In-app messages](/docs/campaign/in-app-messages)
- [Using in-app template builder](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template)
- [Mobile campaigns](/docs/campaign/Mobile)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Personalized SMS with last visited most expensive product
---
Dynamic SMS’s are a type of text message that are sent to user mobile devices. They are an effective way of communicating with your customers and can be used in many ways. Dynamic SMS’s can be a very innovative way to make your communication not only more effective but also more attractive for your customers.
You can add to your message interactive content like e.g. specific product or the discount to encourage your customer to finish a purchase.
## Example of use – Retail/Fashion Industry
---
A customer from the fashion industry prepared an email campaign with 20% discount for a second item and 40% for the third item on their website. They wanted to engage selected customers who opened the email on their phones and did not add anything to their basket until returning to the site.
As a medium, they used general SMS’s and dynamic SMS’s, depending on whether the user visited the product page from the moment the email was opened or not.
Users who visited the product card received **a dynamic SMS** containing the most expensive product among those viewed.

Users who did not visit the product card received **a general SMS.**

Both messages were sent from Automation Hub.
## Requirements
---
- Synerise Tracker
- Email account configuration
- SMS account configuration (integration e.g. with SMS API)
## How to do it
---
1. Prepare **an aggregate** in which you collect information about recent unique visits (e.g. last 10 visits as in the example below) and check products based on their SKU.
To do this enter the name of the attribute. We use a regular expression to be able to create code in jinjava that will show us the most expensive product among the last 10 viewed in a specific time range.

2. Prepare **general sms.**
3. Prepare **the dynamic sms**.
Dynamic SMS’s use jinjava, which checks if the user has viewed 1 product or more. If he saw 1 product, it returns information about this specific product. If a user saw more than 1, the mechanism checks which product was more expensive and this product will be sent to him in the SMS message.
4. Prepare a **segment** of people to whom you want to address the campaign.
5. Prepare an **automation**, which includes the user's event page.visit in a given period of time. In our case, the page.visit event contains the OG:type parameter, which takes the value 'product' if the user viewed the product.

Automation Hub starts with assigning an attribute that has been manually added to users in the created segment. Then we check whether the user has the appropriate value of the assigned attribute. If it meets this condition, we verify its page.visit:
- If it has page.visit with the attribute OG:type equal to product, we send him a dynamic SMS
- If it has page.visit with the OG:type attribute different from the product, we send him a general SMS
Automations can start from the newsletter.open event and then you can set a delay, after which we check the further conditions of the campaign to avoid manual interference in starting the automation.
## Generated events
This use case generates approximately 11 events per profile that completes the flow:
[`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~4), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`profile.updated`](/docs/assets/events/event-reference/profiles#profileupdated) (~1), [`sms.send`](/docs/assets/events/event-reference/sms#smssend) (~1), [`sms.click`](/docs/assets/events/event-reference/sms#smsclick) (~1).
## Read more
---
- Read more about [Automation Hub](/docs/automation)
- Read more about [SMS campaigns](/docs/campaign/SMS)
- Read more about [Segmentation](/docs/analytics/segmentations/creating-segmentations)
# Recommendations for customers with high lifetime value
To improve the effectiveness of recommendations, you can use the Predictions feature to set customers with a high lifetime value (LV) as the target group.
Based on the prediction results on lifetime value estimation for each customer, you can prepare a segmentation that consists of customers organized according to the score for a customer lifetime value. With an efficient customer segmentation, you have a better understanding of customers and can design a strategy for recommendations that is tailored for these groups.
The last step is to combine all information while creating a recommendation - you can encourage customers with low propensity to buy, but to those with a high livetime value (LV) score, you can recommend items that, apart from the matching criterion based on previous interactions, will meet the condition of low price and high margin. The potential purchase won't lower the profit margin generated by the customer.
## Prerequisites
---
- Enable the [personalized recommendation model](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations).
- Create a segmentation based on [the results of the customer lifetime value prediction](/use-cases/ltv-prediction).
- Your item catalog must include the attribute that describes profit margin (in this use case, the value of the margin is expressed as a string).
## Create a recommendation
---
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter a meaningful name of the recommendation.
3. In the **Type & Items feed** section, click **Define**.
1. From the **Items feed** dropdown list, select the catalog that contains items for the recommendation.
2. As the type, select **Personalized**.
3. Click **Apply**.
4. In the **Items** section, click **Add slot**. You can name the slot for later reference.
5. In the **Number of items** subsection, set the minimum number of items to `4` and maximum number of items to `6`.
6. Click **Static filter**.
Learn about the difference among [elastic, static filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#select-conditions-of-displaying-items), and [distinct filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#distinct-filter).
7. From the dropdown list, choose **IQL Query**.
7. Click **Select**.
8. From the dropdown list, select **Function**.
**Result**: The **ADD** function appears.
8. Click **ADD** and from the dropdown list, select the **IF** function.
**Result**: If function syntax
8. Click the first **Select** node.
1. From the dropdown list, select **Profile segmentations**.
2. Next to the **client.segmentations** node, click the icon.
3. From the dropdown list, select **Attribute**.
3. Click the **null** node.
**Result**: appears below.
4. Click **Attribute**.
5. From the dropdown menu, select **Segmentation**.
5. Click **Select value**.
6. From the dropdown list, choose the name of the segment that you created based on the customer lifetime value prediction.
6. Between the **client.segmentations** node and the selected segmentation node, click the plus icon.
7. From the dropdown, choose **HAS**.
9. In the **IF** function, click the middle **Select** node.
1. From the dropdown menu, choose **Attribute**.
2. Click the **null** node.
**Result**: appears below.
3. Click **Select value**.
4. From the dropdown list, choose the attribute that describes the items' margin.
4. Next to the selected attribute, click the icon and choose **String**.
5. Click the **value** node.
**Result**: appears below.
6. Click **Manual value**.
7. From the dropdown list, select **Attribute value**.
7. Click **Select value**.
8. From the dropdown list, select the attribute that describes items' margin.
8. Click **Select value**.
9. From the dropdown list, choose the margin attribute value. In our example, it is `high`.
9. Between the margin attribute and the **high** node, click the plus icon.
10. Choose the sign.
10. In the **IF** function, click the last **Select** node.
11. From the dropdown list, choose **Take all**.
**Result**: The final configuration of the IQL query
11. At the bottom of the static filters pop-up, click **Apply**.
12. In the **Items** section, click **Apply**.
13. In **Boosting**, you can enable [boosting](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-the-boosting-factors).
14. In **Additional settings**, optionally you can exclude already bought products and set a metric to sort by.
15. Save the recommendation by clicking **Save**.
## What's next
---
You can display the recommendation to customers in a number of ways, for example by using the [recommendation insert](/developers/inserts/recommendations-v2) in [dynamic content](/docs/campaign/dynamiccontent/creating-dynamic-content).
## Check the use case set up on the Synerise Demo workspace
---
Check the prepared [recommendations](https://app.synerise.com/ai-v2/recommendations/lvodHInFzhkP) and [segmentation](https://app.synerise.com/analytics-v2/segmentations/2c0ddbb3-261b-4d41-adb3-bc73ec4c29f3) directly in the Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Building elements in IQL builder](/docs/ai-hub/recommendations-v2/recommendation-filters#elements-of-the-formula)
- [Calculate customer lifetime value](/use-cases/ltv-prediction)
- [Creating recommendations](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign)
- [Enable Predictions](/docs/ai-hub/predictions/predictions-introduction#how-can-i-get-started)
- [Filters in recommendations](/docs/ai-hub/recommendations-v2/recommendation-filters)
- [Requirements for item feed](/docs/ai-hub/recommendations-v2/item-feed-requirements)
- [Setting up the predictions](/docs/ai-hub/predictions/predictions-introduction#what-are-predictions)
# Send customers from Synerise to Custom Audience in Facebook
Synerise enables you to collect data from various sources and create advanced analyses based on this data. In short, Synerise enables you to gain insights from your data as well as create segments. The power of Synerise is that not only it allows you to gather, process and analyze data but also it lets you reuse it in the external sources.
In this use case, you will use the native Facebook integration in Automation Hub to send a group of customers who were active in the web and mobile channels during last 30 days to Custom Audience.
## Prerequisites
---
- [Generate the system user access token in Facebook](https://developers.facebook.com/docs/audience-network/optimization/report-api/system-user/); as the `scope` value, select `ads_management`.
- [Create Custom Audience in Facebook](https://developers.facebook.com/docs/marketing-api/reference/custom-audience/).
## Process
---
To send Custom Audience, follow the steps listed below in the following order:
1. [Create a segmentation of customers](/use-cases/send-custom-audience-webhook#create-a-segmentation) who are the most active in the web and mobile channels during last 30 days.
2. [Create a workflow](/use-cases/send-custom-audience-webhook#create-a-workflow) in which you will send the group of customers to Custom Audience in Facebook.
## Create a segmentation
---
As the first part of the process, create a group of customers who were active in the mobile and web channels during last 30 days. The segmentation includes only customers with an email address. In the further part of the process, this group will be exported to Custom Audience in Facebook.
You must always narrow down the segmentation to customers who have an email address or a phone number.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter a meaningful name of the segmentation.
3. Click **Choose filter**.
5. From the dropdown list, select the **session.start** event.
4. As the time range, set **Last 30 days**.
6. Click **Choose filter**.
7. From the dropdown list, select the **screen.view** event.
8. As the time range, set **Last 30 days**.
9. Click **Choose filter**.
10. From the dropdown list, select the **Email address** attribute.
11. As the logical operator, by clicking icon, select **Is true**.
12. Connect these conditions by the **And** operator.
13. Click **Save**.
The configuration of the segmentation
## Create a workflow
---
In this part of the process, create a workflow for the group of customers you created in the [previous step](/use-cases/send-custom-audience-webhook#create-a-segmentation). This workflow sends the group of customers to Custom Audience in Facebook.
### Choose the segmentation of customers
1. Go to **Automation Hub > Workflows > New workflow**.
2. On the dashboard, click the plus icon.
3. From the dropdown list, select **Audience**.
**Results**: The **Audience** node is added to the dashboard.
4. Double-click the node.
**Result**: A pop-up appears.
5. Leave the **Run trigger** option at default.
6. Click the **Select segment** button.
7. From the dropdown list, select the [segmentation you created in the previous step](/use-cases/send-custom-audience-webhook#create-a-segmentation).
**Result**:
The configuration of the Audience node
7. Click **Apply**.
### Configure the Facebook integration
1. Click the plus button on the **Audience** node.
2. From the dropdown list, select the **Add Profiles to Custom Audience** node.
2. Double-click the node.
2. From the **Select connection** dropdown list, select an existing connection which allows you to authorize in Facebook Ad.
If you haven't established a connection yet:
1. At the top of the dropdown list, click **Add connection**.
2. In the **Access token** field, paste the token generated as a part of [prerequisites](/use-cases/send-custom-audience-webhook#prerequisites).
3. Click **Next**.
4. In the **Connection name**, enter the name of the connection (it will be only visible on the list of connections).
The connection can be re-used to any custom audience created in the Facebook Ad Account related to the token generated as a part of [prerequisites](/use-cases/send-custom-audience-webhook#prerequisites).
3. In the **API version** field, enter the Facebook API version according to the [Facebook documentation](https://developers.facebook.com/docs/marketing-api/audiences/guides/custom-audiences/).
5. From the **Identified type** dropdown list, select **Email**.
6. In the **Identifier source** field, enter `{{ client.email }}`.
You can read more about Jinjava tags in Automation Hub [here](/developers/inserts/automation).
4. In the **Audience ID** field, enter the ID of the Custom Audience to which you want to send your group of customers.
**Result**:
The configuration of the Add Profiles to Custom Audience node
6. Confirm by clicking **Apply**.
### Add the End node
1. Click the plus icon on the **Add Profiles to Custom Audience** node.
2. From the dropdown list, select **End**.
3. In the upper right corner, click **Save & Run**.
The final configuration of the workflow
4. Wait a few minutes for the response of the webhook.
**Result**: An **automation** event is saved to the profiles of the customers. Then, go Facebook, to **Facebook Manager > Audiences** to check your Custom Audience.
A webhook response with the OK status (200) on a customer's profile
## What's next
---
You can start creating personalized ads to your customers in Facebook. You can see your custom audience in **Facebook Manager > Audiences**.
## Check the use case set up on the Synerise Demo workspace
---
You can also check the [segmentation configuration](https://app.synerise.com/analytics/segmentations/6474998d-d04a-40cd-866c-c0f484d9eae1) and [workflow configuration](https://app.synerise.com/automations/automation-diagram/36e343c7-9d80-4600-b2c4-8f92cab368ed) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 4 events per profile that completes the flow:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~1), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), `facebook.addToCustomAudience` (~1).
## Read more
---
- [Automation inserts](/developers/inserts/automation)
- [Automation Hub](/docs/automation)
- [Creating segmentations](/docs/analytics/segmentations/creating-segmentations)
- [Add Profiles to Custom Audience node](/docs/automation/integration/facebook/send-custom-audience)
# Automated Replenishment Email with Upsell Recommendations
You can encourage customers to reorder items that they have previously purchased, to meet demand. This kind of campaign increases the chances of making a purchase and thus increase your revenue.
It might be useful especially in the FMCG industry, for products that sell quickly as coffee or milk. Additionally, we can use boosting to promote more products based on chosen indicators. Boosting rules are built using the same editor as the filters, but unlike filtering, boosting does not entirely exclude items that do not meet the conditions.
In this use case, we will create the workflow which, after a month from the transaction, will send an email with recommended products from a specific category (coffee) to encourage the customer to reorder. The recommendation will be boosted by the personalization model to boost products whose price exceeds the average price of all the customer's transaction from a specific category.
## Prerequisites
---
- Implement transaction events either through [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- Create [an email account](/docs/campaign/e-mail/configuring-email-account)
- Create [items feed](/docs/ai-hub/recommendations-v2/item-feed-requirements)
- **Recommended**: Become familiar with [creating recommendations](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign).
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate](/use-cases/replenishment#create-an-aggregate) that calculates the average value of products from the `Coffee` category previously bought by the customer.
2. [Create the recommendation with boosting rules](/use-cases/replenishment#create-the-recommendation-with-boosting-rules).
2. [Create an email template](/use-cases/replenishment#create-an-email-template).
3. [Create a workflow](/use-cases/replenishment#create-a-workflow).
## Create an aggregate
---
In this part of the process, create an aggregate that calculates the average value of products bought by the customer from `Coffee` category.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Average**.
4. From the **Choose event** dropdown list, select the `product.buy` event.
4. As the event parameter, select **$finalUnitPrice**.
5. Next to the **$finalUnitPrice**, click **+where**.
6. From the dropdown list, select **$category**.
7. As the operator, choose **Equal**.
9. In the text field, enter the value of the category you want to use in replenishment campaign - in this use case, it will be `Coffee`.
8. Define the period analyzed in the aggregate.
9. Save the aggregate.
Configuration of the aggregate
Configuration of this aggregate depends on the implementation of the transaction events and it might differ for each workspace.
## Create the recommendation with boosting rules
---
In this step, we create a personalized recommendation that will be filtered to the coffee category. Additionally, we will apply boosting rules to this campaign to promote products whose price is higher than the average price of the previously purchased products from this category by a customer.
### Create the campaign
---
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. In the **Type & Items feed** section:
1. Select an item catalog.
2. As a recommendation type, select **Personalized recommendations**.
3. Click **Apply**.
3. In the **Items** section, configure at least one slot.
1. Choose the minimum and maximum number of products to be displayed in the recommendation frame.
2. In the **Static filter** section, click **Choose filter**.
3. Select **Visual Builder**.
**Result**: The Visual Builder window appears.
4. From the **Select attribute** dropdown list, choose the **category** attribute.
5. As the logical operator, select **Equals**.
6. From the **Select value** dropdown list, select **Coffee**.
7. In the **Level range** field, enter `0`.
4. Click **Apply**.
Static filter section
### Build the boosting rule
---
In this part of the process, you will build a rule that boosts the products whose price is higher than the average price a customer paid for the transaction during the specific period.
1. In the **Boosting** section, click **Define**.
2. Click **Add rule**.
3. Click **Define rule** and select **IQL Query**.
**Result**: The IQL Query window opens.
4. Click the **Select** node.
5. From the dropdown list, select **Attribute**.
6. Click the **null** node.
**Result**: The **Select value** button appears.
7. Click **Select value**.
8. From the dropdown list, select the **price** attribute.
9. Click the
10. From the dropdown list, select **Context**.
11. Click the **null** node.
**Result**: The **Select value** and **Property** buttons appear.
12. From the **Property** dropdown list, select **Aggregate context**.
13. From the **Select value** dropdown list, select an aggregate created in [the previous step](/use-cases/replenishment#create-an-aggregate).
14. Change the mathematical operator between the nodes to the greater-than sign (**>**).
8. Click **Apply**.
Boosting items with the price higher than the average value of order in this category
9. In the **Promote/Demote** selector, select **Promote** (default value).
10. Use the slider to adjust how much you want the rule to affect the results.
11. Save the **Boosting** section settings by clicking **Apply**.
12. Optionally, you can define the settings in the **Additional settings** section.
13. Save the recommendation.
## Create an email template
---
In this part of the process, prepare an email template with the recommendation created in [the previous step](/use-cases/replenishment#create-the-recommendation-with-boosting-rules) that will encourage a customer to make another purchase from the specific category.
1. Go to **Experience Hub > Emails > Templates > Drag&drop builder** or **Code editor** to create an email template.
2. In the upper right corner, click **Inserts**. In the **AI Cart Recommendations 2** catalog, find [previously build recommendations](/use-cases/replenishment#create-the-recommendation-with-boosting-rules) on the list of inserts.
3. Copy and paste the Jinjava code of the recommendation and insert it to the template of your email.
4. Adjust the visual layer of the email to your needs.
4. Save your template.
## Create a workflow
---
In this part of the process, create a workflow which is triggered by the `product.buy` event from `Coffee` category. The workflow will wait 30 days. If a customer did not make another purchase from this category after that period, we will send the email with the recommended products.
1. In Synerise, go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
3. As the first node, add **Profile Event**. In the configuration of the node, select the event that triggers the workflow. In this use case, it's a `product.buy` event,
4. Click **+ where** and choose **$category**.
5. As the logical operator, select **Equal**.
6. In the text field, enter `Coffee`.
4. Confirm by clicking **Apply**.
5. As the second node, add **Delay**. In the configuration of the node, set the period to `30 days`.
6. As the next node, choose **Profile Filter** to check if customers have bought a product from the coffee category during last 30 days. To do this:
1. Choose the `product.buy` event.
2. As the parameter, choose **$category**.
5. As the logical operator, select **Equal**.
6. In the text field, enter `Coffee`.
3. Set the time range to last 30 days.
4. Click **Apply**.
7. To the **Matched** path, add the **End** node.
8. To the **Not matched** path, add the **Send Email** node.
9. In the **Send email** node configuration:
1. In the **Sender details**, define the account from which the email will be sent.
2. In the **Content** section:
1. Enter the subject of the email which will be visible in the customer's inbox.
2. Select the email template created in [the previous step](/use-cases/replenishment#create-an-email-template).
3. Optionally, you can add UTM and URL parameters. If not, click **Skip step**.
10. Confirm by clicking **Apply**.
7. Add the **End** node to finish the workflow.
8. Optionally, you can set up the capping for this workflow based on your business needs.
8. Click **Save & Run**.
Workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
You can check the the configuration of each step from this use case in our Synerise Demo workspace:
- [Aggregate](https://app.synerise.com/analytics/aggregates/3b5d4f67-ed80-33d8-838f-00be16a0b5f7)
- [Recommendation](https://app.synerise.com/ai-v2/recommendations/gHRu3EMcjO6w)
- [Workflow](https://app.synerise.com/automations/automation-diagram/3b9158df-b63f-4845-a81e-a53adf9101c8)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 12 events per profile that completes the flow:
[`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Automation Hub](/docs/automation)
- [Email campaigns](/docs/campaign/e-mail)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Recommendations with products in customer's size
The purpose of the recommendation is to present the customer with the products best suited to their behavioral profile built during each visit in your online shop. One of the ways to do it is to recommend items in the customer's size.
By analyzing previous transactions, you can save an additional attribute in the customer's profile that stores information about the size of the products that they purchased. Later, you can use this attribute to build a filter in recommendations.
This use case shows how to create a recommendation that serves 4 personalized items in a customer's size.
## Prerequisites
---
- Enable the [personalized recommendation model](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations).
- Supplement the customer profiles with the size attribute.
## Create a recommendation
---
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter a meaningful name of the recommendation.
3. In the **Type & Items feed** section, click **Define**.
1. From the **Items feed** dropdown list, select the catalog that contains items for the recommendation.
2. As the type, select **Personalized**.
3. Click **Apply**.
4. In the **Items** section, click **Define**.
5. Click **Add slot**. You can name the slot for later reference.
5. In the **Number of items** subsection, set the minimum and maximum number of items to `4`.
Setting the minimum and maximum number of items to the same number ensures that exactly this many items will appear in the slot.
6. Click **Static filter**.
Learn about the difference among [elastic, static filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#select-conditions-of-displaying-items), and [distinct filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#distinct-filter).
7. From the dropdown list, choose **Visual Builder**.
7. Click **Select attribute**.
8. From the dropdown list, choose the item size attribute.
8. Click **Operator**.
9. From the dropdown list, choose **Equals**.
9. Click the icon and keep clicking until you get the option.
10. Click **Select value**.
11. From the dropdown list, choose the attribute that contains the customer's size.
11. On the bottom of the elastic filter pop-up, click **Apply**.
12. In the **Items** section, click **Apply**.
13. In **Boosting**, you can enable [boosting](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-the-boosting-factors).
14. In **Additional settings**, optionally you can exclude already bought products and set a metric to sort by.
15. Save the recommendation by clicking **Save**.
## What's next
---
You can display the recommendation to customers in a number of ways, for example by using the [recommendation insert](/developers/inserts/recommendations-v2) in [dynamic content](/docs/campaign/dynamiccontent/creating-dynamic-content).
## Check the use case set up on the Synerise Demo workspace
---
You can check the [recommendation settings](https://app.synerise.com/ai-v2/recommendations/0RaMcz0bJTtr) in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Creating recommendations](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign)
- [Filters in recommendations](/docs/ai-hub/recommendations-v2/recommendation-filters)
- [Requirements for item feed](/docs/ai-hub/recommendations-v2/item-feed-requirements)
# Automated Alerts for Campaign Display Issues via Slack
Synerise workflows allow you to create customized mechanisms, thanks to which you can monitor any campaign you create and see if it is properly displayed, what results it generates, whether it is clickable, etc. One of such types of campaigns are recommendation campaigns displayed on the website or in the application, which let you prepare fully personalized content for your audience. The key element during creating recommendation campaigns is controlling if they are displayed correctly for your customers.
Problems with campaign display might occur in case of:
- changes on the website (for example in HTML structure or CSS selectors),
- problems in settings of campaign filters (too narrow),
- errors in product feed.
Alerts are very efficient in cases that require immediate actions. When an incident occurs, you can use a workflow which generates an alert message and sends it to your Slack channel with information that your campaign does not work. In this situation, you can react immediately and check the campaign settings.
In our use case, we will create a workflow that starts hourly and checks if the recommendation campaign on the website was generated any and displayed during the last 60 minutes. If not, the workflow sends an alert message to the Slack channel. When counting how many times the recommendation was displayed, we will use events generated in the customer's profile every time it happens.
## Prerequisites
---
- Implement a [recommendation campaign](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign) on your website that you want to monitor. Check our [use cases](/use-cases/?ordering=DESC&sortBy=publishDate&filters=tags%3D%3D%22ai+recommendations%22ANDchannel%3D%3D%22website%22) to learn more how to do it step by step.
- Create [an incoming webhook in Slack](https://api.slack.com/messaging/webhooks).
## Process
---
In this use case, you will go through the following steps:
1. [Create a metric](/use-cases/dynamic-campaign-alert#create-a-metric) which counts how many times a campaign was displayed during the last 60 minutes.
2. [Create a workflow](/use-cases/dynamic-campaign-alert#create-a-workflow) that sends an alert message.
## Create a metric
---
In this part of the process, you create a metric which counts how many times a recommendation was displayed during the last 60 minutes.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As the metric type, select **Simple metric**.
3. As the aggregator, set **Count**.
4. As the occurrence type, set **All**.
5. From the **Choose event** dropdown list, select **dynamicContent.show**.
6. Click button.
7. Click the **Choose parameter** button.
8. From the dropdown list, select **id**.
9. Click the **Choose operator** button.
10. From the dropdown list, select **Equal**.
11. As the value of the operator add the ID of your dynamic content campaign. To find it, go to **Experience Hub > Dynamic content**, find your campaign on the list and click the three-dot button. Hover over the ID of the campaign and click **Copy ID**.
12. Set the date range for **Last 60 minutes**.
12. Click **Save**.
Metric configuration
In our case, we use a dynamic content campaign with product recommendations, which automatically generates the `dynamicContent.show` event when the campaign is displayed on the website. This event has an `id` parameter which specifies the ID of the dynamic content campaign. However, this metric can be based on any other event, depending on how the campaign is implemented.
## Create a workflow
---
In this step, you will create a workflow which triggers every hour and checks if the campaign was displayed in the last 60 minutes. If not - it sends an automatic alert to your Slack channel.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Scheduled Run trigger node
---
At this stage, you configure the conditions that trigger the workflow.
1. As the trigger node, add **Scheduled Run**.
2. In the configuration of the node:
1. Leave the **Run trigger** option at default (**all time**).
2. From the **Timezone** dropdown list, select the time zone consistent with the timezone selected for your workspace.
3. Define the frequency of the workflow. In this use case, it's every day, every hour from 8:00 to 22:00.
4. Confirm by clicking **Apply**.
The configuration of the Scheduled Run node
### Define the Metric Filter node
---
In the **Metric Filter** node, you will select [the metric prepared in the previous part of the process](/use-cases/dynamic-campaign-alert#create-a-metric). The continuation of the workflow will depend on the result of the metric. If the metric result is equal to or less than 0, an alert will be sent to a Slack channel.
1. After the trigger node, add **Metric Filter**.
2. In **Define condition**, choose the [metric created in the previous step](/use-cases/teams-integration#create-a-metric-which-counts-the-change-in-transactions).
3. As the condition, by using the mathematical operators, set the metric result as equal to `0`.
4. Click **Apply**.
The configuration of the Metric Filter node
### Define the Send Channel Message node
---
In this step, you will configure the settings of the outgoing integration that sends the alert message to a Slack channel.
#### Create a connection
1. As the **matched** path after the Metric Filter node, add the **Slack > Send Channel Message** node.
3. In the configuration of the node:
- If you already have created a connection, select the connection from the list.
- If you haven't created any connection yet:
1. At the top of the dropdown list, click **Add connection**.
2. In the **Incoming Webhook URL** field, enter the incoming webhook URL you created as a part of [prerequisites](/use-cases/dynamic-campaign-alert#prerequisites).
3. Click **Next**.
4. In the **Connection name** field, enter the name for the connection you created.
5. Click **Apply**.
**Result**: A connection is created and selected.
#### Define the integration parameters
1. In the **Type of message** field, choose **Simple text message**.
2. Below, in **Add text message**, add the content of the message which should be sent to the Slack channel.
3. Confirm by clicking **Apply**.
Configuration of the workflow that sends alert messages based on the metric results to the Slack channel
### Prepare the final settings
---
1. **Add End nodes** where the workflow should finish for users.
2. Optionally, define **capping**.
3. Optionally, **add titles** to each node so the workflow will be more understandable to your colleagues.
4. Name the **workflow**.
5. To save it as a draft, click Save, or activate the workflow by clicking **Save & Run**.
Workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
You can check the [metric](https://app.synerise.com/analytics/metrics/cd9779ca-86a0-4a62-a0db-4dbb1ca1a92b) and [workflow](https://app.synerise.com/automations/automation-diagram/4cf2fe1c-87fb-4b80-8151-7aa1920098c1) configuration directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per workflow execution:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`slack.sendChannelMessage`](/docs/assets/events/event-reference/integration#slacksendchannelmessage) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Custom events](https://hub.synerise.com/api-reference/data-management#operation/CustomEvent)
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Metrics](/docs/analytics/metrics)
- [Recommendations](/docs/ai-hub/recommendations-v2)
- [Slack integration](/docs/automation/integration/slack/send-message-to-slack-channel)
# ABX Test - Optimizing Discounts for Medium-Purchase-Probability Customers
This ABX test is designed to help optimize discount offers for customers with low predicted purchase probability from specific category — a segment that requires more strategic effort to convert.
Using our prediction model, customers are divided into three groups:
- High probability to buy
- Medium probability to buy
- Low probability to buy
Instead of offering discounts to everyone, the focus here is on the **medium-intent group**, where the real challenge lies. This segment is targeted with multiple variants of a campaign for specific product category (like electronics in our case) to determine which incentive, if any, drives the highest engagement and conversion:
- 5% discount
- 10% discount
- 15% discount
- No discount (control group)
The results help you fine-tune your strategy by understanding which discount level justifies the cost of acquisition in this sensitive segment. This leads to smarter spending on incentives and a higher return on your promotional efforts.
## Prerequisites
---
To implement this use case, perform the following steps in the given order:
- [Create an email account](/docs/campaign/e-mail/configuring-email-account).
- [Prepare email templates](/docs/campaign/e-mail/creating-email-templates).
- Create [voucher pools](/docs/assets/code-pools) with different discounts. In our example: 15%, 10% and 5% for `Electronics` category.
## Process
---
1. [Create a Propensity prediction](/use-cases/abx-optimize-coupon-strategy#create-a-propensity-prediction) that produces the 5-point score (results will be later grouped using 3-point score labels).
2. [Create a segmentation](/use-cases/abx-optimize-coupon-strategy#create-a-segmentation).
3. [Create a workflow](/use-cases/abx-optimize-coupon-strategy#create-a-workflow).
## Create a Propensity prediction
---
In this part of the process, you will create a propensity prediction to purchase any product from the `electronics` category for the audience of recognized customers (assigned with the email attribute and with a page visit event within the last 30 days).
Synerise allows you to run the predictions also for anonymous visitors. If you need to prepare scenario for other segment - like anonymous visitors - you can define the conditions while preparing the segment.
### Select the model type
1. Go to **AI Hub > (AI Predictions) Models > New prediction**.
2. On the pop-up, select the **Create from scratch** option.
3. Select **Propensity**.
4. Name your prediction.
### Select customers to be analyzed
Select the audience for whom you want to prepare a prediction.
1. In the **Audience** section, click **Define**.
2. Click **Choose segmentation**.
3. On the dropdown list, click **Create new**.
4. In the **Segmentation name** field, enter a meaningful name of the segmentation.
5. Click **Next step**.
5. Click **Add condition**:
1. From the dropdown list, select the `email` attribute.
2. From the **Choose operator** dropdown list, select **String** and **Is not empty** (this operation will work on Recognized visitors only, as the email field in anonymous visitors has special handling policy).
6. Once again click **Add condition**:
1. From the dropdown list, select the `Visited page` event.
2. In the calendar in the bottom right corner, leave **Last 30 days**.
7. Save the segmentation by clicking **Create segmentation**.
8. Click **Apply**.
Propensity audience configuration
### Define the item
In this section, you define the product category for which you want to calculate the prediction, in our case it's the `electronics` category. This is done by creating a filter that matches the product category in the catalog.
1. In the **Item selection** section, click **Define**.
2. Click **Choose item feed**.
3. Select the catalog that contains the items you want to make the prediction for.
**Result**: The **Item filter** section appears.
4. Click **Define item filter**.
5. From the **Select value** dropdown list, select the `category` attribute.
6. As the logical operator, select **In**.
7. Click **Select value** and add `0` items.
**Result**: An **Array values** pop-up appears.
8. Use the search field to add the desired product category. In our case:`root catalog> default category>electronics`.
9. Click **Add**.
10. Click **Apply**.
13. Click **Save**.
10. Save the item feed configuration by clicking **Apply**.
Propensity item filter configuration
### Additional settings and saving
Configure the [additional settings](/docs/ai-hub/predictions/propensity#additional-settings) (or leave them at default) and click **Save & Calculate**. In our case we choose the 5-point probability scale: very high, high, medium, low, very low.
**Result:**
After the calculation is complete a `snr.propensity.score` event is saved in the profiles of each customer in the audience. The event data includes detailed results of the prediction. Based on the `snr.propensity.score` event, you can create segmentations of customers with different propensity.
## Create a segmentation
---
Based on the `snr.propensity.score` event, create a segmentation of customers with medium propensity to purchase any item from the product - `electronics` category.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation.
1. Click **Add condition**.
2. Select the `snr.propensity.score` event.
3. Click **+ where**.
4. As the event parameter, select `modelId` (available in the parameters of the `snr.propensity.score` event).
Properties of the snr.propenisty.score event
3. As the logical operator, select **Equal**.
4. In the text field, enter the value of the `modelId` parameter.
5. Click **+ and where**.
6. As the event parameter, select `score_label`.
7. As the logical operator, select **Equal**.
8. In the text field, enter `Medium`.
9. Set the date range according to your buisness needs.
5. Click **Save**.
For other scenarios using 5 point label scale you can group very low & low and very high & high propensity scores using `contain` operator accordingly. This way you can create 3 point label scale.
Segmentation configuration
## Create a workflow
---
As the final part of the process, create a workflow that sends an email with a voucher code to customers with the medium propensity to buy items from the electronics category. We will use the A/B/X tests to send the different vouchers to different groups of users. This way, we will be able to check the effectiveness of incentives of a different level.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Choose the segmentation of customers
1. As the first node of the workflow, add **Audience**. In the node settings:
1. In the **Define audience** section, select the [segmentation you created in the previous step](#create-a-segmentation), click **Apply** to confirm.
9. Confirm by clicking **Apply**.
### Add the ABx Test node
---
1. Add the **ABx Test** node.
2. Click **Add group** to create 4 groups of customers.
By default, we have the group A and B with an equal 50/50 division - you can add another group here, and de-select the **Equal allocation** option if you want an unequal division. In our example, 4 groups are created.
- **Group A**: 25% of the database
- **Group B**: 25% of the database
- **Group C**: 25% of the database
- **Group D**: 25% of the database
3. Enable the **Generate a variant assignment event** option. As a result, Synerise will record which test variant a given customer was assigned to, which later allows you to analyze results and build segments based on that assignment.
4. To save your changes, click **Apply**.
Screenshot presenting ABx Test node
### Add the Send Email node
---
Add the **Send Email** node to 3 of the 4 groups in our workflow.
1. Add the **Send Email** node. In the node settings:
1. In the **Sender details** section, choose the email account from which the email will be sent.
2. In the **Content** section, type the **Subject** and from the **Template** dropdown, select [the template you created as part of the prerequsites](#prerequisites).
In the email editor, click the Inserts button and from the dropdown list, select Pools. Find one of the [pools you created as a part of prerequisites](#prerequisites) and click it. Then copy its code and paste to the email template.
3. In the **UTM & URL parameters** section, you can define the UTM parameters added to the links included in the email.
4. In the **Additional parameters** section, you can optionally describe campaigns with [additional parameters](/docs/campaign/e-mail/creating-email-campaigns#adding-custom-parameters).
2. Click **Apply**.
3. Repeat the all steps in the two following Send Email nodes. Change the voucher pool ID in the content of the email template.
4. Add the **End** node to the last group of customers. By doing this, you will exclude this audience segment from receiving any communications, allowing you to determine how many of them make purchases without any incentives.
### Add the finishing node and set capping
---
1. Add the **End** node after each **Send Email** node.
2. In the upper right corner, click **Set Capping** and define the limit of workflows.
3. In the upper right corner, click **Save & Run**.
The final workflow
## What's next
---
Once your ABX workflow is live, it’s important to go beyond campaign delivery and take a closer look at the actual effectiveness of each variant.
To support this analysis, make sure you enabled the **Generate a variant assignment event** option in the ABx Test node when building the workflow. This guarantees that Synerise will generate an `automation.abTestVariantAssigned` event, for each customer who passes through this node.
With these events in place, you can now build four segments representing the groups who received different incentives:
- automation.abTestVariantAssigned → variantName = A (10% discount)
- automation.abTestVariantAssigned → variantName = B (15% discount)
- automation.abTestVariantAssigned → variantName = C (20% discount)
- automation.abTestVariantAssigned → variantName = X (no discount – control group)
1. Go to **Decision Hub > Segmentations > New segmentation**.
3. Enter the name of the segmentation.
4. Click **Add condition**.
4. From the dropdown list, select the `automation.abTestVariantAssigned` event.
5. Add the following conditions to the event:
- **diagramId** – This parameter allows you to differentiate between multiple ABX tests running in your environment. The ID is the part of the URL that comes after /automation-diagram/, for example: **ced9c208-8adb-4879-b9dd-55c7aab50872** in the URL `https://app.synerise.com/automations/workflows/automation-diagram/ced9c208-8adb-4879-b9dd-55c7aab50872`.
- **variantName** – This is the actual test group the user was assigned to:
A → 15% discount
B → 10% discount
C → 5% discount
D → No discount
7. Using the date picker in the lower-right corner, set the time range based on your business needs. Confirm by clicking **Apply**.
6. Save the segmentation.
8. Create the next segmentation. Repeat the steps.
Segmentation configuration
Once you’ve created these segments, you can analyze your results. You can for example compare performance metrics such as:
- Open Rate (OR)
- Click-Through Rate (CTR)
- Conversions (transaction.charge)
etc.
You can also take the analysis a step further by comparing test results across different predictive groups. For example, do users from the "Low probability" group respond better to incentives than those who were originally scored as "High probability"? This can reveal whether your discounting strategy should be personalized not only by behavior but also by predicted intent.
This layered analysis will help you understand not just which discount works best overall, but which incentive works best for which type of customer — and whether offering anything at all is even necessary in certain segments.
This scenario assumes using the entire audience for the campaign and analyzing the results.
If we want to run an A/B test and, after a defined period, send out the discount value that brings the highest benefits, we need to reserve X% of the audience for that final send. The winning discount will be selected based on performance metrics, using a metric filter.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the following objects in the Synerise Demo workspace:
- [target segmentation](https://app.synerise.com/analytics-v2/segmentations/f3e6db3b-d73d-4737-b50f-3b153b34e3df)
- [prediction](https://app.synerise.com/ai-v2/predictions/roqlnshnmwob)
- [final segmentation](https://app.synerise.com/analytics-v2/segmentations/8403ef59-5e32-41a1-8309-9a32eaf41f7d)
- [workflow](https://app.synerise.com/automations/workflows/automation-diagram/ced9c208-8adb-4879-b9dd-55c7aab50872)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 10 events per profile that completes the flow:
[`snr.propensity.score`](/docs/assets/events/event-reference/predictions#snrpropensityscore) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`automation.abTestVariantAssigned`](/docs/assets/events/event-reference/automation#automationabtestvariantassigned) (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1), [`voucherCode.assigned`](/docs/assets/events/event-reference/loyalty#vouchercodeassigned) (~1).
## Read more
---
- [ABx Test node](/docs/automation/conditions/abx-split-node)
- [Automation Hub](/docs/automation)
- [Predictions](/docs/ai-hub/predictions)
# Change date format for analytics
It may happen that your implementation sends additional date information, such as the date of first time an app was launched, in the custom attributes of customers. If that date has a different format than the one required by Decision Hub, you can use Expressions to transform it.
The example in this article explains how to transform a date in `dd.mm.yyyy` format into a timestamp that can be used in Decision Hub. In the custom attributes of the customer profile, the parameter that stores the date is called `app_first_started`. If you're an advanced user, you can modify the regular expressions in the article to work with different formats of dates in the parameter.
## Prerequisites
---
- Implementation of [tracking code](/developers/web/installation-and-configuration#creating-a-tracking-code) on your website.
- The attribute with the date (in this example, it's `app_first_started`) must be defined. This can be done in one of the following ways:
- [Add the attribute in **Profile attributes**](/docs/crm/customer-properties#adding-profile-attributes-in-the-synerise-portal).
- Create or update a customer with the attribute (using the API or SDK).
## Process
---
The process consists of three stages:
1. [Create expressions to extract elements of the date](#create-expressions-to-extract-elements-of-the-date).
2. [Create an expression to re-arrange the elements of the date into a format that can be converted into a timestamp](#create-an-expression-to-re-arrange-the-elements-of-the-date).
3. [Convert the date into a timestamp](#convert-into-a-timestamp).
Due to event data retention, such attributes should be stored permanently in a customer's profile, not in event data.
In the course of this procedure, you can use the **Show in profile card** toggle in each expression to preview the results in a test customer's profile.
## Create expressions to extract elements of the date
---
Three separate expressions are used to extract the day, month, and year. The only difference between them is the regular expression used.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. From the **Expressions for** dropdown list, select **Attribute**.
3. In the **Formula definition** section, click **Select**.
4. From the list that opens, select **Function > Regexp**.
5. In the brackets, click the left **Select** button and from the list, select **Profile**.
7. Click the **unnamed** node that appeared.
8. At the bottom of the page, click **Choose attribute**.
9. In the list of attributes, find and select `app_first_started` (you can use the search field).
10. In the brackets, click the right **Select** button and from the list, select **Constant**.
11. Click the **0** node that appeared.
12. At the bottom of the page, in the input field, paste the regular expression that extracts the day: `(?<=^)(\d*?)(?=\.)`
13. Above the formula creator, enter a meaningful name for the expression.
Expression to extract the day from a date in dd.mm.yyyy format
14. In the upper-right corner, click **Save**.
15. In the upper-right corner, click **Publish**.
16. Create the month and year expression by performing the following steps twice:
1. Return to the list of expressions and locate the expression you created.
2. To the right, click the icon and select **Duplicate**.
3. Click the duplicated expression to open it for editing.
4. Change the name of the expression.
5. In the **Formula definition** section, click the node with the regular expression.
6. Change the regular expression to:
- For month: `(?<=\.)(\d*?)(?=\.)`
- For year: `(?<=\.)(\d*?)(?=$)`
7. Click **Publish**.
## Create an expression to re-arrange the elements of the date
---
In this stage, you create an expression that concatenates (joins) the results of the three expressions above into a single string in `yyyy/mm/dd` format. This format can later be converted into a timestamp.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Create the following attribute expression:
Expression to concatenate the elements of a date
**Explanation**:
- **Concat** is a function.
- Expression results (green nodes) are treated and inserted like customer attributes.
- `/` is a constant.
The expression takes three strings (year, month, day) that are the results of the expressions you created before and joins them into one string with `/` as the separator.
3. Click **Save**.
4. Click **Publish**.
## Convert into a timestamp
---
In this stage, convert the `yyyy/mm/dd` date into an Analytics-compatible timestamp.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Create the following expression:
Expression that converts yyyy/mm/dd into a timestamp
**Explanation:**
- **To timestamp** is a function.
- Expression results are treated and inserted like customer attributes.
3. Click **Save**.
4. Click **Publish**.
## What's next
---
You can now use the result of the last expression (called "Timestamp from yyyy/mm/dd" in this example) as a timestamp in analytics, for example to create a segmentation of customers who first started the app after a certain date or to find the transactions that a customer made before they first started the application.
If you enabled the **Show in profile card** toggles, the expression results are visible in the right panel of a customer card in **Profiles**:
Expression results in a customer profile
## Check the use case set up on the Synerise Demo workspace
---
You can find five expressions created in this use case in our Synerise Demo workspace at the links listed below:
- [expression used to extract the day](https://app.synerise.com/analytics/expressions/4b67b443-c5bd-4637-9f52-a05b5d77ca33)
- [expression used to extract the month](https://app.synerise.com/analytics/expressions/f2e2409c-3dff-4205-89b6-5d0525b31e64)
- [expression used to extract the year](https://app.synerise.com/analytics/expressions/257b0362-a181-4d21-bfe7-82a8f89ba513)
- [expression to re-arrange the elements of the date](https://app.synerise.com/analytics/expressions/3f330b8a-7d11-4ab9-88c4-946a3c3d83b8)
- [expression for timestamp from yyyy/mm/dd](https://app.synerise.com/analytics/expressions/25677e70-e82f-4932-8329-1883fb00fe3d)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case does not generate any events.
## Read more
---
- [Expressions](/docs/crm/expressions)
# Send Reminder Emails for Products Added to Saved List
If the customer adds a favorite product to a list, but does not complete a transaction, send an email based on the product. This can direct the customer straight to the recently liked product.
You can always let your customers know if products they like go on sale. Use a reminder email to send them notifications about the latest promotion connected with products they have on their lists.

## Example of use - Retail industry
The client wants to convert abandoned items on saved lists. He has sent an email campaign with a reminder about the saved products and encouraged customers to finish the purchase.
**Results**
- OR 18.94%,
- CTR 8.11%,
- Conversion 15,7%.
## How to do it
---
1. First of all create your segment with customers who e.g. during last week have added something to favorite list but have not made a purchase. Also you can add any other condition based on the goal of your campaign.
2. Create an email campaign with products added to favorites or last seen products by this customer. Here you can read more [how to do it.](/docs/ai-hub/recommendations-v2/recommendation-types#last-seen)
Learn more how to build an [email campaign](/docs/campaign/e-mail).
3. When your template is ready, you can use it in an automation.
A good idea to maintain customer commitment and increase their willingness to buy is to send an email reminder about the items in the wish list.
You can do this with the following automation:

Automation blocks in this template:
- Profile Event as a trigger – leaving the website (session finished)
- Delay – for example 2h
- Profile Filter – consent for profiling
- Send an email with personalized products
## Generated events
This use case generates approximately 10 events per profile that completes the flow:
[`session.end`](/docs/assets/events/event-reference/web-and-app#sessionend) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1).
# Abandoned cart landing page with similar recommendations
Recovering abandoned carts is essential for maximizing revenue and strengthening customer retention. By leveraging customer behavior data, businesses can create a personalized shopping experience that encourages customers to complete their purchases. This approach becomes even more effective when combined with product recommendations, offering alternatives with similar features. A well-designed landing page that displays both abandoned items and similar products can significantly enhance the user experience and drive higher conversion rates by guiding customers toward products they are more likely to buy.
This use case demonstrates how to integrate a dynamic product listing into a dedicated landing page and send a mobile communication redirection to it. It presents products customer abandoned in their cart and recommendations for similar products. The purpose is to offer customers a wider selection of items with similar features. The landing page will be built using predefined templates, making it easier to customize the project to meet your business needs.
## Prerequisites
---
To be able to implement this use case, you must:
- Implement mobile pushes in your mobile application: [iOS](/developers/mobile-sdk/configuring-push-notifications/ios), [Android](/developers/mobile-sdk/configuring-push-notifications/android).
- [Import an item catalog for recommendations and configure AI engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations). Enable Similar recommendations.
- Implement the [transaction events](/developers/web/transactions-sdk) using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- [Implement the `cart.status` event](/developers/web/cart), which stores the current status of the cart in the form of an event on the customer's card. The event has to be sent to Synerise after every change in the cart status.
- Collect [product.addToCart event](/docs/assets/events/event-definitions).
## Process
---
To create a landing page with similar products recommendations, perform the steps in the following order:
1. [Create an aggregate](#create-an-aggregate) returning products customer abandoned in their cart.
2. [Create an AI recommendation](#create-an-ai-recommendation) that will be used in the landing page template.
3. [Create a landing page](#create-a-landing-page).
4. [Create a mobile push notification](#create-a-mobile-push-notification) with a link to the landing page.
5. [Create a workflow](#create-a-workflow) sending a mobile push.
## Create an aggregate
---
In this part of the process, create an aggregate that retrieves the list of products from the abandoned cart. These products will be displayed in the template and the aggregate result will serve as context for the recommendations.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. Enter the name of the aggregate.
3. As the type of the aggregate, select **Last**.
5. From the **Choose event** dropdown list, select the `cart.status` event.
6. As the event parameter, select **products**.
7. Set the analyzed period to **Lifetime**.
12. Save the aggregate.
Configuration of the aggregate
## Create an AI Recommendation
---
In this part of the process, you will configure a similar items recommendation with context of items customers abandoned in their carts. This recommendation will be later used in the landing page.
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation (it is only visible on the list of recommendation).
3. In the **Type & Items feed** section, click **Define**.
4. From the **Items Feed** dropdown list, select an item feed.
5. In the **Type** section, choose the **Similar items** recommendation type.
6. Confirm the settings by clicking **Apply**.
7. In the **Items** section, click **Define**.
8. Define the minimum and maximum number of items that will be recommended to the customer in each slot.
9. Optionally, define [Static filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#static-filters) and [Elastic filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#elastic-filters).
10. Confirm by clicking **Apply**.
8. Optionally, you can define the **Boosting** factors.
9. In the **Additional settings** section click **Define**.
1. Enable the **Item context from analytics (aggregate, expression)** switch.
2. From the dropdown list select the aggregate you created [in the previous step](#create-an-aggregate).
3. Click **Apply**.
9. In the right upper corner, click **Save**.
## Create a landing page
---
In this part of the process, you will create a landing page. We will use a predefined template for the abandoned cart landing page with similar recommendations, so there is no need to create a template from scratch.
1. Go to **Experience Hub > Landing Page > Create new**.
2. In the **Content** section, click **Define**.
2. From the list of template folders, select **Predefined templates**.
3. Select the **Abandoned cart** template.
**Result:** You are redirected to the code editor.
You can edit the template in two ways, by editing the code of the template [add inserts](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-snippet-to-the-template-code), [add variables](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-variable) and/or by filling out the form in the Config tab. In this use case, we will use the capabilities of the predefined Config tab.
### Edit form in the Config tab
---
The form in the **Config** tab is pre-filled with default values, which you can modify to suit your business needs.
1. In the **Aggregate - Abandoned Cart ID**, provide a unique identifier for the aggregate that retrieves the list of products from the abandoned cart. Provide the [ID of the aggregate you prepared in the previous step](#create-an-aggregate). You can find it by typing its name or ID in the search box.
2. From **Set the maximum number of items**, select the maximum number of items displayed in the abandoned cart section.
3. In the **Aggregate - Abandoned Cart Title**, you can customize the title for the section with products from the abandoned cart.
4. In **Catalog name**, enter the name of the item catalog.
5. In **Aggregate - Abandoned Cart CTA Text**, you can customize the text for the Call to Action button that will appear in the abandoned cart section.
6. To display similar recommendations enable the **Turn on for the additional recommendation to appear** toggle.
7. In **Additional Recommendation ID**, provide a unique identifier for the recommendation. Provide the [ID of the recommendation you prepared in the previous step](#create-an-ai-recommendation). You can find it by typing its name or ID in the search box.
8. 8. From **Set the maximum number of items**, select the maximum number of items to be displayed for similar products recommendation section.
9. In **Additional Recommendation Title**, you can customize the title for the section with recommendation for similar products.
10. In **Additional Recommendation CTA Text**, you can customize the text for the Call to Action button that will appear in the recommendation section.
11. Optionally, you can add an additional recommendation in the **Additional Recommendation** section. You can specify a title, unique ID, and set the maximum number of items to be shown in this secondary recommendation section.
14. In **Hero Header**, you can type the header you want to display on your landing page.
15. In **Hero Image**, you can provide the link to the main image.
17. In **Hero Paragraph**, you can customize the message that will appear beneath the title.
18. In **Hero Button Text**, you can insert the text that will be displayed on the main CTA (Call to Action) button in the Hero section.
19. Optionally, you can adjust the style of the landing page in the **Hero**, **Footer**, **General** and **Main** sections.
20. After you make changes to the template, you can check the preview.
1. Click the **Preview Contexts** button on the upper left side.
2. Enter the ID of a customer.
3. Click **Apply**.
Edit form in the Config tab
8. If the template is ready, click **Use in communication**.
**Additionally, the template also includes extra features such as:**
- The ability to add a stroke to the Header in the Hero section;
- A switch that allows you to toggle between having a button border;
- An option to put the Header First in the Hero Section (Column Look);
- An option for your Hero Section to have a Background Image.
### Define schedule settings
---
1. In the **Schedule** section, click **Define**.
1. Select the timezone.
2. Select the time when the landing page will be active according to your business needs.
6. Click **Apply**
Edit form in the Schedule tab
### Define the SEO settings
---
In this part of the process you can define technical details concerning search engine optimization and increase the chances of placing high in search results.
### Set up the URL
---
In this part of the process, you will define the URL to your landing page.
1. From the **Domain** dropdown list, select the address of your landing page.
2. Optionally, if you want to add a part to the address after the domain, in **Nice URL** provide this part, for example, `dresses-and-skirts` (don't use a slash, it is added automatically).
3. In **URL for redirecting users when the landing expires (optional)** enter the URL to which you will redirect users after the landing page expires.
4. Optionally, in **Fallback URL** enter the URL to which users will be redirected if your landing page is unavailable due to errors (for example, when it can't be rendered due to Jinjava syntax error). If you leave this field empty, users will be redirected to a generic error page.
4. In **URL preview**, you are provided with a final link to your landing page. The preview is in real time, so if you fill a domain or URL, you get the preview of the address simultaneously.
5. Confirm the settings by clicking **Apply**.
### Adjust optional settings
---
1. In the **HTTP headers** section, you can add custom HTTP headers to your landing page. In the **Key** and **Value** fields, enter a header and its value, respectively.
2. In the **Customize** section:
- you can add CSS and scripts to your landing page
- you can define the URLs to external sources or paste the snippets
- in the JS section under the **Advanced options** option, to enable tracking users on your landing page, you can paste the [tracking code](/developers/web/installation-and-configuration#adding-the-tracking-code-to-your-site).
### Save your campaign
1. After you make changes to the campaign, you can check the preview. Click the **Preview** button on the upper right side.
2. When your landing page is ready you can **Save it as a draft** or directly click **Publish**.
## Create a mobile push notification
---
In this part of the process, create an mobile push with link to the landing page. You can use a predefined template or create your own template from scratch.
1. Go to **Experience Hub > Mobile > Templates**.
2. You can use the template from the folder or create your own one using the mobile push code editor. Click **New Template > Simple Push**.
2. Create your mobile push in the code editor, and place there the link to the landing page created in the [previous step](#create-a-landing-page). For more information on creating a simple mobile push, visit our [User Guide](/docs/campaign/Mobile/creating-mobile-push).
To ensure that the landing page content is personalized and rendered specifically for the customer who is being redirected, you must pass the UUID of the customer in the link. This can be done by adding `snrs_cl` parameter in the URL in the following ways:
- by adding manually the Jinjava insert that retrieves UUID to the link, for example: `https://your.landingpage.com?snrs_cl={{customer.uuid}}`
- by inserting the link using `{% preparelink %}YOUR_LANDING_PAGE_URL{% endpreparelink %}` tags which automatically adds the `snrs_cl` parameter to the link.
You can read more about customer context in landing pages in ["Establishing customer context" section](/docs/campaign/landing-page/creating-landing-page).
4. **Save** your template.
## Create a workflow
---
In this part of the process, you will create the workflow which sends a mobile push. The workflow will be triggered by the `product.AddToCart` event. The delay is defined up to 1 day. If a customer does not make a transaction within one day, we will send a mobile push with link to the abandoned cart landing page with similar product recommendations.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the trigger node
At this stage, we will configure the conditions that launch the workflow. As a trigger, we will use the **product.addToCart** event.
1. As the first node of the workflow, add **Profile Event**. In the configuration of the node:
1. From the **Choose event** dropdown menu, choose the **product.addToCart** event.
2. Confirm by clicking **Apply**.
### Configure the Delay node
1. Click **Then** and add the **Delay** node. In the node settings:
1. In the **Delay** field, type `1`.
2. From the dropdown list, choose **Day**.
2. Click **Apply**.
### Define the Profile Filter node
---
As the next node, choose **Profile Filter** to check if a customer have made a transaction in the last 24 hours.
1. Click **Then** and add the **Profile Filter** node. In the node settings:
1. From the **Choose filter** dropdown, select the `transaction.charge` event.
3. Set the date range to the last 1440 minutes.
Use 1440 minutes instead of 1 day – use smaller granulation, as in this case 1 day would take the time from current hour till the midnight, so such an analysis would not take into consideration all customers who meet the meet the filter conditions.
2. Click **Apply**.
### Define the Send Mobile Push
1. To the **Not matched** path, add the **Send Mobile Push** node. In the node settings:
1. In the **Mobile push type** section, choose **Simple push**.
2. In the **Content** section, [choose the template you prepared in the previous step](#create-a-mobile-push-notification).
5. In the **Additional parameters** section, you can optionally assign parameters, which will be added to every event generated by this communication.
6. In the **Test** section, you can optionally send a test mobile push.
2. Click **Apply**.
### Add the finishing nodes and set capping
1. Add the **End** nodes after **Send Mobile Push** node and to the **Matched** path after the **Profile Filter** node.
2. In the upper right corner, click **Set Capping** and define the limit of workflows a profile can start:
1. Set **Limit** to 1.
2. Set **Time** to 30 days.
4. Confirm by clicking **Save**.
5. In the upper right corner, click **Save & Run**.
Workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of every element of this process directly in Synerise Demo workspace:
- [Aggregate](https://app.synerise.com/analytics/aggregates/05b3c50d-0a58-3565-9b61-de98d7298446) that returns the list of products from the abandoned cart.
- [Similar Recommendation](https://app.synerise.com/ai-v2/recommendations/Qgt7QWHu35ZB)
- [Landing page](https://app.synerise.com/campaigns/landing-pages/create/16c3b5f0-49ee-4b2b-87ee-3175d582b138:2024-10-02T11:43:09.806646793/content-manager/template/editor?variant=0) with abandoned cart similar recommendations.
- [Workflow](https://app.synerise.com/automations/workflows/automation-diagram/907ad7df-4cbd-45a5-bdb8-2821bb273118) sending a mobile push with the link to the landing page.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 13 events per profile that completes the flow:
[`product.addToCart`](/docs/assets/events/event-reference/items#productaddtocart) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`push.send`](/docs/assets/events/event-reference/mobile-push#pushsend) (~1), [`push.view`](/docs/assets/events/event-reference/mobile-push#pushview) (~1), [`push.click`](/docs/assets/events/event-reference/mobile-push#pushclick) (~1), [`landingpage.visit`](/docs/assets/events/event-reference/landing-page#landingpagevisit) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Automation Hub](/docs/automation)
- [Landing page](/docs/campaign/landing-page)
- [Mobile campaigns](/docs/campaign/Mobile)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Email notification to call center about expensive abandoned cart
You can alert your call center when a customer doesn’t complete a purchase of high value. Send an email alert with their contact details, the products from their abandoned cart and some personalized recommendations for the customer. After your call center receive the email alert, they can contact the customer directly and convince them to finish their purchase.
This use case describes how to prepare an automated workflow that is triggered by customer adding products to a cart exceeding specified value. In response, the workflow sends an email alert to your call center with products that the customer abandoned in the cart and contact data of this customer such as phone number after 48 hours, if they have not made a purchase. One of the challenges addressed in this use case is the use of Email Alert node.
## Prerequisites
---
- [Create an email account](/docs/campaign/e-mail/configuring-email-account).
- [Create an email template](/docs/campaign/e-mail/creating-email-templates) with an alert.
- Implement customer identification [on the website](/developers/web/tracking-form-data) and [in your mobile app](/developers/mobile-sdk/user-identification-and-authorization).
- Implement a custom event for adding a product to cart, which will be available in the customer profile. In this example, the event is called `product.addToCart`. Implement custom events in your [mobile application](/developers/mobile-sdk/event-tracking#product-added-to-cart) or [website](/developers/web/event-tracking#declarative-tracking-custom-events).
## Prepare a workflow
---
Create a workflow which sends an email alert to your call center, after a customer abandons their shopping cart with value exceeding a specific amount. Optionally, you can add additional nodes, depending on your business needs.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Profile Event trigger node
---
At this stage, we will configure conditions that launch the workflow. As a trigger, we will use the `product.addToCart` event.
1. As the first node of the workflow, add **Profile Event**. In the configuration of the node:
1. From **Choose event** dropdown menu, choose `product.addToCart` event.
2. Click the + where button, from the **Choose parameter** dropdown menu, choose **product:price:amount**.
3. From the **Choose operator** dropdown, choose **Number**, and then select **More or equal to**.
4. In the next field, type the price amount of the items.
2. Confirm by clicking **Apply**.
Configuration of the Profile Event node
### Configure the Event Filter node
---
This node will set the workflow to wait for 48 hours for customer conversion (`product.buy`). If the purchase occurs, then the workflow ends. If it doesn't happen, the workflow moves on because the customer meets the abandoned cart scenario. This setting is just an example and can be configured according to your business needs.
1. As the next node, add **Event Filter**. In the configuration of the node:
1. In the **Check** field, from the dropdown menu choose **for period of time**.
2. Set the time range. In our case, it is 48 hours.
3. In the **Define conditions** section, from the **Choose event** dropdown menu, choose `product.buy` event.
4. Click the + where button and from **Choose parameter** dropdown menu, choose **product:price:amount**.
5. From the **Choose operator** dropdown, choose **Number**, and then select **More or equal to**.
6. In the next field, type the price amount of the items, the same as in the previous step.
4. Confirm by clicking **Apply**.
5. For the **Matched** path, add the **End** node.
### Configure the Email Alert node
---
1. To the **Not matched** path, add **Email Alert**. Configure according to your business needs.
2. Define Content:
1. In the **Template for content** field, select an alert email template prepared earlier.
2. In the **Subject** field, enter your message subject.
3. In the **Recipent** section, create a list of call center recipients of the alert email.
4. Confirm by clicking **Apply**.
You need to enrich your email template with customer's contact data and with the data of the product from their abandoned cart. Use [customer attributes inserts](/developers/inserts/insert-usage#customer-attributes) to enrich template with customer's information such as phone number, email address etc. Use [automation inserts](/developers/inserts/automation#event-parameters) to insert the product the customer abandoned in their cart.
You can also include 5 last seen products by this customer, and 5 products from personalized recommendations. Check this [use case](/use-cases/saving-abandoned-carts-using-dynamic-email-recommendations) for inspiration.
### Add the finishing node
---
9. Add the **End** node.
10. In the upper right corner, click **Save & Run**.
The workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
You can also check the [workflow configuration](https://app.synerise.com/automations/workflows/automation-diagram/39f6f5ac-fb0b-4195-8875-c474754a2f8f) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 6 events per profile that completes the flow:
[`product.addToCart`](/docs/assets/events/event-reference/items#productaddtocart) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1).
## Read more
---
- [Creating email templates](/docs/campaign/e-mail/creating-email-templates)
- [Creating workflows](/docs/automation/creating-automation)
# AI recommendations in blog posts
Blogging enables you to reach your target group in an easier way than other conventional marketing channels. Preparing articles connected with your offer can promote your products or brand, attract an audience, and establish you as an authority in the field.
If you have a blog with a lot of readers, there may be a great opportunity to boost revenue because you can implement recommended products below your blog posts or inside them and make it easier to find the products that engage readers.
This use case describes how to enrich a blog with recommendations of outdoor running shoes suitable for specific terrains. The output of the use case are two separate frames which present the following recommendations:
- Bestselling road racing shoes - the filters of the recommendation use custom `surface` attribute set to `asphalt`.
- Bestselling trail racing shoes - the filters of the recommendation use custom `surface` attribute set to `off-road`.
AI recommendations in a blog post
## Prerequisites
---
- Implement a [tracking code](/developers/web/installation-and-configuration#creating-a-tracking-code) to the blog.
- [Import a product feed](/use-cases/import-product-feed-to-catalog).
## Process
---
In this use case, you will go through the following steps:
1. [Preparing AI recommendations](/use-cases/ai-recommendations-blog-post#prepare-ai-recommendations).
2. [Create dynamic content campaign](/use-cases/ai-recommendations-blog-post#create-dynamic-content).
## Prepare AI recommendations
---
As the first part of the process, create two separate AI recommendations:
- Bestselling racing shoes suitable for running on asphalt
- Bestselling racing shoes suitable for running off-road
The recommendations will differ only in the filter conditions.
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation (it is only visible on the list of recommendations).
3. In the **Type & Items feed** section and click **Define**.
4. From the **Items feed** dropdown list, select a product feed that has a trained model.
5. Select the **Top products** recommendation type.
Selected type and product feed of the recommendation
6. In the **Items** section, click **Define**.
7. Click **Add slot**.
8. Click the **Unnamed slot** that was created.
8. Define the minimum and maximum number of products displayed in the frame according to your needs.
9. In the settings of the **Static filters**:
- For the bestselling racing shoes suitable for running on asphalt:
Configuration of static filters for racing shoes suitable for running on asphalt
- For the bestselling racing shoes suitable for running off-road:
Configuration of static filters for racing shoes suitable for running off-road
10. In the **Additional settings**, click **Define**.
11. From the **Sort metric** dropdown list, select **Conversion Percent in the last 30 days**.
A metric that arranges the order of the items in the recommendation according to the conversion percentage
12. Click **Save**.
13. Create the second recommendation. Repeat the steps.
## Create dynamic content
---
Create two sets of dynamic content to insert the recommendations on your blog. The first set will use in the dynamic content template the AI recommendation that contains bestselling racing shoes suitable for running on asphalt, the other bestselling racing shoes suitable for running off-road. Apart from that, you will put them in different blog posts.
If you don’t want to use dynamic content, you can retrieve recommendations through API, [using this method](https://hub.synerise.com/api-reference/ai-recommendations#operation/GetRecommendationsByCampaignV2)
1. Go to **Experience Hub > Dynamic content > Create new**.
2. Enter the name of the dynamic content.
1. Choose **Insert Object** type.
2. As the audience, select **everyone**.
3. In the **Content** section, select **Simple message**, and specify the CSS selector where you want to insert recommendations.
4. In the **Content** tab, click **Create Message**.
5. In the code editor, insert Jinjava with the AI recommendation and add your own CSS.
Click to see Jinjava
Replace `your_campaign_ID` with the ID of the AI recommendation (either of the bestselling shoes suitable for asphalt or off-road). The ID of the AI campaign is contained in the URL of the recommendation.
<!-- Downloading the AI campaign --> {% recommendations3 campaignId=your_campaign_ID %} {% for p in recommended_products3 %} <li data-snr-ai-product-id="{{p.itemId}}"> <a class="snrs-AI--item-link" href="{{p.link}}" title="{{p.title}}"> <img src="{{ p.imageLink }}"class="products-slider__item-image snrAI-product-image snrAI-product-image-{{p.itemId}}" width="90" alt="{{p.title}}" id="snrAI-image-{{p.itemId}}"> <h3 class="snrs-AI-product--product-name"> <span class="snrs-AI-product--name-first">{{p.title}}</span> </h3> <span class="snrs-AI-product--series">{{p.attributes.series}}</span> </a> </li> {% endfor %} {% endrecommendations3 %}
8. Save the template.
5. In the **Schedule** section, select the date when the dynamic content is activated.
6. In **Display settings**, configure the settings:
- **Triggers** set to **On landing**.
- Leave **Delay** at default.
- In the **Page targeting** section, select **Others**:
- Under **Display on pages** banner, click **Add rule**.
- From the dropdown list, select **Page containing URL**.
- In the text field, enter the link to your blog post.
- Leave the rest of the settings at default.
Display settings
6. Confirm by clicking **Apply**.
7. In the **UTM & URL parameters** section, click **Skip step**.
8. Activate the dynamic content.
9. Create the second dynamic content template to display the recommendations with the other group bestselling shoes for specific terrain. Repeat all the steps.
**Result**: The recommendation frames are displayed at the URLs with the blog posts.
## Generated events
This use case generates approximately 8 events per profile that completes the flow:
[`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~2), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~2), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1), [`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~2), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1).
## Read more
---
- [API Recommendations](https://hub.synerise.com/api-reference/ai-recommendations#tag/Recommendations)
- [Dynamic content campaigns](/docs/campaign/dynamiccontent)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Transform and import product data to a catalog
In this use case, we will focus on the process of importing and transforming product data from an `.XML` file using data transformation. This method of data transformation is beneficial as it eliminates the need for the data to be in a predetermined, structured format.
In this use case, we will make the following modifications to the file:
- Add 2 new columns:
- **discounted**: this column will contain the `true` value for all products which have a value (price) assigned in the `g:sale_price` column.
- **percentage_discount**: this column contains the percentage value of the discount based on `g:price` and `g:sale_price` columns.
- Edit values:
Replace the value of `g:availability` column from `1`/`0` to `in stock`/`out of stock`.
## Input data in use case
---
In this use case, we use two files:
- the complete `.XML` file in the Google Merchant Format which contains the full set of products. The file contains the following attributes: `g:id,g:title,g:description,g:image_link,g:price,g:sale_price,g:availability`.
- the sample of the product data in the `.XML` format.
To reproduce this scenario in your workspace, [create a catalog](/docs/assets/catalogs/creating-catalogs) and prepare the files.
If your product data is complete, you can skip transforming data. But if you need to modify the file with product data before an import to Synerise, you can modify the data in **Automation > Data Transformation**. To do so, create a sample of your product data and include all attributes you want to modify. If you miss the attributes in the sample file, but import the actual product data with them, the data will be imported as delivered in the actual file.
Example XML file
```xml
Your Store Name
https://www.yourstore.com
Your Store with clothes1Shirtwhite cotton shirt with a round neckhttps://www.yourstore.com/product-1https://www.yourstore.com/product-1-image.jpg19.9910.9912Jeansblue cotton jeanshttps://www.yourstore.com/product-2https://www.yourstore.com/product-2-image.jpg29.9920.990
```
## Process
---
In this use case, you will go through the following steps:
1. [Create a data transformation rule](/use-cases/import-xml-file#create-a-data-transformation) to transform the data in the sample file.
2. [Create a workflow](/use-cases/import-xml-file#create-a-workflow) to import the .`XML` file to Synerise.
## Create a data transformation
---
In this part of the process, you define the rules of modifying data before sending it to the Synerise based on the sample file. Each of the following sub-steps describes the individual changes performed on the file.
We will add follwing rules:
- Add 2 new columns:
- **discounted**: this column will contain the `true` value for all products which have a value (price) assigned in the `g:sale_price` column.
- **percentage_discount**: this column contains the percentage value of the discount based on `g:price` and `g:sale_price` columns.
- Edit values:
Replace the value of `g:availability` column from “1/0“ to “in stock/out of stock“
1. Go to **Automation Hub > Data Transformation > Create transformation**.
2. Enter the name of the transformation.
3. Click **Add input**.
Before you proceed with selecting sample data and defining transformation rules, optionally, you can select a goal to help you structure the data. If you want to create a transformation diagram without a specific goal and you know the structure of the output data, skip this step.
Goals will suggest you the required data for the import into Synerise.
### Add file with sample data
This node allows you to add a data sample. In further steps, you define how the data will be modified. Later, when [this transformation is used in the Automation workflow](/docs/automation/operation/data-transformation-node), the system uses the rules created for the sample data as a pattern for modifying actual data.
1. On the canvas, click the **Add input** node.
2. On the pop-up, click **Upload a new file** or drag one here.
3. Upload the `.XML` file created as the part of prerequisites.
4. You can preview the file, then click **Apply**.
### Add the new column
7. On the **Data Input** node, click the grey dot.
8. From the dropdown list, select **Add column**.
9. Click the **Add column** node.
10. In the configuration of the node:
1. In the **Add column** field, enter the name of the column. In this use case, it's `discounted`.
3. From the dropdown list, select **Dynamic value**.
4. In the **Type value** box, add the Jinja code, which adds the `true` value for all products with `g:sale_price` attribute in this new column. You can use the code presented below:
{% if root["g:sale_price"] is defined %}true{% endif %}
5. Leave **Handle incomplete data** at default (**Skip row if error occurred**) to skip missing or invalid data which may occur during transformation.
7. Confirm by clicking **Apply**.
### Add the new column
7. On the **Add column** node, click **THEN**.
8. From the dropdown list, select **Add column**.
9. Click the **Add column** node.
10. In the configuration of the node:
1. In the **Add column** field, enter the name of the column. In this use case, it's `percentage_discount`.
3. From the dropdown list, select **Dynamic value**.
4. In the **Type value** box, add the Jinja code, which counts the percentage value of the discount based on `g:price` and `g:sale_price` attributes and adds it to this new column. You can use the code presented below:
{% if root["g:sale_price"] is defined %}{{ root["g:sale_price"]*100/root["g:price"] }}{% endif %}
5. Leave **Handle incomplete data** at default (**Skip row if error occurred**) to skip missing or invalid data which may occur during transformation.
7. Confirm by clicking **Apply**.
### Edit values
7. On the **Add column** node, click **THEN**.
8. From the dropdown list, select **Edit values**.
9. Click the **Edit values** node. In the configuration of the node:
1. Click **Add rule**.
2. Click **Add column**.
3. From the dropdown list, select column name, in this case it's `g:availability`.
4. Set the **Edit values** values option to:
1. **Replacing**
2. **Dynamic value**.
4. In the **Type value** field, enter the Jinja code which replaces the value of `g:availability` attribute from `1` and `0` to `in stock`/`out of stock`. You can use the code presented below:
{% if root['g:availability'] == 1 %}in stock{% else %}out of stock{% endif %}
5. Leave **Handle incomplete data** at default (**Skip row if error occurred**) to skip missing or invalid data which may occur during transformation.
7. Confirm by clicking **Apply**.
### Add the finishing node
This node lets you preview the output of the modifications to the sample data.
1. On the **Edit values** node, click **THEN**.
2. From the dropdown list, select **Data Output**.
3. To preview the results, click the **Data Output** node.
The preview of modifications to the file
4. Close the preview
3. In the upper right corner, click **Save and publish**.
**Result**:
The diagram of data transformation
## Create a workflow
---
The scenario for this use case describes a one-time import of the `.XML` file with a product database to Synerise.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the launch date
3. As the trigger node, add **Scheduled Run**.
4. In the configuration of the node:
1. Change the **Run trigger** option to **one time**.
2. Select **Immediately**.
3. Confirm by clicking **Apply**.
The configuration of the Scheduled Run node
### Select file to import
1. Add a **Local File** node.
2. In the configuration of the node:
1. Upload the file.
2. Confirm by clicking **Apply**.
Local File transfer
### Add data transformation node
1. Add a **Data Transformation** node.
2. In the configuration of the node:
1. Choose the name of the data transformation, which you have created in the [previous part of the process](/use-cases/import-xml-file#create-a-data-transformation).
2. Confirm by clicking **Apply**.
Data Transformation node
### Add import to catalog
1. On the **Data Transformation** node, click **THEN**.
2. From the list that opens, select **Synerise > Import to Catalog**.
3. Open **Import to Catalog** node.
4. Choose the catalog from the list.
5. As a primary key, choose `g:id` parameter.
5. Click **Apply**.
### Add the finishing node
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
The workflow configuration
You can monitor the flow of the workflow in the **Transformation logs** tab. It contains information about the execution of the workflow.
The logs for the workflow
## Check the use case set up on the Synerise Demo workspace
---
You can check the [data transformation](https://app.synerise.com/automations/data-transformation/baebb542-133f-4e13-9d18-29fdaef74fc8) and [automation process](https://app.synerise.com/automations/workflows/automation-diagram/4ccfae2d-3525-4cba-a7dc-0615e3f96cf3) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per workflow execution:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Data Transformation](/docs/automation/data-transformation-and-imports)
- [Data Transformation node](/docs/automation/operation/data-transformation-node)
```
# Content personalization in an external tool on the example of e-point CMS
Personalization refers to the process of tailoring experiences, products, and services to the unique needs and preferences of individual customers. By using large amounts of data and technology to analyze it accurately, we can gain an understanding of each cusotomer's behavior, preferences, and characteristics. Such knowledge allows companies to deliver an engaging and valuable personalized experience to each customer.
Implementing personalization on a website can bring many benefits. First, it can improve the customer experience by providing personalized content and recommendations that are tailored to each customer's interests and preferences. This can lead to increased engagement and loyalty as customers feel more valued and understood by the business.
Second, personalization can also lead to increased revenue by driving more sales and higher customer lifetime value. By providing personalized product recommendations and offers, companies can encourage customers to make repeat purchases and continue to engage with the brand over time.
Third, personalization can also lead to cost savings by reducing the need for broad, one-size-fits-all marketing campaigns. By targeting specific customer segments with personalized messages and offers, companies can achieve higher conversion rates and lower customer acquisition costs.
This use case describes the process of sending customers segmentations using tracking code and API to an external tool - CMS. Based on the acquired customer segmentations created in Synerise, we can tailor content and offers to each customer group to meet their needs and expectations.
## Prerequisites
---
- Implement a [tracking code](/developers/web/installation-and-configuration) into your website.
- Generate a Workspace [API key](/docs/settings/tool/api) with the following permission: `ANALYTICS_BACKEND_SEGMENTATIONS_LIST_READ`
## Process
---
In this use case, you will go through the following steps:
1. [Create a segmentation](/use-cases/content-personalization-CMS#create-a-segmentation).
2. [Get all segmentations for clients](/use-cases/content-personalization-CMS#get-all-segmentations-for-client).
## Create a segmentation
---
In this step, you can create any customer segmentation for which you will personalize content/offers on your site. In our case, we will create a segmentation of heavy buyers based on the RFM analysis. You'll find a detailed process for creating the RFM analysis in [this use case](/use-cases/rfm-analysis).
The segmentation shown in this use case is just an example. You can create any other segmentation that meets your specific business needs.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segment.
3. Choose **Add condition** and find the RFM segmentation. For detailed steps on how to create an RFM segmentation, refer to [this section](/use-cases/rfm-analysis#create-a-rfm-segmentation) of the process of creating RFM analysis.
4. Select the **Equal** operator and in the right field enter the name of the segment that defines the heavy buyers. In our case, we type - `Heavy Buyers`
5. Save the segmentation.
Segmentation settings
## Get all segmentations for client
---
In this part of the process, you will get all the customer segmentations from Synerise to use them for content personalization from within your external tool - CMS in our case.
We will also provide a code sample, the task of which is to replace the title content on the page if the customer belongs to a certain segmentation. However, before implementing the code, there are a series of requests you need to perform. These requests will help determine whether the customer belongs to the segmentation that we have chosen as the condition for displaying the personalized header.
Completing this procedure requires some knowledge on sending API requests using cURL, Postman, or similar tools.
1. Acquire API authorization token by using [Log in as Workspace](https://hub.synerise.com/api-reference/profile-management#operation/profileLogin) endpoint. Use it to authorize later calls to the API.
See an example of a cURL request
curl --request POST --url https://api.synerise.com/uauth/v2/auth/login/profile --header 'content-type: application/json' --data '{"apiKey":"64c09614-1b2a-42f7-804d-f647243eb1ab"}'
2. Get all defined segmentations by list, using [List segmentations](https://hub.synerise.com/api-reference/analytics-suite#tag/Analytics-v2) endpoint.
See an example of a cURL request
curl --request GET --url 'https://api.synerise.com/analytics/%7Bnamespace%7D/segmentations?page=SOME_NUMBER_VALUE&limit=SOME_NUMBER_VALUE&search=SOME_STRING_VALUE&sortBy=SOME_STRING_VALUE' --header 'Authorization: Bearer _YOUR_JWT_TOKEN_'
3. Pick which segmentations from above call response are relevant and see if the client is in them by using [Check if profile in segmentations](https://hub.synerise.com/api-reference/analytics-suite#operation/analytics2-segmentation-check) endpoint.
See an example of a cURL request
4. Show part of your web frontend based on your segmentations.
Below we present an exemplary React code that renders component that displays a secondary title if a specific profile ID is present in an array of segmentations. Remember to communicate with the Synerise API in your backend and pass segmentations to the frontend.
The presented React code is just an example. You can use any other method to render your content.
function renderPersonalizedMessage(props) {
const segmentations = props.segmentations;
return (
<div>
<h1>Hello!</h1>
{segmentations.includes("a8b2ed5c-c342-436f-a98e-eca642767926") &&
<h2>Discover our new offer!.</h2>}
</div>
);
}
**Below you will find a sequence diagram to help you better understand the communication flow between e-point CMS and Synerise.**
Communication flow diagram
## Explore the content configuration process in e-point CMS
---
Below, you'll find screenshots from e-point CMS that demonstrate the configuration of various platform elements.
- Below are screenshots showcasing the e-point visual builder. In the first screenshot, you can see a component created specifically for a specified customer segment.
e-point CMS Visual Builder with defined component
- In the following screenshot, the same page is displayed, but the component is hidden and will only be shown to customers outside of the predefined segment.
e-point CMS Visual Builder with hidden component
- The screenshot displayed below presents the configuration panel for the component.
e-point CMS component configuration panel
- The screenshot below provides a view of the list of e-point CMS segmentations that were obtained from Synerise.
e-point CMS segmentation list
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of [segmentation](https://app.synerise.com/analytics-v2/segmentations/a8b2ed5c-c342-436f-a98e-eca642767926) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case does not generate any events.
## Read more
---
- [e-point CMS](https://www.e-point.com/products/e-point-cms)
- [API keys](/docs/settings/tool/api)
- [API references](https://hub.synerise.com/api-reference)
- [Segmentations](/docs/analytics/segmentations)
- [Synerise API](/developers/api)
# Brickworks loyalty template with tiered offer
Delivering personalized and context-aware communication often requires combining behavioral insights with dynamically evaluated logic.
[Brickworks](/docs/assets/brickworks) allows you to define a communication template that can dynamically assign the most relevant loyalty offer for each customer based on their browsing behavior.
In this use case, you will create a schema that enables an email template to return a specific loyalty offer based on an evaluated expression. This supports a next best offer (NBO) approach, where each customer receives the most relevant promotion determined by their behavior. The expression analyzes the price range of the products they viewed and assigns them to one of three predefined tiers. Based on the tier result, customers can automatically receive an email containing the loyalty offer that best matches their browsing behavior.
## Prerequisites
---
- Implement a [tracking code](/developers/web/installation-and-configuration) into your website.
- Implement the [transaction events](/developers/web/transactions-sdk) using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- Prepare a tier-based loyalty offer.
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate](#create-an-aggregate) that will return last visited product price.
2. [Create segmentations](#create-segmentations) of customers qualifying for one of the three offer tiers.
3. [Create an expression](#create-an-expression) that returns information on tier which the customer qualifies for.
4. [Create a schema](#create-a-schema) with offer based on the expression result.
5. [Create records](#create-records).
6. [Create an email campaign](#create-an-email-campaign) based on the brickworks schema, using our predefined email template.
## Create an aggregate
---
In this step, create an aggregate that returns the price of the last visited product. The result of the aggregate will be used in segmentations determining tiers in the offer.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last**.
5. From the **Choose event** dropdown list, select the `page.visit` event.
6. As the event parameter, select **price**.
7. Click the **+ where** button.
8. From the **Choose parameter** dropdown list, select **price** once again.
9. From the **Choose** dropdown list, select **String** and the **Is not empty** operator.
7. Set the period from which the aggregate will analyze the results, in our case **Last 30 days**.
12. Save the aggregate.
Aggregate that returns the price of the last visited product configuration
## Create segmentations
---
Based on the [aggregate created in the previous step](#create-an-aggregate), create three segmentations of customers qualifying for one of the three next best offer tiers - Low Cost, Advantage, or All Inclusive.
### Low cost tier segmentation
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation.
1. Click **Add condition**.
2. Select the [aggregate created in the previous step](#create-an-aggregate).
3. From the **Choose** dropdown list, select **Number** and the **Less or equal to** operator.
4. In the text field, enter `300` as the upper limit of this tier.
5. Click **Save**.
Segmentation that returns customers meeting the conditions of the low cost tier
### Advantage tier segmentation
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation.
1. Click **Add condition**.
2. Select the [aggregate created in the previous step](#create-an-aggregate).
3. From the **Choose** dropdown list, select **Number** and the **Less than** operator.
4. In the text field, enter `700` as the upper limit of this tier.
5. Click **Add condition**.
2. Select the [aggregate created in the previous step](#create-an-aggregate).
3. From the **Choose** dropdown list, select **Number** and the **More than** operator.
4. In the text field, enter `300` as the lower limit of this tier.
5. Click **Save**.
Segmentation that returns customers meeting the conditions of the advantage tier
### All inclusive tier segmentation
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation.
1. Click **Add condition**.
2. Select the [aggregate created in the previous step](#create-an-aggregate).
3. From the **Choose** dropdown list, select **Number** and the **More or equal to** operator.
4. In the text field, enter `700` as the upper limit of this tier.
5. Click **Save**.
Segmentation that returns customers meeting the conditions of the all inclusive tier
## Create an expression
---
In this step, create an attribute expression that evaluates the customer's last visited product price and assigns it to the appropriate offer segment. The expression checks whether the profile meets the criteria for the Low Cost, Advantage, or All Inclusive NBO segmentation categories and returns the corresponding offer label. This expression will be later used in the schema.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression.
3. Set the **Expression for** option to **Atribute**.
4. Click **Select** and from the **Function** dropdown list, choose **To string**.
5. Click **Select** in the brackets, and from the **Function** dropdown list, choose **If**.
6. Click the first **Select** in the brackets, and pick **Profile**.
1. Click the **0** node that appeared on the canvas.
3. Scroll down the page and click **Choose attribute**.
4. From the dropdown list, select the [low cost tier segmentation you created earlier](#low-cost-tier-segmentation).
7. Click the second **Select** in the brackets, and pick **Constant**.
1. Click the **0** node that appeared on the canvas.
3. Scroll down the page and type `Low Cost Offer` in the field.
8. Click the third **Select** in the brackets, and from the **Function** dropdown list, choose **If**.
9. Click the first **Select** in the brackets, and pick **Profile**.
1. Click the **0** node that appeared on the canvas.
3. Scroll down the page and click **Choose attribute**.
4. From the dropdown list, select the [advantage tier segmentation you created earlier](#advantage-tier-segmentation).
10. Click the second **Select** in the brackets, and pick **Constant**.
1. Click the **0** node that appeared on the canvas.
3. Scroll down the page and type `Advantage` in the field.
11. Click the third **Select** in the brackets, and from the **Function** dropdown list, choose **If**.
12. Click the first **Select** in the brackets, and pick **Profile**.
1. Click the **0** node that appeared on the canvas.
3. Scroll down the page and click **Choose attribute**.
4. From the dropdown list, select the [all inclusive tier segmentation you created earlier](#all-inclusive-tier-segmentation).
13. Click the second **Select** in the brackets, and pick **Constant**.
1. Click the **0** node that appeared on the canvas.
3. Scroll down the page and type `All inclusive` in the field.
14. Click the thirds **Select** in the brackets, and pick **Constant**.
1. Click the **0** node that appeared on the canvas.
3. Scroll down the page and type `null` in the field.
15. Click **Save**.
Expression that returns information on tier which the customer qualifies for.
## Create a schema
---
In this section, you will configure a [Brickworks schema](/docs/assets/brickworks/quick-start/creating-a-schema) with fields for offer information.
1. Go to **Data Modeling Hub > Schemas > New schema**.
2. Choose **Simple Schema**.
3. In **Display name**, enter a name for the schema, for example **Telco offers**. **API names** value is pre-filled with the value from **Display name**. The value in this field is the unique identifier used to reference this schema in API requests.
4. Optionally, add the **Description**.
### Add the Offer title
1. Click **Add new field** and choose **String**.
3. Complete the fileds:
- Add the **Display name** for the field in our case `Offer title`.
- The **API name** will be pre-filled automatically.
- **Description** is optional, in our case `Presents offer title to be displayed for customer`.
4. In **Settings**, select **Use as record title**.
5. Click **Apply** to save your changes.
Schema configuration
### Add the Offer image
1. Click **Add new field** and choose **Image**.
3. Complete the fileds:
- Add the **Display name** for the field in our case `Offer image`.
- The **API name** will be pre-filled automatically.
- **Description** is optional, in our case `image of the offer`.
5. To save your changes, Click **Apply**.
### Add other descriptive fields
1. Click **Add new field** and choose **String**.
3. Complete the fileds:
- Add the **Display name** for the field.
- The **API name** will be pre-filled automatically.
- **Description** is optional.
5. To save your changes, click **Apply**.
In this use case, we add the following **String** fields:
- `Offer short description` - describes the purpose of the offer,
- `Package conditions` - minutes, internet packages description,
- `Promotion for new subscribers` - new subscribers only - promotion information.
### Add the Price
1. Click **Add new field** and choose **Number**.
2. Choose **Float** to let users type real numbers, also numbers which contain fractional or decimal parts.
3. Complete the fileds:
- Add the **Display name** for the field in our case `Price`.
- The **API name** will be pre-filled automatically.
- **Description** is optional, in our case `monthly price for offer in Euro`.
5. To save your changes, click **Apply**.
### Add the Number of months
1. Click **Add new field** and choose **Number**
2. Choose **Integer** to let users type in a whole number that can be positive, negative, or zero, but does not include any fractional or decimal part.
3. Complete the fileds:
- Add the **Display name** for the field in our case `number of months`. the **API name** will be pre-filled automatically. **Description** is optional, in our case `Number of contracted months. -1 equals that the offer has no contract engagement`.
4. In **Settings**, check **Dafault value** and type `-1`
5. To save your changes, click **Apply**.
Brickworks configuration
### Add the Expression
5. Click **Add new field** and choose **Expression**.
3. Complete the fileds:
- Add the **Display name** for the field in our case `qualified offer`.
- The **API name** will be pre-filled automatically.
- **Description** is optional, in our case `informs about offer which qualifies for client`.
4. Choose the [expression created in the previous part of the process](#create-an-expression) from the list.
5. To save your changes, click **Apply**.
### Add the Jinjava code
5. Click **Add new field** and choose **Jinjava code**
3. Complete the fileds:
- Add the **Display name** for the field in our case `display offer`.
- The **API name** will be pre-filled automatically.
- **Description** is optional, in our case `informs if offer should be displayed`.
4. Use jinjava code:
{% if record.offerTitle == record.qualifiedOffer %}true{% else %}false{% endif %}
5. To save your changes, click **Apply**.
### Set up the Audience & Settings
1. Click the **Audience & Settings** tab.
2. In the **Audience** section, click **Define**.
3. Choose the schema recipients according to your needs, in our case choose **Everyone**.
4. Click **Apply**.
5. In the upper-right corner, click **Save**
## Create records
---
[Creating a record](/docs/assets/brickworks/quick-start/creating-a-record) means adding the data to the schema. It means that you fill out schema fields. In this case, these are examples of telecommunications offers - one of the three next best offer tiers - Low Cost, Advantage, or All Inclusive.
1. Go to **Data Modeling Hub > Data collections > Select schema**.
2. Choose [schema created in the previous step](#create-a-schema).
3. In the upper-right corner, click **New record**. We will create three records in total, for each of the tiers.
4. Add a name for the record.
5. Add a slug for the record. Slug is a unique, URL-friendly version of the name. It usually contains only lowercase letters, numbers, and hyphens.
6. Add **Offer title**.
7. Add coresponding **Offer image**, **Offer short description**, **Package conditions**, **Price**, **Number of months**, **Promotion for new subscribers**.
8. Everything in **Qualified offer** section shouold be pre-filled with data provided in the schema.
9. In the upper-right corner, click **Publish** to publish your record.
10. Repeat steps **3-9** for two remaining tiers.
### Previewing records
After saving the record either as a draft (in case of records created based on versioned schemas) or publishing it (in case of both schema types), you can [preview the record for the context of a selected user](/docs/assets/brickworks/quick-start/creating-a-record#previewing-records). This context-driven approach enables your records to adapt dynamically based on the requesting application, user session, or any external factors you define.
1. In **Data Modeling Hub > Data collections**.
2. In the header, from **Select schema** dropdown list, select the [schema created in the previous step](#create-a-schema).
3. Find the record which you want to preview.
4. Enter the record configuration.
5. Click **Preview**.
6. Click **Preview contexts**.
7. From the dropdown list, find a profile for which you want to generate record preview. This means the same record can render completely differently depending on the context you provide.
Record results for an example profile
8. You can also see the preview as JSON.
JSON record results for an example profile
## Create an email campaign
---
In this part of the process, you [create an email campaign](/docs/campaign/e-mail/creating-email-campaigns). We will use a predefined template, so there is no need to create a template from scratch.
1. Go to **Experience Hub > Email campaign > Create new**.
2. Enter the name of the email campaign.
3. In the **Audience** section, define the recipents of your campaign according to your business needs.
### Define content
---
In this part of the process, you will create the content of the email message that returns information on tier which the customer qualifies for, with the help of ready-made template.
1. Click **Define** in the **Content** section.
2. From the dropdown in the **From email address** section, select the email account from which the email will be sent.
2. In **Subject**, provide the subject of the email.
3. Click **Create message** and from the list of template folders, select **Predefined templates**.
3. Select the **Brickworks: Telco offer** template.
**Result:** You are redirected to the code editor.
You can edit the template in two ways, by editing the code of the template [add snippets](/docs/campaign/e-mail/creating-email-templates/email-code-editor#adding-a-snippet-to-the-template-code), [add variables](/docs/campaign/e-mail/creating-email-templates/email-code-editor#adding-a-variable) and/or by filling out the form in the Config tab. In this use case, we will use the capabilities of the predefined Config tab.
#### Edit form in the Config tab
---
The form in the **Config** tab is already filled in with default values. You can keep them or change them to fit your business needs.
Email template configuration
1. To the **Schema ID** field, add the ID of the [schema created in the previous part of the process](#create-a-schema).
2. To the following fields, add the ID of the [records created in the previous part of the process](#create-records). You can find the ID of the record in the record URL:
- **Record ID - Low cost offer**,
- **Record ID - All inclusive**,
- **Record ID - Advantage** fields**,
3. Optionally, you can edit the copy and design of the template.
10. After you make changes to the template, you can check the preview.
1. Click the **Preview** button on the upper left side.
2. Enter the ID of a customer.
3. Click **Apply**.
11. If the template is ready, in the upper right corner click **Save as...**.
12. On the pop-up:
1. In the **Template name** field, enter the name of the template.
2. From the **Template directory** dropdown list, select the folder where the template will be saved.
3. Confirm by clicking **Save**.
13. To continue the process of configuring the email campaign, click **Next**.
14. To save your content changes, click **Apply**.
### Prepare the final settings
1. In the **Schedule tab**, decide when your email is sent.
3. Optionally:
1. In the **UTM & URL parameters** section, add the parameters to track the email performance.
2. In the **Additional parameters** section, add the custom event parameters with constant values to the automatically generated events in the email channel.
3. In the **Test** section, you can send a test email of your message to verify if the content of the email is displayed correctly.
3. If everything is ready, click **Send**.
## What's next
---
After defining this schema, you can reuse the template across other placements as needed. It can be applied in emails, in-apps, or any additional surfaces supported by your setup.
## Check the use case set up on the Synerise Demo workspace
---
In Synerise Demo workspace, you can check the configuration of:
- [Aggregate](https://app.synerise.com/analytics-v2/aggregates/861fd984-a278-3ff9-aefa-58db40fc21c2)
- [Low cost tier segment](https://app.synerise.com/analytics-v2/segmentations/f71be786-8147-4dd3-8099-76434865e284)
- [Advantage tier segment](https://app.synerise.com/analytics-v2/segmentations/680bb059-2ce0-4990-b380-39b1bdc932e6)
- [All inclusive tier segment](https://app.synerise.com/analytics-v2/segmentations/e377294f-8e6a-42c7-9851-f0eff8a794d8)
- [Expression](https://app.synerise.com/analytics/expressions/f7afae27-ad5a-4faf-afe0-ec32f7a89dcd)
- [Brickwork schema](https://app.synerise.com/assets/brickworks/schemas/37ef59a6-710d-494f-b8c6-f67fd873a77d)
- [Email campaign](https://app.synerise.com/campaigns/email/create/de4862a7-5e5b-4398-acbe-d907bf5ae477)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 6 events per profile that completes the flow:
[`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1), [`brickworks.generated`](/docs/assets/events/event-reference/brickworks#brickworksgenerated) (~3).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Brickworks](/docs/assets/brickworks)
- [Email campaigns](/docs/campaign/e-mail)
- [Expressions](/docs/crm/expressions)
- [Segmentation](/docs/analytics/segmentations)
# Display list of available coupons in a mobile app
In this use case, you can easily set up a list of available promotions inside your mobile app, shown to the user after selecting the My Promotions section. All you need is an in-app campaign targeted to all users, with the display of the promotions list triggered by tapping that section.
You can adjust the copy and other elements directly in the template, since the entire setup is based on predefined in-app templates that are simple to adapt.
## Prerequisites
---
- Create an [item catalog](/docs/assets/catalogs).
- Integrate Synerise [mobile SDK](/developers/mobile-sdk) in your mobile application.
- Implement the [transaction events](/developers/web/transactions-sdk) using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- Implement [basic loyalty program with points](/use-cases/loyalty-programs-basics).
- [Integrate Synerise promotions](/docs/ai-hub/promotions/introduction-to-promotions).
## Implement a promotions catalog template
---
This template provides an in-app catalog of coupons that can be redeemed with points. You can:
- Display the list of coupons available
- Show possibility to copy the code
### Create an in-app message
---
In this part of the process, you create an in-app campaign triggered by your custom event.
The trigger should come from a dedicated event generated by your mobile application — for example, an action such as tapping the ‘My promotions’ button. This ensures that the in-app is displayed only when the user intentionally requests it.
1. Go to **Experience Hub > In-app messages> Create in-app**.
2. Enter the name of the in-app.
### Define the audience
---
As the first step, define the target group of customers for the in-app message.
1. In the **Audience** section, click **Define**.
4. Click **Everyone**.
8. To save the audience, click **Apply**.
### Define content
---
In this part of the process, you will create the content of the in-app message that will appear in the mobile application with the help of ready-made template.
The template is designed so that the user can copy a specific coupon to the clipboard and paste it later in the checkout in the appropriate field.
1. In the **Content** section, click **Define**.
2. Click **Create message** and from the list of template folders, select **Predefined templates**.
3. Select the **Promotions catalog** template.
**Result:** You are redirected to the code editor.
You can edit the template in two ways, by editing the code of the template ([add snippets](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-snippet-to-the-template-code), [add variables](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-variable) and/or by filling out the form in the Config tab. In this use case, we will use the capabilities of the predefined Config tab.
In-app configuration
#### Edit form in the Config tab
---
The form in the **Config** tab is already filled in with default values. You can change them to fit your business needs.
This template automatically pulls all active promotions from your promotion list in which the customer fits the defined audience. To make sure the more important promotions appear first for the user, adjust their priority. Here’s how to do it:
In the Type and limits section of specific promotion - in the Priority field, enter a number that defines the promotion’s priority.
Priority controls the display order in the customer’s view. 1 is the highest. If multiple applicable promotions share the same priority, the one created earlier will be shown first.
2. Edit the copy using Title, and all the fileds connected with the Headers of the loyalty card.
9. Define the colors and style for the following fields: Borders, Backgrounds,and Text colors.
10. Set up the maximum number of promotion displayed for the user.
10. After you make changes to the template, you can check the preview.
1. Click the **Preview** button on the upper left side.
2. Enter the ID of a customer.
3. Click **Apply**.
Considering that the in-app is very interactive, the preview in the platform may not be enough to test the in-app performance. That’s why we suggest checking the preview directly in the mobile app.
11. If the template is ready, in the upper right corner click **Save this template > Save as**.
12. On the pop-up:
1. In the **Template name field**, enter the name of the template.
2. From the **Template folder** dropdown list, select the folder where the template will be saved.
3. Confirm by clicking **Apply**.
13. To continue the process of configuring the in-app campaign, click **Next**.
14. To save your content changes, click **Apply**.
### Select events that trigger the in-app message display
---
In this part of the process, you will define the custom event triggering the display of the in-app message.
1. In the **Trigger events** section, click **Define**.
2. Select **Add event** and from the dropdown list, choose your custom event.
4. As the logical operator, select **Exists**.
5. Click **Apply**.
### Schedule the message and configure display settings
---
As the final part of the process, you will set the display settings of the in-app message such as schedule, capping, priority of the message among other in-app messages.
1. In the **Schedule** section, click **Define** and set the time when the message will be active.
2. In the **Display Settings** section, click **Change**.
3. Define the **Delay display**, **Priority index** and enable the **Frequency limit** toggle to manage the frequency of in-app message display in the application.
You can additionally enable the **Capping limit** toggle to limit the amount of time the in-app message can be displayed to a user in general.
16. Click **Apply**.
17. Optionally, you can define the UTM parameters and additional parameters for your in-app campaign.
18. Click **Activate**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of [promotion catalog in-app campaign](https://app.synerise.com/communications/in-app/a12e8289-4b81-4b10-a631-4c100a597858) in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
`custom trigger event` (~1), [`inApp.show`](/docs/assets/events/event-reference/inapp#inappshow) (~1), [`inApp.click`](/docs/assets/events/event-reference/inapp#inappclick) (~1).
## Read more
---
- [In-app messages](/docs/campaign/in-app-messages)
- [Using in-app template builder](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template)
- [Promotions](/docs/ai-hub/promotions)
# Calculate CTR, OR, and CTOR based on unique event occurrences
OR (Open rate), CTR (Click-through rate), and CTOR (Click-to-open rate) are indicators which marketers use to estimate the success of campaigns. One of the challenge in calculating these rates is that the customers may open the message and click the links multiple times. That is why it is so important to consider only the first (unique) occurrences of such activity.
By using the Synerise Decision Hub, you can create analyses which analyze only the unique occurrences of opening a message or clicking links included in them.
The use case describes a process of creating expressions that enrich events such as sending an email, opening of the email, clicking a link in the email with parameters like campaign and customer ID, as well as the `journeyId` parameter related to automation. Later on, the expressions are used in the metrics to calculate CTR, OR, and CTOR.
## Prerequisites
---
- [Configure an email account](/docs/campaign/e-mail/configuring-email-account)
- [Send an email](/docs/campaign/e-mail) for which you can prepare the analysis or prepare a [workflow sending emails](/docs/automation/actions/send-email).
## Process
---
1. [Create expressions](#create-expressions) that enrich events.
2. [Create metrics](/use-cases/calculate-ctr-or-ctor#create-metrics) that return the unique values of CTR, OR, CTOR
## Create expressions
---
In this part of the process, create two event expressions of the `newsletter.open`, and `newsletter.click` events. Those expressions will enrich the events with an email address and customer ID, as well as the `journeyId` parameter related to automation, if the email was sent through Automation Hub. You will use these expressions in the further part of the process.
Depending on the integration with your email provider, you may collect different events or their names may be different in your workspace.
### Open newsletter event
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter a meaningful name of the expression.
3. Set the **Expression for** option to **Event**.
4. From the **Choose event** dropdown list, select **newsletter.open** event.
5. Build the expression as shown on the screenshot below:
The configuration of the expression with the newsletter.open event
6. Save the expression.
### Click newsletter event
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter a meaningful name of the expression.
3. Set the **Expression for** option to **Event**.
4. From the **Choose event** dropdown list, select **newsletter.click** event.
5. Build the expression as shown on the screenshot below:
The configuration of the expression with the newsletter.click event
6. Save the expression.
## Create metrics
---
In this part of the process, use the expressions you created in the previous part of the process as factors in formula metrics which calculate CTR, OR, and CTOR as a percentage.
### CTR
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As the kind of the metric, select **Formula metric**.
4. Click the **Select** node.
5. From the dropdown list, select **Event**.
6. As the aggreator, select **Count distinct**.
7. From the **Choose event** dropdown list, select the `newsletter.click` event.
8. In the **Choose parameter** dropdown, choose **Expressions** and from the dropdown list select the [the expression for the unique occurrences of the newsletter.click event](#click-newsletter-event) you have created in the previous step.
8. Next to the node with the **newsletter.click** event, click the plus button.
9. From the dropdown list, select **Event**.
6. As the aggreator, select **Count**.
7. From the **Choose event** dropdown list, select the `message.send` event.
8. Change the mathematical operator between the nodes to division sign by clicking the plus sign between them.
9. Next to the second aggregate, click the plus button.
10. From the dropdown list, select **Number**.
11. Click the added node and change the number to `100`.
12. Change the mathematical operator between the message.send node and `100` to multiplication sign by clicking the plus sign between them.
13. Save the metric.
The formula of the CTR metric
### OR
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As the kind of the metric, select **Formula metric**.
4. Click the **Select** node.
5. From the dropdown list, select **Event**.
6. As the aggreator, select **Count distinct**.
7. From the **Choose event** dropdown list, select the `newsletter.open` event.
8. In the **Choose parameter** dropdown, choose **Expressions** and from the dropdown list select the [the expression for the unique occurrences of the newsletter.open event](#open-newsletter-event) you have created in the previous step.
8. Next to the node with the **newsletter.open** event, click the plus button.
9. From the dropdown list, select **Event**.
6. As the aggreator, select **Count**.
7. From the **Choose evente** dropdown list, select the `message.send` event.
8. Change the mathematical operator between the nodes to division sign by clicking the plus sign between them.
9. Next to the second aggregate, click the plus button.
10. From the dropdown list, select **Number**.
11. Click the added node and change the number to `100`.
12. Change the mathematical operator between the message.send node and `100` to multiplication sign by clicking the plus sign between them.
13. Save the metric.
The formula of the OR metric
### CTOR
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As the kind of the metric, select **Formula metric**.
4. Click the **Select** node.
5. From the dropdown list, select **Event**.
6. As the aggreator, select **Count distinct**.
7. From the **Choose event** dropdown list, select `newsletter.click` event.
8. In the **Choose parameter** dropdown, choose **Expressions** and from the dropdown list select the [the expression for the unique occurrences of the newsletter.click event](#click-newsletter-event) you have created in the previous step.
9. Next to the node with the `newsletter.click` event, click the plus button.
10. From the dropdown list, select **Event**.
11. As the aggreator, select **Count distinct**.
12. From the **Choose event** dropdown list, select the `newsletter.open` event.
13. From the **Choose parameter** dropdown list, select [the expression for the unique occurrences of the newsletter.open event](#open-newsletter-event) you have created in the previous step.
13. Change the mathematical operator between the nodes to division sign by clicking the plus sign between them.
14. Next to the second aggregate, click the plus button.
15. From the dropdown list, select **Number**.
16. Click the added node and change the number to `100`.
17. Change the mathematical operator between the newsletter.open node and `100` to multiplication sign by clicking the plus sign between them.
18. Save the metric.
The formula of the CTOR metric
## What's next
---
You can display the metrics you created on a [dashboard](/docs/analytics/analytics-dashboard), which will help you present them in convenient and readable form as well as setting time periods from which you want the data to be presented.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of each analysis from this use case in our Synerise Demo workspace.
You can find the following aggregates:
- [Expression for unique newsletter.open event](https://app.synerise.com/analytics/expressions/be91ce19-3daf-4670-bf2c-c7c36d0c46ba)
- [Expression for unique newsletter.click event](https://app.synerise.com/analytics/expressions/aaa40556-6370-43f1-b354-6ac620a13812)
Also, you can find the following metrics:
- [CTR](https://app.synerise.com/analytics/metrics/d3cbeffb-4883-4621-a403-15e4bddc4650)
- [OR](https://app.synerise.com/analytics/metrics/69af6a34-02d9-4a11-8436-1c8967b0abf3)
- [CTOR](https://app.synerise.com/analytics/metrics/373dc09a-552d-4108-a713-e0261ac86516)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case does not generate any events.
## Read more
---
- [Expressions](/docs/crm/expressions)
- [Metrics](/docs/analytics/metrics)
# Discount for a product complementary to the product viewed
Personalized discount coupons can be an effective incentive to buy a product. They are a great tool that businesses frequently use successfully, helping them find new customers and **encouraging more sales.**
Properly directed, coupons can meet the client's needs and at the same time direct them towards the purchase of a specific type of product or brand.
## Example of use - Home appliances industry
**Challenge**
A customer from the electronics and home appliances industry decided to encourage customers to buy equipment from a certain brand.
To start the promotion, the client prepared a discount coupon for a product complementary to another item from the same brand. The offer was personalized and addressed to users interested in buying this type of equipment. A customer who viewed various home projectors received after 5 minutes an email with a discount coupon for an electric screen with the purchase a projector of a given brand. The rebate code was valid during shopping in the online store and to use it the customer just had to enter the code in the appropriate place when making purchase.

## Prerequisites
---
- Synerise web SDK implemented.
- [OG tags](/developers/web/og-tags) implemented.
- Import of [code pool](/docs/assets/code-pools) from which the discount codes will be taken.
- Email account [configuration](/docs/campaign/e-mail/configuring-email-account).
## Process
---
1. Create an [email template](/use-cases/discount-for-complementary-product#create-an-email-template-with-code-pools) with code pools.
2. Create a [workflow](/use-cases/discount-for-complementary-product#create-a-workflow).
## Create an email template with code pools
---
1. Go to **Experience Hub > Email**.
2. Prepare an email template that will be sent to the client and place the code in Jinjava in it, which will be responsible for collecting the coupon from the pool.
3. Select the appropriate code pool from the snippets in email creator.
4. **Save** your template.
## Create a workflow
---
Prepare the automation that will start on the event of visiting the page with the given type of product and will send the email with discount code after specific delay.
1. Go to **Automation Hub > Workflows**.
2. Choose **Profile Event** as a trigger.
3. Choose event `page.visit` and define the pages with the given type of products.
4. After visiting the product page there should be an appropriate delay.
4. Add action node - sending an email with a discount code, created in previous step.
5. Add end node and **save** your workflow.
Automation
## Check the workflow set up on the Synerise demo workspace
---
Check the [workflow](https://app.synerise.com/automations/automation-diagram/27716cf5-2b10-4182-893e-9b1d8666cba8) settings directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 9 events per profile that completes the flow:
[`page.visit`](/docs/assets/events/event-reference/web-and-app#pagevisit) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`voucherCode.assigned`](/docs/assets/events/event-reference/loyalty#vouchercodeassigned) (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1).
## Read more
---
- [Automation](/docs/assets/code-pools)
- [Creating email templates](/docs/campaign/e-mail/creating-email-templates)
- [Snippets](/docs/assets/snippets)
- [OG tags](/developers/web/og-tags)
# Category promotion
By focusing on specific product categories, you can curate promotions that resonate with your customers' unique needs. Unlock the ability to connect with your customers during special occasions that matter most to them. Whether it's the back-to-school rush, festive holidays, or the start of barbecue season, category promotions allow you to deliver precisely timed offers that align with your audience's interests. Elevate your business promotional strategy with Synerise and harness the power of precision marketing to elevate customer engagement and enhance conversion rates.
In this use case, you will create a back-to-school promotion for electronics category, valid only once per customer.
## Prerequisites
---
- Implement Promotions with [SDK mobile in your mobile application](/developers/mobile-sdk/loyalty) or through [API](https://hub.synerise.com/api-reference/loyalty-and-engagement#operation/profileLogin) in any channel.
- [Implement transactional events](/developers/web/methods-reference#tracking-transactions).
- [Import the product feed to a catalog](/use-cases/import-product-feed-to-catalog).
- Create a specific category filter in the product catalog to be reused while preparing the promotion.
Click here to see how to build the filter
Go to Data Modeling Hub > Catalogs.
On the list find the catalog in which you want to create the filter.
On the right side of the screen, click
Click Define.
On the pop-up, define the conditions by clicking Choose filter. The list contains all parameters from the product feed.
Filter configuration for category
Name and save the filter by clicking Save filter.
## Create a promotion
---
Create a promotion for one specific category [using the catalog filter created as part of the prerequisites](#prerequisites). The promotion gives a 15% discount for items from the specified category and is valid only once per customer.
1. Go to **AI Hub > Regular Promotions > Add Promotion**.
2. Enter a name for the promotion.
3. Select the **For selected items** type of promotion.
4. In the **Audience** section, choose **Everyone**.
5. In the **Content** section:
1. Define the name, descriptions, thumbnail and image of the promotion.
3. Optionally, you can add tags to the promotion and JSON code with advanced parameters.
2. Confirm the settings by clicking **Apply**.
Content configuration
6. In the **Type and limits** section:
1. In **Type section**, leave the selection at default (**General**).
2. In the **Priority** field, enter a number that defines the priority for the promotion.
Priority defines the order of display in the customer’s view. 1 is the highest priority. If two or more promotions applicable to a customer have the same priority, the order of display is determined by the date of creation. The one that was created earlier takes the priority over the other promotion.
3. Select the **Single** tab (default).
4. In the **Limit per profile** field, type 1.
5. From the **Discount type** dropdown list, select **Percentage**.
6. From the **Discount mode** dropdown list, select **Static**.
7. In the **Value** field, type 15.
8. Confirm the settings by clicking **Apply**.
Type and limits configuration
7. In the **Schedule** section, specify the time, when you want to display your promotion according to your business needs.
8. In the **Items** section:
1. From the **Source catalog** dropdown list, select a catalog of items.
2. In the **Include items** section, choose **Filtered items**.
3. From the **Select filter** dropdown list, select [the filter created as a part of the prerequisites](#prerequisites).
Type and limits configuration
9. To apply configuration and run the promotion, click **Publish**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [promotion configuration](https://app.synerise.com/campaigns/promotions/5486dfe0-92e2-4f2f-aa9b-901457489f47) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 4 events per profile that completes the flow:
[`client.activatePromotion`](/docs/assets/events/event-reference/loyalty#clientactivatepromotion) (~1), [`transaction.charge`](/docs/assets/events/event-reference/items#transactioncharge) (~1), [`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~2).
## Read more
---
- [Catalogs](/docs/assets/catalogs/introduction-to-catalogs)
- [Promotions](/docs/ai-hub/promotions)
# Send emails with dynamic attachments
There are various business cases in which personalized attachments need to be sent to customers through email. One reason for this is the specific nature of industries like finance, banking, insurance, or healthcare. Email communication in various industries often involves sending dedicated documents to customers, often due to legal requirements. Additionally, personalizing attachments can be beneficial for specific marketing campaigns aiming to meet particular business needs. Our Dynamic Attachments feature enables the process of sending customized attachments to each customer by email.
In this use case, we demonstrate how to add two dynamic attachments to an email communication, with each attachment tailored to individual customer. To do this, we create a workflow in which we upload selected files then attach them to an email and send them to customers. This use case illustrates a scenario where we send two requests with a single file.
## Prerequisites
---
- [Create an email account](/docs/campaign/e-mail/configuring-email-account) which you will use to send emails.
- [Create an email template](/docs/campaign/e-mail/creating-email-templates) that you will use in your communication.
- You must integrate your system that generates files dedicated to customers and upload them to Synerise through the [Synerise API](https://hub.synerise.com/api-reference/asset-management#operation/addClientFiles) (with content encoded in base64).
To see the event reference related to attachment upload events, click [here](/docs/assets/events/event-reference/automation).
## Create a workflow
---
Create a workflow in which you specify the files you want to attach to the email communication. In this use case, we follow a scenario in which the workflow is triggered by the **attachment.upload** event, which retrieves information about the Insurance Agreement files. Then, we wait for the Policy Certificate to be uploaded, and then send email with both of these documents in attachments, where each attachment is dedicated to an individual customer.
Event **attachment.upload** can be extended with any custom attributes. In our case, we are sending an additional parameter **docType**, which contains information about the type of the uploaded file. We will use this parameter to specify the event from which we want to get the uploaded files.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Profile Event trigger node
---
The trigger for starting this workflow is the **attachment.upload** event that appears in the customers profiles when files sent from the external source have been successfully uploaded and are ready to be used as a dynamic attachment. The first event from which we want to get file was send with **docType** parameter value - `Insurance agreement`.
1. As the first node of the workflow, add **Profile Event**.
2. Name this node with a unique name.
2. From **Choose event** dropdown menu, choose the **attachment.upload** event.
3. Click the **+ where** button and from the dropdown list, choose the parameter that specify the type of uploaded file. In our case, it is the **docType** parameter.
4. From the **Choose operator** dropdown, select **Equal(String)**.
5. In the text field, type the type of the file. In our case, it is `Insurance agreement`.
6. Confirm by clicking **Apply**.
Profile Event trigger node
### Define Event Filter
---
After the first file is uploaded, define the second event from which you want to upload file. We use **attachment.upload** event with the **docType** parameter value - `Certificate of policy`.
1. Add the **Event Filter** node.
2. Name this node with a unique name.
2. From **Choose event** dropdown menu, choose the **attachment.upload** event.
3. Click the **+ where** button and from the dropdown list, choose the parameter that specify the type of uploaded file. In our case, it is the **docType** parameter.
4. From the **Choose operator** dropdown, select **Equal(String)**.
5. In the text field, type the type of the file. In our case, it is `Certificate of policy`.
6. Confirm by clicking **Apply**.
Event Filter node
### Define the Send Email node
---
When all files are already uploaded, add them as attachments to the email communication.
1. Add the **Send Email** node.
2. In the **Sender details** section, choose the email account from which the email will be sent.
3. In the **Content** section, in the **Subject** field, enter the subject of the email, and from the **Template** dropdown, select [the template you created as part of the prerequisites](#prerequisites).
4. In the **Dynamic Attachment** section select the files which will be added.
Send Email node
5. In the **UTM & URL parameters** section, you can define the UTM parameters added to the links included in the email.
6. In the **Additional parameters** section, you can optionally describe campaigns with [additional parameters](/docs/campaign/e-mail/creating-email-campaigns#adding-custom-parameters).
7. Click **Apply**.
### Add the finishing node
---
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
Workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the [workflow](https://app.synerise.com/automations/automation-diagram/eca92056-9e89-4199-a7fb-77dc72330c82) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 9 events per profile that completes the flow:
[`attachment.upload`](/docs/assets/events/event-reference/automation#attachmentupload) (~2), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Dynamic attachments](/docs/automation/actions/send-email#dynamic-attachments)
# Personalized SMS with voucher to a previously visited store
SMS messages are an effective channel to reach your users. A good solution is to use dynamic SMS campaigns and personalize their content based on customer information such as the last-bought product or favorite store.
By sending the customer a discount to a particular store, you can **deepen engagement and loyalty.**
## Example of use - Retail Industry
**Challenge**
We created a dynamic SMS campaign with discount codes to stores previously visited by specific customers. It was based on a store attribute, which was added after a purchase in an offline store. Based on this information, we knew in which store the customer made a previous purchase.

## Requirements
- Customer data base with phone numbers and marketing consent for sending SMS campaigns
- Attributes: customer first name, the name of the store in which he made a recent purchase (integration with POS)
- Discount coupon list
- Integration of SMS gateway with Synerise. Read more about [how to do it >>](/docs/settings/configuration/sms-account)
---
## How to do it
1. **Create SMS campaign**
- In the **Audience** section, choose the campaign recipients. The system will automatically show you the customers who have given marketing consent for this type of campaign and have phone numbers on their contact card. You can choose to send the SMS to specific segments, create a new one directly from this place or send the message to everyone.
- In **Content**, you have to choose the sender name (based on previously completed integration with a sending platform) and then you can create a message template in the text editor.
2. **Use inserts in SMS creator to use dynamic content in your message**
- Use the name of your users to make the message more personalized (search for the “name” insert and copy the code to your message box)
- Add the text of your message.
- Add info about the user’s favorite store (find the proper attribute e.g. “store” and paste its code to message box)
- Add voucher choosing inserts – pools (find the proper attribute e.g. “vouchers” and paste its code to message box).
3. **Set up the campaign schedule and test the campaign**
- In Schedule, choose what time the campaign will be sent
- The last part is testing. If you want to test your SMS, you have to add your phone number and check how the message is displayed.
## Generated events
This use case generates approximately 2 events per profile that completes the flow:
[`sms.send`](/docs/assets/events/event-reference/sms#smssend) (~1), [`voucherCode.assigned`](/docs/assets/events/event-reference/loyalty#vouchercodeassigned) (~1).
## Read more
---
- Learn how to build [SMS campaign](/docs/campaign/SMS)
- Learn more about [Inserts](/developers/inserts)
# Calculate transactions with the use of promotional codes
To implement effective promotional campaigns, it is important to carefully analyze the results of past campaigns, draw conclusions and use this knowledge in the future. This use case describes how to calculate the number of transactions with the use of promotional codes.
## Prerequisites
---
- Implement a [tracking code](/developers/web/installation-and-configuration).
- Implement [transactional events](/developers/web/methods-reference#tracking-transactions).
- Create and activate a [promotion](/docs/ai-hub/promotions).
## Process
---
In this use case, you will go through the following steps:
1. [Prepare a regular expression](/use-cases/event_data_modification#prepare-a-regular-expression).
2. [Create an expression](/use-cases/event_data_modification#create-an-expression).
3. [Create an aggregate](/use-cases/event_data_modification#create-an-aggregate).
4. [Create a metric](/use-cases/event_data_modification/#create-a-metric).
## Prepare a regular expression
---
When a promotion is assigned to a customer, the event appears on the customer’s profile (for example, a `handbill.assign` event). This event contains a parameter (in this use case, `promo3`) with the promotion number.
If a customer uses the promotion code during the purchase, a transaction event appears on the customer’s profile with the parameter that contains the promotion number as well. However, the values of these parameters are slightly different for the two events.
In the transaction event, two zeros at the beginning of the promotion number are deducted, so the challenge is to turn these values into an identical format as it is in the **handbill.asign** event.
Comparison of the handbil.assign and transaction event
For this purpose, prepare a regular expression that will extract the number of promotion from the parameter of the transaction event. In our use case, the regular expression will take the following form `(?<="promoId":")(.+?)(?=\"|$)`. You will use it in the next part of the procedure.
The regular expression matches a promoID in an example value of the transaction event parameter
## Create an expression
---
Create an expression for the transaction event. Using the **Concat** function in the expression, add two zeros to the **loyalRewards** parameter (which contains the number of the promotion). As a result, the two zeros are added at the beginning of the promotion number and the expression returns the number of promotion which matches the number of promotion in the **handbill.asign** event.
1. Go to **Behavioral Data Hub > Expression > New expression**.
2. Enter the name of the expression.
3. Set the Expression for option to **Event**.
4. From the dropdown list, select **transaction.charge**.
5. In the Formula definition section of the page, click **Select**.
Result: A dropdown list appears.
6. From the list that opens, select **Function > Concat**.
7. In the brackets, click the left **Select** button and from the list, select again **Function > Concat**.
8. In the brackets, click the left and right Select button from the list and select **Constant** with value `0`.
9. After the brackets click the **Select** button and from the list select **Function > Regexp**.
10. In the brackets, click the left Select button and from the list, select **Event attribute loyalRewards**.
11. Click the right **Select** button and from the list, select **Constant** with value `(?<="promoId":")(.+?)(?=\"|$)`.
12. Save the expression.
Expression adding zeros to the parameter
## Create an aggregate
---
In this part of the process, create an aggregate that returns the id of the assigned promotion from promo3 parameter.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Click **Analyze profiles by** and select **Last Multi**.
3. In the Size field choose how many values you would like to return.
4. Select **Consider only distinct occurrences of the event parameter**.
5. Select the **handbill.assign** event.
6. Select the **promo3** parameter.
7. Select the **id** and **variantName** parameter for which you want to get results.
An aggregate that will return the most recently assigned promotions
## Create a metric
---
In this step you will create a metric that calculates the number of transactions made by customers who had the promotional code assigned to their profile and used it during the purchase process.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. Leave the Aggregator at default **(Count)**.
4. Select the **product.buy event**.
5. Add the ”**promoId z loyalRewards**” parameter - additional parameter created with [expression](/use-cases/event_data_modification#create-an-expression).
6. Select **In** operator.
7. Keep clicking the icon next to the logical operator until you get **Choose value** button.
8. Select the aggregate that returns last multi assigned personalized promotions created in [this step](/use-cases/event_data_modification#create-an-aggregate).
9. Add a filter with people who had a `handbill.assign` event from a specific campaign id.
10. Select the date range of the metric.
11. Save the metric.
Metrics configuration
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of every element of this process directly in Synerise Demo workspace:
- [Expression](https://app.synerise.com/analytics/expressions/c0d65888-178e-4c48-84f1-f348b553c486)
- [Aggregate](https://app.synerise.com/analytics/aggregates/f1b6d24c-8541-3f85-b7e5-ec5482d0c3f4)
- [Metric](https://app.synerise.com/analytics/metrics/44da8800-568f-4f1c-9014-0627580225f1)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case does not generate any events.
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Expressions](/docs/crm/expressions)
- [Metrics](/docs/analytics/metrics)
# AI-Powered Store Locator for Finding Nearest Shops
Customers are looking for solutions that maximize their benefits and allow them to meet their needs promptly. A widespread behavior among customers is to check store locations on the store page, which enables them to find a store in the most convenient location. Therefore, it is beneficial to have a solution prepared to satisfy this need.
This use case describes configuring an AI search to return information about a company's store locations.
## Prerequisites
---
- Prepare `.CSV` file with main information regarding a store location.
The file should contain required columns - **itemId** and **category** and other custom values like postal code, street address, city, and so on.
You can find the requirements for the `.CSV` file format [here](/docs/assets/catalogs/creating-catalogs#requirements).
Click to see a sample CSV file
category,city,itemId,lat,lon,postalCode,state,streetAddress,streetName,streetNumber,title STORE,Washington,497,38.897,-77.0251,20073,District of Columbia,3960 Killdeer Terrace,Hanson,8,Nienow and Sons STORE,Brooklyn,69,40.6924,-73.9666,11205,New York,7720 Mockingbird Circle,Bultman,39231,Baumbach-Glover STORE,Los Angeles,742,33.9754,-118.417,90094,California,85774 Stone Corner Street,Washington,652,Grimes LLC STORE,Little Rock,197,34.6725,-92.3529,72209,Arkansas,97498 Bunting Road,Boyd,712,Frami Inc STORE,Salem,622,44.8685,-123.0438,97306,Oregon,40 Dorton Court,Esch,79,Roberts and Sons STORE,Brea,550,33.9187,-117.8892,92822,California,92 Di Loreto Street,Golden Leaf,16877,Hermann-Bergnaum STORE,Sacramento,966,38.3774,-121.4444,94207,California,7250 Green Ridge Center,Kensington,6,Jacobson-Cronin STORE,Baton Rouge,492,30.3795,-91.1671,70820,Louisiana,3351 Grim Lane,Del Mar,5638,Bahringer Inc STORE,Dallas,710,32.7673,-96.7776,75387,Texas,0 Talisman Junction,Glendale,480,"Rippin, Wiza and Borer"
## Process
---
1. Import `.CSV` file to a [catalog](/use-cases/ai-search-store-location#create-a-catalog).
2. [Configure AI Engine](/use-cases/ai-search-store-location#configure-ai-engine).
3. Create and configure [search index](/use-cases/ai-search-store-location#create-an-ai-search-index).
## Create a catalog
---
In the first part of the process, import the `.CSV` file into the catalog.
Import CSV
1. Go to **Data Modeling Hub > Catalogs > New Catalog**.
**Result**: A pop-up opens.
2. Enter the name of the catalog.
3. Confirm it by clicking **Apply**.
**Result**: A catalog appears on the list. Its position on the list is defined by alphabetic order (the list is arranged from Z-A).
4. Click the catalog on the list.
5. On the upper right corner, click **Import CSV** button.
**Result**: A pop-up opens.
6. Click **Upload file** button.
**Result**: A pop-up opens.
7. Select the file to be uploaded. Confirm with **OK**.
8. In the **Order key** field, type the name of the column whose values are treated as the key.
In our case, the `itemId` value will function as the key.
9. Confirm by clicking **Import**.
**Result**: Imported records are available in the catalog.
Example of a catalog
## Configure AI Engine
---
In this part of the process, create and configure feed for AI engine based on the catalog created [earlier](/use-cases/ai-search-store-location#create-a-catalog).
A catalog configured for AI engine
1. Go to **Settings > AI engine configuration**.
2. Click **Add feed**.
**Result**: A pop-up appears.
3. Select the product feed you want to use. In this case select **Catalog**.
4. On the pop-up, select the type of catalog: **Data catalog**.
5. From the dropdown list, select a catalog created in the [previous step](/use-cases/ai-search-store-location#create-a-catalog).
6. Confirm by clicking **Apply**.
7. On the list of feeds, click the feed created earlier.
8. In the **Applied search engines** tab, click **Show**.
9. Switch the **Search engines** toggle on.
10. Confirm by clicking **Apply**.
11. Click **Save**.
Launching Search Engine
## Create an AI Search index
---
In this part of the process, create an index of AI search that facilitates searching for a store by city, postal code, street address, and street name.
1. Go to **AI Hub > Indexes**.
2. Click **Add index**.
**Result**: The index creation screen opens.
3. In the **Index name** field, type the meaningful name of the index.
1. From the **Choose catalog** dropdown list, select an [item catalog](/use-cases/ai-search-store-location#configure-ai-engine) to use as the source for the search results.
Remember that the value of an item attribute in the item catalog cannot be longer than 1000 characters. It applies both for creating a new index and updating it.
2. From the **Choose search engine language** dropdown, select the language of your search engine.
4. Click **Next step**.
Example of basic index settings
5. Define response and searchable attributes.
More detailed information about these attributes can be found [here](/docs/ai-hub/ai-search/define-attributes/?helpCenterAi=define#response-attributes).
In this case, `city`, `postal code`, `street address`, and `street name` are selected a searchable attributes, so the customer will be able to search for stores using them.
6. Click **Next step**.
**Result**: The Filters & Facets screen opens.
7. Skip this step by clicking **Next step**.
**Result**: The Ranking screen opens.
8. Click **Complete**.
7. The Ranking screen opens. Click **Complete**.
8. Wait until the index is ready. Refresh the page until you receive information in the upper right corner of the screen that the index is ready.
Your index is ready
9. Check the results by clicking **Preview**.
10. In the search field, enter the name of the store or store location.
**Result**: A list with the defined search results appears.
## What's next
---
Once AI search is configured, it can be implemented in any channel, such for example a website using [dynamic content](/docs/campaign/dynamiccontent/creating-dynamic-content).
We recommend enriching the integration with a store location map. This can be achieved using public tools such as **Azure Maps**. You can find extensive documentation for Azure Maps [here](https://docs.microsoft.com/en-gb/azure/azure-maps/) or use this [quick demo application](https://docs.microsoft.com/en-gb/azure/azure-maps/quick-demo-map-app). The `.CSV` file to be used in this case must contain the longitude and latitude to create the map.
## Check the use case set up on the Synerise Demo workspace
---
You can also check the [AI search configuration](https://app.synerise.com/ai-v2/search/indices/cbc43b41c46dea9f6d187e9f32b3dc7f1729689355/settings) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 2 events per profile that completes the flow:
[`item.search`](/docs/assets/events/event-reference/search#itemsearch) (~1), [`item.search.click`](/docs/assets/events/event-reference/search#itemsearchclick) (~1).
## Read more
---
- [AI engine configuration](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-search#selecting-attributes-for-preview)
- [AI search](/docs/ai-hub/ai-search/introduction-to-ai-search)
- [Catalogs](/docs/assets/catalogs)
- [Dynamic content](/docs/campaign/dynamiccontent/creating-dynamic-content)
# Identifying Customers' Preferred Communication Channel
In today's data-driven world, understanding user preferences is the key to effective marketing. Knowing whether your audience prefers the mobile or desktop channel helps you effectively reach a specific audience by connecting with customers through channels they love most.
In this use case, you will create aggregates and segmentations that will help identify user preferences between mobile and desktop channels, enabling more targeted and effective communication.
## Prerequisites
---
- [Implement a tracking code](/docs/settings/tool/tracking_codes).
- Integrate Synerise [mobile SDK](/developers/mobile-sdk) in your mobile application
## Process
---
In this use case, you will go through the following steps:
1. [Create two aggregates](#create-two-aggregates), one that returns the number of the `Visited page` events on desktop and the other that returns the number of `screen.view` events in a mobile application.
2. [Create a segmentation](#create-a-segmentation) based on these aggregates, so you can divide your customers according to their preferred communication channel.
## Create two aggregates
---
The first step is creating two aggregates that count page visits (based on the [`page.visit` event](/docs/assets/events/event-reference/web-and-app#pagevisit) on the website and views in the mobile application (based on the [`screen.view` event](/docs/assets/events/event-reference/web-and-app#screenview).
### Aggregate returning number of visits on the desktop
---
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Count**.
4. From the **Choose event** dropdown list, select the **Visited page** event.
5. Set the period from which the aggregate will analyze the results. In our case, it's **last 30 days**.
6. Save the aggregate.
The aggregate counting visited pages
### Aggregate returning number of visits in the mobile application
---
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
9. Click **Analyze profiles by** and select **Count**.
10. From the **Choose event** dropdown list, select the **mobile screen viewed** event.
11. Set the period from which the aggregate will analyze the results. In our case, it's **last 30 days**.
12. Save the aggregate.
The aggregate counting mobile screen views
## Create a segmentation
---
In this part of the process, we create a segmentation that consists of two segments. One segment comprises customers who have a higher number of website visits compared to visits on the mobile application, while the other segment consists of customers who have a lower number of page visits compared to visits on the mobile application.
1. Go to **Decision Hub > Segmentations > New Segmentation**.
2. Enter the name of the segmentation.
3. From the **Add condition** dropdown list, select the [aggregate counting page visits](#create-two-aggregates) you created in the previous part of the process.
4. Click the **Choose** button, and from the list of operators, choose **More than**.
5. Next to the opperator, change the **Number** to **Parameter**.
6. From the **Parameter** dropdown list, select the [aggregate counting screen views in the mobile application](#create-two-aggregates) you created in the previous part of the process.
7. Name the segment as follows: `Desktop preference`.
The segment with more website visits
8. Duplicate the segment, and rename it as follows: `Mobile preference`.
9. In the new segment, change the opperator to **Less than**.
10. Next to the opperator, change the **Number** to **Parameter**.
11. From the **Parameter** dropdown list, select the [aggregate counting screen views in the mobile application](#create-two-aggregates) you created in the previous part of the process.
The segment with more mobile application visits
12. Save the segmentation.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of all elements used in the use case, directly in Synerise Demo workspace:
- [Agreggate counting website visits](https://app.synerise.com/analytics/aggregates/4cd80712-6463-3f55-ac5f-29b3abc08153)
- [Aggregate counting mobile visits](https://app.synerise.com/analytics/aggregates/61738e01-69c6-3864-ac1e-12ba9065a522)
- [Segmentation](https://app.synerise.com/analytics-v2/segmentations/ba36aeb9-1c69-4362-bbf1-ecbd7cfce590)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case does not generate any events.
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Segmentation](/docs/analytics/segmentations)
# Displaying personalized recommendations before typing a search query
AI search phrases that are well-built and adaptable can become a key tool enabling maximum shortening of the user's path, leading to more purchases.
To enable customers to find items they need as quickly as possible, it is important to take care of the accuracy of search results, monitor its behavior and calibrate it accordingly. Various types of recommendations allow **adding** other modules with **recommended products to the search engine**.
AI search
---
## Example of use - construction industry
**Challenge**
A client from the construction industry wanted to shorten the user's path as much as possible to find the needed product using AI search. For this purpose, the client decided to display product suggestions in the form of a list already at the stage when the user clicks on the search engine, but has not yet enter the desired phrase. The displayed offers were selected based on a personalized recommendations model.
**Results**
- CTR **11%**
- Campaign conversion **1.4%**
- Increase in the number of people using the search engine by **9%** within **21 days** from introducing the AI search modification.
## Prerequisites
---
Before you start implementing this use case, you must fulfill the requirements listed below:
- [Implement event tracker](/developers/mobile-sdk/event-tracking).
- [Implement OG tags](/developers/web/og-tags).
- [Import product feed to Synerise](/developers/product-feed).
- [Track transaction events](/developers/web/event-tracking).
## Process
---
To prepare such a scenario, you have to follow 2 important steps.
1. [Prepare personalized recommendations](/use-cases/ai-search-improvements#prepare-personalized-recommendations).
2. [Set up dynamic content](/use-cases/ai-search-improvements#set-up-a-dynamic-content).
## Prepare personalized recommendations
---
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. From the drop down list, choose **Catalog** based on which your recommendations will be built.
3. Choose **Personalized** as the recommendation type.
Select the type of recommendation
4. In **Items** define more details about your recommendation.
You must select the minimum and maximum number of products displayed in the recommendation frame. Optionally, you can set the filters (for example, narrow down the number of items from a specific category), however, in this use case the client didn't add the filters. You can also create filters by following the instructions in [this](/docs/ai-hub/recommendations-v2/recommendation-filters) article.
## Set up a dynamic content
---
To insert personalized recommendations in the search results right before a user starts typing a search phrase, use dynamic content.
1. Choose **Insert Object** type.
2. Select your **Audience**. You can target your communication to everyone or select segment of users. In our example we target communcation to **everyone**.
3. In the **Content** section, click **simple message** and specify the CSS selector where you want to insert recommendations.
4. In the **Content** tab section, click **Create message** insert Jinjava code with AI recommendation and add your own CSS.
Check the Jinjava code
<!-- Opening the tag that retrieves the value from recommendation prepared in point 1--> {% recommendations3 campaignId=xxx %} for loop below: <!-- In the section {% for r in recommended_products3 %} a {% endfor %} there is access to all variables from a given object (products here) - which parameters you add to the template depends on you. --> {% for r in recommended_products3 %} <!-- {{ r.itemId }} {{ r.title }} {{ r.imageLink }}{{r.price.value}}{{r.salePrice.value}} - parameters taken from the recommendation. The itemId is a standard name, but others (like category, price, salePrice, title, imageLink) only depend on names defined in the feed--> {{r.itemId}} {{r.title}} {{r.imageLink}} {{r.price.value}} {{r.salePrice.value}} {% endfor %} <!-- Closing of the tag that gets the value from the recommendation prepared in point 1 --> {% endrecommendations3 %}
Implementation of the script above results in displaying recommendation personalized for individual user after clicking the AI search. Remember to replace `xxx` in the `campaignID` with the ID of the recommendation you prepared in the previous steps.
6. Skip **UTM** section.
7. In **Display Settings**, define where dynamic content is shown: **Always**, **On landing**, on **All pages**.
8. In the upper right corner, click **Schedule** and **Activate** when the dynamic content has to be active.
## Check the use case set up on the Synerise Demo workspace
---
You can check [recommendations](https://app.synerise.com/ai-v2/recommendations/PsDLh5DdTlk3) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per profile that completes the flow:
[`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [AI recommendation](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign)
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Jinjava inserts](/developers/inserts/filter)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Interest-Based Segmentation Using URL Fragments from Page Visits
Having more product categories in your store, you can easily measure which category a customer visits most frequently.
Based on the URL of the visited page, you can find a lot of information. In this use case, we treat visits to specific URL as visits to specific categories (for example, if the URL contains "/shoes/", we assume that the customer has visited the "Shoes" category).
Using the Decision Hub, we can define how many times a customer visited specific categories and then extract the one most frequently visited by them. Additionally, you can create a segmentation by grouping these customers by favorite category. In this use case, we will show you how to create such a segmentation on the example of 4 selected categories using aggregates and expressions that use the URL fragment in the page visit event.
## Prerequisites
---
Implement [tracking code](/developers/web/installation-and-configuration#creating-a-tracking-code) on your website.
If there are more product categories, we recommend additionally implementing [OG tags](/developers/web/og-tags). Thanks to that, an additional parameter will be collected in the `page.visit` event with the exact path of the category visited by the customer. Based on that, you can simplify the presented analyses and reduce them to one aggregate with the "TOP" aggregator and segmentation (there would be no need to create an expression and aggregates for each category).
## Process
---
This procedure consists of three stages:
1. Create [aggregates](/use-cases/segmentation-based-on-interests#create-aggregates) that count visits on each of four product categories.
2. Create an [expression](/use-cases/segmentation-based-on-interests#create-an-expression) that returns the highest result for every category.
3. Create a [segmentation](/use-cases/segmentation-based-on-interests#create-a-segmentation) that groups customers by the most frequently visited category.
## Create aggregates
---
Create aggregates that count visits on each of product categories. In this stage, we assume that visiting a given fragment of the URL equals visiting a category. To measure the results, create 4 aggregates that count the number of visits to each of the four categories.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate (in this example, the name of the aggregate will be the same as the category name).
3. By clicking the button, set **Count** as the type of the aggregate result.
4. From the **Choose event** dropdown list, select the `page.visit` event.
5. Click the **Where** button and from the **Choose parameter** dropdown list, select `uri`.
6. Select the **Contain** logical operator.
7. In the text field, next to the logical operator, enter the name of the product category.
8. Save the aggregate.
9. Create another one or more aggregates for their respective categories. Repeat the steps 1-8.
**Result**: The aggregates will count visits of individual users to the product category. The aggregates are available in **Behavioral Data Hub > Live Aggregates**.
Filled settings of the category A aggregate
## Create an expression
---
In this step, create an expression that will use the max function. This function returns the highest value in a set of values. Use it in order to return the result of the category most frequently visited by the user. It will be used later in building the segmentation.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression.
3. From the dropdown list, select **Attribute**.
4. To start creating the formula of the expression, click the **Select** button.
5. Create the formula as presented on the video below:
6. Save the expression by clicking **Save**. The expression returns the highest values for every category.
Filled settings of the expression
## Create a segmentation
---
In this stage, create a segmentation based on previously created aggregates and expression. It will contain four segments, each dedicated to one category. This way you will find out which of the categories is most popular.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation.
3. Click **Choose filter**.
4. Select the **Profiles** tab.
5. Select **Expressions**.
6. Find the expression created in the previous steps.
7. Choose the **Equal** operator.
8. Click the icon next to the logic operator and keep clicking until you get .
9. From the **Choose value** dropdown list, click the icon, and then select **Aggregates**.
10. Find the aggregate for the first product category.
11. From the **Choose filter** dropdown list, select an aggregate for the same product category for which you are creating a segment.
12. From the **Choose operator** dropdown, choose **Number**, and then select **More or equal to**.
13. Next to the logical operator, in the text field, enter `1`.
With this additional condition, you ensure to include in the segment only those users who have at least 1 visit on the selected page category.
14. Create the next segments for the remaining product categories by clicking the icon.
15. To save the segmentation, click **Save**.
16. To preview the visual form of the segmentation, click **Preview analyze**.
If you want to include a customer in more than one segment when the customer met all the conditions, you can enable the **Multi-match** toggle. Remember, however, that **this option is only available for preview proposals and cannot be used for targeting, communication or in building further analyses**.
Adjusted segmentation settings
## What's next
---
You can use the created segmentation on the [dashboard](/docs/analytics/analytics-dashboard) or use it as an audience in any [communication channel](/docs/campaign). You can also display personalized communicates on the website using [dynamic content](/docs/campaign/dynamiccontent) depending on the most often visited category by your customers.
## Check the use case set up on the Synerise Demo workspace
---
The list below contains the aggregates from the use case with example categories created in our Synerise Demo workspace:
- [Aggregate that returns the number of visits to the men shirts category](https://app.synerise.com/analytics/aggregates/15dfe25c-49d0-3f55-a148-6948ebc96de6)
- [Aggregate that returns the number of visits to the men trousers category](https://app.synerise.com/analytics/aggregates/4bcc37f7-ca21-3fac-91fe-344532d1203e)
- [Aggregate that returns the number of visits to the men ties category](https://app.synerise.com/analytics/aggregates/84e94e08-75df-39a7-a361-0fd1e440c726)
- [Aggregate that returns the number of visits to the men polo category](https://app.synerise.com/analytics/aggregates/8850e1eb-6a9c-3147-8ad0-b306f2a55b32)
In our Synerise Demo workspace you can also find the configuration of [the expression that returns the most frequently visited category by a customer](https://app.synerise.com/analytics/expressions/a2d2b9ca-dc01-484a-8c6b-b5d6d1e83f3a) and [segmentation that organizes customers according to the visits to the categories](https://app.synerise.com/analytics/segmentations/b641998d-d035-4fd4-9b57-d7829c5e1528).
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case does not generate any events.
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Expressions](/docs/crm/expressions)
- [Segmentation](/docs/analytics/segmentations/creating-segmentations)
# Brickworks product template with AI-based similar recommendations
Presenting accurate and up-to-date product content across channels often requires combining product catalog data with dynamically generated recommendations.
[Brickworks](/docs/assets/brickworks) allows you to define a product template that can pull product attributes directly from your catalog and extend it with AI-based similar products.
In this use case, you will create a schema enabling templates to return:
- dynamic product information coming from a Synerise catalog
- dynamically computed similar products based on an AI recommendation model
Additionally, this schema will serve as an in-app template derived from a template available in the Synerise Demo workspace (ID: 1590) and will be displayed directly within the application.
The goal is to enable an in-app view that appears when a user adds a product to their favorites from that product’s page (triggered by the product.addToFavorite event). This view will display the selected product alongside AI-generated recommendations of similar items.
## Prerequisites
---
- Import a product feed to Synerise. You can find instructions [here](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-search).
- Implement a [tracking code](/developers/web/installation-and-configuration) into your website.
- [Configure AI engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations).
- [Configure an item catalog for recommendations](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations). Enable similar items recommendations.
- Implement the [transaction events](/developers/web/transactions-sdk) using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- Implement a custom event for adding a product to favorites, which will be available in the customer profile.
In this example, the event is called `product.addToFavorite`.
Implement custom events in your [mobile application](/developers/mobile-sdk/event-tracking#product-added-to-favorites) or [website](/developers/web/event-tracking#declarative-tracking-custom-events).
## Process
---
In this use case, you will go through the following steps:
1. [Create an AI recommendatons](#create-an-ai-recommendations) with similar products.
2. [Create a schema](#create-a-schema) with similar AI recommendations.
3. [Create the record](#create-the-record).
3. [Create an in-app campaign](#create-an-in-app-campaign) based on the brickworks schema.
## Create an AI recommendations
---
In this part of the process, you will configure a [similar items recommendation](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign) with context. This recommendation will later act as a reusable data source inside the schema, so any component that uses the schema will automatically access consistent recommendations.
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation (it is only visible on the list of recommendation).
3. In the **Type & Items feed** section, click **Define**.
4. From the **Items Feed** dropdown list, as an item feed, select an item catalog which you configured as a part of [prerequisites](#prerequisites).
5. In the **Type** section, choose the **Similar items** recommendation type.
6. Confirm the settings by clicking **Apply**.
7. In the **Items** section, click **Define**.
8. Define the minimum and maximum number of items that will be recommended to the customer in each slot.
9. Optionally, define [Static filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#static-filters) and [Elastic filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#elastic-filters).
10. Confirm by clicking **Apply**.
8. Optionally, you can define the **Boosting** factors.
9. In the right upper corner, click **Save**.
## Create a schema
---
In this section, you will [create a Brickworks schema](/docs/assets/brickworks/quick-start/creating-a-schema) with fields for product information and AI recommendations. The schema acts as a structured container for all data that will later be displayed to users in different channels. By defining fields here, you create a single place where product-related information is stored, updated, and reused across templates, campaigns, and runtime contexts.
1. Go to **Data Modeling Hub > Schemas > New schema**.
2. Choose **Simple Schema**.
3. Enter a name for the schema, in **Display name** for example **Product template**. **API names** value is pre-filled with the value from Display name. The value in this field is the unique identifier used to reference this schema in API requests.
4. Optionally, fill in the **Description** field.
### Add Product Name
5. Click **Add new field** and choose **String**
3. Complete the fields:
- Add **Display name** for the field in our case `Product name`.
- **API name** will be pre-filled automatically.
4. Set the field as **Required** by selecting the **Required field** checbox.
5. To save your changes, click **Apply**.
Brickworks configuration
### Add Item ID
5. Click **Add new field** and choose **Jinjava code**
3. Complete the fields:
- Add the **Display name** for the field in our case `Item ID`.
- The **API name** will be pre-filled automatically.
4. Check the **Cast to** field. By default, Jinjava output is cast to string. Use this option to cast the result to another type (number, boolean, JSON).
5. Choose type as the `Integer`.
5. To save your changes, click **Apply** .
Brickworks configuration
### Add Product Catalog
5. Click **Add new field** and choose **Catalog**.
3. Complete the fields:
- Add the **Display name** for the field in our case `Product Catalog`.
- The **API name** will be pre-filled automatically.
4. From the catalogs list, choose the catalog with the product feed which you imported as a part of [prerequisites](#prerequisites)
5. Optionally you can enter the primary key used to identify items in the catalog (string or JINJAVA). In this case it will be Jinjava primary key with the value: `{{ record.itemid }}`.
5. Click **Apply** to save your changes.
### Add the AI Recommendations
5. Click **Add new field** and choose **AI Recommendations**
3. Complete the fields:
- Add the **Display name** for the field in our case `Similar Products`.
- The **API name** will be pre-filled automatically.
4. Choose from the list AI Recommendations created in the [previous step](#create-an-ai-recommendations)
5. Enter the Product context - Item ID passed as context for recommendations. In pur case it will be Jinjava primary key with the value:`{{ record.itemid }}`. It is required in similar/complementary campaigns. Optional in personalized ones.
5. To save your changes, click **Apply**.
Brickworks configuration
### Set up the Audience & Settings
1. Click the **Audience & Settings** tab.
2. In the **Audience** section, click **Define**.
3. Choose the schema recipients, in our case, choose **Everyone**.
4. Click **Apply**.
5. In the upper-right corner, click **Save.**
## Create the record
---
[Creating a record](/docs/assets/brickworks/quick-start/creating-a-record) means adding the data to the schema. It means that you fill out schema fields with the actual values.
This step fills the structure you created earlier with real data that will be rendered to the user. Anything you enter here becomes the source of truth for templates, recommendations, and dynamic elements across your communication channels. By storing product-specific information inside the record, you ensure that all in-app messages, PDP blocks, or emails referencing this schema always draw from the same, consistent data set.
1. Go to **Data Modeling Hub > Data collection > Select schema**.
2. Choose [schema created in the previous part of the process](#create-a-schema).
3. Click **Add record**.
4. Add a name for the reocrd.
5. Add a slug for the reocrd. Slug is a unique, URL-friendly version of the name. It usually contains only lowercase letters, numbers, and hyphens. In our case it will be `dynamic`.
6. As an itemId add `{{ context.itemid }}`.
7. Click **Publish** to publish your record.
### Previewing records
After saving the record either as a draft (in case of records created based on versioned schemas) or publishing it (in case of both schema types), you can [preview the record](/docs/assets/brickworks/quick-start/creating-a-record#previewing-records) for the context of a selected user. This context-driven approach enables your records to adapt dynamically based on the requesting application, user session, or any external factors you define.
1. Go to **Data Modeling Hub > Data collections**.
2. In the header, from **Select schema* dropdown list, select the [schema](#create-a-schema) created previously.
3. Find the record which you want to preview.
4. Enter the record configuration.
5. Click the **Preview context**.
6. From the dropdown list, find a profile for whom you want to generate record preview. This means the same record can render completely differently depending on the context you provide.
6. Click **Add parameter** and choose the parameter from your catalog you want to preview, in our case it will be `itemid`. As the value of this field add the example itemid value for exemplary product.
Brickworks configuration
**Result**: You will see the dynamic preview with the data about the specific product from your catalog.
Brickworks configuration
What is more you can see what similar recommendations will be generated for this specific product for the choosen user.
Brickworks configuration
## Create an in-app campaign
---
In this part of the process, you [create an in-app campaign](/docs/campaign/in-app-messages/create-inapp-message) triggered by the `product.addTofFavorite` event. We will use a template available on the Demo Workspace (1590), so there is no need to create a template from scratch, you can copy the template to your workspace and use it.
1. Go to **Experience Hub > In-app messages> Create in-app**.
2. Enter the name of the in-app.
### Define the audience
---
As the first step, define the target group of customers for the in-app message.
1. In the **Audience** section, click **Define**.
4. Click **Everyone**.
8. To save the audience, click **Apply**.
### Define content
---
In this part of the process, you will create the content of the in-app message that will appear in the mobile application with the help of ready-made template.
1. In the **Content** section, click **Define**.
2. Click **Create message**.
We’re using a ready-made template available in the 1590 Synerise Demo workspace. You can use this template as a base and copy it into your own workspace.
**Result:** You are redirected to the code editor.
You can edit the template in two ways, by editing the code of the template [add snippets](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-snippet-to-the-template-code), [add variables](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-variable) and/or by filling out the form in the Config tab. In this use case, we will use the capabilities of the predefined Config tab.
#### Edit form in the Config tab
---
The form in the **Config** tab is already filled in with default values. You can keep them or change them to fit your business needs.
In-app configuration
1. To the **Schema ID** field, add the ID of the [schema created as the part of prerequisites](#create-a-schema).
You can find schema ID in the URL of the schema.
2. To the **Record ID** field, add the ID of the [record created as the part of prerequisites](#create-the-record).
You can find the record ID in the URL of the record.
3. To the **ContextID** field, insert a value of the context parameter of the product used in the record. In our case it will be an example itemid for example: `e579487933852f3a83abd9e840175c`.
3. You can optionally edit the copy and design of the template.
10. After you make changes to the template, you can check the preview.
1. Click the **Preview** button on the upper left side.
2. Enter the ID of a customer.
3. Click **Apply**.
Considering that the in-app is very interactive, the preview in the platform may not be enough to test the in-app performance. That’s why we suggest checking the preview directly in the mobile app.
11. If the template is ready, in the upper right corner click **Save this template > Save as**.
12. On the pop-up:
1. In the **Template name field**, enter the name of the template.
2. From the **Template folder** dropdown list, select the folder where the template will be saved.
3. Confirm by clicking **Apply**.
13. To continue the process of configuring the in-app campaign, click **Next**.
14. To save your content changes, click **Apply**.
### Select events that trigger the in-app message display
---
In this part of the process, you will define the event triggering the display of the in-app message.
1. In the **Trigger events** section, click **Define**.
2. Select **Add event** and from the dropdown list, choose `product.addTofFavorite` event.
3. Click the **+ where** button and select `mobile`.
4. As the logical operator, select **Exists**.
5. Click **Apply**.
### Schedule the message and configure display settings
---
As the final part of the process, you will set the display settings of the in-app message such as schedule, capping, priority of the message among other in-app messages.
1. In the **Schedule** section, click **Define** and set the time when the message will be active.
2. In the **Display Settings** section, click **Change**.
3. Define the **Delay display**, **Priority index** and enable the **Frequency limit** toggle to manage the frequency of in-app message display in the application.
In our case, we want to display the message to the customer a maximum of 1 time in period of 7 days.
You can additionally enable the **Capping limit** toggle to limit the amount of time the in-app message can be displayed to a user in general.
16. Click **Apply**.
17. Optionally, you can define the UTM parameters and additional parameters for your in-app campaign.
18. Click **Activate**.
## What's next
---
After defining this schema, you can reuse the template across other placements as needed. It can be applied not only in PDP blocks, emails, or in-app views, but also in any additional surfaces supported by your setup—for example homepage modules, product carousels, or campaign-specific placements. This allows you to keep product data consistent while still generating similar items dynamically.
## Check the use case set up on the Synerise Demo workspace
---
In Synerise Demo workspace, you can check the configuration of:
- [Similar Recommendation](https://app.synerise.com/ai-v2/recommendations/Qgt7QWHu35ZB)
- [Brickwork schema](https://app.synerise.com/assets/brickworks/schemas/4f90172f-2439-4e32-9588-77a156a8c6e1)
- [In-app campaign](https://app.synerise.com/communications/in-app/7f5cc48e-d9d2-4bac-97cc-fb2384d358d1)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 7 events per profile that completes the flow:
[`product.addToFavorite`](/docs/assets/events/event-reference/items#productaddtofavorite) (~1), [`inApp.show`](/docs/assets/events/event-reference/inapp#inappshow) (~1), [`inApp.click`](/docs/assets/events/event-reference/inapp#inappclick) (~1), [`brickworks.generated`](/docs/assets/events/event-reference/brickworks#brickworksgenerated) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Brickworks](/docs/assets/brickworks)
- [In-app messages](/docs/campaign/in-app-messages)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Enhance personalized recommendations by applying filter with aggregate
---
Personalized recommendations is a great way to enhance customers experiences while serving them with products tailored for their preferences. With Synerise, you can go a step further and narrow those already personalized recommendations to product attributes specific for each customer. These can be cusomers' favorite color, style, size, or any other attribute. By enhancing personalized recommendations with those attributes, you can increase customers engagement, boost conversion rates and foster brand loyalty.
In this use case we will create a set of personalized product recommendations based on recently seen styles for customers who have not made a purchase in the last 30 days and send these recommendations through email.
This use case provides you with an instruction how to use a ready-made email template that can be used 1:1 in a business scenario.
## Prerequisites
---
- Implement a [tracking code](/developers/web/installation-and-configuration) into your website.
- [Import an item catalog for recommendations](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations). Enable Personalized recommendations.
- [Implement OG tags](/developers/web/og-tags), in this use case we use `product:style`. You can implement any other data on which you want to base the aggregate.
- Configure a [sender account](/docs/campaign/e-mail/configuring-email-account).
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate](#create-an-aggregate) returning the top style of products visited by customer, it will be used in the recommendation configuration.
2. [Prepare an AI recommendation](#prepare-an-ai-recommendation).
3. [Prepare an email template](#prepare-an-email-template) with recommendation.
4. [Create a workflow](#create-a-workflow).
## Create an aggregate
---
In this part of the process, create an aggregate that returns the most frequently seen style of products by a customer in the last 24 hours. Those products will not be displayed in the template, but the aggregate result will serve as a context for recommendations.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Top**.
4. From the **Choose event** dropdown list, select the **Visited page** event.
5. As the event parameter, select **product:style**.
6. Click the **+ where** button.
7. From the **Choose parameter** dropdown list, select the **product:style** parameter.
8. From the **Choose operator** dropdown list, select **Is true (Boolean)**.
9. Using the date picker in the lower-right corner, set the time range to **Last 24 hours**. Confirm your choice with the **Apply** button.
7. Click **Save**.
Configuration of the aggregate returning top styles in the last 24 hours
## Prepare an AI recommendation
---
In this part of the process, you will configure a personalized recommendation which will be later used in the email template. This recommendation will suggest items based on the [results of the aggregate created in the previous step](#create-an-aggregate).
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation (it is only visible on the list of recommendation).
3. In the **Type & Items feed** section, click **Define**.
4. From the **Items feed** dropdown list, select an item feed.
5. In the **Type** section, choose the **Personalized** recommendation type.
6. Confirm the settings by clicking **Apply**.
7. In the **Items** section, click **Define**.
1. Click **Add slot**.
2. Define the minimum and maximum number of items that will be recommended to the customer in each slot.
3. Click **Define filter** in the [Static filter](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#static-filters) section, and from the dropdown list choose **Visual Builder**.
4. From the **Select attribute** dropdown list, choose **style**.
5. From the **Operator** dropdown list, select **Equals**.
6. Change the **Value** atribute to **Aggregate**.
7. From the **Select value** dropdown list, select the [aggregate created in the previous step](#create-an-aggregate).
8. Click **Apply**.
Configuration of the static filter
9. Optionally, define [Elastic filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#elastic-filters).
10. Click **Apply**.
8. Optionally, you can define the **Boosting** factors and settings in the **Additional settings** section.
9. In the right upper corner, click **Save**.
## Prepare an email template
---
In this part of the process, you will create an email template. We will use a predefined template for the personalized recommendations, so there is no need to create a template from scratch. If you want to create a template from scratch, you can use the following email builders:
- [email template builder](/docs/campaign/e-mail/creating-email-templates/email-code-editor)
- [basic drag & drop builder](/docs/campaign/e-mail/creating-email-templates/creating-custom-html-block-basic-builder).
1. Go to **Experience Hub > Email**.
2. On the left pane, click **Templates** and from the list of template folders, select **Predefined dynamic templates**.
3. Select the **Recommended products** template.
**Result:** You are redirected to the code editor.
You can edit the template in two ways, by editing the code of the template ([add inserts](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-snippet-to-the-template-code), [add variables](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-variable) and/or by filling out the form in the Config tab. In this use case, we will use the capabilities of the predefined Config tab.
### Edit form in the Config tab
---
The form in the **Config** tab is pre-filled with default values, which you can modify to suit your business needs.
1. In the **Logo** section, you have the option to customize the logo's height, link, title, and image source.
2. In the **Main image** section, you can specify the height, link, title, and the source of the main image.
4. In the **First recommendation header** section, you can type the header you want to display and define the background and font colors.
5. In the **First recommendation products** section:
1. Set the value in the **Number of product in row** field.
1. From the **Recommendation id** dropdown list select the [recommendation you prepared in the previous step](#prepare-an-ai-recommendation). You can find it by typing its name or ID in the search box.
2. Customize the **Product name font color**, **Font color**, **Button font color**, **Button background color**, **Button border radius** and **Button text** options.
6. Optionally, repeat steps 3-4 for **Second recommendation header** and **Second recommendation products** and configure **Category section**, **Contact section**, **Social media** and **Footer** or hide them by switching off the respective toggle.
To preview the template without switched off sections, use the **Preview Contexts** option.
7. After you make changes to the template, you can check the preview.
1. Click the **Preview Contexts** button on the upper left side.
2. Enter the ID of a customer.
3. Click **Apply**.
8. If the template is ready, click the arrow next to **Use in communication** in the upper right corner, and from the dropdown select **Save as**.
9. On the pop-up:
1. In the **Template name field**, enter the name of the template.
2. From the **Template folder** dropdown list, select the folder where the template will be saved.
3. Confirm by clicking **Save**.
## Create a workflow
---
In this part of the process, you will create a workflow which sends emails with personalized recommendations to customers, triggered when they finish their session on the site. The email will be sent maximum once a month, to customers who did not made a purchase in the last 30 days.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the trigger node
---
The workflow is triggered for specific group of customers every day at a defined time. In our case - customers with email marketing agreement who have not made a transaction, and for whom the [the results of the aggregate created in the previous step](#create-an-aggregate) is valid.
1. As the first node, add the **Audience** node.
2. In the configuration of the node, set the **Run trigger** option to **repeatable**.
3. Set the interval to 1 per day.
4. Choose the day and time when the process starts.
5. Select the time zone.
6. In **Define audience**, choose **New Audience** and click **Define conditions**.
1. As the first condition, from the **Choose filter** dropdown menu, choose **Email agreement** attribute.
2. From the **Choose operator** dropdown list, select **Is true (Boolean)**.
3. As the second condition, from the **Choose filter** dropdown menu, choose the [aggregate created in the previous step](#create-an-aggregate).
4. From the **Choose operator** dropdown list, select **Is true (Boolean)**.
5. As the third condition, from the **Choose filter** dropdown menu, choose the `transaction.charge` event, and change condition to **not matching**.
6. Using the date picker in the lower-right corner, set the time range to **Custom** and set to **30 days**. Confirm your choice with the **Apply** button.
Configuration of the Audience trigger node
7. Click **Apply**.
7. Click **Apply**.
### Define the Send Email node
---
1. Add the **Send Email** node. In the node settings:
1. In the **Sender details** section, choose the email account from which the email will be sent.
2. In the **Content** section, type the **Subject** and from the **Template** dropdown, select [the template you created in the previous step](#prepare-an-email-template).
3. In the **UTM & URL parameters** section, you can define the UTM parameters added to the links included in the email.
4. In the **Additional parameters** section, you can assign [additional parameters](/docs/campaign/e-mail/creating-email-campaigns#adding-custom-parameters) to the events generated by sending and interacting with this email.
2. Click **Apply**.
### Add the finishing node and set capping
---
1. Add the **End** node.
2. In the upper right corner, click **Set Capping** and define the limit of workflows a profile can start:
1. Set **Limit** to 1.
2. Set **Time** to 1 month.
2. In the upper right corner, click **Save & Run**.
Workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of each step directly in Synerise Demo workspace:
- [Aggregate](https://app.synerise.com/analytics/aggregates/7523f982-51b6-3a28-8fbf-183613936caf)
- [Personalized Recommendation](https://app.synerise.com/ai-v2/recommendations/qu78KmoKeviP)
- [Workflow](https://app.synerise.com/automations/automation-diagram/87212121-30f6-437d-9c39-df60aa492efe)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 9 events per profile that completes the flow:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~1), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Automation Hub](/docs/automation)
- [Email templates](/docs/campaign/e-mail/creating-email-templates)
- [Recommendations](/docs/ai-hub/recommendations-v2)
- [Segmentation](/docs/analytics/segmentations)
# Sending reminder about recently visited category at the very best time
A properly personalized campaign can encourage the customer to make a purchase - but it is even more effective if it is sent at the very best time. For this purpose, it is worth using the time optimizer, a solution that allows you to send campaigns at the time best suited to the activity of a specific customer. Thanks to this option, you can be sure that the campaign will reach them during the time of their activity and will not go unnoticed. Using time optimizer, you increase the chances that the customer will read the communication, use the discount, and finalize the purchase.
In this use case, we will present sending a reminder to a customer with the information about promotion for a specific product category which they visited 7 days before and did not make a purchase. The email will be sent based on the time optimizer to reach each customer at the time when they open emails most often. We consider the time range between 8-22, during the specific day.
## Prerequisites
---
- Configure an [email account](/docs/campaign/e-mail/configuring-email-account).
- [Enable time optimizer](/docs/settings/configuration/time-optimizer#enabling-time-optimizer) in Synerise settings.
- [Create an Email mode](/docs/settings/configuration/time-optimizer#creating-modes) for time optimizer that will analyze the customer’s activity time in the email channel.
- Create an [email template](/docs/campaign/e-mail/creating-email-templates) with information about promotions for specific product category.
Optionally you can implement [coupons](/docs/assets/code-pools) which you can import and add to your email template as the [insert](/developers/inserts/insert-usage#code-pools).
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction). Make sure that you implement `category` parameter in the transaction events.
- Implement [Synerise JS SDK](/developers/web/installation-and-configuration) on your website.
- Implement [OG tags](/developers/web/og-tags). Thanks to this, the `product:category` parameter will be available in the `page.visit` events. We will later use this parameter to determine which product category the customer visited.
## Create a workflow
---
Prepare a workflow that sends an email with the information about discount for the product category, which customer visited 7 days before but have not made the purchase since then. In our case, it will be a promotion for the `decorations` category.
The workflow starts every day at 8 A.M. and it is targeted to people who meet the conditions above. Then, the time optimizer chooses the best time to deliver the email for the next 14 hours for every customer and then, the email is send.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Audience node
---
Choose the **Audience** node as the trigger. In this step, you will select the group of customers who have visited the `decorations` category exactly 7 days before but did not make a purchase since then.
1. Start the workflow with the **Audience** node.
2. In the configuration of the node, set the **Run trigger** option to **repeatable**.
3. Set the interval to 1 per day.
4. Choose the day and time when the process starts. Choose 8 A.M. to provide plenty of time for the time optimizer to choose the best time for a particular customer.
5. Select the time zone.
6. In **Define audience**, choose **New Audience** and click **Define conditions**.
1. As the first condition, from **Choose filter** dropdown menu, choose `page.visit` event.
2. Click the **+ where** button, choose **product:category**, and then select **Equal**. As the value, enter the name of the category. In our case it is `decorations`.
3. Set the time range to **Last 1 day before 7 days**.
4. As the second condition, from **Choose filter** dropdown menu, choose the `product.buy` event.
5. Click the **+ where** button, choose **category**, and then select **Equal**. As the value, enter the category `decorations`.
6. Set the time range to **Last 8 days** to exclude the customers who have not made a purchase since the last visit in a specific category.
7. Change the **Profiles matching funnel** option to **Profiles not matching funnel** by clicking the **matching** word.
8. Click **Apply**.
Configuration of the Audience node
### Define the Optimize Time node
---
In this step you will set up the time optimizer, which will select the best time to send email for every customer.
1. Add the **Optimize Time** node.
2. From the **AI optimization mode** dropdown, choose **Mail**.
3. In **Time period to analyze**, choose the best moment to activate the node that follows the Optimize Time node. In our case it will be **Custom time period**.
4. In the **Time period** field, enter `14`, to be sure that the message will be sent between 8 and 22, and the best time for every customer will be narrowed to this period.
5. Click **Apply**.
Configuration of the Optimize Time node
You can choose the time period for sending your campaign based on your business needs. You can choose a wider range with the end date, and additional exclusions, for example - for weekends or night hours.
### Define the Send Email node
---
In this step, select the email template with information about the promotion for products from the `decorations` category and set up the final sending settings.
1. Add the **Send Email** node.
1. In the **Sender details** section, choose the email account from which the email is sent.
2. In the **Content** section, select the template that you prepared as a part of the prerequisites with information about current promotion for specific product category. Add the subject of the email.
3. In the **UTM & URL parameters** section, define the UTM parameters added to the links included in the email.
4. In the **Additional parameters** section, optionally describe campaigns with [additional parameters](/docs/campaign/e-mail/creating-email-campaigns#adding-custom-parameters).
5. Click **Apply**.
Send Configuration of the Send Email node
### Prepare the final settings
---
1. Add the **End** node.
2. Optionally, add titles to each node so the workflow will be more understandable to your colleagues.
3. Name the workflow.
4. To save it as a draft, click **Save** it or activate by clicking **Save & Run**.
Configuration of the workflow
## Check the use case set up on the Synerise Demo workspace
---
You can check the [workflow configuration](https://app.synerise.com/automations/automation-diagram/4b934898-00ef-49fb-927d-6bb3aff7e39a) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 8 events per profile that completes the flow:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`snr.ate.prediction`](/docs/assets/events/event-reference/predictions#snrateprediction) (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Coupons](/docs/assets/code-pools)
- [Email campaigns](/docs/campaign/e-mail)
- [Time optimizer](/docs/settings/configuration/time-optimizer)
# Personalized products on landing page
Synerise allows you to prepare a dedicated landing page containing a **personalized offer of recommended products**. You can send it via email or web push to people who were on the site but did not buy anything or didn't even add anything to their cart. This will allow you to attract their attention again after leaving the site. Also you can add a tab in the menu, like **Chosen for you**, which will redirect to such a landing page with an offer suited for a particular user.
## Example of use - Home appliances industry
Our client wanted to activate customers, who left an e-store but did not add anything to the shopping cart. They used automation to send an email message directing to the landing page with personalized recommendations after a customer had finished the session.
Landing Page
**Results**
- OR 25,2%,
- CTR 21,8%,
- Conversion 5,13%.
## Prerequisites
---
To be able to implement this use case, you must:
- [Implement a tracking code](/docs/settings/tool/tracking_codes)
- [Track forms](/developers/web/tracking-form-data)
- [Configure newsletter sign-up process](/docs/settings/configuration/newsletter-sign-up)
- [Create a sender account](/docs/campaign/e-mail/configuring-email-account)
## Process
---
Creating a landing page with personalized products, perform the steps in the following order:
1. [Prepare a subpage](/use-cases/landing-page-personalized#prepare-a-subpage).
2. [Prepare AI Recommendation](/use-cases/landing-page-personalized#prepare-ai-recommendation).
3. [Prepare Dynamic Content](/use-cases/landing-page-personalized#prepare-dynamic-content).
## Prepare a subpage
---
Prepare an empty page within the website of your ecommerce store, for example, `www.yourdomain/recommended-for-you`, which will contain only header and footer – the rest will be added by Dynamic Content.
## Prepare AI Recommendation
---
1. Go to **Experience Hub > Recommendations** and click **Add Recommendation**.
2. Choose personalised recommendation type.
3. Select how many products the user should get – as it is a landing page, you can show them way more products than by email or a typical recommendation frame.
4. Add additional filters if needed.
AI recommendation
## Prepare Dynamic Content
---
You can use Dynamic content to insert recommendations on the landing page.
1. Choose **Insert Object** type.
2. Select **everyone** in the Audience.
3. In Content select **Simple message**, and specify the CSS selector where you want to insert recommendations.
4. In the Content tab, click **Create Message**, insert Jinjava code with AI recommendation and add your own CSS. Let’s look at how to prepare the appropriate the jijnava code.
Check the jinja code
<!-- Downloading the AI campaign --> {% recommendations2 campaignId=cg3HBgRC5P2h %} {% for p in recommended_products2 %} <li data-snr-ai-product-id="{{p.productRetailerPartNo}}"> <a class="snrs-AI--item-link" href="{{p.link}}" title="{{p.title}}"> <img src="{{ p.imageLink }}" class="products-slider__item-image snrAI-product-image snrAI-product-image-{{p.productRetailerPartNo}}" width="90" alt="{{p.title}}" id="snrAI-image-{{p.productRetailerPartNo}}"> <h3 class="snrs-AI-product--product-name"> <span class="snrs-AI-product--name-first">{{p.title}}</span> </h3> </a> </li> {% endfor %} {% endrecommendations2 %}
5. Schedule when dynamic content is active.
6. In **Display settings**, specify that Dynamic contet has to be shown Always, On landing, or on a specific URL.
Display settings
Save the dynamic cotent, and use the ready recommendation in your landing page.
If you don’t want to use dynamic content, you can retrieve recommendations via API request [details](https://hub.synerise.com/api-reference/ai-recommendations#tag/Recommendations).
## Generated events
This use case generates approximately 13 events per profile that completes the flow:
[`session.end`](/docs/assets/events/event-reference/web-and-app#sessionend) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~1), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1), [`landingpage.visit`](/docs/assets/events/event-reference/landing-page#landingpagevisit) (~1), [`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [AI API recommendations](https://hub.synerise.com/api-reference/ai-recommendations#tag/Recommendations/)
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Jinjava inserts](/developers/inserts/insert-usage)
- [Personalized recommendations](/docs/ai-hub/recommendations-v2/recommendation-types#personalized)
# Traffic Dispatcher for Control Group Allocation in Multiple Campaigns
A/B testing is a powerful tool for businesses to optimize their marketing campaigns. By testing different versions of a campaign with a randomly split audience, businesses can determine which version is more effective at achieving their desired outcome, such as increased conversions or engagement. This data-driven approach enables businesses to make informed decisions about their campaigns, improve their return on investment, and grow. Whether it's testing different ad copy, visuals, or call-to-actions, A/B testing can help businesses fine-tune their marketing strategies and achieve greater success.
With our predefined Dynamic Content (DC) templates, you can easily create your own control group dispatcher. In this use case, we will use the DC campaign to run the dispatcher. The ready-to-use Java Script in the template will update the page body with `data-test-snrs` attribute according to predefined user allocation. The attribute can be later found in the customer profile with value A or B.
## Prerequisites
---
- [Implement a tracking code](/docs/settings/tool/tracking_codes) into your website.
## Create dynamic content
---
The dispatcher will assign users to 2 groups in 2 areas:
- The group will be assigned as an attribute in the customer profiles. The attribute is called `test-snrs` and takes the following values:
- **A** - recommendation group (people in this group are able to see recommendations and personalized content),
- **B** - control group (people in this group should not get any recommendations and personalized content).
- It will add a `data-test-snrs` (=”A” or =”B”) attribute to the page body, which you must use in any later campaign settings. You can find out more about this in the [What's next](#whats-next) section.
1. Go to **Experience Hub > Dynamic content > Create new**.
2. Enter the name of the dynamic content.
3. Choose the **Insert Object** type.
4. As the Audience, leave **Everyone**.
### Define content
1. In the **Content** section, select **A/B tests**.
2. In the **Variations** section, click **Allocation**.
1. Switch off the **Set equal** toggle.
2. Set the **Profile allocation** to A-90% / B- 10%.
Manual profile allocation
3. Switch back to **Content** and specify the CSS selector as **Before (in div)**: `body > div `.
4. Click **Create Message**.
5. From the list of template folders, select a folder with the predefined script templates.
**Result**: You are redirected to the list of predefined templates.
Script templates folder
6. Select the **Dispatcher for AB tests** template.
**Result**: You are redirected to the template builder.
This template consists only of predifined JavaScript. When the customer is assigned to a group, there is always an attribute added to the body in your website HTML code that identifies in which group the customer is.
7. Edit the form in the Config tab:
1. From **Variant to be assigned** choose **A**.
2. Click **Next**.
8. In the **Content** section, click **Variant B** and specify the CSS selector as **Before (in div)**: `body > div `.
9. Click **Create Message**.
10. Repeat steps 5-6.
11. Edit the form in the Config tab:
1. From **Variant to be assigned** choose **B**.
2. Click **Next**.
12. Click **Apply**.
### Define schedule and display settings
The dispatcher needs to be active all the time.
1. In the **Schedule** section, click **Define** and choose **Display immediately**.
If you have more that one dispatcher configured in your business profile (ex. for different percentages of audience) remember that two dispatchers cannot render on the website at the same time. In such case you need to make a delay for one of them. 1 second should be enough.
2. Click **Apply**.
3. In the **Display Settings** section, click **Define**.
4. As the trigger, leave **On landing**.
5. Skip the **Advanced options** configuration.
6. Click **Apply**.
7. Click **Activate**.
## What's next
---
The [above DC campaign](#create-dynamic-content) gives the `data-test-snrs` (=”A” or =”B”) attribute to the page body.
You can see the attributes in client profile in **Behavioral Data Hub > Profiles**. You can use this attribute in all sorts of analytics.
In order to send any DC campaigns to a recommendation group (group A), selector `body[data-test-snrs="A"]` should be placed in the campaign **Content** section, before the place where you want to render your DC campaign.
CSS selector configuration
There must be a space after `body[data-test-snrs="A"].`
**Example:**
```css
body[data-test-snrs="A"] .catalogsearch-result-index .message.notice
```
**After (in div)** can be modified depending on your business needs.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [dynamic content configuration](https://app.synerise.com/campaigns/create/7a237c5c-61af-426c-95d4-c5d2101c1156) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`variant.assign`](/docs/assets/events/event-reference/search#variantassign) (~1), [`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`profile.updated`](/docs/assets/events/event-reference/profiles#profileupdated) (~1).
## Read more
---
- [AB tests](/docs/ai-hub/ai-search/configuring-ab-test)
- [Dynamic content](/docs/campaign/dynamiccontent)
# In-app Memo Game
Gamification is an effective way to increase user engagement, boost session duration, and make in-app experiences more memorable. By combining a simple interactive game with product discovery, brands can capture user attention while promoting key products in an enjoyable and interactive way.
In this use case, you’ll create an in-app memo game (3x3 grid) where the tiles feature images of your most viewed products from the last 30 days. This approach blends entertainment with commerce — users play to match pairs while naturally discovering your bestsellers.
The in-app will be activated after every transaction, giving user the chance to gain the discount for the next shopping.
The game dynamically loads product images using a predefined recommendation frame. When a player completes the game, they can be rewarded with a discount code for your bestsellers for the next transaction.
It’s built on a ready-to-use template, so you don’t need any coding skills to set it up — the layout and logic are preconfigured.
## Prerequisites
---
- [Implement Synerise SDK in your mobile app](/developers/mobile-sdk).
- [Configure AI engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-search). Enable the **Top items** model.
- [Configure an item catalog for recommendations](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations). Select the **Top items** model to train the feed.
- Create a [promotion](/docs/ai-hub/promotions) code which will enable a discount when finalizing the purchase.
## Process
---
In this use case, you will go through the following steps:
1. [Create AI recommendations](/use-cases/in-app-memo#create-ai-recommendations) with top items.
2. [Create an in-app campaign](/use-cases/in-app-memo#create-an-in-app-campaign) with a memo game with top products.
## Create AI recommendations
---
In this step, create an AI recommendation campaign that will be used to display products in your in-app memo game.
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation (it is only visible on the list of recommendations).
3. In the **Type & Items feed** section, click **Define**.
4. From the **Items feed** dropdown list, select a product feed.
6. Choose the **Top items** recommendation type.
8. Click **Apply**.
9. In the **Items** section, click **Define**.
10. Click **Add slot**.
11. Define the minimum and maximum number of products that will be recommended to the user.
In our example, it is from 3 (minimum) to 3 (maximum).
12. Optionally, add a **Static filter**.
Learn about the differences between [elastic, static filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#select-conditions-of-displaying-items), and [distinct filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#distinct-filter).
*.
21. In the **Boosting** section, you can enable [boosting](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-the-boosting-factors).
22. In **Additional settings**, you can exclude already bought products.
23. Save the recommendation by clicking **Save**.
## Create an in-app campaign
---
In this part of the process, you will create an in-app campaign, presented after the user makes a transaction.
1. Go to **Experience Hub > In-app messages > Create new**
2. Enter a meaningful name for the in-app campaign.
### Define the audience
---
1. In the **Audience** section, click **Define**.
2. Select the **Everyone** tab.
3. Click **Apply**.
### Define content
---
1. In the **Content** section, click **Define**.
2. Click **Create message** and from the list of template folders, select **Predefined templates**.
3. Select **Memo game**.
**Result:** You are redirected to the code editor.
You can edit the template in two ways, by editing the code of the template ([add inserts](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-snippet-to-the-template-code), [add variables](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-variable)) and/or by filling out the form in the **Config** tab. In this use case, we will use the capabilities of the predefined **Config** tab.
#### Edit form in the Config tab
---
The **Config** tab already has default values filled in. You can keep them or change them to fit your business needs.
In-app configuration
1. In the **General Settings** section:
1. In the **Brand name** field, enter the name of your brand (for example, Synerise).
2. In the **Promotion code** field, enter the discount code displayed after the game is completed, created as a part of [prerequisites](#prerequisites).
3. In the **Promotion name** field, type the campaign name, presented in the middle box in the game.
4. In the **Picture source** field, select the source of images for the cards:
- Hardcoded URLs – enter image links manually.
- AI Recommendations – dynamically load images from an existing recommendation campaign (like in this case).
If you select AI Recommendations, enter the AI Recommendations Campaign ID in the dedicated field in the last section (for example, 5tf3u77lj3Hq).
2. In the **Game Settings** section:
1. Set up the time limit. To remove the time limit, enter `0`
2. If you want to allow users to replay the game, enable the **Show Restart button** option.
3. In the **Win Modal** section, enter the success message displayed after the user completes the game. Optionally, you can include a link or CTA to redirect users to a product page or a personalized offer.
4. In the **Hardcoded Pictures** section (optional): If you selected Hardcoded URLs as your picture source, paste the image links for each card in the fields provided.
5. In the **Colors** section, define your game’s color scheme.
6. In the **Layout** section, personalize the layout of the game.
7. In the **AI Recommendations** section, confirm that the AI Recommendations Campaign ID field contains the ID of the campaign you have created in the [previous step](#create-ai-recommendations) (for example, 5tf3u77lj3Hq). This setup ensures that images in the memo game come directly from your recommendation frame — for instance, Top Viewed Products – Last 30 Days.
8. After you make changes to the template, you can check the preview.
1. Click the **Preview** button on the upper left side.
2. Enter the ID of a customer or a product.
3. Click **Apply**.
Considering that the in-app is very interactive, the preview in the platform may not be enough to test the in-app performance. That's why we suggest checking how this campaign displays altogether directly in the mobile app.
9. If the template is ready, in the upper right corner, click **Save this template > Save as**.
10. On the pop-up:
1. In the **Template name** field, enter the name of the template.
2. From the **Template folder** dropdown list, select the folder where the template will be saved.
3. Confirm by clicking **Apply**.
11. Click **Next** to continue the process of configuring the in-app campaign.
12. Click **Apply** to save your content changes.
### Select events that trigger the in-app message display
---
In this part of the process, define the event that triggers the display of the in-app message. In our case, the trigger is `transaction.charge` event.
1. In the **Trigger events** section, click **Define**.
2. Click **Add event** and from the dropdown list, choose the `transaction.charge` event.
3. Click the **+ where** button and as the parameter, choose `source`.
4. As the logical operator, select **Equal** and as the value add `MOBILE`.
5. Click **Apply**.
### Schedule the message and configure display settings
---
As the final part of the process, you need to set the schedule, display settings configuration, capping, priority of the message among other in-app messages.
1. In the **Schedule** section:
1. Click **Define**.
2. Choose **Run immediately** option.
3. Click **Apply**.
2. In the **Display settings** section:
1. Click **Define**.
2. Define the **Delay display** as **0** and **Priority index** as **1**.
5. Click **Apply**.
3. Optionally, you can define the UTM parameters in the **UTM & URL parameters** section. Otherwise, click **Skip step**.
4. Optionally, you can add the custom parameters in the **Additional parameters** section. Otherwise, click **Skip step**.
3. To start your campaign, click **Activate**.
## What's next
---
Use the data collected from the memo game to:
- Retarget players who completed the game but did not make another purchase.
- Create follow-up in-app or email campaigns featuring items from the memo grid.
- Rotate the recommendation type (e.g., “Top purchased” or “Trending now”) to keep the game fresh.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the campaign components directly in Synerise Demo workspace:
- [AI recommendation configuration](https://app.synerise.com/ai-v2/recommendations/tvHzWPoH4YfY),
- [In-app campaign](https://app.synerise.com/communications/in-app/0ff7a956-4372-45f2-8c4b-9b8c13798e1d)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 4 events per profile that completes the flow:
[`transaction.charge`](/docs/assets/events/event-reference/items#transactioncharge) (~1), [`inApp.show`](/docs/assets/events/event-reference/inapp#inappshow) (~1), [`inApp.click`](/docs/assets/events/event-reference/inapp#inappclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1).
## Read more
---
- [In-app messages](/docs/campaign/in-app-messages)
- [Using in-app template builder](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template)
- [Mobile campaigns](/docs/campaign/Mobile)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Propensity-based customer segmentation
This use case is a short continuation of the [Propensity - brand](/use-cases/propensity-brand) use case and it describes the process of creating a segmentation based on the score of the propensity prediction. The result of the segmentation shows the assignment of customers to the likelihood of purchase of particular products.
## Prerequisites
---
- Add a [tracking code](/developers/web/installation-and-configuration) to your website.
- Create a [Propensity prediction](/use-cases/propensity-brand) that produces the 5-point score (very low, low, medium, high, and very high).
- Make a note of the `modelId` parameter (available in the parameters of the `snr.propensity.score` event).
Click to see where to find modelId
Conditions of the segmentation
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate](/use-cases/segmentation-propensity-based#create-an-aggregate).
2. [Create a segmentation](/use-cases/segmentation-propensity-based#create-segmentation).
## Create an aggregate
---
As the first part of the process, create an aggregate that returns the latest score of the propensity prediction of a specific model.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter a meaningful name of the aggregate.
2. Set **Analyze profiles by** to **Last**.
3. Select the **snr.propensity.score** event.
4. As the event parameter, select **score_label**.
5. Click **+ where**.
6. From the **Choose parameter** dropdown list, select **modelId**.
7. As the logical operator, select **Equal**.
8. In the text field, enter the value of the modelId parameter.
9. As the date range, select **Lifetime**.
10. Save the aggregate.
Conditions of the aggregate
## Create segmentation
---
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation.
3. By clicking **Add segment** add five segments and name each of them as follows: `Very low`, `Low`, `Medium`, `High`, `Very high`.
Very low
Conditions of the segmentation
### Preview segmentation
1. Click **Show preview**.
You receive the number of customers in each segment and the percentage of each segment in relation to the whole population in the segmentation.
2. Additionally you can change the chart type - pie chart and column chart. You can also export the information to CSV/XLSX (data) or JPEG/PNG/PDF (chart).
Preview of the segmentation
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of every element of this process directly in Synerise Demo workspace:
- [Aggregate](https://app.synerise.com/analytics/aggregates/930e05c6-ec5f-3ade-a00b-c638a0f5bb0b)
- [Segmentation](https://app.synerise.com/analytics-v2/segmentations/07e00c22-e99c-4f95-b201-4124e703bd5c)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case does not generate any events.
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Segmentation](/docs/analytics/segmentations)
# Exporting reports to SFTP server
The Reports feature in Synerise gives lots of opportunities to create custom reports adjusted to your business needs and the data you store in the workspace. Thanks to data transformation and automation, you can create the mechanism of exporting reports to your external resource cyclically.
In this use case we will describe how to export a report to an SFTP server every day. We will also create a data transformation diagram which changes the name of a column in the report before sending it.
Completing this procedure requires some knowledge on sending API requests using cURL, Postman, or similar tools.
## Prerequisites
---
- Create a catalog in your SFTP server in which your reports will be stored.
- Create a [report](/docs/analytics/reports) that will be exported to the SFTP server.
The time scope of the report should be adjusted to the frequency of exporting data. For example, if you export the report every day, it should have the time scope set to **Yesterday** - thanks to this, you will export data each day from the previous day.
- Create a workspace [API key](/docs/settings/tool/api) with the permission required by [the "Preview report as CSV method](https://hub.synerise.com/api-reference/analytics-suite#operation/previewAllGroupingsCSVPOST_v4).
## Process
---
1. [Prepare a file with sample data](/use-cases/export-report-sftp#prepare-a-file-with-sample-data).
2. [Create data transformation diagram](/use-cases/export-report-sftp#create-data-transformation-diagram).
3. [Create a workflow](/use-cases/export-report-sftp#create-a-workflow).
## Prepare a file with sample data
---
In this part of the process, you need to prepare a file with sample data which will be used to create Data Transformation later.
1. Go to **Decision Hub > Reports**.
2. From the list, select the report you created for exporting.
3. Click the **Preview** tab.
4. Click **Download CSV**.
5. Open the file in text editor and remove rows from it until 10 are left. This copy is only needed as a file sample for creating the Data Transformation.
## Create data transformation diagram
---
In this part of the process, we define the rules of modifying data before sending it to the SFTP server. Each report exported from Synerise has a column named `Value`, which contains the value of metric used in the report. For the purposes of this use case, we will change the name of this column to `number of clicks`.
The data transformation diagram which is the output of this part of the process is used later to [automate sending the data](/use-cases/export-report-sftp#create-a-workflow).
1. Go to **Automation > Data Transformation > Create transformation**.
2. Enter the name of the transformation.
3. Click **Add input**.
### Add file with sample data
The **Data input** node allows you to add a data sample. In further steps, you define how the data must be modified. Later, when this transformation is used in the Automation workflow, the system uses the rules created with the sample data as a pattern for modifying actual data.
4. On the pop-up, click **Add example**.
5. Upload the file prepared in [this step](/use-cases/export-report-sftp#prepare-a-file-with-sample-data).
6. Change the default delimiter to `;`.
The configuration of the Data input node
6. Click **Generate**.
### Change the name of the column
7. On the canvas, click the right mouse button.
8. From the dropdown list, select **Rename column**.
9. Click the **Rename column** node.
10. In the configuration of the node:
1. Click **Add rule**.
2. Click **Add column**.
3. Select the **Value** column.
4. Under **Edit values by**, from the dropdown list, select **Replacing**.
6. In the text field, enter `number of clicks`.
The configuration of the Rename column node
7. Confirm by clicking **Apply**.
### Add the finishing node
This node lets you preview the output of the modifications to the sample data.
14. On the canvas, click the right mouse button.
15. From the dropdown list, select **Data output**.
15. In the upper right corner, click **Save and publish**.
**Result**: You have published a Data Transformation diagram and it can now be used in a Workflow.
The diagram of data transformation
## Create a workflow
---
In this part of the process, you will create the workflow that exports report data to SFTP server every day at 6:00 AM.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the launch date
3. As the trigger node, add **Scheduled Run**.
4. In the configuration of the node:
1. Leave the **Run trigger** option at default (**all time**).
2. From the **Timezone** dropdown list, select the time zone consistent with the timezone selected for your workspace.
3. Define the frequency of the workflow. In this use case, it's every day at 6:00 AM.
The workflow will automatically launch everyday at 6:00 AM.
The configuration of the Scheduled Run node
4. Confirm by clicking **Apply**.
### Define the report that will be exported
In this part of the process, we need to define an HTTPS request in the **Get File** node which retrieves a CSV file with report data. The full documentation of this request is available [here](https://hub.synerise.com/api-reference/analytics-suite#operation/previewAllGroupingsCSVPOST_v4).
1. Click **THEN** and from the dropdown list, select **HTTPS > Get File**.
2. In the configuration of the node:
1. From the **Method** dropdown menu, select **POST**.
2. Enter the **URL**: `https://api.synerise.com/analytics/analytics/v4/reports/preview-csv`
3. From the **File format** dropdown menu, select **CSV**.
4. Change the default **Delimiter** to `;`.
5. Add the JSON body of the request:
1. In a new browser tab, open the report you want to export.
2. Open the browser's developer tools and go to the tab where you can preview HTTP requests.
3. In the report, go to the **Preview** tab.
4. In the developer tools, locate the request to the `analytics/v4/reports/preview-csv` endpoint and copy its request body.
5. Paste the request body into the **Body** field of the automation node.
You can also build the request body manually, according to the [documentation](https://hub.synerise.com/api-reference/analytics-suite#operation/previewAllGroupingsCSVPOST_v4).
6. In the **Authorization** section, choose the API key with the required permissions (according to the [documentation](https://hub.synerise.com/api-reference/analytics-suite#operation/previewAllGroupingsCSVPOST_v4)).
7. Leave the rest of the settings as default.
The configuration of the Get File node
3. Confirm by clicking **Apply**.
### Select the data transformation rules
1. Add a **Data Transformation** node.
2. In the configuration of the node, select the [data transformation you have created before](/use-cases/export-report-sftp#create-data-transformation-diagram).
The configuration of the Data Transformation node
3. Confirm by clicking **Apply**.
### Configure settings for SFTP protocol
In this part of the process, we will configure the settings for an SFTP connection so that your report, after passing through transformation rules, can be stored in the external resource.
1. Add the **Send File** node by clicking **THEN > SFTP**.
2. In the configuration of the node:
1. Enter the path to your server.
2. Select the port.
3. Enter the path to the directory.
4. Enter the name of the file that the report will be saved as.
5. If needed, in the **File name suffix**, select the suffix of the file name.
We recommend choosing the **Date** suffix, which adds the current date to the file name, so that the names of your files do not repeat in the catalog (files will be sent every day) and are easier to browse.
6. From the **File format** dropdown list, select the **CSV** format.
7. Change the default **Delimiter** to `;`.
8. In the **Authentication** section, select the method of authentication.
9. Confirm by clicking **Apply**.
### Add the finishing node
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
The workflow configuration
You can monitor the flow of the workflow in the **Transformation logs** tab. It contains information about each execution of the workflow.
The logs for the workflow
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of use case in Synerise Demo workspace:
- [Created workflow](https://app.synerise.com/automations/automation-diagram/ddd30f46-9f9f-4427-a835-97324ffd3da1)
- [Data transformation rules](https://app.synerise.com/automations/data-transformation/04802b73-f425-494e-9a5d-c1e807b1d0e7).
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per workflow execution:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Data Transformation](/docs/automation/data-transformation-and-imports/introduction)
- [Reports](/docs/analytics/reports)
# Identify products purchased at a promotional price
In order to better match the offer with the customer's needs, a company needs to conduct an in-depth analysis of the customers' behavior and buying habits on its website. Knowing what products have been purchased as part of a promotion can prove to be very important and beneficial and can be used later while creating different campaigns.
## Prerequisites
---
- A [tracking code](/developers/web/installation-and-configuration) implemented into the website.
- Send information about transactions through [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
## Process
---
In this use case, you will go through the following steps:
1. [Create an expression](/use-cases/create-event-attribute#create-an-expression).
2. [Create a metric](/use-cases/create-event-attribute#create-a-metric).
3. [Create segmentation](/use-cases/create-event-attribute#create-a-segmentation).
4. [Create report](/use-cases/create-event-attribute#create-a-report).
## Create an expression
---
After a purchase is made, the **product.buy** event appears in the customer's profile. This event contains two parameters: **product:price:amount** - describing the original price of the product and **$finalUnitPrice** - describing the final price of the product. The transaction event does not indicate whether the purchased product was covered by a promotion (unless such a parameter has been implemented into the workspace).
Example of the product.buy event
Using Decision Hub, you can create an event expression that deducts the price of the purchased product from the regular price.
Create an expression that calculates the difference between the initial and the final price of the product.
1. Go to **Behavioral Data Hub > Expression > New expression**.
2. Enter the name of the expression.
3. Set the Expression for option to **Event**.
4. From the dropdown list, select **Bought products**.
5. Click the **unnamed** node.
6. From the **Choose attribute** dropdown list, select **product:price:amount**.
7. Click the plus icon.
8. From the dropdown list, select **Event attribute**.
9. From the **Choose attribute** dropdown list, select **$finalUnitPrice**.
10. Change the mathematical operator between these two parameters to minus.
11. Save the expression.
Formula of the expression
## Create a metric
---
In this part of the process, you create metrics to see how many products were purchased at a discount. This metric will include the [expression](/use-cases/create-event-attribute#create-an-expression) - if the result of this expression is greater than 0, it means that the product was bought at a discount.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter a meaningful metric name.
3. Leave the metric kind at default (**Simple**).
4. As the aggregator type, select **Sum**.
5. Select the **Bought product** event.
6. Add the **$quantity** parameter.
7. Select the **where** input that appeared on the canvas.
8. Select the expression created in the [previous step](/use-cases/create-event-attribute#create-an-expression).
8. Choose the **More than** number operator.
9. Keep clicking the icon next to the logical operator until you get **#** icon.
10. In the blank field, enter `0`.
11. Select the date range of the metric (for example, last 30 days)
11. Save the metric.
Metric configuration
## Create a segmentation
---
Create a segmentation to see how many customers bought discounted products.
1. Go to **Decision Hub > Segmentation > New Segmentation**.
2. Enter the name of segmentation.
3. On the canvas, click **Choose filter**.
4. From the dropdown list, select the **Bought product** event.
5. Select the **where** input that appeared on the canvas.
6. Select the expression created in the [previous step](/use-cases/create-event-attribute#create-an-expression).
7. Choose the **More than** number operator.
8. Keep clicking the icon next to the logical operator until you get **#** icon.
9. In the blank field, enter `0`.
10. Select the date range of the segmentation (for example, last 30 days).
11. Save the segmentation.
Segment configuration
## Create a report
---
In this part of the process, create a report to clearly show the most frequently purchased discounted products, displaying the product parameters that interest you the most (in our example, we display the product names).
1. Go to **Decision Hub > Report > New report**.
2. Enter the name of the report.
3. Select the metric you created in [this part](/use-cases/create-event-attribute#create-a-metric) of the process.
4. From the **Range** dropdown list, select the number of top (the most frequently bought products) to be shown in the preview of the report.
5. In the **Dimension** section, choose a parameter from **product.buy** suggesting what the product is. Among the most common parameters, you can choose **$name** or **$sku**.
6. In the date range, select the time that will be analyzed.
Select the same date range as you selected for the metric and the segmentation.
7. Save the report.
8. Click preview to see the results.
The configuration of report with products bought on promotion
The report will return information about how many, for example, XYZ shoes were purchased at a discount.
Report preview
## Check the use case set up on the Synerise Demo workspace
---
You can find the analyses created in this use case in our Synerise Demo profile at the following links:
- [expression](https://app.synerise.com/analytics/expressions/ca0777e4-19c3-4c1d-84a3-e5d439dc7184),
- [metric](https://app.synerise.com/analytics/metrics/9b948b8c-8728-42a7-b4e4-2526be5d151f),
- [segmentation](https://app.synerise.com/analytics/segmentations/4f4722e9-2b80-4dcb-a483-98f11e1bd812),
- [report](https://app.synerise.com/analytics/reports/883d2dc2-b438-487c-8aee-7c9ee65911e9).
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case does not generate any events.
## Read more
---
- [Expressions](/docs/crm/expressions)
- [Metrics](/docs/analytics/metrics)
- [Segmentation](/docs/analytics/segmentations)
# Predict propensity to buy an item
You can use the Predictions feature to calculate the probability of customers buying a particular item. The results can be used for better targeting of your marketing efforts.
Propensity to buy a particular item: blue sport shoes, identified by a unique ID
## Prerequisites
---
- [Enable the Propensity prediction type](/docs/ai-hub/predictions/enabling-predictions#enabling-propensity-and-best-fit-predictions).
- The `itemID` attribute (the unique identifier attribute of an item) must be added to [filterable attributes](/docs/ai-hub/ai-search/define-attributes#filterable-attributes).
## Creating the prediction
---
1. Go to **(AI Predictions) Models > New prediction** and select **Propensity** as the prediction type.
2. Select an audience for the prediction.
For more information, see the [Predictions quick start article](/docs/ai-hub/predictions/propensity#select-customers-to-be-analyzed).
### Define the item
In this section, you define the item for which you want to calculate the prediction. This is done by creating a filter that matches the item by its unique identifier in the catalog.
1. In the **Item feed** section, click **Define**.
2. Click **Choose item feed**.
3. Select the catalog that contains the items you want to make the prediction for.
**Result**: the **Item filter** section appears.
4. Click **Define item filter**.
5. From the **Select attribute** drop-down list, select the `itemId` attribute.
You can use the search field.
6. From the drop-down list that appears, select the **Equal** operator.
7. From the list of available values that appears, select an identifier.
You can use the search field.
The filter matches exactly one item
8. Click **Save**.
9. Save the item feed configuration by clicking **Apply**.
### Additional settings and saving
Configure the [additional settings](/docs/ai-hub/predictions/propensity#additional-settings) (or leave them at default) and click **Save & Calculate**.
## What's next
---
After the calculation is completed, a `snr.propensity.score` event is saved in the profiles of each customer in the audience. The event data includes detailed results of the prediction.
Based on the `snr.propensity.score` event, you can create segmentations of customers with different propensity and use those segmentations as campaign targets:
- [email](/docs/campaign/e-mail)
- [SMS](/docs/campaign/SMS)
- [web push](/docs/campaign/Webpush)
- [mobile push](/docs/campaign/Mobile)
- [dynamic content](/docs/campaign/dynamiccontent)
- [screen views](/docs/campaign/screen-views)
Email, SMS, web push and mobile push can be sent manually or you can launch them by using [Automation Hub](/docs/automation).
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the [Propensity prediction](https://app.synerise.com/ai-v2/predictions/propensity/ovwcgaomjlwu), [segmentation](https://app.synerise.com/analytics-v2/segmentations/2de2b62c-c659-47fc-8a41-cfba97e94439) and [catalog](https://app.synerise.com/assets/catalogs/13168) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates 1 event per profile that completes the flow:
[`snr.propensity.score`](/docs/assets/events/event-reference/predictions#snrpropensityscore) (~1).
## Read more
---
- [Predictions](/docs/ai-hub/predictions)
# Find profiles who will buy a specific item
In today's fast-paced business landscape, accurate predictions hold the key to informed decision-making and sustainable growth. As companies strive to stay ahead, they understand the pivotal role predictions play in optimizing their strategies.
Across industries, there exists a multitude of scenarios where predictions offer a competitive advantage. The nature of these scenarios is diverse and varies according to each company's unique objectives. Synerise simplifies prediction adoption with predefined templates, allowing businesses to swiftly integrate cutting-edge predictions into their strategies without the need for extensive data expertise. These templates span various goals, from reducing churn to predicting buying behavior and lifetime value.
In this use case, we focus on predicting buying behavior. Specifically, we'll follow a scenario aimed at finding customers who are willing to buy a specific product. You will discover how to effortlessly harness our templates and align them with your business goals.
## Prerequisites
---
- [Enable the "Propensity" prediction type](/docs/ai-hub/predictions/enabling-predictions#enabling-propensity-and-best-fit-predictions).
- The `itemID` attribute (the unique identifier attribute of an item) must be added to [filterable attributes](/docs/ai-hub/ai-search/define-attributes#filterable-attributes) in the item feed that you want to use for the prediction.
- Create the segmentation for which you want to create a prediction. You can also create an entirely new segmentation while creating the prediction.
## Create a prediction using a predefined template
---
In this use case, we will use a predefined scenario for the business goal of predicting buying behavior, specifically finding profiles that are willing to buy a certain item.
1. Go to **> New prediction** and select **Use Predefined scenarios**.
Two paths for creating predictions
### Define the business objective and the scenario you want to follow
---
In this part of the process, you need to select the business objective and its corresponding variant.
1. Define the prediction name.
2. On the left side of the screen, from the list of business objectives, select **Predict buying behavior**.
3. Select the **Find profiles who will buy a specific item, brand or category** scenario.
4. Click **Continue**.
Definition of the business objective and specific scenario
### Select an item feed to use as the source of items/item attributes
---
1. Click **+ Choose item feed**.
2. From the drop-down list, select the item feed.
3. Select an item for which you want to create a prediction. In this use case, select the default **Title / ID** option and click the **+ Select item** field.
4. From the list of all items, select the items for which the prediction will be created.
5. Click **Continue**.
Selection of item feed and specific items for prediction
### Select segmentation
---
In this part of the process, you need to select a group of profiles to examine their propensity to buy an item selected in the previous step.
1. Click **+ Select Segmentation**.
2. From the drop-down list, select the segmentation you created earlier as a part of prerequisites.
3. Click **Continue**.
Selection of the segmentation for which the propensity to buy the product will be calculated
### Define final settings
---
Configure the [additional settings](/docs/ai-hub/predictions/propensity#additional-settings) (or leave them at default) and click **Continue**.
Final setup screen
### Summary check
---
This is the final part of the process, where you can check all the settings configured during the prediction setup. If you want to make any changes, you can go back to the required step using the **Back** button and make the necessary modifications. If no changes are required, click the **Save and Calculate** button.
Prediction summary
## What's next
---
After the calculation is completed, a `snr.propensity.score` event is saved in the profiles of each customer in the audience. The event data includes detailed results of the prediction.
Based on the `snr.propensity.score` event, you can create segmentations of customers with different propensity and use those segmentations as campaign targets:
- [email](/docs/campaign/e-mail)
- [SMS](/docs/campaign/SMS)
- [web push](/docs/campaign/Webpush)
- [mobile push](/docs/campaign/Mobile)
- [dynamic content](/docs/campaign/dynamiccontent)
- [screen views](/docs/campaign/screen-views)
Email, SMS, web push and mobile push can be sent manually or you can launch them by using [Automation Hub](/docs/automation).
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the [Propensity prediction](https://app.synerise.com/ai-v2/predictions/propensity/ovwcgaomjlwu) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates 1 event per profile that completes the flow:
[`snr.propensity.score`](/docs/assets/events/event-reference/predictions#snrpropensityscore) (~1).
## Read more
---
- [Predictions](/docs/ai-hub/predictions)
# Use Countdown Timers in Email Campaigns to Drive Sales with Sendtric
Countdown timers in email campaigns are a proven way to create urgency, boosting engagement and driving conversions for limited-time offers.
In this use case, we will describe how to send an email campaign for a 48-hour special sale.
To emphasize urgency, it will embed a live countdown timer created using Sendtric.
This visual element dynamically updates in real-time, showing customers how much time remains to take advantage of the sale, increasing click-through and purchase rates.
## Prerequisites
---
- [Email account](/docs/campaign/e-mail/configuring-email-account) configured.
- Create an account on [Sendtrick](https://www.sendtric.com/).
- In Sendrtick, configure a timer. You can personalize it based on your business needs. Copy the timer's code for use later in the process.
- Create a segmentation for the target audience.
## Prepare an email campaign
---
In this part of the process, you create an email campaign, targeted to [the segment you created in the prerequisites](#prerequisites) with the countdown prepared as a part of [prerequisites](#prerequisites)
1. Go to **Experience Hub > Email campaign > Create new**.
2. In the **Audience** section, choose the segment created in the [prerequisites](#prerequisites)
3. Configure the **Content** section.
1. Choose the email account from which you want to send your message.
2. In the **Subject** field, enter your message subject.
2. Click **Create message** and create or choose an email template from default projects.
### Create the email template using Visual Builder
---
1. Prepare the email template based on your business needs.
2. Drag and drop the **Image** component where you want the countdown to appear.
3. In the image settings, in the **URL** field, paste the image address from the Sendtric code generated when you created the timer. The address is in the `src` parameter of the code.
6. Apply the changes.
**Watch the video below to see how to add the sendtric code step by step.**
### Create the email template using Code Editor
---
1. Prepare the email template based on your business needs.
2. Insert an **img** tag into your email template at the desired location:
Remembert to replace **URL** and paste the image address from the Sendtric code generated when you created the timer.
3. Save your changes.
### Add additional settings
---
4. In the **Schedule** section, specify the time when you want to send your communication.
4. Optionally, you can define **UTM & URL parameters**. If you don't need them, click **Skip step**.
4. Confirm by clicking **Apply**.
## Check the use case set up on the Synerise Demo workspace
---
Check the [email campaign settings](https://app.synerise.com/campaigns/email/create/6c598f2a-96c1-4a13-bd85-c477c313a284) in the Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1).
## Read more
---
- [Creating emails](/docs/campaign/e-mail/creating-email-campaigns)
- [Jinjava inserts](/developers/inserts/insert-usage)
- [Personalized recommendations](/docs/ai-hub/recommendations-v2/recommendation-types#personalized)
- [Segmentation](/docs/analytics/segmentations/creating-segmentations)
# Using Rules to Boost Specific Brands and Products in Search Results
You can promote brands in the search results using rules. For example, if you have a partnership with a certain brand, you might want to promote items from that brand for some queries. Another example of promoting is returning an item in a specified position in the search results. This is useful when you added a new item to your inventory and it lacks user interactions. You can promote that item to be the first in the search results for a given query.
In this use case, we will show you how to combine both scenarios in one rule that is triggered when a customer searches for `4k UHD TV` (the rule requires exactly this query string):
- `brandA` is promoted.
- An item (called `item1` in this example) is shown as the first result of the search.
## Prerequisites
---
- An item feed must be provided.
- The attribute containing the item's brand must be added to [filterable attributes](/docs/ai-hub/ai-search/define-attributes#filterable-attributes).
- The Search Engine must be enabled for your workspace.
## Creating the rule
---
1. Go to **AI Hub > Indexes**.
2. Choose the index for which you want to apply the rule.
3. Go to the **Rules** tab.
4. Click **Add rule**.
5. In the top left corner of the screen, enter the name of the rule.
6. In the **Conditions** section, click the **Define** button.
7. In the **Query** option (selected by default), leave the **If query** value at **is**.
8. In the **Phrase** input, type `4k UHD TV`.
9. Click **Apply**.
10. In the **Consequences** section, click the **Define** button.
11. Click **Add consequence** and from the dropdown menu choose **Promote item**.
12. In the **Item** input provide the item that will be promoted. In our example, it is `item1`.
13. Change the **Position** to the place in the search results that the item should be promoted to. In our case, it's `1`.
14. Click **Add consequence** and from the dropdown menu choose **Filter query results**.
Settings of the rule that promotes an item. The selection menu for the second consequence is open.
15. Click **Add filter**.
**Result:** A dropdown menu and an input field appear above the **Add filter** button.
16. From the dropdown menu, choose the attribute that contains the brand of the items that you want to show in the results.
17. In the input field to the right of the dropdown, provide the brand that will be promoted.
18. Click **Apply**.
19. **Optional**: To schedule your rule to be active from a start date to an end date, click **Define** in the **Schedule** section.
Otherwise, your rule will be active immediately, with no end date.
20. In the top right corner of the screen, click the **Save & publish** button.
## Generated events
This use case generates approximately 2 events per profile that completes the flow:
[`item.search`](/docs/assets/events/event-reference/search#itemsearch) (~1), [`item.search.click`](/docs/assets/events/event-reference/search#itemsearchclick) (~1).
## Read more
---
- [AI Search](/docs/ai-hub/ai-search)
- [Rules](/docs/ai-hub/ai-search/query-rules)
# Send a mobile push at the best time
Sometimes push notifications can end up annoying customers when sent at the wrong time. You can optimize time of sending push notifications with the help of our time optimizer and connect with your customers at the right time.
This use case describes a workflow that sends a mobile push notification encouraging to purchase when a customer adds a product to a wishlist. The sending time is adjusted to the customers' activity in the mobile app.
## Prerequisites
---
- [Implement Synerise SDK in your mobile application](/developers/mobile-sdk).
- Implement mobile push notifications in your mobile application: [iOS](/developers/mobile-sdk/configuring-push-notifications/ios), [Android](/developers/mobile-sdk/configuring-push-notifications/android).
- Implement the add to wishlist event in your [mobile application](/developers/mobile-sdk/event-tracking#product-added-to-favorites).
- [Create a mobile push template](/docs/campaign/Mobile/creating-mobile-push).
## Process
---
1. [Enable time optimizer](/use-cases/send-mobile-push-with-time-optimizer#enable-time-optimizer).
2. [Create a custom mode](/use-cases/send-mobile-push-with-time-optimizer#create-a-custom-mode) in time optimizer.
3. [Create a workflow](/use-cases/send-mobile-push-with-time-optimizer#create-a-workflow) to send the mobile push at the best time.
## Enable time optimizer
---
1. Go to **Settings > AI Engine Configuration**.
2. Select **Time optimizer** tab.
3. Click **Define**.
4. Switch the toggle on.
## Create a custom mode
---
In this part of the process, create a custom time optimizer mode which you will use in the workflow in further part of the process. In this use case, the idea is to define the events that will be taken into account by the time optimizer while calculating the best time to send the message. In our case, it will be the `screen.view` event, so the optimizer will choose the time when the customer is most active in the application (when the customer generates the `screen.view` events the most).
1. Go to **Settings > AI Engine Configuration**.
2. Select the **Time optimizer** tab.
3. Click **Define**.
4. Click **Add new node**.
5. Select **Custom** to create a new mode:
1. In the **Mode name** field enter the name for the custom mode.
2. From the **Predicted event** dropdown list, select the `screen.view` activity to calculate the most probable time of occurrence.
3. From the **Input events** dropdown list, select the event `screen.view`, based on which the engine will perform the predictions.
4. Click **Apply**.
6. Click **Apply** to save the new mode.
To keep the time optimizer enabled, at least one mode must be active.
Configuration of custom mode in time optimizer
## Create a workflow
---
As the second part of the process, create a workflow that manages the push notifications.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
3. As the first node of the workflow, add **Profile Event**. In the node settings:
1. In the **Define conditions** field, select the `addToWishlist` event.
8. Confirm by clicking **Apply**.
4. Add an **Optimize Time** node. In the configuration of the node:
1. Select the [custom mode](/use-cases/send-mobile-push-with-time-optimizer#create-a-custom-mode) you created in previous part of the process.
2. Set the time period to analyze according to your business needs.
3. Confirm by clicking **Apply**.
4. Add **Send Mobile Push** node. In the configuration of the node:
1. Define the **Template type**.
2. Select the **Push template** you have created.
3. Confirm by clicking **Apply**.
5. Add the **End** node to finish the workflow.
6. To run the workflow, click **Save & Run**.
The final configuration of the workflow
## Check the use case set up on the Synerise Demo workspace
---
You can check the [workflow configuration](https://app.synerise.com/automations/automation-diagram/d12e52a8-5827-4fca-b064-9b21d6f4c536) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 9 events per profile that completes the flow:
`product.addToWishlist` (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`snr.ate.prediction`](/docs/assets/events/event-reference/predictions#snrateprediction) (~1), [`push.send`](/docs/assets/events/event-reference/mobile-push#pushsend) (~1), [`push.view`](/docs/assets/events/event-reference/mobile-push#pushview) (~1), [`push.click`](/docs/assets/events/event-reference/mobile-push#pushclick) (~1).
## Read more
---
- [Configuring mobile notifications](/docs/campaign/Mobile/mobile_campaign)
- [Time optimizer](/docs/settings/configuration/time-optimizer)
- [Workflow settings](/docs/automation/creating-automation)
# Call center dashboard
Creating a dashboard for call center is a great way for call center epmloyees to monitor day-to-day operations, customer buying history as well as their satisfaction based on various metrics and KPIs.
In this use case you will design a dashboard for call center personnel. It will be a reporting tool that shows call center-related analytics so you can monitor, optimize and improve contact with your customers. The goal of the visual presentation is to make analysis simpler by cutting down the time it takes to ingest information from hours to seconds.
## Prerequisites
---
- Implement a [tracking code](/developers/web/installation-and-configuration) on your website.
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- Add [custom events](https://hub.synerise.com/api-reference/data-management#operation/CustomEvent) and their [parameters](/docs/assets/events/adding-event-parameters) to save data to customers' profiles when they perform an activity.
In this particular use case:
- `product.return`,
- `callcenter.call`.
- Implement [OG tags](/developers/web/og-tags) on your website.
## Process
---
In this use case, you will go through the following steps:
1. [Create expressions](#create-expressions) that return the date of transaction, returns and page visit.
2. [Create aggregates](#create-aggregates) for transactions, returns, visits to the website and call center history.
3. [Create metrics](#create-metrics) for bought products, returns, top visited brands, top visited products and queries.
2. [Create reports](#create-reports) for history of bought products, returns, top visited brands, top visited products and history of queries.
3. [Create trends](#create-trends) of history of calls.
4. [Create a dashboard](#create-a-dashboard) that gathers created analyses.
5. [Add the dashboard to customer profiles](#add-the-dashboard-to-customer-profiles).
These are just examples of analytics you can use, such a dashboard can be expanded with various other analytics suitable for your business needs.
## Create expressions
---
In this part of the process, create two expressions for the following events: `transaction.charge` and `page.visit`. They will be later used in [aggregates](#create-aggregates) to return dates of specific events.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression.
3. Set the **Expression for** option to **Event**.
4. From the **Choose event** dropdown list, select `transaction.charge` event.
5. In the **Formula definition** section, click **Select**.
6. From the list that opens, select **Function > Regexp**.
7. In the brackets, click the **Select** button and from the list, select **Event attribute**.
1. Click the **Unnamed** node that appeared.
9. At the bottom of the page, click **Choose parameter**.
10. In the list of attributes, find and select **TIMESTAMP**.
8. Click the next **Select** button in the brackets and from the list, select **Constant**.
1. Click the **0** node that appeared.
2. At the bottom of the page, type `....-..-..` for date format.
9. Save the expression.
10. Create a second expression and repeat all steps for `page.visit` event.
Configuration of the expression returning transaction date
## Create aggregates
---
In this part of the process, you will create a number of aggregates on transactions, returns, page visits and call center calls, which will be used in the dashboard in the further part of the process.
### Transactions
Create aggregate that:
Returns the date of the first and last transaction made by a customer
Go to Behavioral Data Hub > Live Aggregates > Create aggregate.
As the aggregate type, select Profile.
Enter a meaningful name of the aggregate.
Switch the Show in profile card option on.
Click Analyze profiles by and select First to return the date of first transaction.
Click the Choose event dropdown list.
From the dropdown list, select the `transaction.charge` event.
Using the date picker in the lower-right corner, set the time range to Lifetime.
Click Apply.
Save the aggregate.
Create a second aggregate and repeat all steps for Last option, to return the date of last transaction.
Configuration of the aggregate returning first transaction date
Returns the last product a customer bought
Go to Behavioral Data Hub > Live Aggregates > Create aggregate.
As the aggregate type, select Profile.
Enter a meaningful name of the aggregate.
Switch the Show in profile card option on.
Click Analyze profiles by and select Last to return the name of the last bought product.
Click the Choose event dropdown list.
From the dropdown list, select the `product.buy` event.
Click choose parameter and choose the `$name` parameter.
Using the date picker in the lower-right corner, set the time range to Lifetime.
Click Apply.
Save the aggregate.
Configuration of the aggregate returning last brought product name
Returns last transaction value
Go to Behavioral Data Hub > Live Aggregates > Create aggregate.
As the aggregate type, select Profile.
Enter a meaningful name of the aggregate.
Switch the Show in profile card option on.
Click Analyze profiles by and select Last to return the value of the last transaction customer made.
Click the Choose event dropdown list.
From the dropdown list, select the `transaction.charge` event.
Click choose parameter and choose the `$totalAmount` parameter.
Using the date picker in the lower-right corner, set the time range to Lifetime.
Click Apply.
Save the aggregate.
Configuration of the aggregate returning customer's last transaction's value
Calculates the number of transactions for a customer
Go to Behavioral Data Hub > Live Aggregates > Create aggregate.
As the aggregate type, select Profile.
Enter a meaningful name of the aggregate.
Switch the Show in profile card option on.
Click Analyze profiles by and select Count to return the number of all the transactions customer made.
Click the Choose event dropdown list.
From the dropdown list, select the `transaction.charge` event.
Using the date picker in the lower-right corner, set the time range to Lifetime.
Click Apply.
Save the aggregate.
Configuration of the aggregate returning the number of transactions made by a customer
Calculates the value of all transactions for a customer
Go to Behavioral Data Hub > Live Aggregates > Create aggregate.
As the aggregate type, select Profile.
Enter a meaningful name of the aggregate.
Switch the Show in profile card option on.
Click Analyze profiles by and select Sum to return the value of all the transactions customer made.
Click the Choose event dropdown list.
From the dropdown list, select the `transaction.charge` event.
Click choose parameter and choose the `$totalAmount` parameter.
Using the date picker in the lower-right corner, set the time range to Lifetime.
Click Apply.
Save the aggregate.
Configuration of the aggregate returning the value of all transactions made by a customer
### Returns
Create an aggregate that:
Which result is the name of the last returned product
Go to Behavioral Data Hub > Live Aggregates > Create aggregate.
As the aggregate type, select Profile.
Enter a meaningful name of the aggregate.
Switch the Show in profile card option on.
Set the Analyze profiles by option to Last to display the last product a customer returned.
Click the Choose event dropdown list.
From the dropdown list, select the `product.return` event.
Click choose parameter and choose the `name` parameter.
Using the date picker in the lower-right corner, set the time range to Custom and set to 90 days.
Click Apply.
Save the aggregate.
Configuration of the aggregate returning the name of the last product customer returned
Which result is the price of the last returned product
Go to Behavioral Data Hub > Live Aggregates > Create aggregate.
As the aggregate type, select Profile.
Enter a meaningful name of the aggregate.
Switch the Show in profile card option on.
Click Analyze profiles by and select Last to display the price of the last product a customer returned.
Click the Choose event dropdown list.
From the dropdown list, select the `product.return` event.
Click choose parameter and choose the `price` parameter.
Using the date picker in the lower-right corner, set the time range to Custom and set to 90 days or according to your business needs.
Click Apply.
Save the aggregate.
Configuration of the aggregate returning the price of the last product customer returned
### Web activities
In this part of the process, create an aggregate that returns the date of the first or last visit to the web page.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter a meaningful name of the aggregate.
3. Switch the **Show in profile card** option on.
3. Click **Analyze profiles by** and select **First** or **Last** to return the date of the first or last date customer visited the web page.
4. Click the **Choose event** dropdown list.
5. From the dropdown list, select the `page.visit` event.
6. Click **choose parameter** and search for the [expression created in the previous part of the process](#create-expressions) regarding the chosen event.
7. Using the date picker in the lower-right corner, set the time range to **Lifetime**.
8. Click **Apply**.
9. Save the aggregate.
Configuration of the aggregate returning the date of the first customer vist to the web page
### Contact Center
In this part of the process, create aggregate that returns the time of call center calls.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter a meaningful name of the aggregate.
3. Switch the **Show in profile card** option on.
3. Click **Analyze profiles by** and select **Sum** to return the time of call center calls.
4. Click the **Choose event** dropdown list.
5. From the dropdown list, select the `callcenter.call` event.
6. Click **choose parameter** and choose the `callDuration` parameter.
7. Using the date picker in the lower-right corner, set the time range to **Custom** and set to **30 days** or according to your business needs.
8. Click **Apply**.
9. Save the aggregate.
Configuration of the aggregate returning duration of calls with call center
## Create metrics
---
In this part of the process, you will create five metrics for the following events: `product.buy`, `product.return`, `page.visit` and `item.search`. They will be later used in [reports](#create-reports).
### Number of bought products
This metric will return the number of all products bought by a customer.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As a metric kind, select **Simple metric**.
4. As the type, set **Event**.
5. As the aggregator, set **Sum**.
4. As the occurrence type, set **All**.
5. From the **Choose event** dropdown list, select `product.buy`.
6. Click button.
**Result**: The **Choose parameter** button appears.
7. From the **Choose parameter** dropdown list, choose `$quantity`.
8. To select a specific time range, click the calendar icon. In our case it will be **Lifetime**. Confirm your choice with the **Apply** button.
9. Click **Save**.
Configuration of the metric returning the number of all bought products
### Number of returned products
This metric will return the number of all products returned by a customer.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As a metric kind, select **Simple metric**.
4. As the type, set **Event**.
5. As the aggregator, set **Count**.
4. As the occurrence type, set **All**.
5. From the **Choose event** dropdown list, select `product.return`.
6. To select a specific time range, click the calendar icon. In our case it will be **Lifetime**. Confirm your choice with the **Apply** button.
7. Click **Save**.
Configuration of the metric returning the number of all returned products
### Number of page visits
This metric will return the number of all page visits made by a customer.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As a metric kind, select **Simple metric**.
4. As the type, set **Event**.
5. As the aggregator, set **Count**.
4. As the occurrence type, set **All**.
5. From the **Choose event** dropdown list, select `page.visit`.
6. To select a specific time range, click the calendar icon. In our case it will be **Lifetime**. Confirm your choice with the **Apply** button.
7. Click **Save**.
Configuration of the metric returning the number of all page visits
### Number of visited products
This metric will return the number of all products visited by a customer.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As a metric kind, select **Simple metric**.
4. As the type, set **Event**.
5. As the aggregator, set **Count**.
4. As the occurrence type, set **All**.
5. From the **Choose event** dropdown list, select `page.visit`.
6. Click button.
**Result**: The **Choose parameter** button appears.
7. From the **Choose parameter** dropdown list, choose `product:retailer_part_no`.
5. From the **Choose operator** dropdown list, select **String** and **Is not empty**.
6. Using the date picker in the lower-right corner, set the time range to **Lifetime**. Confirm your choice with the **Apply** button.
7. Click **Save**.
Configuration of the metric returning the number of all page visits
### Number of searched items
This metric will return the number of all products searched by a customer.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As a metric kind, select **Simple metric**.
4. As the type, set **Event**.
5. As the aggregator, set **Count**.
4. As the occurrence type, set **All**.
5. From the **Choose event** dropdown list, select `item.search`.
6. Using the date picker in the lower-right corner, set the time range to **Custom** and set to **30 days** or according to your business needs. Confirm your choice with the **Apply** button.
7. Click **Save**.
Configuration of the metric returning the number of all item.search events
## Create reports
---
In this part of the process, you will create reports on transactions, returns and web activities which will be used in the dashboard in the further part of the process.
### History of bought products
This report will return the name of all products bought by a customer and the time of their purchase.
1. Go to **Decision Hub > Reports > New report**.
2. Enter a meaningful name of the report.
3. Click the **Choose metric** and from the dropdown list, select [a metric for number of bought products, created in the previous part of the process](#number-of-bought-products).
4. From the **Range** dropdown list, select the number of top (the most frequently bought) products to be shown in the preview of the report. In this case it will be **TOP 5** products.
5. In the **Dimension** section, from the dropdown list, select **Event > Parameters**. To be able to show products name in the report, choose `$name`.
6. Click **Add dimension**.
1. Click **Choose dimension** and from the dropdown list, select **Event > Specials**. To be able to show when the product wast bought, choose `TIMESTAMP`.
8. Click **Enable filter**.
1. Click **Choose filter** and from the dropdown list, select **CLIENT_ID**.
2. Click **Choose operator** and from the dropdown list, select **Equal (String)**.
3. Change the type of value by clicking the icon until you get .
3. In the first field, write `clientId` and in the second field enter `.`
4. Click **Apply**.
Configuration of the filter in report
8. Using the date picker in the lower-right corner, set the time range to **Custom** and set to **90 days** or according to your business needs. Confirm your choice with the **Apply** button.
9. Save the report.
Configuration of the report returning the name and the price of top 5 products bought by a customer
### History of returned products
This report will return the name of all products returned by a customer, their price and the time of return.
1. Go to **Decision Hub > Reports > New report**.
2. Enter a meaningful name of the report.
3. Click the **Choose metric** and from the dropdown list, select [a metric for number of returned products, created in the previous part of the process](#number-of-returned-products).
4. From the **Range** dropdown list, select the number of top (the most frequently returned) products to be shown in the preview of the report. In this case, it will be **TOP 3** products.
5. In the **Dimension** section, from the dropdown list, select **Event > Parameters**. To be able to show products name in the report, choose `name`.
6. Click **Add dimension**.
1. Click **Choose dimension** and from the dropdown list, select **Event > Parameters**. To be able to show what the product price is, choose `price`.
6. Click **Add dimension**.
1. Click **Choose dimension** and from the dropdown list, select **Event > Specials**. To be able to show when the product was returned, choose `TIMESTAMP`.
8. Click **Enable filter**.
1. Click **Choose filter** and from the dropdown list, select **CLIENT_ID**.
2. Click **Choose operator** and from the dropdown list, select **Equal (String)**.
3. Change the type of value by clicking the icon until you get .
3. In the first field, write `clientId` and in the second field enter `.`
4. Click **Apply**.
8. Using the date picker in the lower-right corner, set the time range to **Custom** and set to **90 days** or according to your business needs. Confirm your choice with the **Apply** button.
9. Save the report.
Configuration of the report returning the name, price and time of return for top 3 products returned by a customer
### Top visited brands
This report will return the name of the most frequently visited brands by a customer and the number of visits.
1. Go to **Decision Hub > Reports > New report**.
2. Enter a meaningful name of the report.
3. Click the **Choose metric** and from the dropdown list, select [a metric for number of all page visits, created in the previous step](#number-of-page-visits)
4. From the **Range** dropdown list, select the number of top (the most frequently viewed) products to be shown in the preview of the report. In this case it will be **TOP 5** products.
5. In the **Dimension** section, from the dropdown list select **Event > Parameters**. To be able to show product's brand in the report, choose `brand`.
8. Click **Enable filter**.
1. Click **Choose filter** and from the dropdown list, select **CLIENT_ID**.
2. Click **Choose operator** and from the dropdown list, select **Equal (String)**.
3. Change the type of value by clicking the icon until you get .
3. In the first field, write `clientId` and in the second field, enter `.`
4. Click **Apply**.
8. Using the date picker in the lower-right corner, set the time range to **Custom** and set to **30 days** or according to your business needs. Confirm your choice with the **Apply** button.
9. Save the report.
Configuration of the report returning the top 5 product brands visited by a customer
### Top visited products
This report will return the name of most visited products by a customer, their price, and the number of visits.
1. Go to **Decision Hub > Reports > New report**.
2. Enter a meaningful name of the report.
3. Click the **Choose metric** and from the dropdown list, select [a metric for number of all visited products, created in the previous step](#number-of-visited-products)
4. From the **Range** dropdown list, select the number of top (the most frequently visited) products to be shown in the preview of the report. In this case, it will be **TOP 5** products.
5. In the **Dimension** section, from the dropdown list, select **Event > Parameters**. To be able to show products name in the report, choose `title`.
6. 6. Click **Add dimension**.
1. Click **Choose dimension** and from the dropdown list, select **Event > Parameters**. To be able to show the product's price, choose `price`.
8. Click **Enable filter**.
1. Click **Choose filter** and from the dropdown list, select **CLIENT_ID**.
2. Click **Choose operator** and from the dropdown list, select **Equal (String)**.
3. Change the type of value by clicking the icon until you get .
3. In the first field, write `clientId` and in the second field, enter `.`
4. Click **Apply**.
8. Using the date picker in the lower-right corner, set the time range to **Custom** and set to **30 days** or according to your business needs. Confirm your choice with the **Apply** button.
9. Save the report.
Configuration of the report returning the top 5 products visited by a customer
### Searched queries
This report will return the name of the most frequently searched queries by a customer and the number of searches.
1. Go to **Decision Hub > Reports > New report**.
2. Enter a meaningful name of the report.
3. Click the **Choose metric** and from the dropdown list, select [a metric for number of all searched items, created in the previous step](#number-of-searched-items)
4. From the **Range** dropdown list, select the number of top (the most frequently searched) phrases to be shown in the preview of the report. In this case, it will be **TOP 10**.
5. In the **Dimension** section, from the dropdown list, select **Event > Parameters**. To be able to show the searched query in the report, choose `query`.
8. Click **Enable filter**.
1. Click **Choose filter** and from the dropdown list, select **CLIENT_ID**.
2. Click **Choose operator** and from the dropdown list, select **Equal (String)**.
3. Change the type of value by clicking the icon until you get .
3. In the first field, write `clientId` and in the second field, enter `.`
4. Click **Apply**.
8. Using the date picker in the lower-right corner, set the time range to **Custom** and set to **30 days** or according to your business needs. Confirm your choice with the **Apply** button.
9. Save the report.
Configuration of the report returning the top 10 most searched queries
## Create trends
---
In this part of the process, you will create trends on history of page visits and call center calls.
### Visits on the website
This trend will show number of customer visits to the webiste over a specific time frame.
1. Go to **Decision Hub > Trends > New trends**.
2. Enter a meaningful name of the trend.
3. Click the **Choose event** button and from the dropdown list, select `page.visit`.
8. Click **Enable filter**.
1. Click **Choose filter** and from the dropdown list, select **CLIENT_ID**.
2. Click **Choose operator** and from the dropdown list, select **Equal (String)**.
3. Change the type of value by clicking the icon until you get .
3. In the first field, write `clientId` and in the second field, enter `.`
4. Click **Apply**.
9. Set the **Interval** in the lower-right conrer to **day**.
8. Using the date picker in the lower-right corner, set the time range to **Last 7 days** or according to your business needs. Confirm your choice with the **Apply** button.
9. Save the trend.
Configuration of the trend of page visits in the last 7 days
### History of calls
This trend will show the number of customer call center calls over a specific time frame.
1. Go to **Decision Hub > Trends > New trends**.
2. Enter a meaningful name of the trend.
3. Click the **Choose event** and from the dropdown list, select `callcenter.call`.
8. Click **Enable filter**.
1. Click **Choose filter** and from the dropdown list, select **CLIENT_ID**.
2. Click **Choose operator** and from the dropdown list, select **Equal (String)**.
3. Change the type of value by clicking the icon until you get .
3. In the first field write `clientId` and in the second field enter `.`
4. Click **Apply**.
9. Set the **Interval** in the lower-right conrer to **day**.
8. Using the date picker in the lower-right corner, set the time range to **Last 7 days** or according to your business needs. Confirm your choice with the **Apply** button.
9. Save the trend.
Configuration of the trend of call center calls in the last 7 days
## Create a dashboard
---
In the final part of the process you will create a dashboard with [aggregates](#create-aggregates), [reports](#create-reports) and [trends](#create-trends) created in previous steps.
1. Go to **Decision Hub > Dashboards > Add dashboard**.
2. Enter the name of the dashboard.
3. To add a widget to the dashboard, click an icon on the panel. The icons are (left to right): HTML code, text field, image, [segmentation](/docs/analytics/segmentations/creating-segmentations), [trend](/docs/analytics/trends/creating-trends), [funnel](/docs/analytics/funnels/creating-funnels), [metric](/docs/analytics/metrics/creating-simple-metrics), [histogram](/docs/analytics/histograms/creating-histograms), [aggregate](/docs/crm/aggregates/creating-profile-aggregates), [expression](/docs/crm/expressions), and a [report](/docs/analytics/reports/creating-reports).
You can create the dashboard by grouping the created analytics in sections: Transactions, Returns, Web Activities, Call Center. You can create custom template according to your business needs with the help of this [article](/docs/analytics/analytics-dashboard/creating-dashboards) or follow the sample instructions below.
4. Click the Text icon on the panel.
**Result**: A **Text widget** will appear on the blank dashboard.
2. You can edit widget contents with the editor on the right. In the **Title** field type `Transactions`, you can add a **Description** below.
You can adjust the size of widgest by dragging their lower right corner.
Configuration of the text widget
3. Add an aggregate by clicking the Aggregate icon on the panel.
4. Edit widgets contents with the editor on the right. In the **Aggregate** section choose the [aggregate that returns the date of the first transaction made by customer you have created in the previous part of the process](#transactions). You can change the title and description. Do the same for the following [aggregates created in the previous part of the process](#transactions): the date of the last transaction, last bought product, last transaction value, number of transactions, value of all transactions.
Configuration of the aggregate widget
5. Add a report by clicking the Report icon on the panel.
6. Edit widgets contents with the editor on the right. In the **Report** section choose the [report on history of bought products you have created in the previous part of the process](#history-of-bought-products). You can change the title and description.
7. Click the **Style** section in the widget editor and change **Visualization type** to **Table**.
Configuration of the report widget
8. Repeat steps **4 to 10** to create another sections: Returns, Web activities and Call Center.
You can look up the sample dashboard created in the Demo workspace [here](https://app.synerise.com/analytics/dashboards/33651c9f-666e-4a48-aa6d-7dc1cfd0d9f8/edit?clientId=0)
11. When you complete creating the dashboard, click **Save dashboard**.
By default, a new dashboard is private. If you want to share it with others, check the instruction [here](/docs/analytics/analytics-dashboard/sharing-dashboards).
## Add the dashboard to customer profiles
---
Optionally, you can add the dashboard to customer profiles.
You can add a dashboard with dynamic data to a customer’s profile, only if at least one analysis inside the dashboard includes a dynamic key. To be able to display statistics about an individual customer, a dashboard must contain at least one analysis that uses the dynamic key - `clientId`. Aggregates and expressions don’t need `clientId` because they already contain it.
1. Go to **Profiles** and select a customer on the list.
2. On the top of the activity list, click **Statistics**.
**Result**: A set of statistics appears.
4. On the top of statistics, click the icon.
**Result**: A dropdown list appears.
5. Select **Manage dashboards**.
**Result**: A pop up appears.
6. On the top of the pop-up, click **Add dashboard**.
**Result**: A dropdown list appears.
7. From the dropdown list, select a dashboard.
8. To confirm your choice, click **Add**.
**Result**: The dashboard appears on the bottom of the list.
9. To manage the order of the dashboards added to the customer's profile, drag and drop them in the preferred order.
10. To save the changes, click **Apply**.
## Check the use case set up on the Synerise Demo workspace
---
You can check all configurations directly in Synerise Demo workspace:
- Expressions
- [Transaction date](https://app.synerise.com/analytics/expressions/0d844720-6bb7-4776-a661-52cc81577b06)
- [Page visit date](https://app.synerise.com/analytics/expressions/d31828b7-ef9c-4c7d-8316-3769eb8612c2)
- Aggregates
- [First transaction date](https://app.synerise.com/analytics/aggregates/7380e558-3d44-30b7-ac26-b1e233e9b16e)
- [Last transaction date](https://app.synerise.com/analytics/aggregates/d6baacd7-684e-31f6-b3c4-76376090c061)
- [Last bought product name](https://app.synerise.com/analytics/aggregates/ccbd08cc-1cd0-3b44-bc39-eb2dcd0998e5)
- [Last transaction value](https://app.synerise.com/analytics/aggregates/8a459dea-e2e7-3c99-8e9b-1b7e12f850e0)
- [Number of transactions](https://app.synerise.com/analytics/aggregates/24011aa2-632d-319f-9047-8f13712105c8)
- [Sum of all transactions](https://app.synerise.com/analytics/aggregates/55cf86a5-acd9-3540-8293-13737a495300)
- [Last returned product name](https://app.synerise.com/analytics/aggregates/d36783fa-382d-3141-8537-9c70ff53ba97)
- [Last returned product price](https://app.synerise.com/analytics/aggregates/2aee5c1f-2cbc-3961-9d07-cc15ef8550e1)
- [First page visit date](https://app.synerise.com/analytics/aggregates/b75f9b8f-01b8-3733-80cf-b31a35c46da7)
- [Last page visit date](https://app.synerise.com/analytics/aggregates/3ff1c746-488c-3f4f-b0ef-2ca09f0b593a)
- [Call center calls duration](https://app.synerise.com/analytics/aggregates/36bf88a6-e646-36cd-957e-a87c5f32a11e)
- Metrics
- [Bought products](https://app.synerise.com/analytics/metrics/077074e8-db7c-4e46-bd2e-24e292bee839)
- [Returned products](https://app.synerise.com/analytics/metrics/5772cbe8-5cef-4659-b049-383747f4a355)
- [Product page visits](https://app.synerise.com/analytics/metrics/ec561bb7-8227-4f56-9d9c-6979437fed51)
- [Page visits](https://app.synerise.com/analytics/metrics/4afbcbc7-ab8f-4bc9-8b73-2547b2dfeee2)
- [Number of searched items](https://app.synerise.com/analytics/metrics/e40f03f4-58d3-4156-9a41-776b3b2c2b24)
- Reports
- [History of bought products](https://app.synerise.com/analytics/reports/08639f32-0d6c-4b4b-a78e-4eec7a8d00cb)
- [History of returned products](https://app.synerise.com/analytics/reports/9e92b281-ef93-4cfb-9fd0-916334ef8df9)
- [Top visited brands](https://app.synerise.com/analytics/reports/2de0ad6c-3fb4-434f-8de9-1bf6b6528504)
- [Top searched queries](https://app.synerise.com/analytics/reports/1c09d8b2-fdfe-465a-b030-78f3593860e9)
- Trends
- [Page visits](https://app.synerise.com/analytics/trends/1bfa16b9-9518-4c1a-af12-9c4671048800)
- [Call center calls](https://app.synerise.com/analytics/trends/d813b0ae-aa02-4cb1-929b-de75fdbb46ac)
- [Dashboard](https://app.synerise.com/analytics/dashboards/33651c9f-666e-4a48-aa6d-7dc1cfd0d9f8?clientId=0)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case does not generate any events.
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Dashboards](/docs/analytics/analytics-dashboard)
- [Expressions](/docs/crm/expressions)
- [Metrics](/docs/analytics/metrics)
- [Behavioral Data Hub](/docs/crm)
- [Reports](/docs/analytics/reports)
- [Trends](/docs/analytics/trends)
# Message Duplication Prevention for SMS Campaigns Based on Unique Phone Numbers
This use case presents a solution to prevent sending the same message to the profiles who have the same phone number. Sharing the same phone number by profiles may happen for example, when a person leaves the company and a new employee takes over a work phone with the phone number of the previous employee; or when a person creates two accounts with different personal data but the same phone number.
The core idea of this use case is to check the database for the same phone number and ensure that only one message is sent out when multiple profiles have the same number. This solution is designed to save costs and ensure that profiles do not receive unnecessary messages.
The assumption of this use case is importing all customers with unique phone numbers and enabled marketing agreement in the SMS channel to a catalog. All these customers will have a `phone_unique` tag assigned to them. Then, every time a customer enables SMS marketing agreement a workflow will verify whether the phone number for this customer is unique. If so, it will be tagged with `phon_unique`.
We recommend using the `phone_unique` tag for addressing recipients in mass campaigns to all customers (for example, general information about important changes that do not contain personalization). It is not necessary for real-time campaigns, especially those triggered by specific user behaviors and activities such as entering a page, purchasing, and so on, because there is a small probability of sending the same message several times to one number. However, this risk is high with large and mass shipments.
It is important to be careful with the personalization of such messages, especially without additional verification of ness of the phone number.
## Prerequisites
---
- Create a catalog in Synerise in which you will store customers with unique phone numbers
This will allow you to select customers with a `phone_unique` tag as the recipients of your future SMS campaigns - this way you will make sure each customer won't receive the same message several times.
- In **Data Modeling Hub > Profile Tags**, [add the following tag](/docs/assets/tags): `phone_unique`
It will be used later in the process.
- Create a workspace [API Key](/docs/settings/tool/api) which you will use in the process.
## Process
---
In this use case, you will go through the following steps:
1. [Create a segmentation](/use-cases/double-phone-number#create-a-segmentation) to group customers who have a phone number assigned and enabled marketing agreement in the SMS channel.
2. [Create a workflow which sends the customers from the segmentation to the catalog](/use-cases/double-phone-number#create-a-workflow-which-sends-the-customers-from-the-segmentation-to-the-catalog).
3. [Download the file with customers from the catalog](/use-cases/double-phone-number#export-the-file-from-the-catalog).
4. [Transform data](/use-cases/double-phone-number#transform-data) in the file: add a column with a `phone_unique` tag, remove `item_key` column, and rename the `id` column.
5. [Create a workflow which imports the modified file with customers to Synerise](/use-cases/double-phone-number#create-a-workflow-which-imports-the-modified-file-with-customers-to-synerise).
6. [Create a workflow that verifies uniqueness of the phone number and assigns a tag to a customer](/use-cases/double-phone-number#create-a-workflow-that-verifies-uniqueness-of-the-phone-number-and-assigns-a-tag-to-a-customer).
7. [Create a workflow that deletes a tag when a customer withdraws consent for receiving SMS](/use-cases/double-phone-number#create-a-workflow-that-deletes-a-tag-when-a-customer-withdraws-consent-for-receiving-sms).
## Create a segmentation
---
In this part of the process, you will create a segmentation of customers who have a phone number and enabled a marketing agreement in the SMS channel.
1. Go to **Decision Hub > Segmentations > New segmentation**.
3. Enter the name of the segmentation.
4. From the **Add condition** dropdown list, select the `phone` attribute.
5. Click the **Choose** button, and from the list of operators, choose **Boolean**, and then select **Is true**.
4. From the **Add condition** dropdown list, select the `SMS agreement` attribute.
5. Click the **Choose** button, and from the list of operators, choose **Boolean**, and then select **Is true**.
6. Save the segmentation.
Segmentation configuration
## Create a workflow which sends the customers from the segmentation to the catalog
---
In this part of the process, you will create a workflow that imports customer data (phone number) to a file and sends it to the catalog you created as a part of prerequisites. The data will be deduplicated, which means the catalog will contain only unique phone numbers.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Scheduled Run trigger node
---
At this stage, configure the conditions that trigger the workflow.
1. As the trigger node, select **Scheduled Run**.
2. In the configuration of the node:
1. Change the **Run trigger** option to **one time**.
2. Choose the **Immediately** option.
3. Confirm by clicking **Apply**.
The configuration of the Scheduled Run node
### Select customers to export
---
In this part of the process, select a [segmentation of customers you created in the previous part of the process](#create-a-segmentation). Then, you will select the attribute (`phone`) whose value will be exported to a catalog in further steps.
1. Add the **Get Profiles** node.
2. In the configuration of the node:
1. Select the segmentation you [created in the previous step](#create-a-segmentation) to extract customers’ data.
2. In the **Attributes** section, select **phone**.
3. Confirm by clicking **Apply**.
The configuration of the Get Profiles node
### Add the Import to Catalog node
---
In this part of the process, select a catalog to which the customer data will be imported.
1. Add the **Import to Catalog** node.
2. In the configuration of the node:
1. Select the catalog created as a part of the prerequisites to which the data will be imported.
2. In the **Primary key** field, enter the `phone` attribute.
3. Confirm by clicking **Apply**.
The configuration of the Import to Catalog node
### Prepare the final settings
---
1. Add the **End** node and connect it to the **Import to Catalog** node.
3. Optionally, add titles to each node so the workflow will be more understandable to your colleagues.
Prepare workflow
5. Activate the workflow by clicking **Save & Run**.
**Result**: The data will be sent to a catalog and de-duplicated during import.
## Export the file from the catalog
---
In this part of the process, you will download the file you imported to the catalog.
1. Go to **Data Modeling Hub > Catalogs**.
2. Choose the catalog from the list.
3. To download the file with your data, click **Download CSV** .
In the next step, you will use the exported file to create a data transformation rule which you will use further in the process in the Data Transformation node.
## Transform data
---
In this part of the process, you will perform the following modifications to the file:
- remove the `item_key` column
- rename the `id` column to `clientId`
- add the `tags` column with the `phone_unique` value
1. Go to **Automation > Data Transformation > Create transformation**.
2. Enter the name of the transformation.
3. Click **Add input**.
### Add file with sample data
---
The **Data input** node allows you to add a file to be modified. In further steps, you define how the data in the file will be modified (transformation rules). Later, when this transformation is used in the workflow in the [Data Transformation node](/docs/automation/operation/data-transformation-node), the system uses the rules to transform a file selected in the workflow.
1. On the pop-up, click **Add example**.
2. Upload the file exported in [the previous step](/use-cases/double-phone-number#export-the-file-from-the-catalog).
3. Click **Apply**.
### Remove column
---
Use the **Remove columns** node, which allows you to remove the `item_key` column.
1. On the **Data Input** node, click the grey dot.
2. From the dropdown list, select **Remove columns**.
4. In the configuration of the node:
1. Leave the **Remove Columns** option selected in the dropdown menu.
2. Leave the default value in the dropdown (**Equal**).
3. In the text field, enter `item_key`.
The configuration of the Remove columns node
6. Confirm by clicking **Apply**.
### Rename column
---
In this part of the process, change the name of the `id` column to `clientId`.
1. On the **Filter column** node, click the grey dot.
8. From the dropdown list, select **Rename column**.
9. Click the **Rename column** node.
10. In the configuration of the node:
1. Click **Add rule**.
2. Click **Add column**.
3. Select the **id** column.
4. Under **Edit values by**, from the dropdown list, select **Replacing**.
6. In the text field, enter `clientId`.
The configuration of the Rename column node
7. Confirm by clicking **Apply**.
### Add the new column
---
In this part of the process, you will add the new `tags` column with the `phone_unique` value.
1. On the **Rename Column** node, click the grey dot.
2. From the dropdown list, select **Add column**.
9. Click the **Add column** node.
10. In the configuration of the node:
1. In the **Add column** field, enter the name of the column. In this use case, it's `tags`.
3. From the dropdown list, select **Static value**.
4. In the value box, enter `phone_unique`.
5. Leave **Handle incomplete data** at default (**Skip row if error occurred**) to skip missing or invalid data which may occur during transformation.
7. Confirm by clicking **Apply**.
The configuration of the Add new column node
### Add the finishing node
---
This node lets you preview the output of the transformation rules applied to the file.
1. On the **Add column** node, click the grey dot.
2. From the dropdown list, select **Data Output**.
3. To preview the results, click the **Data Output** node.
The preview of modifications to the file
4. Close the preview
3. In the upper right corner, click **Save and publish**.
The diagram of data transformation
## Create a workflow which imports the modified file with customers to Synerise
---
In this part of the process, you will create a workflow that applies transformation rules you created in the [previous part of the process](#transform-data) to the file with customers data and import the modified file to Synerise. As a result, the profiles will be updated.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Scheduled Run trigger node
---
At this stage, you will define the conditions that launch the workflow.
1. As the trigger node, add **Scheduled Run**.
2. In the configuration of the node:
1. Change the **Run trigger** option to **one time**.
2. Choose the **Immediately** option.
4. Confirm by clicking **Apply**.
The configuration of the Scheduled Run node
### Select file to import
---
Select the file you exported in [part of the process](#export-the-file-from-the-catalog).
1. Add the **Local File** node.
2. In the configuration of the node:
1. Upload the file.
2. Confirm by clicking **Apply**.
Local File transfer
### Add Data Transformation node
---
Select a data transformation rule you created [in this part of the process](#transform-data).
1. Add the **Data Transformation** node.
2. In the configuration of the node, select the [data transformation you have created before](#transform-data).
The configuration of the Data Transformation node
3. Confirm by clicking **Apply**.
### Add import profiles and finishing node
---
In this part of the process, you will import the transformed file with customers to Synerise.
1. Add the **Import Profiles** node.
2. Add the **End** node.
3. In the upper right corner, click **Save & Run**.
The workflow configuration
## Create a workflow that verifies uniqueness of the phone number and assigns a tag to a customer
---
In this part of the process, you will create a workflow that is launched when a customer enables marketing agreement in the SMS channel. The workflow checks whether the phone number is unique, if so the customer is assigned with a `phone_unique` tag and the catalog which stores unique phone numbers is updated.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the trigger node
---
The workflow is triggered by **Profile Event** where the triggering event is `profile.updated` with the `profile.receivesmses` parameter which is set to true.
1. Add the first node - **Profile Event**. In the node configuration:
1. From the **Choose event** dropdown list, choose the **profile.updated** event.
2. Click button.
3. From the **Choose parameter** dropdown list, select **profile.receivesmses**.
5. From the **Choose operator** dropdown list, select **Is true(Boolean)**.
2. Click **Apply**.
Configuration of the Profile Event node
### Add the Profile Filter node
---
In the next stage, using the Profile Filter node, you check if the customer already has the `phone_unique` tag and phone number. You take into account customers who have phone but do not have the `phone_unique` tag.
1. Add the **Profile Filter** node.
2. In the settings of the node, choose **Profiles > Attributes** and select the `phone_unique` tag.
3. As **Operator**, choose **Boolean - Is true** and nd modify the "Profile `matching` attribute" to "`not matching` attribute."
5. Click **Choose filter** and select the attribute `phone`.
3. As the **Operator**, choose **Boolean - Is true**.
4. Click **Apply**.
3. For the **Not Matched** path, add the **End** node .
4. Click **Apply**.
The Profile Filter node configuration
### Configure the Outgoing Integration node
---
In this part of the process, you will send a request to [retrieve all items from the catalog](https://hub.synerise.com/api-reference/data-management#operation/getItemsByBag) to check if the phone number exists in the catalog.
1. To the **Matched** path, add the **Outgoing Integration** node. In the configuration of the node:
1. Choose **Custom webhook**.
2. In the **Webhook name** field, enter `getPhoneFromCatalog`.
3. In the **URL** section:
1. Choose the **GET** method.
2. Enter the following endpoint: `https://api.synerise.com/catalogs/bags/XXXX/items?itemKey={{client.phone}}`, replace `XXXX` with the ID of your catalog.
7. As the method of authorization, select **by API key**.
8. From the dropdown list, select the API key you created as a [part of prerequisites](#prerequisites).
7. Click **Apply**.
Webhook settings
### Configure the Event Filter node
The workflow will wait for the webhook to return the value of the body.metaData.totalCount parameter. If it's other than 0, the workflow will end. If it is 0, the profile will be updated with the `phone_unique` tag.
1. As the next node, add **Event Filter**. In the configuration of the node:
1. In the **Check** field, from the dropdown menu choose **for period of time**.
2. Set the time range. In our case, it is 5 minutes.
3. In the **Define conditions** field, from the **Choose event** dropdown menu, choose `webhook.response` event.
3. Click the **+ where** button and select `name`.
4. As the logical operator, select **Equal (String)**.
5. As the value, add the name of the event used in the previous node: `getPhoneFromCatalog`.
3. Click the **+ where** button and select `body.metaData.totalCount`.
4. As the logical operator, select **Equal (Number)**.
5. As the value, add `0`.
5. Click **Apply**.
3. For the **Not matched** path, add the **End** node .
Event Filter node settings
### Add the Update Profile node
---
1. For the **Matched** path, add the **Update Profile** node.
2. From the dropdown list, select **phone_unique** tag.
3. Leave the right dropdown list at default (**Add**).
3. To save the changes, click **Apply**.
The configuration of the Update Profile node
### Configure the Outgoing Integration node
---
In this step, [your catalog with unique phone numbers will be updated](https://hub.synerise.com/api-reference/data-management#operation/addItems).
1. Add **Outgoing Integration** node. In the configuration of the node:
1. Choose **Custom webhook**.
2. In the **Webhook name**, enter `addPhoneToCatalog`.
3. In the **URL** section:
1. Choose the **POST** method.
2. Enter the following URL: `https://api.synerise.com/catalogs/bags/XXXX/items?itemKey={{client.phone}}`, where `XXXX` is the ID of your catalog.
4. In the **Body** section, enter:
7. As the authorization method, select **by API key**.
Webhook settings
### Add the finishing node
---
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
**Result**:
The workflow configuration
## Create a workflow that deletes a tag when a customer withdraws consent for receiving SMS
---
The next step is to create a workflow that will be triggered when a customer withdraws their consent. The workflow has similar structure to the previous one. What changes here is the trigger, instead of Profile Event, you will use the Audience node that is repeatedly triggered, for example everyday, at a certain time.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the trigger node
---
The workflow is triggered for specific group of customers every date at a define time.
1. Start the workflow with the **Audience** node.
2. In the configuration of the node, set the **Run trigger** option to **repeatable**.
3. Set the interval to 1 per day.
4. Choose the day and time when the process starts.
5. Select the time zone.
6. In **Define audience**, choose **New Audience** and click **Define conditions**. Our audience will be a group of users who has `phone_unique` tag and change their sms agreement.
1. As the first condition, from the **Choose filter** dropdown menu, choose `phone_unique` attribute.
2. Choose operator as **Is true (Boolean)**.
4. As the second condition, from the **Choose filter** dropdown menu, choose the `SMS agreement` attribute.
5. Choose operator as **Equal (String)** and add the value. In our case it will be `false`.
Configuration of the segmentation in the Audience node
8. Click **Apply**.
Configuration of the Audience node
### Add the Profile Filter node
---
In the next stage, using the Profile Filter node, you check if the customer has the `phone_unique` tag and phone number.
1. Add **Profile Filter** node.
2. In the settings of the node choose **Profiles > Attributes** and select the tag `phone_unique`.
3. As the **Operator**, choose **Boolean - Is true**.
5. Click **Choose filter** and select the attribute `phone`.
3. As the **Operator**, choose **Boolean - Is true**.
4. Click **Apply**.
3. For the **Not Matched** path, add the **End** node .
The Profile Filter node configuration
### Configure the Outgoing Integration node
---
In this part of the process, you will send a request to [retrieve all items from the catalog](https://hub.synerise.com/api-reference/data-management#operation/getItemsByBag) to check if the phone number exists in the catalog.
1. To the **Matched** path, add the **Outgoing Integration** node. In the configuration of the node:
1. Choose **Custom webhook**.
2. In the **Webhook name** field, enter `getPhoneFromCatalog`.
3. In the **URL** section:
1. Choose the **GET** method.
2. Enter the following endpoint: `https://api.synerise.com/catalogs/bags/XXXX/items?itemKey={{client.phone}}`, replace `XXXX` with the ID of your catalog.
7. As the method of authorization, select **by API key**.
8. From the dropdown list, select the API key you created as a [part of prerequisites](#prerequisites).
7. Click **Apply**.
Webhook settings
### Configure the Event Filter node
---
The workflow will wait for the webhook to return the value of the body.metaData.totalCount parameter. If it's equal 0, the workflow will end, because it means that the number is not in the catalog and no need to remove the tag since the number was not unique and the workflow ends. If it's 1, it means the number exists in the catalog because it was unique and the workflow must go on.
1. As the next node, add **Event Filter**. In the configuration of the node:
1. In the **Check** field, from the dropdown menu choose **for period of time**.
2. Set the time range. In our case, it is 5 minutes.
3. In the **Define conditions** field, from the **Choose event** dropdown menu, choose `webhook.response` event.
3. Click the **+ where** button and select `name`.
4. As the logical operator, select **Equal (String)**.
5. As the value, add the name of the event used in the previous node: `getPhoneFromCatalog`.
3. Click the **+ where** button and select `body.metaData.totalCount`.
4. As the logical operator, select **Equal (Number)**.
5. As the value, add `1`.
5. Click **Apply**.
3. For the **Not matched** path, add the **End** node .
Event Filter node settings
### Add the Update Profile node
---
1. For the **Matched** path, add the **Update Profile** node.
2. From the dropdown list, select **phone_unique** tag.
3. Click the right dropdown list and select **Remove**.
3. To save the changes, click **Apply**.
The configuration of the Update Profile node
### Configure the Outgoing Integration node
---
In this step, [you will remove a customer with their phone number from the catalog](https://hub.synerise.com/api-reference/data-management#operation/deleteItem).
1. Add the **Outgoing Integration** node. In the configuration of the node:
1. Choose **Custom webhook**.
2. In the **Webhook name** field, enter `removePhoneFromCatalog`
3. In the **URL** section:
1. Choose the **DELETE** method.
2. Enter the following URL:`https://api.synerise.com/catalogs/bags/XXXX/items/{{event.params['body.data[0].id']}}`, where `XXXX` is the ID of your catalog.
7. As the authorization method, select **by API key**.
8. From the dropdown list, select the API key you created as a [part of prerequisites](#prerequisites).
7. Click **Apply**.
Webhook settings
### Add the finishing node
---
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
**Result**:
The workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
In the Synerise Demo workspace, you can check:
- [segmentation configuration](https://app.synerise.com/analytics-v2/segmentations/8e08c002-e0bf-4e66-bb28-7bf276918ee0)
- [workflow configuration](https://app.synerise.com/automations/automation-diagram/cd94653c-b2a6-43c2-afa8-7090dee0d81e)
- [data transformation](https://app.synerise.com/automations/data-transformation/8888bd88-53a8-4f3a-89c6-93fddf4e6392)
- [workflow which imports modified file with customers back to Synerise](https://app.synerise.com/automations/automation-diagram/3f15df7f-10fb-428c-aa52-047d56dfe7d9)
- [workflow which updates the customer's profile](https://app.synerise.com/automations/automation-diagram/9bf58473-d660-4f4b-a7be-61b4605b0673)
- [workflow that deletes a tag when a customer withdraws consent for receiving SMS](https://app.synerise.com/automations/automation-diagram/afbc1610-892e-43cb-ac8c-e6e49eea56f3)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 11 events per profile that completes the flow:
[`profile.updated`](/docs/assets/events/event-reference/profiles#profileupdated) (~2), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~5), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`webhook.response`](/docs/assets/events/event-reference/integration#webhookresponse-and-custom-webhook-response-names) (~2).
## Read more
---
- [Automation Hub](/docs/automation)
- [Catalogs](/docs/assets/catalogs/introduction-to-catalogs)
- [Data Transformation](/docs/automation/data-transformation-and-imports)
- [Import](/docs/assets/imports/introduction-to-imports)
- [Segmentation](/docs/analytics/segmentations)
- [SMS campaigns](/docs/campaign/SMS)
# Subscription for a product in mobile app
The advantage of creating a subscription model in your mobile commerce is that users can enjoy discounted rates on their desired products, which they buy regularly. This option is also beneficial for offline store owners, as it increases customer loyalty and encourages customers to visit more frequently and make more purchases.
In this use case we will create a subscription service mechanism based on Synerise's promotions and analytics. The subscription allows to collect one coffee a day for the next 30 days, 30 coffees in total. Customer pays upfront and the price per item is lower than if bought separately.
## Prerequisites
---
- Integrate Synerise [promotions](/docs/ai-hub/promotions)
- Implement subscription status management using your billing system or payment gateway:
- When the subscription is enabled (customer paid for a monthly subscription):
1. Send a `subscription.status` event with the `segment_enabled` parameter set to `1`
This parameter is used to track if a customer is eligible for a coffee on each day. It is changed with a workflow after the client buys coffee and resets at midnight.
2. Update the customer's profile with the `subscription.active` attribute set to `1`
This attribute is used to track if the monthly subscription is paid and active.
- When the subscription ends or is disabled, update the customer's profile with the `subscription.active` attribute set to `0`
In this example, Synerise doesn't de-activate the subscription after its period runs out. Your mobile application must do this.
## Security configuration
---
Before you start working with this hub, if you are a Synerise customer or partner, consider reading [the section about denylisting events](/docs/settings/tool/api#denylist). This natively accessible configuration will allow you to manage the restrictions in points management that may help you prevent fraud.
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate](/use-cases/subscription#create-an-aggregate) checking the subscription status.
2. [Create a segmentation](/use-cases/subscription#create-a-segmentation) eligible for the subscription based on the previously created aggregate.
4. [Create a promotion](/use-cases/subscription#create-a-promotion) in Synerise, that reduces the subscribed item's price to zero for the customer.
3. [Create a workflow that tracks redemptions](/use-cases/subscription#create-a-workflow-that-tracks-redemptions) when the customer redeems a coffee. This is needed to track if a coffee was already picked up on a particular day (by using the aggregate created earlier).
5. [Create a workflow which checks the subscription status daily](/use-cases/subscription#create-a-workflow-which-checks-the-subscription-status-daily).
## Create an aggregate
---
In this part of the process, create an aggregate that returns the customer's daily redemption status from the most recent `subscription.status` event.
It is important to collect on the client-side transactional information about buying a subscription by customer. In this situation you should generate on your side event (in this case it is `subscription.status`) with the parameter (in this case named `segment_enabled`) with information if the customer is eligible for their daily coffee and send this event to Synerise (the value should be `1` if yes, or `0` if not).
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last**.
4. From the **Choose event** dropdown list, select the `subscription.status` event.
5. As the event parameter, select **segment_enabled**.
5. Click **+where** and choose the **segment_enabled** parameter.
9. From the **Choose operator** dropdown list, select **Equal**.
6. As the value set up `1` (it means that it is active).
6. Define the period from which the aggregate will look up event data - in this case, it is **Lifetime**.
7. Click **Save**.
Configuration of the aggregate
## Create a segmentation
---
Create a segmentation of customers based on the results of [the aggregate you created](/use-cases/subscription#create-an-aggregate) in the previous part of the process. This segmentation shows the customers who did not redeem a coffee on a particular day.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation.
3. Click **Choose filter**.
4. From the dropdown list, select the [aggregate you created before](/use-cases/subscription#create-an-aggregate).
5. As the logical operator, select **Equal**.
6. In the text field, enter `true`.
7. Save the segmentation.
Segment settings
## Create a promotion
---
In this step, create a promotion that reduces the subscribed product’s price to zero and can be redeemed 30 times.
1. Go to **AI Hub > Regular Promotions > Add promotion**.
2. Select the **For selected items** option.
3. In the **Audience** section:
4. Choose the [segment created previously](/use-cases/subscription#create-a-segmentation).
5. Click **Apply**.
4. In the **Content** section:
2. Add the name in the **Display name**.
2. In the **Price** field, enter `0`.
3. In the **Long description** add the names and SKU's of products which price should be reduced to zero (in this case coffees).
4. Define the name and description of the promotion.
3. Confirm the settings by clicking **Apply**.
4. In **Type & limits** section:
1. Choose the **Custom** type.
2. Choose the **Multibuy** sub-type.
4. Define the number of usages per activation as `1`.
6. Define distribution period in the **Schedule** section and publish the promotion to apply all changes and run the promotion.
7. After buying the subscription the promotion created above should be activated on the client side - **for 30 times** (because it is the promotion for 30 coffees). Check the [first](https://hub.synerise.com/api-reference/loyalty-and-engagement#operation/ActivateAPromotion) or [second](https://hub.synerise.com/api-reference/loyalty-and-engagement#operation/BatchActivate) option which help you in activation of the promotion in our documentation.
## Create a workflow that tracks redemptions
---
In this step create a workflow that generates the event which informs that user collecting his daily coffee. In this workflow, after the promotion is redeemed by customer who has subscription - `client.removePoints` event is generated. This event is the trigger of the described workflow, which removes a customer from the segment for one day (they will not be able to use this subscription two times a day).
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Profile Event trigger node
---
At this stage, you configure the workflow to be triggered by a `client.removePoints` event.
1. As the first node of the workflow, add **Profile Event**. In the configuration of the node:
1. From **Choose event** dropdown menu, choose `client.removePoints` event.
2. Click the + where button, from the **Choose parameter** dropdown menu, choose **promotionUuid**.
3. From the **Choose operator** dropdown, choose **Equal (String)**.
4. In the next field, type the UUID of the promotion that you created earlier.
2. Confirm by clicking **Apply**.
### Define the Generate Event node
---
At this stage, an event is generated which is then used to exclude this profile from the segmentation of customers who did not pick up a coffee on this day.
1. As the second node of the workflow, add **Generate Event**.
2. In the **Event name**, enter `subscription.status`.
4. In the **Body** section, define the parameters of this event. In this case it is: ``` {"segment_enabled": "0"} ``` This removes the customer from the segment of customers eligible for a coffee on this day.
5. Click **Apply**.
### Add the finishing node
---
9. Add the **End** node.
10. In the upper right corner, click **Save & Run**.
The workflow configuration
## Create a workflow which checks the subscription status daily
---
In this step create a workflow that checks the current subscription status. It is triggered by the **Audience** node, which starts the automation every day at 00:00. This way, customers who picked up their daily coffee and were removed from the segment of eligible customers the day before, are re-added to the segment and can use the promotion during the next day. They must also have an active subscription.
### Define the Audience trigger node
---
At this stage, you configure the conditions that trigger the workflow.
1. As the trigger node, add an **Audience** node.
2. In the configuration of the node:
1. Set the **Run trigger** option to **repeatable**.
2. Set the interval to 1 per day.
3. As the time when the process starts, Choose 0:00 A.M. to make sure that the automation will check the customer status at the beginning of each day.
4. Select the time zone.
6. In **Define audience**, choose **New Audience** and click **Define conditions**.
1. As the first condition, from the **Choose filter** dropdown menu, choose the `subscription.status` event.
2. Click the **+ where** button, choose **segment_enabled**, and then select **Equal**. As the value, enter `0`
6. Set the time range to **Last 1 day before 1 day**.
3. As the second condition, from **Choose filter** dropdown menu, choose the `subscription.active` attribute and then select **Equal**. As the value, enter `1`.
8. Click **Apply**.
The configuration of the Audience node
### Define the Generate Event node
At this stage, an event with information that the customer has an active subscription and should be added to the segment again is generated. Based on that, the customer will be able to redeem another coffee during this day.
1. As the second node of the workflow, add **Generate Event**.
2. In the **Event name**, enter `subscription.status`.
4. In the **Body** section, define the parameters of this event. In this case, it is:
```json
{"segment_enabled": "1"}
```
This re-adds the customer to the segment of customers eligible for a coffee on this day.
5. Click **Apply**.
### Add the finishing node
---
9. Add the **End** node.
10. In the upper right corner, click **Save & Run**.
The workflow configuration
## Request from cash register
---
After using one of the [method](/use-cases/subscription#create-a-promotion)described in the promotion section - when customer buy a coffee, the cash register sends a request about promotions ([read more](https://hub.synerise.com/api-reference/loyalty-and-engagement#operation/GetClientPromotionsByACustomFilter)). If the cash register sees in the answer that customer has an active subscription, after processing the transaction, [redeem](https://hub.synerise.com/api-reference/loyalty-and-engagement#operation/RedeemAPromotion) the one promotion according to one of the methods above.
## What's next
---
This promotion can be the first step towards a more advanced marketing strategy and possibilities. While collecting your primary subscription (in this case coffee) you can for example receive a gift once in a billing period - (for example free muffin or small coffee).
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration directly in Synerise Demo workspace:
- [aggregate](https://app.synerise.com/analytics/aggregates/9b44ca29-0f2b-3d63-94ba-d5903707472d)
- [segmentation](https://app.synerise.com/analytics/segmentations/fdcf4f45-7268-49f1-b1dd-9d2add9f2723)
- [workflow which generates the event informing about collecting the coffee on a specific day](https://app.synerise.com/automations/automation-diagram/2a0fc77a-4784-4a5c-a2a9-bb6e6f123094)
- [workflow](https://app.synerise.com/automations/automation-diagram/5be43d01-05fd-4845-baa9-3d425f3196ab) which adds customers with active subscription to the segment again
- [promotion](https://app.synerise.com/campaigns/promotions/7bc157e2-0e43-4072-b5f7-5f5e7db90352)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 42 events per profile that completes the flow:
`subscription.status` (~3), [`client.activatePromotion`](/docs/assets/events/event-reference/loyalty#clientactivatepromotion) (~30), [`transaction.charge`](/docs/assets/events/event-reference/items#transactioncharge) (~1), [`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~1), [`client.removePoints`](/docs/assets/events/event-reference/loyalty#clientremovepoints) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~2), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~2).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Automation Hub](/docs/automation)
- [Loyalty programs basics](/use-cases/loyalty-programs-basics)
- [Promotions](/docs/ai-hub/promotions)
- [Segmentation](/docs/analytics/segmentations)
# The most frequently clicked links in email campaigns
Synerise allows you to create a report of the most frequently clicked links in an email campaign. To display links without UTM parameters, create an expression that formula sets the logic of displaying links.
## Prerequisites
---
- Make sure the links in the email templates contain the [tracking parameters](/developers/inserts/email#adding-utm-and-tracking-parameters-to-links).
## Process
---
In this use case, you will go through the following steps:
1. [Create a metric](/use-cases/report-with-neat-links#create-a-metric) that calculates the occurrences of the `newsletter.click` event.
2. [Create an expression](/use-cases/report-with-neat-links#create-an-expression) that will be available as a variable when including the `newsletter.click` event in analytics.
3. [Create a report](/use-cases/report-with-neat-links#create-a-report).
## Create a metric
---
As the first part of the process, create a metric that calculates the occurrences of the `newsletter.click` event.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. Leave the metric kind at default (**Simple metric**).
4. As **Aggregator**, select **Count**.
5. Leave **Event** and **Occurrence type** at default.
6. From the **Choose event** dropdown list, select **newsletter.click**.
7. As the date range, select **Lifetime**.
8. Click **Save**.
Formula of the metric
## Create an expression
---
In this part of the process, create an expression that will be available as a variable when including the `newsletter.click` event in analytics. The formula of the expression contains the regular expression for the URL parameter of the `newsletter.click` event. As a result, the expression removes UTM parameters from the link.
1. Go to **Behavioral Data Hub > Expression > New expression**.
2. Enter the name of the expression.
3. Set the **Expression for** option to **Event**.
4. From the dropdown list, select **newsletter.click**.
5. Build the formula of the expression:
1. On the dashboard, click **Select**.
2. From the dropdown list, select **Function > Regexp**.
3. In the left **Select** field, select **Event attribute**.
4. From the dropdown list, select **url**.
5. In the right dropdown list, select **Constant**.
6. Enter the following formula: `(?<=www\.|https:\/\/)[^\?\s]+(?=\?)?`
Formula of the expression
6. Save the expression.
## Create a report
---
In this part of the process, create a report based on the metric and expression you prepared before. The result of the report is a table with the top/last links clicked in email campaigns and the number of clicks for each link.
1. Go to **Decision Hub > Reports > New report**.
2. Enter the name of the report.
3. Select the metric you created in this [part](/use-cases/report-with-neat-links#create-a-metric) of the process.
4. From the **Range** dropdown list, select the number of top (the most frequently clicked) or last (the least frequently clicked) results to be shown in the preview of the report.
5. In the **Dimension** section, select the expression you created in [this part](/use-cases/report-with-neat-links#create-an-expression) of the process.
6. In the date range, select the time that will be analyzed.
Configuration of the report
7. Save the report.
8. Click **Preview** to see the results.
Report presents the top 3 clicked links and the number of clicks in the links
## Check the use case set up on the Synerise Demo workspace
---
You can check the analyses created in this use case in our Synerise Demo workspace:
- [Metric that returns the number of clicked links in emails](https://app.synerise.com/analytics/metrics/61110a06-af76-4227-a6bf-d7ab5238a176).
- [Expression that returns a neat link](https://app.synerise.com/analytics/expressions/8a3b2f05-4972-47ef-a03c-04670a55bbb8).
- [Report with a heatmap of links clicked in an email](https://app.synerise.com/analytics/reports/f5a529c4-2d37-49f2-bfbb-2f4dc0c1e232).
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case does not generate any events.
## Read more
---
- [Expressions](/docs/crm/expressions)
- [Metrics](/docs/analytics/metrics)
- [Reports](/docs/analytics/reports)
# Promotion triggered by basket value
In order to increase your sales, you need to make every customer count. The ability to automatically trigger a promotion for your loyal customers at certain basket values will help you boost your average basket value. It can also make customers more satisfied, reliable, and profitable.
In this use case, you will create a promotion for members of a loyalty program: they will receive a specific product for free when their cart value exceeds 100 PLN.
## Prerequisites
---
- [Implement promotions in your mobile application](/developers/mobile-sdk/loyalty), [API](https://hub.synerise.com/api-reference/loyalty-and-engagement#operation/profileLogin).
- [Import your product feed to catalogs](/use-cases/import-product-feed-to-catalog).
- If you want to limit the promotion to only some of your stores, add the list of stores to a catalog. Such a catalog must contain a unique store ID and any other store attributes by which you will filter stores, such as city, zip code, etc. More information about catalogs can be found [here](/docs/assets/catalogs).
## Security configuration
---
Before you start working with this hub, if you are a Synerise customer or partner, consider reading [the section about denylisting events](/docs/settings/tool/api#denylist). This natively accessible configuration will allow you to manage the restrictions in points management that may help you prevent fraud.
## Process
---
1. [Prepare segmentation](/use-cases/promotion-triggered-by-basket-value#prepare-a-segmentation) of customers who are members of the loyalty program.
2. [Create a promotion](/use-cases/promotion-triggered-by-basket-value#create-a-promotion).
## Prepare a segmentation
---
In this part of the process, create a segmentation of customers who are members of the company's loyalty program.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of segmentation.
3. From the **Choose filter** dropdown list, select the **loyaltyCard** attribute.
4. As the logical operator select Boolean **Is true**.
The conditions used in the segment will vary depending on your loyalty program integration (for example, the name of the attribute may be different). You must define the segmentation accordingly.
5. Click **Save**.
An example of a customer segment that participates in a loyalty program
## Create a promotion
---
1. Go to **AI Hub > Regular Promotions > Add promotion**.
2. Select the **For selected items** option.
3. In the **Audience** section, select the segmentation created in [this step](/use-cases/promotion-triggered-by-basket-value#prepare-a-segmentation).
4. In the **Content** section:
1. Define the name, description, and image of the promotion.
2. In the **price** field enter `0`.
3. Confirm the settings by clicking **Apply**.
Example of promotion content
5. In the **Type and limits** field, define the settings so that the promotion is only available once to loyalty program members:
1. As the **Type**, choose **Members only**.
2. In the **Limit per profile** section, enter `1`.
3. In the **Value** section, define the discount as `100%`.
4. Switch the **Basket trigger** toggle on.
5. In the **Minimum value** field, enter `100`.
6. Apply changes.
6. In the **Schedule** section, define the promotion distribution period according to your business needs.
7. **Optional** In the **Stores** section, specify stores where the promotion is available.
This is possible only if the list of stores is imported into a [catalog](/docs/assets/catalogs).
8. In the **Items** section, specify the catalog item to be discounted:
1. In the **Source catalog** field, select an item catalog to select the promotional items from.
2. Select a promotional item by using the **Select items** option (in our case, the item is a coffee).
10. To apply configuration and run the promotion, click **Publish**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [segmentation](https://app.synerise.com/analytics/segmentations/1f34841c-8dd8-49f6-acd9-aab7ce928e23) and [promotion settings](https://app.synerise.com/campaigns/promotions/b168dea2-0f33-46a5-8066-68e8d380c40d) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 4 events per profile that completes the flow:
[`client.activatePromotion`](/docs/assets/events/event-reference/loyalty#clientactivatepromotion) (~1), [`transaction.charge`](/docs/assets/events/event-reference/items#transactioncharge) (~1), [`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~2).
## Read more
---
- [Creating segmentations](/docs/analytics/segmentations)
- [Creating promotions](/docs/ai-hub/promotions)
# Use cases
# Item comparison recommendations on the website
An overwhelming number of products can often discourage a customer from purchasing. An intelligent solution is to use product comparison recommendations to make the buying decision process smoother. Such offers make it easier for customers to decide when trying to choose between multiple models or styles of the same products to get a better idea of which option is best for them. But it also allows marketers to promote products with specific features. Such a solution is a great way to increase customer engagement and conversions.
This use case describes the process of creating dress comparison recommendations for customers on the website.
## Prerequisites
---
- Implement [Synerise tracking code](/developers/web/installation-and-configuration) on your website.
- Implement [OG Tags](/developers/web/og-tags) on your website.
- [Prepare a product feed](/docs/ai-hub/recommendations-v2/item-feed-requirements) with attributes to be used in item comparison recommendations.
- [Configure an item catalog for recommendations](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations). Enable the item comparison recommendations.
- Meet the minimum data requirements of interactions and events.
At least 10,000 item page visits for **Item comparison recommendations**.
## Create a recommendation
---
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter a meaningful name of the recommendation.
3. In the **Type & Items feed** section, click **Define**.
1. From the **Items feed** dropdown list, select the catalog that contains items for the recommendation.
2. As the type, select **Item comparison**.
3. Click **Apply**.
4. In the **Compare attributes** section, click **Define**.
5. Click **Choose**.
6. Select the item attributes from the list of all available attributes to be compared in the recommendations.
6. Click **Apply**.
7. In the **Items** section, click **Define**.
1. Click **Add slot**. You can name the slot for later reference.
2. In the **Number of items** subsection, set the minimum and maximum number of items to `3`.
Setting the minimum and maximum number of items to the same number ensures that exactly this many items will appear in the slot.
3. In **Static filters** set the following parameters:
1. From the dropdown list, choose **Visual Builder**.
2. Click **Select attribute**.
3. From the dropdown list, choose the **category** attribute.
4. Click **Operator**.
5. From the dropdown list, choose **Equals**.
6. Click **Select value**.
7. From the dropdown list, choose the `dress` category.
8. On the bottom of the static filter, click **Apply**.
9. In the **Items** section, click **Apply**.
Learn about the difference among [elastic, static filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#select-conditions-of-displaying-items), and [distinct filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#distinct-filter).
8. Optionally, you can define the settings in the **Boosting** and **Additional settings** sections.
Learn more about [boosting](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-the-boosting-factors) and [additional settings](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#additional-settings).
9. Save the recommendation by clicking **Save**.
You can also check the recommendation configuration directly in Synerise Demo workspace at this [link](https://app.synerise.com/ai-v2/recommendations/psaucwbowxkX).
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## What's next
---
You can display the recommendation to customers in a number of ways, for example by using the [recommendation insert](/developers/inserts/recommendations-v2) in [dynamic content](/docs/campaign/dynamiccontent/creating-dynamic-content).
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Creating recommendations](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign)
- [Dynamic content campaigns](/docs/campaign/dynamiccontent/introduction-to-dynamic-content)
- [Dynamic content inserts](/developers/inserts/dynamic-content)
- [Filters in recommendations](/docs/ai-hub/recommendations-v2/recommendation-filters)
- [Requirements for item feed](/docs/ai-hub/recommendations-v2/item-feed-requirements)
# Send a mobile push to customers who are most likely to buy
In order to increase conversions, you might look into the use of lookalike predictions to identify the customers comparable to prior successful target audiences. Lookalikes let you compare two segments of customers and find those who display similar qualities of performance. Marketers may extend reach of campaigns by incorporating these lookalike audiences into their communication.
This use case describes a workflow that sends a mobile push notification to customers who did not receive it before, and might be likely to purchase after receiving it. Those customers are chosen using highest lookalike prediction score which is calculated on the basis of the segment of customers who reacted well to a previous iteration of that campaign. The workflow is triggered by the `session.start` event in the mobile application, and sends a mobile push after 48 hours if the customer did not make a purchase.
In this use case, we start from the assumption that we want to find customers similar to those who once made the desired conversion in a specific mobile push campaign. Therefore, we use the Lookalikes model. However, if we simply wanted to find customers with the highest probability of purchase, then we would use the propensity prediction model.
## Prerequisites
---
- [Enable the Lookalike prediction type](/docs/ai-hub/predictions/enabling-predictions#enabling-lookalikes).
- Select a campaign sent in the past, on the basis of which we will create a segment for lookalike prediction.
- Implement [transaction events](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- [Implement Synerise SDK in your mobile application](/developers/mobile-sdk).
- Implement mobile push notifications in your mobile application: [iOS](/developers/mobile-sdk/configuring-push-notifications/ios), [Android](/developers/mobile-sdk/configuring-push-notifications/android).
- [Create a mobile push template](/docs/campaign/Mobile/creating-mobile-push).
## Process
---
1. [Create a lookalike prediction](/use-cases/send-mobile-push-customers-most-likely-to-buy#create-a-lookalike-prediction).
2. [Create a workflow](/use-cases/send-mobile-push-customers-most-likely-to-buy#create-a-workflow) that sends the mobile push.
## Create a lookalike prediction
---
In this step, we will calculate the prediction. As a result, on the customers' profiles from the target segmentation a [`snr.lookalike.score`](/docs/assets/events/event-reference/predictions#snrlookalikescore) event will appear. It contains a `score.label` parameter, which determines the similarity between the customers in the target and the source segmentations. The workflow configuration, will be based on this parameter. We will select customers who have the highest similarity to people who previously converted after receiving a given campaign.
1. Go to **AI Hub > (AI Predictions) Models > New prediction**.
2. Enter a meaningful name for the prediction.
2. In the **Select prediction type** window that appears, click **Lookalikes**.
3. Click **Apply**.
### Create a source segmentation
A source segmentation is a group of model customers to whom you compare the target group of customers in order to find similar customers in the target group. In this scenario, customers who made a purchase during past marketing campaign will be the source segmentation.
1. In the **Audience** section, click **Define**.
2. In the **Source segmentation** sub-section, click **Choose segmentation**.
3. On the dropdown list, click **Create new**.
4. In the **Segmentation name** field, enter a meaningful name of the segmentation.
5. Click **Netx step**.
5. Click **Choose filter**:
1. From the dropdown list, select the [`push.view`](/docs/assets/events/event-reference/mobile-push#pushview) event.
2. Click the **+ and where** button and select `id`.
3. As the logical operator, select **Equal**.
4. Type the campaign ID.
6. Click **+ Add funnel step**.
7. Click **Choose filter**:
1. From the dropdown list, select the [`transaction.charge`](/docs/assets/events/event-reference/items#transactioncharge) event.
8. In the lower-right corner, click the clock icon.
**Result**: **Completed within** section will appear.
9. Type `2` and from the dropdown list, select **Days**.
9. Using the date picker in the lower-right corner, select the **Lifetime** value.
6. Save the segmentation by clicking **Create segmentation**.
Source segmentation configuration
### Create a target segmentation
A target segmentation is a group of customers among which you want to find customers who are similar to those included in the source group. In this scenario, we are looking for customers who visited a mobile application in the specified time period and did not receive the previous campaign.
1. In the **Audience** section, click **Define**.
2. In the **Target segmentation** sub-section, click **Choose segmentation**.
3. On the dropdown list, click **Create new**.
4. In the **Segmentation name** field, enter a meaningful name of the segmentation.
5. Click **Netx step**.
5. Click **Choose filter**:
1. From the dropdown list, select the `push.view` event.
2. Click the **+ and where** button and select `id`.
3. As the logical operator, select **Equal**.
4. Type the campaign ID.
5. Change **Profiles matching funnel** to **not matching**.
7. Using the date picker in the lower-right corner, specify the time period:
1. Set the time range in **Relative date range** to **Custom**.
2. Type 30 below, and from the dropdown list next to the field, choose **Days**.
3. Click **Apply**.
8. Click **Choose filter**:
1. From the dropdown list, select the [`session.start`](/docs/assets/events/event-reference/web-and-app#sessionstart) event.
2. Click the **+ and where** button and select `mobile`.
3. As the logical operator, select **Is true**.
9. Using the date picker in the lower-right corner, specify the time period:
1. Set the time range in **Relative date range** to **Last 7 d**.
2. Click **Apply**.
10. Click **Choose filter**:
1. From the dropdown list, select the attribute for push agreement.
2. As the logical operator, select **Is true**.
6. Save the segmentation by clicking **Create segmentation**.
7. Confirm the settings in the **Audience** section by clicking **Apply**.
Target segmentation configuration
### Configure further settings
1. In the **Settings** section, click **Change**.
2. Choose **Set up recurring prediction calculation**:
1. Set the frequence of model training to 7 days.
3. Change the scale from 5 point scale to 2. The scale a customer reached will be available in the `snr.lookalike.score` event, as the `score_label` parameter.
4. Confirm the changes in the Settings section by clicking **Apply**.
5. Click **Save & Calculate**.
## Create a workflow
---
As the final part of the process, create a workflow that manages the push notifications. Visiting the mobile app triggers the start of the workflow. The push notification will be sent after 48 hours to customers with high prediction score and who didn't make a purchase.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Profile Event trigger node
At this stage, we will configure the conditions that launch the workflow. As a trigger, we will use the `session.start` event.
1. As the first node of the workflow, add **Profile Event**. In the node settings:
1. From the dropdown list, select the `session.start` event.
2. Click the **+ and where** button and from the dropdown list, select `mobile`.
3. As the logical operator, select **Is true**.
4. Click **Apply**.
### Configure Delay node
This node will delay sending the push notification.
1. Add the **Delay** node. In the node settings:
1. In the **Delay** field, type `48`.
2. From the dropdown list, choose **Hour**.
2. Click **Apply**.
### Configure the Profile Filter node
This node will filter the customers visiting the mobile application to those who received the `high` value of the `score.label` parameter and those who didn't make a purchase in the last 7 days.
1. As the next node, add **Profile Filter**.
2. In the setting of the node, click **Choose filter** and from the dropdown list, select the `snr.lookalike.score` event:
1. For the event parameter, click the **+ where** button and select `modelId`.
2. As the logical operator, select **Equal**.
3. Enter the ID of the [lookalike prediction](/use-cases/send-mobile-push-customers-most-likely-to-buy#create-a-lookalike-prediction) created in the previous step.
8. Click the **+ and where** button and select `score_label`.
9. As the logical operator, select **Equal**.
10. Type `high`.
9. In the calendar in the right bottom of the page, in the **Relative date range** section, select **Last 7 d**.
3. Click **Apply**.
3. Click **Choose filter** and from the dropdown list, select the transaction charge event:
1. Change the Profiles **matching** funnel to **not matching**.
2. In the calendar in the right bottom of the page, in the **Relative date range** section, select **Last 7 d**.
3. Click **Apply**.
Profile Filter node configuration
4. For the **Not matched** path, add the **End** node .
### Configure settings for mobile push
1. As the next node for the **Matched** path, add the **Send Mobile Push** node. Configure it according to your business needs:
1. Select the template type of mobile push.
2. Select a template prepared earlier.
2. Confirm by clicking **Apply**.
### Add the finishing node and capping
1. Add the **End** node.
2. In the top right corner of the page, click the **Set capping** button. Define the settings:
1. Type as follows **Limit** 1 **Time** 7, and from the dropdown list choose **Day**.
2. Click **Apply**.
3. In the upper right corner, click **Save & Run**.
The workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the [workflow](https://app.synerise.com/automations/automation-diagram/a5388fc9-cf92-4fc2-9225-85e994162e87) in our Synerise Demo workspace:
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 10 events per profile that completes the flow:
[`snr.lookalike.score`](/docs/assets/events/event-reference/predictions#snrlookalikescore) (~1), [`session.start`](/docs/assets/events/event-reference/web-and-app#sessionstart) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`push.send`](/docs/assets/events/event-reference/mobile-push#pushsend) (~1), [`push.view`](/docs/assets/events/event-reference/mobile-push#pushview) (~1), [`push.click`](/docs/assets/events/event-reference/mobile-push#pushclick) (~1).
## Read more
---
- [Configuring mobile notifications](/docs/campaign/Mobile/mobile_campaign)
- [Lookalikes predictions](/docs/ai-hub/predictions/lookalikes)
- [Predictions](/docs/ai-hub/predictions/predictions-introduction)
- [Workflow](/docs/automation/creating-automation)
# Dynamic report for products bought together with top 10 products
This use case is dedicated to companies seeking deeper insights into their product performance which can be achieved by automating the creation of reports of bestsellers from recent transactional data. In this use case, two reports are created:
- first, with top 10 products bought in the last 90 days,
- second, with products most often bought together in the same order with top 10 products from the last 90 days.
The reports will show which products are often purchased together with bestsellers, helping the company make decisions about inventory, marketing, and customer preferences.
The process starts with creating an aggregate that returns the list of 1000 IDs of orders from the last 90 days. Then, you will proceed to creating two metrics: the first one calculates the total quantity of purchased products over the last 90 days, the second metric sums the quantity of products purchased within the order IDs returned by the aggregate created earlier. This way, you will identify frequently co-purchased items. Based on those metrics, you will create reports mentioned before.
As the final part of the process, you will create a workflow that retrieves data from those reports and once a day updates the aggregate, metrics, and reports with the current data. This ensures that all analyses remain up to date everyday. Through this process, the company can effectively monitor product performance, identify trends, and strategize based on data-driven insights. This not only streamlines decision-making but also empowers the company to stay competitive in a dynamic market landscape.
To conveniently monitor and visualize results, a dashboard is created, showing both the bestsellers report and the dynamic report.
## Prerequisites
---
- Implement a [tracking code](/docs/settings/tool/tracking_codes) into your website.
- Import a [product feed](/developers/product-feed) to a catalog.
- Import [transaction events](/developers/web/transactions-sdk).
- [Enrich transactional data from your product feed](/use-cases/enriching-product-page-with-data-from-the-catalog).
- Create a [Workspace API key](/docs/settings/tool/api) with following permissions:
`ANALYTICS_BACKEND_METRIC_UPDATE`, `ANALYTICS_BACKEND_AGGREGATE_UPDATE`, `ANALYTICS_BACKEND_REPORT_READ`.
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate](/use-cases/dynamic-report#create-an-aggregate) that returns a list of order IDs in the last 90 days.
2. [Create a metric that returns the quantity of purchased products](/use-cases/dynamic-report#create-a-metric-that-returns-the-quantity-of-purchased-products) in the last 90 days.
3. [Create a metric that returns the quantity of purchased products in the specific order](/use-cases/dynamic-report#create-a-metric-that-returns-the-quantity-of-purchased-products-in-the-specific-order).
5. [Create a report with top 10 bestsellers](/use-cases/dynamic-report#create-a-report) based on the metric that returns the quantity of purchased products in the last 90 days.
6. [Create a dynamic report](/use-cases/dynamic-report#create-a-dynamic-report) with top 10 complementary products to 10 bestsellers.
7. [Create a workflow](/use-cases/dynamic-report#create-a-workflow) which retrieves and updates the analyses created in the previous parts of the process.
7. [Create a dashboard](/use-cases/dynamic-report#create-a-dashboard) with two reports created earlier.
## Create an aggregate
---
The first step is creating an aggregate that returns IDs of the last 1000 orders which included products from a pre-defined list which will be updated later in the workflow.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last multi** and in the **Size** field, enter `1000`.
The number of last multi should be chosen depending on the specific company's sales volume.
4. Select the **Consider only distinct occurrences of the event parameter** button.
5. From the **Choose event** dropdown list, select the **product.buy** event.
6. As the event parameter, select **$orderId**.
7. Click **+ where** button.
8. From the **Choose parameter** dropdown list, select the **$sku** parameter.
9. From the **Choose operator** dropdown list, select **In Array**.
10. Enter the `.` character. This value will be updated later through a workflow created in the further part of the process.
11. Set the period from which the aggregate will analyze the results. In our case, it's **last 90 days**.
12. Save the aggregate.
Aggregate with top selling products
## Create a metric that returns the quantity of purchased products
---
The next step involves creating a metric that calculates the total sum of purchased items. This simple metric, which considers all occurrences of the `product.buy` event in the last 90 days, will be used in the report which will give you insights into the most frequently purchased products in the defined time frame (in our case - last 90 days).
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As the kind of the metric, select **Simple metric**.
4. As the aggregator, set **Sum**.
5. As the occurrence type, set **All**.
6. From the **Choose event** dropdown list, select the **product.buy** event.
7. Click the **Where** button.
8. Click the **Choose parameter** button.
9. Choose the **$quantity** parameter.
15. To specify the analyzed period, click the **calendar** icon.
15. Choose the **last 90 days**.
16. Confirm your selection by clicking the **Apply** button.
17. Save the metric.
Metric with top selling products
## Create a metric that returns the quantity of purchased products in the specific order
---
In this part of the process, create a metric that returns the quantity of products purchased within specific order IDs. This metric is essential for grouping together products bought in the same order. Later it will be used to identify frequently co-purchased items. This metric will not return results until the workflow, which will be created in the further part of the process, is launched.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As the kind of the metric, select **Simple metric**.
4. As the aggregator, set **Sum**.
5. As the occurrence type, set **All**.
6. From the **Choose event** dropdown list, select the **product.buy** event.
7. As a parameter choose **$quantity**.
7. Click the **Where** button.
8. Click the **Choose parameter** button.
9. Choose the **$orderId** parameter.
10. As an operator select, **In (String)**.
11. As a value of the `$orderId` parameter, select an [aggregate](/use-cases/dynamic-report#create-an-aggregate) created in the previous step.
12. Click the **+where** button.
13. From the dropdown, select the parameter **$sku**.
14. As an operator, select **Not in (String)**.
14. As the value, enter the `.` sign. This value will be updated later through a workflow created in the further part of the process.
11. Set the period from which the metric will analyze the results. In our case **Last 90 days**.
16. Confirm your selection by clicking the **Apply** button.
17. Save the metric.
Metric presented the quantity of products bought
## Create a report
---
In this part of the process, you will create a report that returns the top 10 bestselling products from the last 90 days. This report helps you understand which products are performing exceptionally well, providing insights for inventory management and marketing strategies.
1. Go to **Decision Hub > Report > New report**.
2. Enter a name of the report.
3. Select the metric you created in [the previous part](/use-cases/dynamic-report#create-a-metric-that-returns-the-quantity-of-purchased-products) of the process.
4. From the **Range** dropdown list, choose **10 top**.
5. In the **Dimension** section, from the **product.buy** event, select **$sku** to display the SKU of each product included in the report results.
6. In the **Dimension** section, from the **product.buy** event, select **$name** to display the name of each product included in the report results.
6. For the date range, select the time period you want to analyze. In this case, choose last 90 days.
7. Save the report.
8. Click on **Preview** to view the results.
Report presented top selling products
## Create a dynamic report
---
This report identifies the top 10 products most frequently bought together with the bestselling products from the last 90 days. This dynamic report relies on the [metric](/use-cases/dynamic-report#create-a-metric-that-returns-the-quantity-of-purchased-products-in-the-specific-order) created in the previous step and lets you uncover complementary products. This report will not return results until the workflow, which will be created in the further part of the process, is launched.
1. Go to **Decision Hub > Report > New report**.
2. Enter a name of the report.
3. Select the metric you created in [the previous part](/use-cases/dynamic-report#create-a-metric-that-returns-the-quantity-of-purchased-products-in-the-specific-order) of the process.
4. From the **Range** dropdown list, choose **10 top**.
5. In the **Dimension** section, from the **product.buy** event, select **$sku** to display the SKU of each product included in the report results.
6. In the **Dimension** section, from the **product.buy** event, select **$name** to display the name of each product included in the report results.
6. For the date range, select the time period you want to analyze. In this case, choose last 90 days.
7. Save the report.
8. Click **Preview** to view the results.
Report presented top selling products
## Create a workflow
---
In this part of the process, create a workflow which retrieves data from the report and update the report, metric and aggregate with proper SKUs. This ensures that the analyses created before remain up to date.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Audience trigger node
---
Choose the **Audience** node as the trigger. Set the workflow as repeatable, starting everyday at 9:00 A.M. This node is necessary to facilitate repetitive launching, using the customer-related nodes (such as Event Filter) and using customer context.
1. Start the workflow with the **Audience** node.
2. In the configuration of the node, set the **Run trigger** option to **repeatable**.
3. Set the interval to 1 per day.
4. Choose the day and time when the process starts. Choose 9 A.M.
5. As the audience of the node, you may include only yourself or a test user. The audience is not a priority.
6. Click **Apply**.
Configuration of the Audience node
### Define the first Delay node
---
This node creates a 10 seconds delay before moving to the next condition of the workflow. It helps you minimize the risk that possible server errors or delays will influence your workflow.
1. Add the **Delay** node. In the node settings:
1. In the **Delay** field, type `10`.
2. From the dropdown list, choose **second**.
2. Click **Apply**.
### Configure the first Outgoing Integration node
---
This Outgoing Integration Node fetches the top 10 products from our [report](/use-cases/dynamic-report#create-a-report) generated earlier. These products represent the bestsellers and will serve as the foundation for further analysis.
1. Add **Outgoing Integration**. In the configuration of the node:
1. Choose the authentication method. In our case, it will be **API key**.
2. Click **Add connection**, and on the pop-up, enter the name of the connection and from the dropdown list, select the API Key created as a part of prerequisites.
2. Click **Apply**.
2. In the **Webhook name** field, enter the value of the `name` parameter of the event generated by this integration. In our case, it's `topProductsBoughtTogetherReport`.
3. In **Webhook event name**, click **Create event** and create a new event:
1. As **Name**, enter `report.topProductsBoughtTogether`
2. As **Display name**, enter `Top product report generated`
3. In the **URL** section, select the **POST** method and as the endpoint URL, enter `https://api.synerise.com/analytics/analytics/v4/reports/preview`
4. In the **Headers** section, as the header, add **content-type** and as a value, add **application/json**.
5. In the **Body** section, enter the following JSON code. As the value of the **metricId**, enter the ID of the [metric](/use-cases/dynamic-report#create-a-metric-that-returns-the-quantity-of-purchased-products) which you can find in the URL of this metric.
11. Confirm the settings by clicking **Apply**.
12. Confirm by clicking **Apply**.
Outgoing Integration configuration
### Configure the Event Filter node
---
In this node, the workflow waits for the response from the report generation initiated in the previous step. It ensures that we proceed only when the report data is available.
1. Add the **Event Filter** node.
2. Add the name for the node, in our case it has to be: `topProductsBoughtTogetherReport`, because the exact name was used as the webhook name in the previous step.
1. Check **without limits**.
2. From the **Choose event** dropdown list, select the `report.topProductsBoughtTogether` event.
4. As the event parameter select **status**. The status parameter usually refers to an HTTP status code.
5. From the **Choose operator** dropdown list, select **less than (number)**.
6. As the value, enter `300` to avoid server errors.
7. Confirm by clicking **Apply**.
Event Filter node configuration
### Define the second Delay node
---
This node creates a 10 second delay before moving to the next node in the workflow. It helps you minimize the risk of server errors or delays that could affect your workflow.
1. Add the **Delay** node. In the node settings:
1. In the **Delay** field, type `10`.
2. From the dropdown list, choose **second**.
2. Click **Apply**.
### Configure the second Outgoing Integration node
---
The step involves updating the [aggregate you created in the previous step](/use-cases/dynamic-report#create-an-aggregate) with additional SKUs obtained from the report generated in the first Outgoing Integration node in this workflow. This ensures that the aggregate data remains up to date. The goal of this step is to keep our aggregate data up to date, allowing us to analyze product purchases accurately.
1. Add **Outgoing Integration**. In the configuration of the node:
1. Choose the authentication method. In our case, it will be **API key**.
2. Click **Add connection**, and on the pop-up, enter the name of the connection and from the dropdown list, select the API Key created as a part of prerequisites.
2. Click **Apply**.
2. In the **Webhook name** field, enter the value of the `name` parameter of the event generated by this integration. In our case, it's `topProductsBoughtTogetherUpdateAggregate`.
3. In **Webhook event name**, click **Create event** and create a new event:
1. As **Name**, enter `report.topTogetherAggregateUp`
2. As **Display name**, enter `Top product aggregate updated`
3. In the **URL** section, select the **PUT** method and as the endpoint URL, enter `https://api.synerise.com/analytics/analytics/definitions-manager/aggregates/394379f0-f851-39d8-a62e-fc0613860798`. Remember to replace the ID in the link with the ID of the [aggregate](/use-cases/dynamic-report#create-an-aggregate) created in the previous step.
4. In the **Headers** section, as the header, add **content-type** and as a value, add **application/json**.
5. In the **Body** section add the following code snippet. As values of **id** and **uuid**, enter the ID of the [aggregate](/use-cases/dynamic-report#create-an-aggregate) which you can find in the URL of this aggregate.
11. Confirm the settings by clicking **Apply**.
12. Confirm by clicking **Apply**.
Outgoing Integration configuration
### Define the third Delay node
---
This node creates a 10 second delay before moving to the next condition of the workflow. It helps you minimize the risk of server errors or delays that could affect your workflow.
1. Add the **Delay** node. In the node settings:
1. In the **Delay** field, type `10`.
2. From the dropdown list, choose **second**.
2. Click **Apply**.
### Configure the third Outgoing Integration node
---
The next step involves updating the metric with SKUs obtained from the report generated in the first Outgoing Integration node in this workflow. This ensures that the metric data remains up to date.
1. Add **Outgoing Integration**. In the configuration of the node:
1. Choose the authentication method. In our case, it will be **API key**.
2. Click **Add connection**, and on the pop-up, enter the name of the connection and from the dropdown list, select the API Key created as a part of prerequisites.
2. Click **Apply**.
2. In the **Webhook name** field, enter the value of the `name` parameter of the event generated by this integration. In our case, it's `topProductsBoughtTogetherUpdateMetric`.
3. In **Webhook event name**, click **Create event** and create a new event:
1. As **Name**, enter `report.topTogetherMetricUp`
2. As **Display name**, enter `Top product metric updated`
3. In the **URL** section, select the **PUT** method and as the endpoint URL, enter `https://api.synerise.com/analytics/analytics/v3/metrics/ca35c24c-de50-4f7b-8e1d-38adaa819036`. Remember to replace the ID in the link with the ID of the [metric](/use-cases/dynamic-report#create-a-metric-that-returns-the-quantity-of-purchased-products-in-the-specific-order) created in the previous step.
4. In the **Headers** section, as the header, add **content-type** and as a value, add **application/json**.
5. In the **Body** section add the following JSON frame with Jinjava code. In the place **id** and **uuid** enter the [aggregate](/use-cases/dynamic-report#create-an-aggregate) ID which is located in the link to this aggregate.
11. Confirm the settings by clicking **Apply**.
Outgoing Integration configuration
### Prepare the final settings
---
1. Add the **End** node.
2. Optionally, add titles to each node so the workflow will be more understandable to your colleagues.
4. Enter the name of the workflow.
5. To save it as a draft, click Save, or activate the workflow by clicking **Save & Run**.
The whole workflow process
## Create a dashboard
---
In this part of the process, to conveniently preview the results of all reports you created in the previous part of the process, create a dashboard. This dashboard serves as a central hub for accessing key insights into your product performance.
1. Go to **Decision Hub > Dashboard > New dashboard**.
2. Enter a meaningful name of the dashboard.
3. Add both reports you created earlier in the process:
- [Report with top 10 bestsellers](/use-cases/dynamic-report#create-a-report),
- [Dynamic report](/use-cases/dynamic-report#create-a-dynamic-report).
You can learn more about creating dashboards [here](/docs/analytics/analytics-dashboard/creating-dashboards).
4. Save the dashboard.
Dashboard with both reports
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of all elements used in the use case, directly in Synerise Demo workspace:
- [aggregate](https://app.synerise.com/analytics/aggregates/394379f0-f851-39d8-a62e-fc0613860798)
- [metric with top selling products](https://app.synerise.com/analytics/metrics/6860f5d4-5ae2-4cc0-8472-50ddee1e4496)
- [metric with the sum of quantity of products in the specific order](https://app.synerise.com/analytics/metrics/ca35c24c-de50-4f7b-8e1d-38adaa819036)
- [report with top selling products](https://app.synerise.com/analytics/reports/9cf9ba76-a9db-4fab-855d-95437ffab472)
- [dynamic report](https://app.synerise.com/analytics/reports/e640ffb8-8f6f-4bdc-a9ea-417d69c85d3a)
- [automation](https://app.synerise.com/automations/automation-diagram/bbbbc55f-75fa-4b46-ad9f-ada582366ecc)
- [dashboard](https://app.synerise.com/analytics/dashboards/2fd2f93f-a643-40c2-8655-6058ffc9c6d1)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 12 events per workflow execution:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~7), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), `report.topProductsBoughtTogether` (~1), `report.topTogetherAggregateUp` (~1), `report.topTogetherMetricUp` (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Automation Hub](/docs/automation)
- [API](/developers/api)
- [Metrics](/docs/analytics/metrics)
- [Reports](/docs/analytics/reports)
# Find heavy buyers with declining purchase activity
There are many criteria by which you can create a variety of customer segmentations. The measures you choose will largely depend on the business goal you want to achieve. One of the possible goals may be to keep heavy buyers engaged. Heavy buyers are those customers who do an above-average amount of shopping. Heavy customers typically make up less than one-third of consumers of goods or services but account for more than two-thirds of sales revenue. That is why companies try to take special care of this group of customers.
This use case describes the process of identifying heavy buyers whose buying activity has declined in the current period and reactivating them with communications containing personalized offers that will prompt them to make a purchase.
## Prerequisites
---
Implement [transaction events](https://hub.synerise.com/api-reference/data-management#tag/Events).
## Process
---
- [Create a segmentation of heavy buyers](/use-cases/find-heavy-buyers#create-a-segmentation-of-heavy-buyers)
- [Create a segmentation of heavy buyers whose buying behavior has changed over the past year](/use-cases/find-heavy-buyers#create-a-segmentation-of-heavy-buyers-whose-buying-behavior-has-changed-over-the-past-year)
## Create a segmentation of heavy buyers
---
In this part of the process, you will create a segmentation of heavy buyers based on the number of transactions generated by these customers in the previous period. Before you proceed to creating the segmentation, you will create an aggregate and metric which you will use in the conditions of the segmentation.
Depending on your business needs, you can create a segmentation of heavy buyers based on various criteria and choose a period that meets your requirements.
### Create an aggregate
Create an aggregate that sums up the number of transactions in the previous period.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Count** (then the aggregate result shows the total number of transactions in the time range selected in the analysis).
4. From the **Choose event** dropdown list, select the **transaction.charge** event.
Events may have different labels between workspaces, but you can always find them by their action name (in this step, it’s **transaction.charge**).
5. Change the date range, by clicking the calendar icon. Create the following custom date range `last 365 days before 365 days`.
6. Confirm the changes with the **Apply** button.
7. Save the aggregate by clicking **Save**.
Example settings of the aggregate
### Create a metric
Create a metric that sets a cutoff value for the customer segment with the highest number of transactions.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As a metric kind, select **Simple metric**.
4. As a metric type, select **Profile**.
5. As the aggregator, set **Quantile**.
Quantile is used to divide a sample of data into equal-sized subgroups
6. In the input field which appears next to the aggregator, type `0.7` (to create a cutoff that defines the highest number of values).
7. Click **Choose event**.
8. From the dropdown list, select the [aggregate you created before](/use-cases/find-heavy-buyers#create-an-aggregate).
9. Define the same time range as in the aggregate you use in the metric.
10. Click **Save**.
The final configuration of the metric
### Create a segmentation
In this part of the process, you will create a segmentation of customers with the highest scoring (30% of customers who made the highest number of transactions).
1. Go to **Decision Hub > Segmentation > New Segmentation**.
2. Enter the name of segmentation.
3. On the canvas, click **Add condition**.
4. From the dropdown list, select the [aggregate you created before](/use-cases/find-heavy-buyers#create-an-aggregate).
5. From the **Choose operator** dropdown list, select **More than**.
6. In the text field, enter the value returned from [the metric you created in the previous step](/use-cases/find-heavy-buyers#create-a-metric).
7. Click **Save**.
The final configuration of the metric
## Create a segmentation of heavy buyers whose buying behavior has changed over the past year
---
In this part of the process, you will create a segmentation that groups together all heavy buyers whose buying behavior has declined. Before you proceed to creating the segmentation, create an aggregate and metric which you will use in the segmentation.
### Create an aggregate
Create an aggregate that sums up the number of transactions from the current period.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. Enter the name of the aggregate.
3. By clicking the button, set **Count** as the type of the aggregate result (then the aggregate result shows the total number of transactions in the time range selected in the analysis).
4. From the **Choose event** dropdown list, select the **transaction.charge** event.
5. Change the date range, by clicking the calendar icon. Create the following custom date range `last 365 days before 0`.
6. Confirm the changes with the **Apply** button.
7. Save the aggregate by clicking **Save**.
Example settings of the aggregate
### Create a metric
Create a metric that sets a cutoff value for the customer segment with the lowest number of transactions.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As a metric kind, select **Simple metric**.
4. As a metric type, select **Profile**.
5. As the aggregator, set **Quantile**.
6. In the input field which appears next to the aggregator, type `0.3`(to create a cutoff that defines the lowest number of values).
7. Click **Choose event**.
8. From the dropdown list, select the [aggregate you created before](/use-cases/find-heavy-buyers#create-an-aggregate-1).
9. Define the same time range as in the aggregate you use in the metric.
10. Click **Save**.
The final configuration of the metric
### Create segmentation
Create a segmentation of customers who have the lowest number of transactions from the current period and also belong to the segmentation of heavy buyers.
1. Go to **Decision Hub > Segmentation > New Segmentation**.
2. Enter the name of segmentation.
3. On the canvas, click **Add condition**.
4. From the dropdown list, select the [aggregate you created before](/use-cases/find-heavy-buyers#create-an-aggregate-1).
5. From the **Choose operator** dropdown list, select **Less than**.
6. In the text field, enter the value returned from the [metric that sets a cutoff value for the customer segmentation with the lowest number of transactions](/use-cases/find-heavy-buyers#create-a-metric-1).
7. From the **Add condition** dropdown list, select a [segmentation of heavy buyers](/use-cases/find-heavy-buyers#create-segmentation).
8. From the **Choose operator** dropdown list, select Boolean **Is true**.
9. Click **Save**.
The final configuration of the metric
## What's next
---
Send [an email](/docs/campaign/e-mail/introduction-to-email-campaigns) with personalized offers to the [segmentation](/use-cases/find-heavy-buyers#create-segmentation) you have created with heavy buyers who should be reactivated.
## Check the use case set up on the Synerise demo workspace
---
You can check the segmentation configuration directly in Synerise demo workspace:
- [Segment of heavy buyers](https://app.synerise.com/analytics/segmentations/f22d73d7-5aba-48e7-b70f-54bbc1dba0a2)
- [Segment of heavy buyers whose buying behavior has changed over the past year](https://app.synerise.com/analytics/segmentations/043ea1b9-798e-4945-8b3c-d56be94f65ea)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case does not generate any events.
## Read more
---
- [Email templates](/docs/campaign/e-mail/creating-email-templates)
- [Recommendations](/docs/ai-hub/recommendations-v2/recommendation-types)
- [Segmentations](/docs/analytics/segmentations)
- [Aggregates](/docs/crm/aggregates)
- [Metrics](/docs/analytics/metrics)
# Predicting Churn and Favorite Brands to Retain Lapsing Customers
Customer churn is a major challenge for businesses looking to maintain engagement and revenue. Instead of reacting to churn after it happens, predictive analytics allows us to intervene before customers leave. In this use case, we use machine learning to predict both a **customer's likelihood to churn** and their **preferred brand**. By combining these insights, we can craft highly targeted retention campaigns.
Our approach begins with two key predictions:
- identifying each customer’s best-fit brand,
- assessing their churn probability.
Customers with a high risk of churn are then segmented based on their preferred brand. Using this segmentation, we launch a personalized email campaign featuring product recommendations from their favorite brand. The final step involves integrating this process into an automated workflow, ensuring that high-risk customers receive timely, brand-aligned email with optimized delivery timing for the best engagement results.
## Prerequisites
---
- Implement the [transaction events](/developers/web/transactions-sdk).
- [Enable Time Optimizer](/docs/settings/configuration/time-optimizer#enabling-time-optimizer) in Synerise settings.
- Enable the personalized recommendation type in [AI Engine Configuration](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations).
- Configure [a sender account](/docs/campaign/e-mail/configuring-email-account).
**Prepare 2 predictions**
1. **Churn prediction** (for example, as described in [Predict churn](/use-cases/churn-prediction)).
See an example preview of the Churn Prediction
2. **Bestfit brand prediction** (for example, as described in [Boosting item selection with best fit predictions](/use-cases/bestfit-brand)).
See an example preview of the Bestfit Brand Prediction
## Process
---
1. [Create a segmentation](/use-cases/lapsing-customer#create-a-segmentation) that retrieves the result of the churn prediction prepared as a part of [prerequisites](#prerequisites) - users with high and very high churn risk.
2. [Create an aggregate for best brand](/use-cases/lapsing-customer#create-an-aggregate-for-best-brand) with best fit brand recommendation, thet retrieves the result of a prediction.
2. [Create AI recommendations](/use-cases/lapsing-customer#create-ai-recommendations) with personalized products from specific, personalized brand based on the results of the bestfit brand prediction prepared as a part of [prerequisites](#prerequisites).
3. [Create a workflow](/use-cases/lapsing-customer#create-a-workflow) sending email with AI recommendations with personalized brand to users with the high risk of churn.
## Create a segmentation
---
In this part of the process, we will create a group of customers who have the high and very high risk of churn - based on the churn prediction prepared as a part of [prerequisites](#prerequisites).
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Give the segmentation a meaningful name, for example `High churn risk`.
3. Click **Choose filter** and select the `snr.prediction.score` event.
The event may have a custom label in the list, but can always be found by entering the system name (`snr.prediction.score`) in the search field.
3. Add the following conditions to the event:
- `modelId` parameter equals the ID of the prediction you want to use.
- `score_label` parameter contains `High`, as this will cover customers with High and Very High probability of churning.
The model ID can be copied from the menu in the Prediction list. Remember, that the values are examples and the model ID needs to be changed.
4. Click **Save**.
The segment
## Create an aggregate for best brand
---
Create an aggregate which will return the latest value from the `topValue` parameter of the **snr.bestfit.score** event with modelID representing bestfit brand prediction. This aggregate will be referenced in the filters of AI recommendation configuration.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last**.
5. From the **Choose event** dropdown list, select the **snr.bestfit.score** event.
6. As the event parameter, select **topValue**.
7. Click **+ where** button.
8. From the **Choose parameter** dropdown list, select the **modelID** parameter.
9. From the **Choose operator** dropdown list, select **Equal (string)**.
10. Enter the ID of the created prediction.
You can find the ID in the URL of the Prediction, it is the last string of characters. Below you can find a screenshot which represents exemplary value, and the place in the URL of the prediction where you can find the prediction ID. Remember that the values presented below are examples and the model ID needs to be changed.
ID of the prediction
11. Set the period from which the aggregate will analyze the results to the last **365 days**.
12. Save the aggregate.
Configuration of the aggregate
## Create AI recommendations
---
In this part of the process, you will create an AI recommendation that will display items from the customer's favorite brand returned in the prediction results.
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation (it is only visible on the list of recommendations).
3. In the **Type & Items feed** section, click **Define**.
4. From the **Items feed** dropdown list, select a product feed.
5. Select the **Personalized** recommendation type.
6. Confirm the recommendation type by clicking **Apply**.
6. In the **Items** section, click **Define**.
8. Define the minimum and maximum number of products displayed in the frame according to your needs.
9. Use filters to include specific items in the recommendation frame.
6. Click **Elastic filter**.
Learn about the difference among [elastic, static filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#select-conditions-of-displaying-items), and [distinct filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#distinct-filter).
7. From the dropdown list, choose **Visual Builder**.
7. Click **Select attribute**.
7. From the dropdown list, choose the **brand** attribute.
8. Click **Operator**.
9. From the dropdown menu, choose **Equals**.
10. Click the icon next to **Select value**.
11. Select **Aggregate**
12. Click **Select value**.
11. From the dropdown list, choose the aggregate created in the [previous step](#create-an-aggregate-for-best-brand).
11. At the bottom of the elastic filter pop-up, click **Apply**.
Recommendations configuration
12. In the **Items** section, click **Apply**.
10. In the **Slots and items ordering**, click **Define**.
1. Define how you want to arrange the order of slots and their items in the recommendation frame.
2. In the **Items sorting method within slots** section, select your desired item sorting method within slots.
1. In **Boosting**, you can enable [boosting](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-the-boosting-factors).
13. In **Additional settings**, optionally you can exclude already bought products and set a metric to sort by. Remember that you can define the order of slots if you have created more than one.
14. Save the recommendation by clicking **Save**.
## Create a workflow
---
In this part of the process, create a workflow which sends an email with the recommendations of the products from a favorite brand to the customers with the high and very high risk of churn. Additionally you can add the time optimizer node to optimize the time of sending the email.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Audience node
---
Choose the **Audience** node as the trigger.
1. Start the workflow with the **Audience** node.
2. Leave the **Run trigger** as one time or repeatable with period configured depending on your needs.
3. Choose the day and time when the process starts.
4. In **Define audience**, choose **Segments** and choose the segmentation created in the [previous step](#create-a-segmentation).
The following screen shows the audience configuration used in this use case.
Audience configuration
### Define the Optimize Time node to the Matched path
---
1. Optionally you can add the **Optimize Time** node. In the node settings:
1. From the **AI optimization mode** dropdown list, choose **Web**.
2. In **Time period to analyze**, choose the best moment to activate the node that follows the **Optimize Time** node. In our case it will be **Custom time period**.
3. In the **Time period** field, enter specific number of hours, for example, `12`
2. Click **Apply**.
## Define the Send Email node
---
To distribute the product recommendations based on the results from the best fit prediction, prepare an email template that contains the recommendation you created in the previous part of the process.
1. Add the **Send Email** node.
2. In the **Sender details** section, choose the email account from which the email will be sent.
3. In the **Content** section, in the **Subject** field, enter the subject of the email. You can use the template from the folder or create your own one using the email code editor.
To use the template, click **New Template**.
4. Create your email according to your business needs.
5. Click **Inserts** in the upper right corner, find **AI Recommendations** on the list of inserts, then choose the recommendation you prepared in the [previous step](/use-cases/bestfit-brand#create-ai-recommendations).
6. Save the template.
### Add the finishing node
---
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
Workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
You can also check on our demo account the:
- [churn prediction](https://app.synerise.com/ai-v2/predictions/wrqifoexkwcm)
- [bestfit prediction](https://app.synerise.com/ai-v2/predictions/orbypencokue)
- [segmentation](https://app.synerise.com/analytics-v2/segmentations/134c8225-72da-4cd9-90c5-c9f1a4cfe541)
- [aggregate](https://app.synerise.com/analytics-v2/aggregates/673eb2b8-8869-329c-b6d4-b79e3a0f99bf)
- [AI recommendations](https://app.synerise.com/ai-v2/recommendations/eb5qO10yrfXe)
- [workflow](https://app.synerise.com/automations/workflows/automation-diagram/0fd6f246-b12d-485b-9baf-2e470f7d6639)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## What's next
---
Once the initial workflow is in place, there are several ways to enhance and optimize it further.
Here are some ideas:
- **A/B Testing** – Split high-risk churn customers into different test groups using **A/B/X node**, choose the group percentage allocation to analyze what works best. For example:
- Each segmentation receives different types of recommendations,
- Each segmentation gets various discount level (e.g., 10%, 20%, or free shipping).
This allows us to determine the most effective tactics for re-engagement and customer recovery.
- **Multi-Channel Optimization** – Identify the preferred communication channel for each customer based on historical interactions (e.g., push, email, SMS, in-app messages) as in this use case [Identifying Customers' Preferred Communication Channel](/use-cases/channel-preference). Adapt the workflow to automatically select the most effective channel for each individual. This ensures higher deliverability and engagement by reaching customers where they are most active. Read more about [recommendation ABX testing](/docs/ai-hub/recommendations-v2/recommendation-abx-test)
## Check our latest Case Study
---
Check our [Case Study](https://www.synerise.com/case-study/modivo) with **Modivo** and discover how they leveraged Synerise BaseModel.AI to send personalized mailing with customers's favourite brand.
## Generated events
This use case generates approximately 13 events per profile that completes the flow:
[`snr.prediction.score`](/docs/assets/events/event-reference/predictions#snrpredictionscore) (~1), [`snr.bestfit.score`](/docs/assets/events/event-reference/predictions#snrbestfitscore) (~1), [`snr.ate.prediction`](/docs/assets/events/event-reference/predictions#snrateprediction) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Creating recommendations](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign)
- [Email](/docs/campaign/e-mail)
- [Predictions](/docs/ai-hub/predictions/predictions-introduction)
# Integrating Synerise Decision Hub with Google Marketing Platform for Targeted Remarketing
Remarketing campaigns are used to **show targeted ads to people who have visited your website earlier.** Using the right customer information will help you prepare better campaigns on other websites (not only yours) and cut advertising costs. Remarketing allows you to reach a highly targeted audience of people interested in your company and offer. Showing them targeted ads in external services you can give them another chance to convert.
Using Synerise, you can send information about aggregates, metrics, attributes to Data Layer and, based on this, you can prepare appropriate remarketing campaigns.
If you use RFM analysis and divide your customers into a groups based on their engagement, you can easily monitor to which group specific clients who clicked on your campaign belong.
With this knowledge, you can personalize communication and content and adapt it to customer needs.
## Example of use - Retail industry
**Challenge**
A customer with a pet store decided to use RFM segmentation to find the most engaged customers and reduce advertising expenditures by stopping spending for advertising on unprofitable customers. For this purpose, he prepared a Dynamic content campaign, which sent information to Data Layer regarding to which RFM segment the customer belonged - whether it was, for example, a Top customer or Almost Lost customer. With this information, he could prepare the appropriate remarketing campaigns.
What happened on the site? After customer visit on the website, event was sent to the Data Layer and available for further use in GMP campaigns, and it was completely transparent to the client.

## Requirements
---
- Synerise Tracker
- Integration of events
- Google Data Layer implemented on the website
Remember that if you embed our tracking code in the page code, Data Layer events will be sent even if the user uses Adblock-type tools.
## How to do it
---
You can integrate with Google Analytics and send segments (or events) to GA using Synerise Dynamic Content. You will need to implement JS, which can send events to Data Layer:
We can send to the Data Layer any event, segment, aggregate or even products from the AI campaign.
- Read more about [Data Layer push events.](https://developers.google.com/tag-manager/devguide/)
**Using RFM analysis**
1. Create aggregate with type:Last with the name of the RFM segment to which the customer belongs. Take variable values from the client.assignSyneriseAI event
2. Prepare a Dynamic Content campaign that will be displayed daily, and insert the following code in the JS section:
In the place AGGREGATE_ID enter the aggregate ID which is located in the link to this aggregate.
## Generated events
This use case generates 1 event per profile that completes the flow:
[`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1).
## Read more
---
- Read more about [aggregates](/docs/crm/aggregates)
- Read more about [dynamic analytics](/docs/analytics)
- Read more about [dynamic content campaign](/docs/campaign/dynamiccontent)
# Send Bestselling Products to Customers via Email
Sometimes your customers are not sure what they are looking for. Help them to decide by sending the best-selling items - promote them further in your communication. When people see the bestseller label on your product, they’ll feel more inclined to buy it over another items offering in the same category. It is called “purchase pressure.” Some buyers go straight to the bestseller list to see what is popular now.
You can promote your bestsellers among your customers. You can dynamically add to this email all bestsellers from all categories or just from specific category, often visited by customers.
## Examples of use - Retail industry
**Challenge**
A client from the retail industry prepared a -20% summer sale for the entire collection. This client have sent an email with information about the discount to half of the customers. The second half received an email with a discount and several best-selling items. The email with bestsellers had better results.
Example email with best-selling items
**Results**
- 2,3% CTR for email with bestsellers
- 1,8% CTR for email only with discount
## Prerequisites
---
To be able to implement this use case, you must:
- [Implement a tracking code](/docs/settings/tool/tracking_codes).
- [Upload a product feed](/first-steps/integration/product).
- [Configure AI recommendations](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations).
- [Create transaction events](/developers/web/transactions-sdk).
- [Configure email account](/docs/campaign/e-mail/configuring-email-account).
- [Upload subscriber’s database](/docs/automation/actions/synerise-integrations/import-customers).
## Process
---
To create an email with top products, perform the steps in the following order:
1. [Configure AI recommendations](/use-cases/email-with-top-products#create-ai-recommendations-with-top-products) with top products.
2. [Create email template](/use-cases/email-with-top-products#create-email-template) with previously created recommendations.
3. [Create an email campaign](#create-an-email-campaign).
## Create AI recommendations with top products
---
If you do not have AI models trained yet, follow this [instruction](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations) to import product feed to Synerise.
To be able to recommend items from the top category in various communication types, first you need to initiate the model training for the item feed from which you want to recommend your items.
1. Go to **Settings > AI Engine Configuration > Add feed**.
2. Select the type of the feed.
We recommend using Google Merchant feed due to the size limits for XML files imported to catalogs.
3. After you add the feed, it's added to the list.
4. Double-click the feed on the list of feeds.
5. In the **Recommendation models** section, select **top products**.
Top products recommendations
4. In the **Items** section, define the type of items to be included in the recommendation by using filters.
You can check the [instruction](/docs/ai-hub/recommendations-v2/recommendation-filters) for the recommendation filters and explore [examples of use](/docs/ai-hub/recommendations-v2/recommendation-filters-examples).
1. You must choose **Minimum** and **Maximum** number of items which the recommendation frame includes.`
2. Use elastic and static filters to select items to your recommendation frame.
3. In the **Additional settings** section, you have to influence the arrangement of items in the recommendation. More information is available [here](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-the-boosting-factors).
{{< important >}}
Items section requires you to define more details about your recommendation. Obligatory choose **Min.** and **Max.** number of products which user has to get, and in **Sorting** define metric which has to be used to find products to the message.
{{< /important >}}
5. After saving the recommendation, get the ID of the message.
List of email recommendation
6. **Save** your recommendations.
## Create email template
---
1. Go to **Experience Hub > Email > Templates** and add new template.
2. Prepare your email message, according to your business needs.
3. Using **Inserts** choose previously created recommendations from the list and add them to your template as special code with ID of your recommendations.
4. Save your template.
## Create an email campaign
---
In this use case, configure an email communication that will reuse the content of the recommendation you created in the previous step. While configuring the email, you must select a group of customers, create the content of the email and set up the final setting.
### Select the audience of the email message
Select the customers who will get the email with the top selling items.
1. Choose the customers in [segmentation](https://app.synerise.com/spa/modules/analytics/segmentations/new) or create a new segment directly in the **email message**.
2. Choose users who will get email.
Define the audience
### Create content
After selecting the email recipients, create content.
1. Select the **email account** from which the email will be sent.
2. Prepare the subject of the email.
3. Click **Create message** and built the template of your email. To include the top item recommendations, use the following Jinjava code and your own CSS. Let’s look at how to prepare the appropriate jijnava code.
{{< accordion "Check the Jinjava code" >}}
{{< highlight "jinja" >}}
{% recommendations3 campaignId=xxx %} for loop below: {% for r in recommended_products3 %} {{r.itemId}} {{r.title}} {{r.imageLink}} {{r.price.value}} {{r.salePrice.value}} {% endfor %} {% endrecommendations3 %}
{{< /highlight >}}
{{< /accordion >}}
4. Optionally, add the B variant of the template which will not contain the top product.
### Prepare the final settings
1. Add the title of the email.
2. In the **Schedule tab**, decide when your email is sent.
3. In the **UTM & URL** parameters section, add the parameters to track the email performance.
4. Send **tests** of your message to verify if the content of the email is displayed correctly.
Set up settings page
{{< important >}}
Test message can only be sent when it has a title.
{{< /important >}}
## Check the use case set up on the Synerise Demo workspace
---
Check the [AI recommendations settings](https://app.synerise.com/ai-v2/recommendations/VrEXZm00A7CK) and [email campaign](https://app.synerise.com/campaigns/create/49d6e315-06ab-4a35-bb45-deb5f5264cec) directly in Synerise Demo workspace.
{{% include "/reuse/use-cases/synerise-demo-workspace.md" %}}
## Generated events
This use case generates approximately 6 events per profile that completes the flow:
[`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [AI recommendation](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign)
- [Emails](/docs/campaign/e-mail/creating-email-campaigns)
- [Email communication](/docs/campaign/e-mail)
# Dynamic NPS survey
Net Promoter or **Net Promoter Score (NPS)** is a management tool that can be used to measure the loyalty of a brand's customer relationships. It serves as an alternative to traditional customer satisfaction research and is correlated with revenue growth. If you send your NPS surveys right after the purchase, you increase the chances of getting an immediate reply with relevant feedback.
In this use case, we describe the process of sending a short NPS survey right after the customer makes a purchase in a mobile application. The survey consists of two fields: an NPS rating on a scale from 1 to 10 and a comment field. The customer can provide such a rating only within 48 hours after a purchase.
The campaign layout is different based on the conditions meet by the customer:
- If the customer has already filled out the survey within 48 hours after the purchase and clicks the link again, they will see a message which informs that they have already filled out this survey.
- If the customer has not filled out the survey within 48 hours after the purchase and clicks the link after more than 48 hours, they will see a message which informs that this survey has expired.
- If the customer has not filled out the survey within 48 hours after the purchase and clicks the link in less than 48 hours, a NPS survey is displayed.
In the further part of the process, we will also present you how to create basic analyses based on customers' answers and results from the survey.
Based on these analyses, we will create a Net Promoter Score, which is simply the percentage of customers who are promoters (those who scored 9 or 10) minus the percentage of customers who are critics (those who scored 1 to 6).
## Prerequisites
---
- Implement [tracking code](/docs/settings/tool/tracking_codes) into your website.
- Integrate Synerise [mobile SDK](/developers/mobile-sdk) in your mobile application.
- Implement mobile pushes in your mobile application: [iOS](/developers/mobile-sdk/configuring-push-notifications/ios) and/or [Android](/developers/mobile-sdk/configuring-push-notifications/android).
- Implement all additional information about the transactions based on the documentation for our [transactional API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction). Check the documentation to see how you can set up the `transaction.charge` event to track the mobile transactions directly via **source** parameter.
- In this use case, we use the `form.submit` event, which is sent after filling out the NPS survey. You can send this event using the [API](https://hub.synerise.com/api-reference/data-management#operation/CustomEvent) or [JS SDK](/developers/web/tracking-form-data/tracking-form-data-sdk#calling-the-sdk-directly).
## Process
---
In this use case, you will go through the following steps:
1. [Create a landing page](/use-cases/dynamic-nps#create-a-landing-page) with 3 different layouts.
2. [Create an aggregate which returns the date of completing the survey](/use-cases/dynamic-nps#create-an-aggregate-which-returns-the-date-of-completing-the-survey) - if it exists, it means that the user has completed the survey, if there is no date, it means that they have not completed it.
3. [Create an aggregate which returns the sending time of last mobile push](/use-cases/dynamic-nps#create-an-aggregate-which-returns-the-sending-time-of-last-mobile-push) with a survey which was sent to a user.
4. [Create an expression](/use-cases/dynamic-nps#create-an-expression) which checks if 48 hours have passed since the push message with the NPS survey was sent (expiration condition).
5. [Create a dynamic content campaign](/use-cases/dynamic-nps#create-a-dynamic-content-campaign) with the Jinjava code that checks the conditions which a user must meet to see one of the three landing page version.
6. [Create a mobile push](/use-cases/dynamic-nps#create-a-mobile-push-template) with the link to the landing page.
7. [Create a workflow](/use-cases/dynamic-nps#create-a-workflow) which sends a push notification with the NPS survey to a user after making the transaction.
8. [Create a basic segmentation with NPS score](/use-cases/dynamic-nps#create-a-basic-segmentation-with-nps-score).
9. [Create a Net Promoter Score](/use-cases/dynamic-nps#create-a-net-promoter-score) based on a metric.
## Create a landing page
---
Prepare a landing page within the website of your mobile store, which will contain three different layouts (as it was present in the introduction):
- a message which informs that the survey has been already filled out (in this case marked as #COMPLETED),
- a message which informs that this survey has expired (in this case marked as #EXPIRED),
- a NPS survey in which the customer can rate the purchase or the whole shopping experience (in this case marked as #NPS).
In order for a landing page to correctly collect data, it is necessary to embed the Synerise SDK into the [landing code](/docs/campaign/landing-page). To do this, generate and copy the Synerise [tracking code](/developers/web/installation-and-configuration) and paste it in the landing page's edit panel in **JavaScript insert before end body**, in the Customize section. Below you can find an example how it can look like.
- Replace the value of `trackerKey` with your own, generated [tracking code](/developers/web/installation-and-configuration).
In the code, add the information about the events which will be sent after filling the NPS form. In this case, it is `nps.send` with the `score` parameter that contains the number of points chosen for a particular customer. It should be a number. It will be important in the further analysis of the campaign results.
All the conditions that determine the display of a specific message will be created as a dynamic content campaign displayed on this landing page in the further steps.
## Create an aggregate which returns the date of completing the survey
---
In this step, you will create an aggregate which returns the date of completing the NPS survey - if it exists, it means that the user has completed the survey, if there is no date, it means that the survey has not been completed.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last**.
4. Select the `form.submit` event.
5. As the parameter, choose **TIMESTAMP**
6. Click the **+ where** button and from the **Choose parameter** list, select **title** to indicate the specific form.
7. Choose the **Equal** operator and add the specific name of the form submitted as the value.
8. Set the period from which the aggregate will analyze the results to the last **48 hours**.
12. Save the aggregate.
Configuration of the aggregate that returns the date of completing the survey
## Create an aggregate which returns the sending time of last mobile push
---
In this step, you will create an aggregate which returns the sending time of last mobile push with a survey which was sent to a user.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last**.
4. Select the `push.send` event.
5. As the parameter, choose **TIMESTAMP**
6. Click the **+ where** button and from the **Choose parameter** dropdown list, select **title** to indicate the specific form.
7. Choose the **Equal** operator and enter the name of the latest push message campaign.
8. Set the period from which the aggregate will analyze the results to the last **48 hours**.
12. Save the aggregate.
Configuration of the aggregat that returns the sending time of last mobile push
## Create an expression
---
In this step, you will create an expression which checks if the customer has filled out the form in the last 48 hours.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression.
3. Leave the **Expression** option at default (**Attribute**).
4. Build the following formula of the expression:
Configuration of the expression which checks if the customer has filled out the form in the last 48 hoursExplanation of the expression logic
The expression formula contains the following logic:
The expression checks if the current date is "higher" than the date of submitting the form (48 hours is added to the date of submission).
If more than 48 hours have passed, returns `48h or more`.
If less, returns `0`.
5. Save the expression.
## Create a dynamic content campaign
---
In this part of the process, you will create the dynamic content campaign which will display the layout of campaign in accordance with the conditions met by the customer.
### Create a dynamic content message
---
1. Go to **Experience Hub > Dynamic Content > Create new**.
2. Enter the name of the campaign.
3. Choose the **Insert Object** type.
4. In the **Audience** section, select the **Everyone** tab.
4. In the **Content** section, select **Simple message**, and in the CSS selector field, enter where you want to insert the content - in this case, select **After (in div)**, and enter `.main`.
5. Click **Create message** and choose **Code editor**.
6. In the JS section add the following code, which will display the campaign layout based on conditions met by the customer.
{% expressionvar 90703adb-b985-4a67-abdf-337bd858c4f1 %}
{% set showAfterDays = expression_result %}
{% aggregate 492ba339-09b6-37bd-b368-7120275e54dc %}
{% if aggregate_result[0] is truthy %}
{% set isReviewCompleted = true %}
{% else %}
{% set isReviewCompleted = false %}
{% if isReviewCompleted != false %}
{showImage('#COMPLETED')}
{% else if showAfterDays == '48h or more'%}
{showImage('#EXPIRED')}
{% else %}
{showImage('#NPS')}
{% endif %}
{% endif %}
{% endaggregate %}
{% endexpressionvar %}
"{showImage('#COMPLETED')}" is just an example of how a reference to a specific view on your landing page may look like, it can be coded in a different way, it is important to remember, that in this place must contain the reference to a specific view from landing page.
What is more, remember to change the ID of the aggregate and expression in the code to IDs of your own analyses built in your workspace.
### Set up the schedule and display settings
---
6. In the **Schedule** section, set the display time to **Display immediately** and save your changes.
7. In the **Display settings** section, choose **On landing**.
8. Click **Advanced settings**.
9. In the **Page targeting** section, choose **Others**, and in the **Display on pages** section, click **Add rule**.
10. Select **Page URL containing** and enter the name of your landing page created in the [previous step](/use-cases/dynamic-nps#create-a-landing-page).
8. In the **UTM & URL parameters** section, click **Skip step**.
9. Click **Activate** and start your dynamic content campaign.
## Create a mobile push template
---
In this part of the process, you will create a mobile push template with the link to the landing page with the NPS survey.
1. Go to **Experience Hub > Mobile > Templates**.
2. Create your mobile push in the code editor. In the content of the push notification:
- Add a message
- Add the link to landing page where you have display NPS survey
For more information on creating a simple mobile push, visit our [User Guide](/docs/campaign/Mobile/creating-mobile-push).
## Create a workflow
---
In this part of the process, prepare a workflow that sends the push message with the link to the survey to customers who made a transaction in the mobile application. The workflow excludes customers who have already received the link to this survey during last 30 days.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Profile Event trigger node
---
At this stage, we will configure conditions that launch the workflow. As a trigger, we will use the `transaction.charge` event in the mobile application.
1. As the first node of the workflow, add **Profile Event**. In the configuration of the node:
1. From the **Choose event** dropdown menu, choose the `transaction.charge` event.
2. Click the **+ where** button, from the **Choose parameter** dropdown menu, choose **source**.
3. From the **Choose operator** dropdown, choose **String**, and then select **Contain (String)**.
4. In the next field, type the `mobile` to analyze only transaction made in the mobile application.
2. Confirm by clicking **Apply**.
Profile Event node configuration
### Define the Profile Filter node
---
As the next step, add a Profile Filter node that checks whether the customer has previously received the NPS survey. In this case, we verify it by using the `push.send` event with a link to the NPS survey. This way, the customer who has already received a survey in the last 30 days will not receive another one.
1. Add the **Profile Filter** node.
2. To configure the node settings, click the node.
3. Click the **Choose filter** button and choose the `push.send` event.
4. Click the **+ where** button and from the **Choose parameter** drop-down menu, choose **campaignName**.
5. From the **Choose operator** drop-down, choose **Equal(String)**.
6. Enter the name of the mobile push campaign created in the [previous step](/use-cases/dynamic-nps#create-a-mobile-push-template).
8. Set the time range to **Last 30 days**.
13. Change the **Profiles matching funnel** option to **Profiles not matching funnel** by clicking the **matching** word.
12. Confirm by clicking **Apply**.
13. For the **Not matched** path, add the **End** node.
Profile Filter node configuration
### Configure the Send Mobile Push node
---
1. To the **Matched** path, add a **Send Mobile Push** node.
2. In the settings of the node, from the **Template type** dropdown list, select the template you have prepared in the [previous step](/use-cases/dynamic-nps#create-a-mobile-push-template).
2. Click **Apply**.
### Prepare the final settings
---
1. To the **Not matched** path and after **Send Mobile Push**, add **End** nodes.
3. Optionally, add titles to each node so the workflow will be more understandable to your colleagues.
4. Activate the workflow by clicking **Save & Run**.
The workflow configuration
## Create a basic segmentation with NPS score
---
In this step, create a basic segmentation which divides your customers into 3 groups based on results from your NPS survey and the event `nps.send` and its parameter `score`. In this case, we have three exemplary groups:
- Promoters: 9-10 points
- Indifferent: 7-8 points
- Critics: 1-6 points
Create a segmentation that includes all three groups.
### Create the Promoters segment
---
Create a segment that includes only customers who assessed the purchase/shopping experience at 9 or 10 points.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation.
3. Optionally, switch the **Show in profile card** toggle on.
3. Enter the name of the segment.
3. From the **Add condition** dropdown list, select the `nps.send` event.
4. Click **+ where** button and select the **score** parameter.
4. As the logical operator, select **Less or equal**.
5. Next to the logical operator, in the text field, enter `10`.
4. Click the **and where** button and select the **score** parameter.
4. As the logical operator, select **More or equal**.
5. Next to the logical operator, in the text field, enter `9`.
Configuration of the Promoters segment
### Create the Indifferent segment
---
Create a segment that includes only customers who assessed the purchase/shopping experience between 7 and 8 points.
3. Click **Add segment**.
3. Enter the name of the segment.
3. From the **Add condition** dropdown list, select the `nps.send` event.
4. Click **+ where** button and select the **score** parameter.
4. As the logical operator, select **Less or equal**.
5. Next to the logical operator, in the text field, enter `8`.
4. Click the **and where** button and select the **score** parameter.
4. As the logical operator, select **More or equal**.
5. 5. Next to the logical operator, in the text field, enter `7`.
Configuration of the Indifferent segment
### Create the Critics segment
---
Create a segment that includes only customers who assessed the purchase/shopping experience between 1 and 6 points.
3. Click **Add segment**
3. Enter the name of the subsegmentation.
3. From the **Add condition** dropdown list, select the `nps.send` event.
4. Click **+ where** button and select the **score** parameter.
4. As the logical operator, select **Less or equal**.
5. Next to the logical operator, in the text field enter `6`.
Configuration of the Critics segment
11. Choose a time range as **lifetime**.
12. Save the segmentation.
**Result:** Now you can compare how many customers were in the specific segment.
## Create a Net Promoter Score
---
In this step, create a metric which counts the example Net Promotor Score which is simply the percentage of customers who are promoters (those who scored 9 or 10) minus the percentage of customers who are critics (those who scored 1 to 6).
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As a metric kind, select **Formula metric**.
4. Build the formula of the metric as presented on the screen:
The final form of a metric
In this metric:
- **Promoters** are based on **Profile Filter**.
1. Click **Choose filter** and select the segment created in the [previous step](/use-cases/dynamic-nps#create-a-basic-segmentation-with-nps-score).
2. Choose operator **Equal**.
3. As the value choose the name of the first subsegment, in our case Promoter.
4. Click **Apply**.
Metric settings
- **All - who filled out the form** are based on **Profile Filter**.
1. Click **Choose filter**, and select the segment created in the [previous step](/use-cases/dynamic-nps#create-a-basic-segmentation-with-nps-score).
2. Choose operator **is true**. In this way you will analyze the whole group of users from every subsegment.
4. Click **Apply**.
Metric settings
- **Critics** are based on **Profile Filter**.
7. Click **Choose filter**, and select the segment created in the [previous step](/use-cases/dynamic-nps#create-a-basic-segmentation-with-nps-score).
8. Choose operator **Equal**.
9. As the value choose the name of the last subsegment, in our case Critic.
10. Click **Apply**.
Metric settings
You can also enrich your analysis measuring:
- the average result from the NPS,
- the number of submitted forms with NPS,
- report with most often chosen notes in order,
and more analyses, which you can show on the dedicated dashboard.
## What's next
---
In case you need, you can prepare an export of your NPS results to external systems, for example [to Google Sheets](/use-cases/google-spreadsheet-integration).
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of every element of this process directly in Synerise Demo workspace:
- [Configurartion of the aggregate](https://app.synerise.com/analytics/aggregates/492ba339-09b6-37bd-b368-7120275e54dc), which measure the date of filling out the survey
- [Configurartion of the aggregate](https://app.synerise.com/analytics/aggregates/fe2acb42-1a38-3fc2-9c00-5ab363dce20c), which checks sending time of last mobile push
- [Configurartion of the expression](https://app.synerise.com/analytics/expressions/90703adb-b985-4a67-abdf-337bd858c4f1)
- [Dynamic content campaign](https://app.synerise.com/campaigns/create/20b6430d-0b2b-4de7-96bd-5fc55dfcc0b3)
- [Automation configuration](https://app.synerise.com/automations/automation-diagram/4cbb9e50-65b0-4a96-8c88-d0ecf3d7c577)
- [Segmentation](https://app.synerise.com/analytics-v2/segmentations/64546b35-40b1-4afa-b406-43102c2c57e7)
- [Metric with NPS score](https://app.synerise.com/analytics/metrics/c38e6fd4-fda8-43c3-9f29-865893533d47)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 15 events per profile that completes the flow:
[`transaction.charge`](/docs/assets/events/event-reference/items#transactioncharge) (~1), [`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~2), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`push.send`](/docs/assets/events/event-reference/mobile-push#pushsend) (~1), [`push.view`](/docs/assets/events/event-reference/mobile-push#pushview) (~1), [`push.click`](/docs/assets/events/event-reference/mobile-push#pushclick) (~1), [`landingpage.visit`](/docs/assets/events/event-reference/landing-page#landingpagevisit) (~1), [`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`form.submit`](/docs/assets/events/event-reference/web-and-app#formsubmit) (~1), `nps.send` (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Automation Hub](/docs/automation)
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Expressions](/docs/crm/expressions)
- [Landing page](/docs/campaign/landing-page)
- [Mobile campaigns](/docs/campaign/Mobile)
# Similar recommendations from the same category
This recommendation focuses on showing similar products to the one currently viewed on the page. It aims to help users discover alternatives within the same category while avoiding exact duplicates. The logic is split into two slots to balance precision and completeness, ensuring a consistent and meaningful recommendation experience.
In this use case, the recommendation returns 12 products, divided into two slots:
- Slot A returns 1 to 4 items using a static filter. Recommended products must have the same category and categoryId as the context product but a different title and item ID, ensuring that only distinct alternatives are shown.
- Slot B fills the remaining space with 4 to 8 products using an elastic filter. It still excludes items with the same title or ID but allows for more variation, such as partial name matches or model variants, to increase coverage when Slot A produces limited results.
These two slots together form a complete "You may also like" recommendation block, where:
Slot A focuses on quality (diverse alternatives), Slot B ensures quantity (variants and similar products).
## Prerequisites
---
- Implement a [tracking code](/developers/web/installation-and-configuration) into your website.
- [Configure AI engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations). Enable similar recommendation model.
- Implement the [transaction events](/developers/web/transactions-sdk).
## Prepare an AI recommendation
---
We will configure similar recommendation which returns 2 slots.
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation (it is only visible on the list of recommendations).
3. In the **Type & Items Feed** section, click **Define**.
4. From the **Items Feed** dropdown list, select an item feed.
5. In the **Type** section, choose the **Similar recommendation** type.
6. Confirm the settings by clicking **Apply**.
7. In the **Items** section, click **Define**.
2. Define the minimum and maximum number of items that will be recommended to the customer in the first slot. In our case it will be 1-4.
3. Define [Static filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#static-filters).
4. Click **Define filter**.
5. Select **Visual Builder**.
6. Click **Select value**.
5. Choose **category**.
6. As an operator, choose **Equals**.
7. Click the icon which appeared next to the field with operator and from the dropdown list, select **Context** (eye icon).
7. As the value, choose `category`, to be sure that the category of recommended products will be the same as the category of the currently viewed item.
8. In the **Category level** input, select **Category as a whole**.
9. Click **and where** to add another condition.
10. Choose **itemId**.
6. As an operator, choose **Does not equal**.
7. Click the icon which appeared next to the field with operator and from the dropdown list, select **Context** (eye icon).
7. As the value, choose `itemId`, to be sure that the itemId of recommended products will not be the same as the ID of the currently viewed item.
9. Click **and where** to add another condition.
10. Choose **name**.
6. As an operator, choose **Does not equal**.
7. Click the icon which appeared next to the field with operator and from the dropdown list, select **Context** (eye icon).
7. As the value, choose `name`, to be sure that the title of recommended products will not be the same as the name of the currently viewed item.
4. Confirm by clicking **Apply**.
Configuration of the static filter
5. Add the second slot.
2. Define the minimum and maximum number of items that will be recommended to the customer in the first slot. In our case it will be 4-8.
4. In the **Elastic filter** section, click **Define filter**.
5. Select **Visual Builder**.
6. Click **Select value**.
5. Choose **category**.
6. As an operator, choose **Equals**.
7. Click the icon which appeared next to the field with operator and from the dropdown list, select **Context** (eye icon).
7. As the value, choose `category`, to be sure that the category of recommended products will be the same as the category of the currently viewed item.
8. In the **Category level** input, select **Category level - Take first (2)**.
9. Click **and where** to add another condition.
10. Choose **itemId**.
6. As an operator, choose **Does not equal**.
7. Click the icon which appeared next to the field with operator and from the dropdown list, select **Context** (eye icon).
7. As the value, choose `itemId`, to be sure that the itemId of recommended products will not be the same as the ID of the currently viewed item.
9. Click **and where** to add another condition.
10. Choose **name**.
6. As an operator, choose **Does not equal**.
7. Click the icon which appeared next to the field with operator and from the dropdown list, select **Context** (eye icon).
7. As the value, choose `name`, to be sure that the title of recommended products will not be the same as the name of the currently viewed item.
4. Confirm by clicking **Apply**.
Configuration of the elastic filter
8. Additionally define the boosting rules by clicking **Define** in the **Boosting** section.
9. In the **Additional settings** section, choose **Exclude already bought products**. If your company sells replenishable products, you can set exclusion for specific number of days, for example, exclude products bought not later than 30 days ago.
9. In the right upper corner, click **Save**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the [AI Recommendation](https://app.synerise.com/ai-v2/recommendations/6gKg9VwwoAyC) in our Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 4 events per profile that completes the flow:
[`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~2), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Gender-based promotion
Gender marketing is a sales strategy used to reach out to women and men consumers by understanding their tastes, preferences and consumption trends. It involves the use of market segmentation and focuses on building specific strategies to reach out to female or male consumers, incorporating consumers' gender-specific needs into communication. You can use gender-based promotions to advertise and sell your goods and services successfully.
This use case describes how to create a promotion for customers based on their gender with the use of segmentation.
## Prerequisites
---
- Implement promotions in your [mobile application](/developers/mobile-sdk/loyalty), website or through [API](https://hub.synerise.com/api-reference/loyalty-and-engagement#operation/profileLogin)
- [Implement transactional events](/developers/web/methods-reference#tracking-transactions).
- [Import your product feed to catalog](/use-cases/import-product-feed-to-catalog).
## Process
---
- [Prepare two segmentations](/use-cases/gender-based-promotion#prepare-two-segmentations) of customers based on the category of the products they already bought.
- [Create two promotions](/use-cases/gender-based-promotion#create-two-promotions) based on gender.
## Prepare two segmentations
---
In this part of the process create two segmentations that will group customers based on the category of purchased items.
In this use case, we will assign gender based on the category of products they purchase. These are just example conditions of the segmentation. These conditions may be completely different depending on your business goals and do not have to be based on this event.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of segmentation.
3. From the **Choose filter** dropdown list, select the `product.buy` event.
4. From the **Choose parameter** dropdown list, select **category**.
5. From the dropdown list that appears, select the **Contain** operator.
6. In the next field enter the phrase "-female-" or "-male-".
The construction of this condition depends on the implementation of transactional events and may vary.
7. To determine the time range from which the data will be analyzed, click the calendar icon and choose the **Lifetime** time range. Confirm your choice with the Apply button.
8. Click **Save**.
9. To create the second segmentation repeat the process from steps 1 to 8.
**Result**: The segmentations are saved and can be used as an audience for promotions.
An example of a segmentation of female customersAn example of a segmentation of male customers
## Create two promotions
---
1. Go to **AI Hub > Regular Promotions > Add promotion**.
2. Enter a name for the promotion.
3. According to your business needs select one of the scopes:
- **For selected items**
- **For entire basket**
4. In the **Audience** section, choose **Segments** and select one of segmentations created in [this step](/use-cases/gender-based-promotion#prepare-two-segmentations).
5. In the **Content** section:
1. Define the name, description, and image of the promotion.
2. Define the rest of the settings according to your needs.
3. Confirm the settings by clicking **Apply**.
Example of promotion content
5. Define the **Type and limits** section according to your business needs.
Example of Type and limits settings
6. In the **Schedule** section, define the promotion distribution period according to your business needs.
7. In the **Stores** section, according to you business needs you can specify stores where the promotion is available.
This is possible only if the list of stores is imported into a [catalog](/docs/assets/catalogs).
8. In the **Items** section, specify the catalog item to be discounted:
1. In the **Source catalog** field, select an item catalog to select the promotional items from.
2. In the **Include items** section, pick one according to your business needs.
11. To apply configuration and run the promotion, click **Publish**.
12. To create second promotion repeat all the steps.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the segmentations directly in Synerise demo workspace:
- [a segmentation of female customers](https://app.synerise.com/analytics/segmentations/e4046377-e385-42ff-88c0-92fa14740c61),
- [a segmentation of male customers](https://app.synerise.com/analytics/segmentations/4040a08c-f30a-4709-9ab2-610701e61aaf).
Here you can find the configuration of promotions, available on Synerise demo workspace:
- [for female customers](https://app.synerise.com/campaigns/promotions/ef6a9396-70a9-4d8f-b1d0-fde456e49a9d),
- [for male customers](https://app.synerise.com/campaigns/promotions/0a79c12c-eaa7-4a70-9e35-aa055c0b72db).
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates 1 event per profile that completes the flow:
[`client.activatePromotion`](/docs/assets/events/event-reference/loyalty#clientactivatepromotion) (~1).
## Read more
---
- [Promotions](/docs/ai-hub/promotions)
- [Segmentations](/docs/analytics/segmentations)
# Customers' data import from SFTP server
If you gather your customers' data in several sources, you can use Automation Hub to synchronize it with the customers' profiles in Synerise. It’s possible thanks to the HTTP and SFTP integrations that allow you to send data to Synerise from external sources and the other way round.
This use case describes how to prepare an automated workflow that launches every day and donwloads an updated list of customers with their agreement for email communication from an external resource to Synerise. The automation connects to an external resource using the SFTP protocol and imports data from a CSV file. One of the challenges addressed in this use case is renaming a column in the CSV file while importing the data.
## Prerequisites
---
- Host the .csv file with customers' marketing agreements data on an SFTP server.
- Prepare a sample of data that will be used in data transformation.
To do this, you can take the real file and remove rows until about 10 are left.
## Process
---
1. [Create data transformation rules](/use-cases/import-customers-data-from-sftp#create-data-transformation-rules) that will transform data from the .csv file.
2. [Prepare a workflow](/use-cases/import-customers-data-from-sftp#prepare-a-workflow) that imports data about customers' marketing agreements from the SFTP server to Synerise.
## Create data transformation rules
---
In this part of the process, you define the rules of modifying data.
The data transformation diagram which is the output of this part of the process is used later to [automate sending the data](/use-cases/import-customers-data-from-sftp#prepare-a-workflow).
The sample file is used to configure the data transformation diagram and preview its results. With a [library of nodes](/docs/automation/data-transformation-and-imports/transformations-and-data-operators), you can modify the file by adding, renaming, and merging columns, as well as editing the values in the rows, and so on.
In this example, we will use the **Rename column** node to transform a customers' marketing agreements file so it meets Synerise's requirements.
1. Go to **Automation Hub > Data Transformation > Create transformation**.
2. Enter the name of the transformation.
3. Click **Add input**.
### Add file with sample data
This node allows you to add a data sample. In further steps, you define how the data must be modified. Later, when this transformation is used in the workflow, the system uses the rules created with the sample data as a pattern for modifying actual data.
4. On the pop-up, click **Add example**.
5. Upload the file with the sample data.
Below is the sample used in this article. It consists of two columns, where the first contains a customer's email address, and the second contains the marketing consent: `0` means disabled, `1` means enabled.
```
email;newsletter agreement
john.doe@synerise.com;1
```
6. Click **Generate**.
The configuration of the Data input node
**Result:** The **Data input** view is filled with data from the sample.
Data input of the sample file
### Rename column
The column name is the key under which the data will be imported to Synerise and appear in the output file. In this example, we will use the **Rename column** node to rename the **newsletter agreement** column to **agreements.email**.
1. On the canvas, click the right mouse button.
2. From the dropdown list, select **Rename column**.
3. Click the Rename column node.
4. In the configuration of the node:
1. Click **Add rule**.
2. Select the **Include these** option.
This is the default option. All column names you select will be changed as you specify in the further configuration.
3. Click **Add column**.
4. From the dropdown list, select the columns you want to rename.
5. Under the **Edit values by** subheader, select the **Replacing** option.
This option finds values matching the conditions and replaces them with the value you specify.
Example of the configuration of the Rename column node
5. Before you save the settings, you can check the preview of the file after changes in the **Output data** tab.
6. Confirm by clicking **Apply**.
### Add the finishing node
This node ends the transformation and passes the modified data to the automation where the Data Transformation is used.
1. On the canvas, click the right mouse button.
2. From the dropdown list, select **Data output**.
3. In the upper right corner, click **Save and publish**.
**Result**:
The diagram of data transformation
After the data transformation is published, you can use it in the Data Transformation node while preparing a workflow that imports the files.
## Prepare a workflow
---
As the second part of the process, create a workflow which imports the custom events every day to Synerise.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the launch date
1. As the trigger node, add **Scheduled Run**.
2. In the configuration of the node:
1. Leave the **Run trigger** option at default (**all time**).
2. From the **Timezone** dropdown list, select the time zone consistent with the timezone selected for your workspace.
3. Define the frequency of the workflow (for example, everyday at 6.00 A.M.).
The workflow will automatically launch everyday at the specified time.
The configuration of the Scheduled Run node
4. Confirm by clicking **Apply**.
### Configure settings for SFTP protocol
Use the **Get File** node to transfer the files from the workflow to your server using SFTP protocol.
1. Add the **Get File** node by clicking **THEN > SFTP**.
2. In the [**configuration of the node**](/docs/automation/integration/sftp-integrations/sftp-get-file) :
1. Enter the path to your server.
2. Select the port.
3. Enter the path to the directory.
4. Enter the name of the file where the data will be saved.
6. From the **File format** dropdown list, select the **CSV** format.
7. Verify and modify the delimiters if needed.
8. In the **Authentication** section, select the method of authentication.
The configuration of the SFTP node
3. Confirm by clicking **Apply**.
### Select the data transformation rules
7. Add a **Data Transformation** node.
8. In the configuration of the node, select the [data transformation you have created before](/use-cases/import-customers-data-from-sftp#create-data-transformation-rules).
Example of the configuration of the Data Transformation node
9. Confirm by clicking **Apply**.
### Import customers
1. Add the **Import Profiles** node. In the settings of the node, you can check the list of the optional columns.
2. Confirm by clicking **Apply**.
### Add the finishing node
12. Add the **End** node.
13. In the upper right corner, click **Save & Run**.
**Result**:
The workflow configuration
You can monitor the flow of the workflow in the **Transformation logs** tab. It contains information about each execution of the workflow.
The logs for the workflow
## Check the use case set up on the Synerise Demo workspace
---
You can check the [data transformation rules](https://app.synerise.com/automations/data-transformation/29bfc71a-e94a-4a25-aab0-a6cc363cea1b) directly in Synerise Demo workspace.
Also, you can check there the created [workflow](https://app.synerise.com/automations/automation-diagram/ae1a378c-f72c-42ba-a6fa-c037ff184742).
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 6 events per workflow execution:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`profile.updated`](/docs/assets/events/event-reference/profiles#profileupdated) (~1).
## Read more
---
- [Data Transformation](/docs/automation/data-transformation-and-imports/introduction)
- [Behavioral Data Hub](/docs/crm)
# Automate Sending NPS Survey Data to Google Cloud Pub/Sub
[Google Could Pub/Sub](https://cloud.google.com/pubsub/docs/overview) is a messaging service for exchanging event data among applications and services. It lets you create systems of event producers and consumers, called **publishers** and **subscribers**. Publishers communicate with subscribers asynchronously by broadcasting events to a **topic** regardless of how or when these events are to be processed. Pub/Sub then delivers events to all the subscribers of that topic, and each subscriber has its own logic of reacting to the event.
Integrating Synerise with Google Cloud Pub/Sub provides a seamless solution for exporting data from Synerise to Pub/Sub through dedicated nodes, including the valuable NPS survey data.
With Google Cloud Pub/Sub integration, you can send selected data to this messaging service. This service makes data available to all subscribers, which can include any Google service or other third-party tools.
In this use case, we will create a workflow that sends information with NPS survey data to Google Cloud Pub/Sub using a dedicated node in our Automation.
## Prerequisites
---
- Implement a custom event for NPS survey data, which will be available in the customer profile. In this example, the event is called `nps.sent`. Implement custom events in your [mobile application](/developers/mobile-sdk/event-tracking#basic-custom-event) or website [Web](/developers/web/event-tracking#declarative-tracking-custom-events). You can learn more about NPS survey in [this use case](/use-cases/dynamic-nps).
- Check [the requirements](/docs/automation/integration/google-cloud-pubsub/publish-message#prerequisites) you must meet to integrate Synerise with Google Cloud Pub/Sub.
## Create a workflow
---
Create a workflow which sends information with NPS survey data to Google Cloud Pub/Sub. Every time the `nps.sent` event is generated, the data from the event is sent automatically to Pub/Sub.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Profile Event trigger node
---
At this stage, we will configure conditions that launch the workflow. As a trigger, we will use the `nps.sent` event.
Click here to see example event and its parameters for an example customer
{ "time": "2023-02-15T15:24:49Z", "action": "nps.sent", "label": "", "client": { "id": 5092159999, "email": "e0097757-d1e2-44ac-ba3c-d97979a354c1@anonymous.invalid", "uuid": "e0097757-d1e2-44ac-ba3c-d97979a354c1" }, "params": { "eventCreateTime": "2023-02-15T15:25:08.861Z", "name": "John", "surname": "Doe", "location": "Warsaw", "age": "23", "feedback": "I am very satisfied with the service. The support team was responsive and helpful.", "product_id": "PROD123", "order_id": "ORD456", "nps_score": 9, "NPSsource": "mobile_app" } }
1. As the first node of the workflow, add **Profile Event**. In the configuration of the node:
1. Enter the name of the node.
2. From the **Choose event** dropdown menu, choose the `nps.sent` event.
2. Confirm by clicking **Apply**
### Configure the Publish Message node
---
At this stage, we will configure the Google Cloud Pub/Sub **Publish Message** node.
We recommend publishing data in Google Cloud Pub/Sub using the CloudEvents standard, however, if you want to publish a message out of this standard or if you want to publish more than one message at once, proceed with [“Publish raw messages” node](/docs/automation/integration/google-cloud-pubsub/publish-raw-messages).
1. As the next node, add **Google Cloud Pub/Sub > Publish Message**.
2. Click **Select connection**.
3. From the dropdown list, select the connection.
- If no connections are available or you want to create a new one, see [Create a connection](/docs/automation/integration/google-cloud-pubsub/publish-message#create-a-connection).
- If you selected an existing connection, proceed to defining the integration settings.
4. In the configuration of the node:
1. In the **Project ID** field, enter the unique identifier of your project in Google Cloud Console.
You can learn how to find the project ID [here](https://support.google.com/googleapi/answer/7014113).
2. In the **Topic ID** field, enter the unique identifier of the topic (a named resource that represents a feed of messages).
Learn more about [creating and managing topics](https://cloud.google.com/pubsub/docs/create-topic).
3. In the **Attributes (optional)** field, enter a JSON key-value object with message attributes.
This can be used to filter messages in the subscription. Learn more about [building the "attributes" object](https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage). The Attributes object can contain up to 100 attributes. In this use case, we will add source of the NPS event as an attribute. This will allow subscribers in Pub/Sub to filter the proper messages to be consumed. The example of Attributes object contains [the Automation inserts](/developers/inserts/automation) that retrieve data from the event included in the **Profile Event** node.
Click here to see an example of Attributes object used in this use case
{ "NPSsource": "{{ event.params.NPSsource }}" }
4. In the **CloudEvent type** field, enter the type of data sent in the CloudEvent.
Learn more about [CloudEvent types](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type).
5. In the **Data (optional)** field, enter the event data.
It will be sent to Pub/Sub as the `data` object in a [CloudEvent JSON Object](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md). The CloudEvent object will be automatically encoded with base64 and sent as the `data` field in a [Pub/Sub Message](https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage). In this use case, we will send values of `nps.sent` event parameters such as, among others, **name**, **surname** and **feedback**. The example of Data field contains [the Automation inserts](/developers/inserts/automation) that retrieve data from the event included in the **Profile Event** node.
Click here to see an example of the Data field used in this use case
6. Confirm the settings by clicking **Apply**.
### Add the finishing node
---
1. Add the **End** node.
The workflow configuration
2. In the upper right corner, click **Save & Run**.
**Result**: Every time the `nps.sent` event is performed on the profil of customer, data from this event is streamed to Pub/Sub. After each such action, a response event (`pubSub.publishMessage`) is generated on the customer's profile.
Example of pubSub.publishMessage event, generated after sending data to Google Cloud Pub/Sub
## Check the use case set up on the Synerise Demo workspace
---
You can check the [workflow configuration](https://app.synerise.com/automations/automation-diagram/1fbf41b2-7e9e-46e1-b450-8ceff9289695) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per profile that completes the flow:
`nps.sent` (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~1), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`pubSub.publishMessage`](/docs/assets/events/event-reference/integration#pubsubpublishmessage) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Publish Message node](/docs/automation/integration/google-cloud-pubsub/publish-message)
- [Jinjava inserts](/developers/inserts/automation)
# In-app campaign with cross-sell products
In the world of mobile applications, engaging users effectively and generating revenue are paramount objectives. One powerful strategy for achieving both of these goals is the implementation of in-app cross-sell campaigns. These campaigns are designed to present users with complementary product suggestions precisely when they are most likely to make a purchase, thereby enhancing their experience and increasing the app's revenue potential.
A compelling example of the impact in-app cross-sell campaigns can have is demonstrated through the "product.addToCart" event. In this specific use case, when a mobile app user adds an item to their shopping cart within a mobile application, it triggers a dynamic campaign. This campaign's unique feature is its ability to display cross-selling products tailored to the specific item added to the cart, all based on event parameters such as the SKU (Stock Keeping Unit). By leveraging these parameters and the underlying code of the cross-sell recommendation campaign, the app can deliver a highly personalized and targeted experience to its users.
The primary purpose of this use case is to optimize the user experience within a mobile application by offering relevant product recommendations at a critical moment in the customer's journey – when they are actively making a purchase. By harnessing the "product.addToCart" event, this in-app campaign can provide users with product suggestions that align with their interests and the specific product they have chosen.
In this use case, we provide you with ready-to-use campaign code that you can use 1:1 in your business scenario.
## Prerequisites
---
- [Implement Synerise SDK in your mobile app](/developers/mobile-sdk).
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- [Configure AI engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-search). Enable **Cross-sell** recommendations.
- [Implement the product.addToCart event in your mobile application](/developers/mobile-sdk/event-tracking#product-added-to-cart).
## Process
---
In this use case, you will go through the following steps:
1. [Create AI recommendations](/use-cases/in-app-bestsellers#create-ai-recommendations) with cross-sell products.
2. [Create an in-app campaign](#create-an-in-app-campaign) with the usage of an event parameter.
## Create AI recommendations
---
In this stage, you will create an AI recommendation campaign which will be used to display products in your in-app message. It will present cross-sell recommendations.
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation (it is only visible on the list of recommendations).
3. In the **Type & Items feed** section, click **Define**.
4. From the **Items feed** dropdown list, select a product feed.
5. Select the **Cross-sell** recommendation type.
6. Confirm the recommendation type by clicking **Apply**.
6. In the **Items** section, click **Define**.
7. Click **Add slot**.
8. Click the **Unnamed slot** that was created.
8. Define the minimum and maximum number of products displayed in the frame according to your needs.
9. In **Static filters**, select the **availability** parameter and set it to **is defined**, so the recommendations will show only available items.
9. Optionally, you can use filters to include specific items in the recommendation frame.
10. Confirm the configuration by clicking **Apply**.
8. Optionally, you can define the **Boosting** factors and settings in the **Additional settings** sections.
9. In the right upper corner, click **Save**.
10. Copy the recommendation ID from its URL to use it in [in-app campaign](#create-an-in-app-campaign).
## Create an in-app campaign
---
In this part of the process, you create an in-app campaign triggered by the `product.addToCart` event. After that, the recommendation campaign with cross-sell products for the products added to cart will be displayed.
1. Go to **Experience Hub > In-app messages > Create in-app**
2. Enter a meaningful name for the in-app campaign.
3. In the **Audience** section:
1. Click **Define**.
2. Select the **Everyone** tab.
3. Click **Apply**.
4. In the **Content** section:
1. Click **Create message**.
2. Go to **Use cases** folder and choose **In-app carousel with personalized recommendations** template.
You can edit the template in two ways, by editing the code of the template ([add inserts](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-snippet-to-the-template-code), [add variables](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-variable)) and/or by filling out the form in the **Config** tab. In this use case, we will use the capabilities of the predefined **Config** tab.
#### Edit form in the Config tab
---
The form in the **Config** tab is already filled in with default values. You can keep them or change them to fit your business needs.
The fields in **Config** are split into two types: ones for dynamic content (related to Jinja) and ones for in-app appearance. The dynamic content fields must match the values in the catalog and the names of the attributes returned by the recommendations. The appearance fields only affect the visual layer of the in-app message.
1. From the **Recommendation campaign** dropdown list, select the AI recommendation created [in the previous step](/use-cases/in-app-bestsellers#create-ai-recommendations).
2. In the **Header** section, add the text you want to display as the header of the in-app message.
3. In the **Wrapper background color** field, use the color picker to select the color of the wrapper background.
4. In the **Header background color** field, use the color picker to select the color of the header background.
3. In the **Header text color** field, use the color picker to select the text color.
6. In the **Close icon background color** field, use the color picker to select the icon background color.
6. In the **Close icon color** field, use the color picker to select the color of the close icon.
6. **Name of the product attribute with average rating** and **Name of the product attribute with number of reviews** leave empty, because in this case we do not have this kind of attributes in our catalog.
7. Additionally, you can enable the following options:
- **Sending additional events of viewing a single product in the carousel** - when enabled, an event is generated when a single product from the carousel is viewed. The event will be available in the customer's profile.
- **Use deep links** - when enabled, instead of refering a user to a product on the website, you refer them to a product in the mobile application.
15. To continue the process of configuring the in-app campaign, click **Next**.
16. To save your content changes, click **Apply**.
1. In the **Trigger events** section:
1. Click **Define**.
2. Select **Add event** and from the dropdown list, choose the `product.addToCart` event.
2. Click the **+ where** button and as the parameter, choose `$sku`.
3. As the logical operator, select **is true**.
4. Click **Apply**.
Trigger event settings
1. In the **Schedule** section:
1. Click **Define**.
2. Choose the **Run immediately** option.
3. Click **Apply**.
2. In the **Display settings** section:
1. Click **Define**.
2. Define the **Delay display** as **0** and **Priority index** as **1**.
3. Enable the **Frequency limit** toggle to manage the frequency of in-app message display in the application.
In our case, we set it to once per hour.
3. Click **Apply**.
1. Optionally, you can define the **UTM parameters**. Otherwise, click **Skip step**.
2. Optionally, you can add the custom parameters in the **Additional parameters** section. Otherwise, click **Skip step**.
3. To start your campaign, click **Activate**.
The in-app configuration
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the campaign components directly in Synerise Demo workspace:
- [AI recommendation configuration](https://app.synerise.com/ai-v2/recommendations/bFiHIJu2SdCS)
- [In-app campaign](https://app.synerise.com/communications/in-app/aa837e27-ab55-4bfa-820b-090ff5ef24df)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 6 events per profile that completes the flow:
[`product.addToCart`](/docs/assets/events/event-reference/items#productaddtocart) (~1), [`inApp.show`](/docs/assets/events/event-reference/inapp#inappshow) (~1), [`inApp.click`](/docs/assets/events/event-reference/inapp#inappclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [In-app messages](/docs/campaign/in-app-messages)
- [Mobile campaigns](/docs/campaign/Mobile)
- [Recommendations](/docs/ai-hub/recommendations-v2)
- [Recommendations inserts](/developers/inserts/recommendations-v2)
- [Trigger event parameters](/developers/inserts/inapp#trigger-event-parameters)
# In-app Stories with Personalized Product Recommendations
Display an engaging in-app story that combines interactive storytelling with AI-driven product recommendations. This feature allows businesses to present relevant products in a dynamic and visually appealing format, enhancing user engagement and increasing conversion opportunities. By leveraging predefined, ready-to-use templates, brands can easily create and adapt stories to their specific needs.
In this use case, you'll discover how to create an interactive in-app story promoting a running challenge and specific brand of running shoes. The guide offers detailed steps for using a predefined template, customizing content, and including AI-based recommendations for a personalized and engaging user experience. The target audience consists of women who visited the shoes category in the last 30 days without making a purchase.
## Prerequisites
---
- [Configure AI engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations) for recommendations; enable the personalized recommendation type.
- Implement the [transaction events](/developers/web/transactions-sdk) using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- [Implement Synerise SDK in your mobile app](/developers/mobile-sdk).
## Process
---
In this use case, you will go through the following steps:
1. [Prepare the segmentation](#prepare-the-segmentation) of women who have visited the shoes category during the last 30 days and have not made any transaction.
2. [Create an in-app message](#create-an-in-app-message) with product recommendations using the predefined template.
## Prepare the segmentation
---
In this part of the process, we will create a segmentation of users who have visited the `women/shoes` category in the last 30 days (website of mobile) but have not made any transaction during that time.
1. Go to **Decision Hub > Segmentations > New segmentation**.
3. Enter the name of the segmentation.
4. Click **Add condition**.
4. From the dropdown list, select the `page.visit` event.
6. Click **+ where** and from the dropdown list, select `url`.
7. Choose the **Contain** operator and enter the fragment of the URL for the specific category. In our case it will be `women-shoes`. Alternatively, you can build the following condition: **category equal [category name]**.
7. Using the date picker in the lower-right corner, set the time range to **Last 30 days**.
8. Click **Add condition**.
10. From the list, choose the `screen.view` event,
6. Click **+ where** and from the dropdown list, select `url`.
7. Choose the **Contain** operator and enter the fragment of the URL for the specific category. In our case it will be `women-shoes`. Alternatively, you can build the following condition: **category equal [category name]**.
12. Connect these conditions by the **OR** operator.
7. Using the date picker in the lower-right corner, set the time range to **Last 30 days**.
8. Click **Add condition**.
9. From the list, choose the `transaction.charge` event.
10. By clicking **Performed** above the event name change the condition to **Not performed**.
6. Save the segmentation.
Segmentation configuration
## Create an in-app message
---
In this part of the process, you will create an in-app campaign. We will use a predefined template for the message with interactive in-app stories, so there is no need to create a template from scratch.
1. Go to **Experience Hub > In-app messages> Create in-app**.
2. Enter the name of the in-app.
### Define the audience
---
As the first step, define the target group of customers for the in-app message. In this case, we will use the segmentation created in the [previous step](#prepare-the-segmentation).
1. In the **Audience** section, click **Define**.
2. Click **Segmentations**.
3. Click **Select segmentation** and choose the segmentation created in the [previous step](#prepare-the-segmentation).
3. Save settings in the **Audience** section by clicking **Apply**.
### Define content
---
In this part of the process, you will use a ready-made template to create the content of the in-app message that will be displayed in the mobile application.
1. In the **Content** section, click **Define**.
2. Click **Create message** and from the list of template folders, select **Predefined templates**.
3. Select the **STORIES** template.
**Result:** You are redirected to the code editor.
You can edit the template in two ways, by editing the code of the template, [add inserts](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-snippet-to-the-template-code), [add variables](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-variable) and/or by filling out the form in the Config tab. In this use case, we will use the capabilities of the predefined Config tab.
#### Edit form in the Config tab
---
The form in the **Config** tab is already filled in with default values. You can keep them or change them to fit your business needs.
In-app configuration
1. To lock a specific slide that you want to preview and edit, to prevent it from switching automatically, enable the **Config Mode**.
2. In the **Slide number** field, enter the slide number from which you want to edit.
2. In the **General Settings** section:
- In **Number of stories**, enter the number of slides in the stories (no more than 5).
- In **Stories order**, define the order of stories (for example, 2,3,5,1).
- In **Title** and **Subtitle**, define the title and subtitles of the stories respectively. If you don't want to display them, enter a dash (-).
- If you want to display the avatar, enable the **Display avatar image** option and in **Avatar image**, enter a link to the source of avatar image.
3. In the **Button** section:
- Customize the action button by defining the text on the button (**Text on the button**), the URL to which a user will be redirected (**Destination link**), colors of the button (**Button text color** and **Button color**).
4. Configure the settings for each story
- Each story can be customized separately. You can customize copy in a story, select colors of text and background, provide the links to image or video included in the story, and define the display time.
5. After you complete editing the form, disable the **Config mode** option.
5. After you make changes to the template, you can check the preview.
1. Click the **Preview contexts** button on the upper left side.
2. Enter the ID of a customer.
3. Click **Apply**.
Considering that the in-app is very interactive, the preview in the platform may not be enough to test the in-app performance. That’s why we suggest checking the campaign preview directly in the mobile app.
6. If the template is ready, in the upper right corner click **Save this template > Save as**.
7. On the pop-up:
1. In the **Template name field**, enter the name of the template.
2. From the **Template folder** dropdown list, select the folder where the template will be saved.
3. Confirm by clicking **Apply**.
8. To continue the process of configuring the in-app campaign, click **Use in communication**.
9. To save your content changes, click **Apply**.
### Select events that trigger the in-app message display
---
In this part of the process, you will define the event triggering the display of the in-app message.
1. In the **Trigger events** section, click **Define**.
2. Select **Add event** and from the dropdown list, choose `screen.view` event.
3. Click the **+ where** button and select `source`.
4. As the logical operator, select **Equal**.
5. As the value add `MOBILE`.
5. Click **Apply**.
In-app trigger event configuration
### Schedule the message and configure display settings
---
As the final part of the process, you will set the display settings of the in-app message such as schedule, capping, priority of the message among other in-app messages.
1. In the **Schedule** section, click **Define** and set the time when the message will be active.
2. In the **Display Settings** section, click **Change**.
3. Define the **Delay display**, **Priority index** and enable the **Frequency limit** toggle to manage the frequency of in-app message display in the application.
16. Click **Apply**.
17. Optionally, you can define the UTM parameters and additional parameters for your in-app campaign.
18. Click **Activate**.
### Test the in-app campaign
---
Read the ["Testing" section](/docs/campaign/in-app-messages/create-inapp-message#testing) to discover how to test your in-app campaign.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [segmentation](https://app.synerise.com/analytics-v2/segmentations/e9ba4f5e-76e6-4782-8bc5-3bdb72281688) and [in-app message campaign](https://app.synerise.com/communications/in-app/0954550c-eb59-4b33-a92c-662e348a3029) configuration directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 6 events per profile that completes the flow:
[`screen.view`](/docs/assets/events/event-reference/web-and-app#screenview) (~1), [`inApp.show`](/docs/assets/events/event-reference/inapp#inappshow) (~1), [`inApp.click`](/docs/assets/events/event-reference/inapp#inappclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [In-app messages](/docs/campaign/in-app-messages)
- [Using in-app template builder](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template)
# Tiered loyalty program
Tiered loyalty programs are a way to reward customers based on their level of interaction with your brand. We can help you create a structure that allows all members to enjoy benefits, but also ranks them into groups based on the total transaction value. This creates an environment of member engagement and loyalty that increases word-of-mouth recommendations and customer lifetime values.
#### Use case assumptions
- Loyalty program is created for customers who have created an account (online and/or in point of sales (POS)).
- Customers will be assigned to one of the four levels (tiers) of the loyalty program based on the total balance value (transactions value minus the value of returns) from the last 365 days.
1. White (transactions under 300 PLN)
2. Green (transactions from 300 PLN to 999,99 PLN)
3. Silver (transactions from 1000 PLN to 1999,99 PLN)
4. Golden (transactions above 2000 PLN)
- Making a transaction of a specific amount lets you go automatically to the higher level.
- Being in the specific group makes it possible to use specific discounts for your shopping (it can be for example 5% for Green, 8% for Silver, and 10% for Golden).
- The process involves creating an expression that returns the number of the tier to which a customer belongs: 1 for White, 2 for Green, 3 for Silver, 4 for Golden. Further on, we create a segmentation that is divided into four segments (White, Green, Silver, Golden); the customers are assigned to each segment based on the result of the expression. You can use these segments in your communication.
## Prerequisites
---
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- Implement the [custom event](/developers/web/event-tracking#declarative-tracking-custom-events) which is sent to Synerise when a customer joins a loyalty program (for example, the `loyaltyStatus` event with a `status` parameter set to `active`). Such an event with the appropriate status must be sent each time the membership status changes (when the customer resigns from the program or joins again).
In this case, when a customer joins the loyalty program, a custom event is generated on their profile card. However, these conditions and the scenario can be adapted to your business needs, for example, you can count the customers who joined the loyalty program using the registration event in the mobile application or on the website.
- Implement the [custom event](/developers/web/event-tracking#declarative-tracking-custom-events) which is sent to Synerise when a customer returns products (for example, the `product.return` event with the `$totalAmount` parameter that contains the value of products which are returned). Such an event with the appropriate parameter must be sent each time the customer returns the products.
## Process
---
The process of creating the tiered loyalty program based on the transactions value is divided into the following steps:
1. [Prepare an aggregate which returns the time of joining the loyalty program](/use-cases/loyalty-color-schemas#prepare-an-aggregate-which-returns-the-time-of-joining-the-loyalty-program).
2. [Prepare an aggregate that counts the total transaction value](/use-cases/loyalty-color-schemas#prepare-an-aggregate-that-counts-the-total-transaction-value).
3. [Prepare an aggregate that counts the value of returns](/use-cases/loyalty-color-schemas#prepare-an-aggregate-that-counts-the-value-of-returns).
4. [Prepare an expression counting the balance](/use-cases/loyalty-color-schemas#prepare-an-expression-counting-the-balance) of a customer (transaction value minus the value of returns).
5. [Prepare an expression that returns the tier number](/use-cases/loyalty-color-schemas#prepare-an-expression-that-returns-the-tier-number) to which a customer belongs to.
6. [Create a segmentation of customers in tiers ](/use-cases/loyalty-color-schemas#create-a-segmentation-of-customers-in-tiers) of customers based on their loyalty level, which you can use to analyze the number of customers in tiers.
## Prepare an aggregate which returns the time of joining the loyalty program
---
Start with creating an aggregate that returns the time of the first occurrence of the `loyaltyStatus` event. We recommend setting the analyzed period to **Lifetime**.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **First**.
4. Select the event `loyaltyStatus`.
5. As a parameter, choose **Timestamp**.
6. Select **status**.
7. Use the **Equal (String)** operator and as the value, enter `active`.
8. Set the analyzed period to **Lifetime**.
9. Click **Save**.
Configuration of the aggregate
## Prepare an aggregate that counts the total transaction value
---
In this part of the process, create an aggregate which counts the total value of transactions for a particular customer. It will be counted from the date of joining the loyalty program, but no longer than 365 days backwards from the current date.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Sum**.
4. Select the **transaction.charge** event.
5. As the event parameter, select `$totalAmount`, then choose **TIMESTAMP**.
6. Use operator **More than (Date)** and as the value add the aggregate which you have created [in the previous step](#prepare-an-aggregate-which-returns-the-time-of-joining-the-loyalty-program).
7. Set the analyzed period to **Last 365 days**.
7. Save the aggregate.
Configuration of the aggregate
## Prepare an aggregate that counts the value of returns
---
In this stage of the process, create an aggregate that counts the total value of returns made by a customer. It will be counted from the date of joining the loyalty program, but no longer than 365 days backwards from the current date.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Sum**.
4. Select the **product.return** event.
5. As the event parameter, select `$totalAmount`, then choose **TIMESTAMP**.
6. Use operator **More than (Date)** and as the value add the aggregate which you have created [in the previous step](#prepare-an-aggregate-which-returns-the-time-of-joining-the-loyalty-program).
7. Set the analyzed period to **Last 365 days**.
7. Save the aggregate.
Configuration of the aggregate
## Prepare an expression counting the balance
---
In this part of the process, prepare an expression which counts the account balance for a specific customer. The formula of the expression is a mathematical operation which deducts the [value of returns](/use-cases/loyalty-color-schemas#prepare-an-aggregate-that-counts-the-value-of-returns) from the [total value transactions](/use-cases/loyalty-color-schemas#prepare-an-aggregate-that-counts-the-total-transaction-value).
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. From the **Expressions for** dropdown list, select **Attribute**.
3. Build the following formula of the expression:
Formula of the expression
5. Save the expression.
## Prepare an expression that returns the tier number
---
Prepare the expression which returns the numerical value (from 1 to 4) which signifies the tier to which a customer belongs to. If the expression returns:
- `1` - the customer belongs to the `White` tier (transactions under 300 PLN)
- `2` - the customer belongs to the `Green ` tier (transactions from 300 PLN to 999,99 PLN)
- `3` - the customer belongs to the `Silver` tier (transactions from 1000 PLN to 1999,99 PLN)
- `4` - the customer belongs to the `Golden` tier (transactions above 2000 PLN)
The expression checks if the customer is part of a loyalty program, and then checks if they meet the conditions to join the highest level of the loyalty program. If not, conditions for the next level are checked, and so on until the lowest level. In the case of an error in the dat or when the customer is not assigned to any group, the expression returns `error`.
Formula of the expression - first part Formula of the expression - second part
## Create a segmentation of customers in tiers
---
As the next step, you can prepare a segmentation of customers who belong to the loyalty program. The segmentation will consist of 4 segments (white, green, silver, golden) and the customers will be assigned to each segment based on the result of the [expression that returns the tier number](#prepare-an-expression-that-returns-the-tier-number) they received.
1. Go to **Decision Hub > Segmentations > New Segmentation**.
2. Enter the name of the segmentation.
3. Choose **Add condition**.
4. From the dropdown list, find the [expression that returns the tier number](/use-cases/loyalty-color-schemas#prepare-an-expression-that-returns-the-tier-number) you have created in the previous part of the process.
4. Select the **Equal** operator.
5. In the text field, enter the number that signifies a tier. In our case, enter `4` to include only customers from the `Golden` tier (total balance is equal or greater than 2000 PLN).
5. Set the name of the segment, for example `Golden`.
6. Hover a mouse cursor over the segment and click the **Duplicate** option.
6. Repeat steps 3-6 for the remaining 3 tiers. Enter the following values for the next segments: `3` (for the Silver tier segment), `2` (for the Green tier segment), `1` (for the White tier segment).
5. Save the segmentation.
Segmentation settings
You can later use those segments as an audience in your campaigns and send them personalized messages and promotions. To use the specific segment in the further communication, just create an audience where the result of this segment will be equal to the chosen value (for example `4` for the Golden tier).
## What's next
---
This use case describes the basic assumptions of creating 4 tiers of loyalty. You can expand it by adding additional conditions, for example:
- **Avoid abuse** - You can add a condition based on which the customers who have spent a certain amount can advance to a higher level and benefit from discounts only after the maximum return period has expired (for example, 30 days).
- **Set up a billing cycle** - Suggested to be set to 12 months from achieving a particular level. During this time, a customer must make purchases for an amount specified in the terms and conditions to maintain the given level.
- **Set up account validity** - Consider account validity, for example, 3 years from creating an account. During this time, a customer must confirm/update their data and meet other requirements such as making a certain number of transactions to maintain the account status.
## Check the use case set up on the Synerise Demo workspace
---
You can check all the analytics directly in the Synerise Demo workspace:
- aggregate returning [the time of joining the loyalty program](https://app.synerise.com/analytics/aggregates/67c86eda-4f75-35df-ad31-db88c8932b5c)
- aggregate returning [the total value of transactions](https://app.synerise.com/analytics/aggregates/e5995d34-e567-3783-b8d0-cea447f60e58) for a specific customer
- aggregate returning [the total value of returns](https://app.synerise.com/analytics/aggregates/f57db416-4f61-33ce-a220-d9b47a8e63e8) for a particular customer
- expression returning [the balance](https://app.synerise.com/analytics/expressions/1edff9ca-66c5-415f-b35f-252ce50c96b2) for specific customer
- expression which [returns the numerical value of a tier a customer belongs to](https://app.synerise.com/analytics/expressions/bbe376a4-9a92-434f-bdbb-5c588fcfe44d)
- example [segmentation that divides customers](https://app.synerise.com/analytics-v2/segmentations/ebc292c1-6064-490d-a747-7a62567e81ee) into four tiers in the loyalty program.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case does not generate any events.
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Expressions](/docs/crm/expressions)
Check our loyalty use cases:
- [Award loyalty points for reaching a specific number of transactions](/use-cases/mechanism-of-stamps)
- [Promotion for the first transaction after joining the loyalty program](/use-cases/discount-promotion-for-first-transaction)
- [Promotion triggered by basket value](/use-cases/promotion-triggered-by-basket-value)
- [Rewarding customers in loyalty program for custom activities](/use-cases/adding-points-for-custom-event)
- [Send mobile push notifications with birthday promotion](/use-cases/mobile-push-birthday-promotion)
- [Transfer loyalty points between customers](/use-cases/loyalty-points-transfer-with-push)
# Loyalty points for completing a survey
By incorporating loyalty points into your survey strategy, you can gather valuable insights while fostering a loyal customer base, ultimately enhancing customer satisfaction and driving business growth. Offering loyalty points in exchange for survey participation can encourage new customers to enroll in your loyalty program as well as foster long-term loyalty with exsisting ones. Rewarding customers with loyalty points upon completing a survey creates a compelling incentive for customers to not only share their valuable feedback but also increase their spending.
In this use case, we will create a workflow that grants 500 loyalty points for customers who fill out a survey.
## Prerequisites
---
- Integrate mechanism for awarding loyalty points.
- [Create a dynamic content campaign with a survey](/use-cases/exit-popup-with-survey) according to your business needs.
- Implement a [custom event](https://hub.synerise.com/api-reference/data-management#operation/CustomEvent) (`survey.completed`) that is generated on customer's profiles when they submit a form.
- Integrate Synerise [mobile SDK](/developers/) in your mobile application.
Find more in the [Loyalty programs basics](/use-cases/loyalty-programs-basics) use case.
## Security configuration
---
Before you start working with this hub, if you are a Synerise customer or partner, consider reading [the section about denylisting events](/docs/settings/tool/api#denylist). This natively accessible configuration will allow you to manage the restrictions in points management that may help you prevent fraud.
## Create a workflow
---
Create a workflow that grants 500 loyalty points for filling out a survey.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Profile Event trigger node
At this stage, we will configure the conditions that launch the workflow. As a trigger, we will use the `survey.completed` event.
1. As the first node of the workflow, add **Profile Event**. In the configuration of the node:
1. From **Choose event** dropdown menu, choose the `survey.completed` event.
2. Confirm by clicking **Apply**.
Profile Event node configuration
### Congifure the Generate Event node
1. Add **Generate Event** node.
2. In the settings of the node:
1. In the **Event name** field, enter the name of the event. In our case, we are using `points.loyalty` event.
4. In the **Body** section, use the following code and modify it to your needs:
{
"points": "500"
"source": "survey A"
}
3. Click **Apply**.
Generate Event node configuration
### Add final setting to your workflow
1. Add the **End** node to both paths.
2. Launch the workflow by clicking **Save&Run**.
Configuration of the workflow
## Check the use case set up on the Synerise Demo workspace
---
In Synerise Demo workspace, you can check the configuration of the [Workflow](https://app.synerise.com/automations/automation-diagram/eb46bed4-55ee-43bd-9553-b3a27abceb8b).
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per profile that completes the flow:
`survey.completed` (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~1), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`points.loyalty`](/docs/assets/events/event-reference/loyalty#pointsloyalty) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Jinjava inserts](/developers/inserts)
# Location-Based Personalized Promotions via Mobile Push at the entrance to the store
Giving a personalized set of promotion is one of the best options to help your customer make a purchase decision.
In this use case, you will learn how to create a set of personalized promotions for customers who will receive them when they enter the brick and mortar store. After a promotion is assigned, a customer receives a mobile push notification that contains information about new promotion. An additional incentive to use the promotion at once is that the are valid only an hour from assigning.
Assigned promotions are dedicated for every customer. Based on their purchase history, the AI engine chooses the promotions that a customer is the most likely to use.
## Prerequisites
---
- Implement promotions in your [mobile application](/developers/mobile-sdk/loyalty), [API](https://hub.synerise.com/api-reference/loyalty-and-engagement#operation/profileLogin).
- [Import your product feed to catalog](/use-cases/import-product-feed-to-catalog).
- Implement mobile pushes in your mobile application: [iOS](/developers/mobile-sdk/configuring-push-notifications/ios), [Android](/developers/mobile-sdk/configuring-push-notifications/android).
- Implement [event](https://hub.synerise.com/api-reference/data-management#operation/CustomEvent) sent to Synerise when a customer enters the store. This event can be triggered, for example, by scanning the mobile application in the store.
## Security configuration
---
Before you start working with this hub, if you are a Synerise customer or partner, consider reading [the section about denylisting events](/docs/settings/tool/api#denylist). This natively accessible configuration will allow you to manage the restrictions in points management that may help you prevent fraud.
## Process
---
In this use case, you will go through the following steps:
1. [Create personalized promotions](/use-cases/personalized-promotions-in-mobile-app#create-personalized-promotions).
More about creating personalized promotions is available [here.](/docs/ai-hub/personalized-promotions/creating-ai-promotions#create-promotion-candidates)
2. [Define groups of promotions](/use-cases/personalized-promotions-in-mobile-app#define-a-group-of-promotions) to use them as base for AI engine.
3. [Define a personalized promotion](/use-cases/personalized-promotions-in-mobile-app#define-a-personalized-promotion).
4. [Create a mobile push template](/use-cases/personalized-promotions-in-mobile-app#create-a-mobile-push-template).
5. [Create a workflow](/use-cases/personalized-promotions-in-mobile-app#create-a-workflow).
## Create personalized promotions
---
In this part of the process, create a few personalized promotions which will be candidates for a personalized promotions. The personalized promotions will be selected by the AI engine.
1. Go to **> Regular Promotions > Add promotion**.
2. According to your business needs select one of the scopes:
- **For selected items**
- **For entire basket**
3. Select the group of customers for whom you want to prepare promotion.
4. In the **Content** section:
1. Define the name, description, and image of the promotion.
2. In the **Price** field, enter `0`.
3. Add a [tag](/docs/crm/customer-tag) so that we can use it later to make a base group of promotions.
Example of tag
4. Confirm the settings by clicking **Apply**.
Example of promotion content
5. In the **Types & limits** section, select **Handbill** as the promotion type.
Handbill type of promotion
6. In the **Schedule** section, define the promotion distribution period according to your business needs.
7. Optionally, in the **Stores** section, select the stores in which the promotion is available.
This is possible only if the list of stores is imported into a [catalog](/docs/assets/catalogs).
8. In the **Items** section, select the catalog of items from which you select items for a discount:
1. From the **Source catalog** dropdown list, select a catalog of items.
2. Select the **Entire catalog** option.
3. Confirm by clicking **Apply**.
9. To apply configuration and run the promotion, click **Publish**.
10. Repeat all the steps and create more personalized promotions. In step 8, instead of entire catalog, select specific items (for example, a brand, a category of items - depending on your business assumptions).
## Define a group of promotions
---
In this part of the process, you create a filter of promotions which will be used in a personalized promotion. If you have other personalized promotions active, the engine will only select among personalized promotions with a defined filter.
1. In **Promotions**, above the list of promotions, click **> Define.**
2. Click **Choose filters**.
3. Use the tag you assigned to [personalized promotions](#create-personalized-promotions). This filter will be used while creating a personalized promotion.
Example of filter
4. Save the filter
5. Confirm the settings by clicking **Apply**.
## Define a personalized promotion
---
In this part of the process, create a personalized promotion. The AI engine will select items from personalized promotions with a shop-entrance tag assigned.
1. 1. Go to **AI Hub > Personalized Promotions > New personalized promotion**.
1. As the type, choose **Mobile**.
2. In the **A/B Test settings**, click **Define**.
3. Click .
4. Click **Advanced options**.
5. Select **AI Engine**.
6. Confirm by clicking **Apply**.
7. In the **Filters and limits** section:
1. In the **Promotions in set**, enter a number of personalized promotions to be used as candidates to display in a slot.
2. Click **Define filter**.
3. Select the filter you created in this [step](/use-cases/personalized-promotions-in-mobile-app#define-a-group-of-promotions).
4. To add more slots, click **Ad another** and repeat steps a-c.
5. Confirm by clicking **Apply**.
8. In the **Activity** section:
1. Leave the **Lasting** option at default (**Relative**).
2. Set the activity to 1 hour.
3. Confirm by clicking **Apply**.
9. Configure the **Engine settings** section according to your needs.
You can read more about engine settings [here](/docs/ai-hub/personalized-promotions/creating-ai-promotions#ai-engine-boosting-settings).
2. To apply configuration and run the promotion, click **Publish.**
## Create a mobile push template
---
1. Go to **Experience Hub > Mobile > Templates**.
2. Create your mobile push in the code editor.
For more information on creating a simple mobile push, visit our [User Guide](/docs/campaign/Mobile/creating-mobile-push).
Example of mobile push notification
## Create a workflow
---
In this part of the process, prepare a workflow that assigns personalized promotions and notifies a customer about it when they enter the store.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
3. As the first node of the workflow, add **Profile Event**. In the node settings:
1. From the **Choose event** dropdown menu, select event that is sent to Synerise when a customer enters the store.
2. Confirm by clicking **Apply**.
4. As the next node, add **Outgoing Integration**.
1. Select the **Custom webhook** tab.
2. Enter the name of the webhook.
3. Select the `GET` method.
4. In the URL field, enter: `https://api.synerise.com/v4/promotions/promotion/get-for-client/clientId/{{client.id}}/handbill/HANDBILL-ID`, where `HANDBILL-ID` value must be replaced with the ID of the personalized promotion created in [this step](/use-cases/personalized-promotions-in-mobile-app#define-a-personalized-promotion).
5. As authorization type choose `By API key` and select an API key with the proper permission according to documentation of [endpoint that assigns personalized promotion](https://hub.synerise.com/api-reference/loyalty-and-engagement#operation/getAssignHandbillForClient_GET).
6. Confirm by clicking **Apply**.
Configuration of the Outgoing Integration
5. As the next node, add **Event Filter**. This node ensures that a mobile push is sent after the personalized promotion is assigned to a customer. In the node settings:
1. From the **Choose event** dropdown menu, select the `handbill.assign` event.
2. Confirm by clicking **Apply**.
Configuration of the Event Filter node
6. As the next node, add **Send Mobile Push**. In the configuration of the node:
1. Define the **Template type**.
2. Select the **Push template** created in [this step](/use-cases/personalized-promotions-in-mobile-app#create-a-mobile-push-template) of the process.
3. Confirm by clicking **Apply**.
7. Add the **End** node to finish the workflow.
8. Optionally, you can define **capping** in right upper corner. In capping configuration:
1. Define Limit adn Time.
2. Confirm by clicking **Apply**.
Example configuration of workflow capping
9. Click **Save & Run**.
Final configuration of a workflow that assigns personalized promotions and sends a mobile push to customers who entered the store
Once the personalized promotion is assigned to your customer, they will be displayed with all other promotions that are assigned to a specific customer in your mobile app.
## Check the use case set up on the Synerise Demo workspace
---
You can also check the
- [personalized promotion](https://app.synerise.com/campaigns/promotions/160c4f57-4bac-4805-a7b5-f25efd5582c8)
- [personalized promotion](https://app.synerise.com/campaigns/handbills/ca9ff2d0-746e-455a-8ad2-97a6b3e4c598)
- [mobile template](https://app.synerise.com/campaigns/mobile-push/content-manager/template/153486)
- [workflow](https://app.synerise.com/automations/workflows/automation-diagram/065c8f93-4d92-47ff-a67f-0f96d3d73bea)
directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 11 events per profile that completes the flow:
`store.entrance` (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`webhook.response`](/docs/assets/events/event-reference/integration#webhookresponse-and-custom-webhook-response-names) (~1), [`handbill.assign`](/docs/assets/events/event-reference/loyalty#handbillassign) (~1), [`push.send`](/docs/assets/events/event-reference/mobile-push#pushsend) (~1), [`push.view`](/docs/assets/events/event-reference/mobile-push#pushview) (~1), [`push.click`](/docs/assets/events/event-reference/mobile-push#pushclick) (~1).
## Read more
---
- [Personalized promotions](/docs/ai-hub/personalized-promotions/creating-ai-promotions)
- [Workflows](/docs/automation).
# Sync Microsoft Azure Forms Data with Synerise for Customer Profile Updates
You can integrate Microsoft Azure Forms with Synerise to collect data from the forms in Synerise and create new customer profiles or update the existing ones.
In this use case, a submission of a form that contains three fields (name, surname and email address) launches a workflow that creates a customer profile or updates an existing profile with identical credentials.
Completing this procedure requires some knowledge on sending API requests using cURL, Postman, or similar tools.
## Prerequisites
---
Access to Microsoft Forms and Microsoft Azure.
## Process
---
In this use case, you will go through the following steps:
1. [Create an incoming webhook](/use-cases/send-data-from-forms#create-an-incoming-webhook).
2. [Create a form](/use-cases/send-data-from-forms#create-a-form).
3. [Create a workflow](/use-cases/send-data-from-forms#create-a-workflow).
## Create an incoming webhook
---
Create an incoming webhook to which you will send the data submitted through Microsoft Forms.
1. In Synerise, go to **Automation Hub > Incoming > New integration**.
2. Enter the name of the webhook.
3. In the **Endpoint** section, click **Define**.
The URL field is already is filled in with the endpoint to which the data submitted throught the form will be sent.
1. Optionally, you can add an icon to this integration.
3. Confirm by clicking **Apply**.
Configuration of the Endpoint section
4. In the **Incoming data** section, click **Define**.
5. Click **Retrieve data**. Right after you click the button, send a request to the endpoint in the **Endpoint** section with the sample of data that will be sent through forms. The system waits for the incoming request for 1 minute and 30 seconds. Example request:
Replace the endpoint URL from the example with the endpoint URL from step 3.
6. When the endpoint receives data from the request, verify the list of variables. If the variables include those which are in the payload (in this case, firstname, lastname, and email), click **Define**. If not, click **Start again** re-send request, and wait for the results.
Collected variables from the request
7. Click **Save & publish**.
You can read the documentation of Incoming integration [here](/docs/automation/integration/incoming-webhook-node).
## Create a form
---
In this part of the process, you need to create a form in Microsoft Forms app and configure the flow of sending data from the form to Synerise.
1. Go to Microsoft Forms app.
2. Create a form.
If you need help, you can refer to the [documentation](https://support.microsoft.com/en-us/office/create-a-form-with-microsoft-forms-4ffb64cc-7d5d-402f-b82e-b1d49418fd9d).
Example form used in this use case
3. Go to Azure Portal. From the list of Azure services, select Logic Apps. If you don't see the icon right away, click **More services** and find the app.
Azure services available in the Azure Portal
4. As the connector of the Logic App, select Microsoft Forms.
Connecting Logic App with Microsoft Forms
4. As a trigger, from the dropdown list, select **when a new response is submitted**.
5. Choose the form you want to connect.
Selecting a form
6. In the panel of operations, choose **Microsoft Form Standard**. As an action, choose **get response details**.
7. From the **Form Id** dropdown list, select the ID of your form.
8. From the **Response Id** dropdown list, As response Id select **List of response notifications Response Id**.
Selecting an action to be performed when a form is submitted
9. In the panel of operations, choose **HTTP**. Configure this section according to the [incoming webhook](/use-cases/send-data-from-forms#create-an-incoming-webhook) you created before. The body must be identical to the body you defined in the incoming webhook in Synerise.
Configuring the endpoint section
10. Save the workflow.
## Create a workflow
---
In this part of the process, you create a workflow in Synerise. The workflow starts with the business event trigger that is launched every time a customer submits the form. In response to that, a customer profile is created or updated if it exists already.
1. In Synerise, go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
3. As the first node, select **Business Event**. In the configuration of the node:
1. Select the incoming webhook you created as the first part of this use case.
2. Confirm by clicking **Apply**.
Configuring the Business Event node
4. Add the **Outgoing Integration** node to the workflow. In the configuration of the node:
1. Enter the name of the webhook. This name will be used as a value of the `name` parameter of the `webhook.response` event.
2. Select the **POST** method.
3. Enter the endpoint URL:
- For workspaces hosted in Microsoft Azure EU: `https://api.synerise.com/v4/clients/batch`
- For workspaces hosted in Microsoft Azure USA: `https://api.azu.synerise.com/v4/clients/batch`
- For workspaces hosted in Google Cloud Platform: `https://api.geb.synerise.com/v4/clients/batch`
4. Enter the following headers:
- set the `content-type` header to `application/json` (default),
- set the `accept` header to `application/json`,
- set the `api-version` header to `4.4`
5. Enter the request body. For the form used in this case, the body is as follows:
5. In the **Authorization** section, select **By API key**.
6. From the dropdown list, select API key that has permissions to create or update customer's data.
You can read more about API keys [here](/docs/settings/tool/api) and you can find more information about the endpoint and required API key permissions [here](https://hub.synerise.com/api-referenceClientManagement/ClientManagement.html#operation/BatchAddOrUpdateClients).
6. Confirm by clicking **Apply**.
Configuring the Outgoing Integration node
7. Add the **End** node.
8. Activate your workflow by clicking **Save & Run**.
Final workflow configuration
## Testing
---
If the workflow works, you will see a new/updated customer in **Behavioral Data Hub > Profiles** and a success in the statistics of the **Outgoing Integration** node:
Workflow statistics
## Watch video
---
You can watch the video that presents the whole process of implementing this use case.
## Check the use case set up on the Synerise Demo workspace
---
In the Synerise Demo workspace, you can check the configuration of:
- the [incoming integration](https://app.synerise.com/automations/custom-blocks/integrations/incoming/edit/a205358b-d82b-4e35-88a3-b511d8e3a04d)
- the [workflow](https://app.synerise.com/automations/automation-diagram/f3c9163c-a6e8-4276-a11c-6e45ce1f181f)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 6 events per profile that completes the flow:
`incoming webhook event` (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~1), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`webhook.response`](/docs/assets/events/event-reference/integration#webhookresponse-and-custom-webhook-response-names) (~1), [`profile.updated`](/docs/assets/events/event-reference/profiles#profileupdated) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Integrations](/docs/automation/integration)
# Send an email with promotions labeled with a specific tag
This use case describes the process of sending promotions through the email channel. The email template contains a predefined HTML block with promotions which retrieves a Synerise promotion you indicate in the configuration of this block.
The promotions can be easily adapted for different communication channels, but in this scenario, we will focus on email campaigns. Our target audience consists of active users who have made at least one purchase in the past year. The campaign will dynamically deliver the list of active promotions available for a specific user, presenting only offers with a specific tag. This approach is especially important when managing multiple active promotions from different areas but intending to send only those that are tagged with the `home` label within your campaign.
With the power of dynamic HTML blocks, we can seamlessly integrate these promotions into the email templates, ensuring that each recipient receives relevant offers.
## Prerequisites
---
- [Create an email account](/docs/campaign/e-mail/configuring-email-account).
- [Import your product feed to catalog](/use-cases/import-product-feed-to-catalog).
- Implement mobile pushes in your mobile application: [iOS](/developers/mobile-sdk/configuring-push-notifications/ios), [Android](/developers/mobile-sdk/configuring-push-notifications/android).
- [Implement a tracking code](/docs/settings/tool/tracking_codes).
- Implement the [transaction events](/developers/web/transactions-sdk) using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
## Process
---
In this use case, you will go through the following steps:
1. [Create promotions](/use-cases/promotions-in-email#create-promotions) with specific tag.
3. [Create a segmentation](/use-cases/promotions-in-email#create-a-segmentation) of customers who have made a transaction last year, this group will be the recipients of the email campaign.
4. [Create an email template](/use-cases/promotions-in-email#create-an-email-template).
5. [Create an email campaign](/use-cases/promotions-in-email#create-an-email-campaign).
## Create promotions
---
In this part of the process, create a promotion (or more) which you will insert in the email template. You can create a promotion with the following scopes:
- [For selected items](/docs/ai-hub/promotions/creating-promotions) - you can select items to which you want to apply a discount
- [For entire basket](/docs/ai-hub/promotions/creating-promotions-for-entire-basket) - you can reduce the value of the whole shopping cart if its value matches the fixed price limit,
Regardless of the selected promotion scope, in the configuration of the promotion, in the **Content** section, find the **Add tag** field and add a `home` tag.
Example of tag
## Create a segmentation
---
In this part of the process, we will create a group of customers who have made a transaction during the last year. This group will serve as the recipients of an email campaign. It’s important to clarify that these customers will receive the email, rather than being the target audience for a promotion. Additionally, ensure that the conditions set for the Audience in the promotion do not conflict with those of the Audience for the email recipients, to avoid any discrepancies between the two groups.
1. Go to **Decision Hub > Segmentations > New segmentation**.
3. Enter the name of the segmentation.
4. Click **Add condition**.
4. From the dropdown list, select the `product.buy` event.
6. From the **Choose operator** dropdown, choose **Boolean**, and then select **Is true**.
7. Using the date picker in the lower-right corner, set the time range to **Relative time range > Last 365 days**. Confirm by clicking **Apply**.
6. Save the segmentation.
Segmentation configuration
## Create an email template
---
To distribute the promotions, you need to prepare an email template that includes the promotion created in the previous step of the process. This step involves incorporating Jinjava code into the email template to fetch the details of the promotion labeled with the `home` tag for which an email recipient is eligible. The instructions for this step include the necessary code.
1. Go to **Experience Hub > Emails > Templates > Drag&drop builder**.
2. From the **Content** section, click **HTML BLOCKS** and add pull it to the chosen place in your template.
2. Click the **Configure** button.
3. Choose the **Predefined blocks** folder where you will find the **Promotions** block.
4. You must edit the template of the predefined block. It already contains a universal reference to a promotion, but we need to narrow down the promotion scope to those which are labeled with the **home** tag. The following changes must be added to the code of the block in the **HTML** section:
- to `{% set fieldsVar = ["code", "params", "name", "status", "images", "params", "description", "headline"] %}`, add `, "tags"`
- replace `{%- if count < noOfItems -%}` with `{%- if count < noOfItems && i.tags|selectattr("name", "equalto", "home")|length > 0 -%}` and if you're using other tag than home, replace `"home"` with the name of your tag
**Below, you can compare the code before and after changes:**
{% set fieldsVar = ["code", "params", "name", "status", "images", "params", "description", "headline", "tags"] %}
{% promotions fields=fieldsVar %}
{% set count = 0 %} {%- for i in promotions_result -%}
{%- if count < noOfItems && i.tags|selectattr("name", "equalto", "home")|length > 0 -%}
{% set fieldsVar = ["code", "params", "name", "status", "images", "params", "description", "headline"] %}
{% promotions fields=fieldsVar %}
{% set count = 0 %} {%- for i in promotions_result -%} {%- if count < noOfItems -%}
4. When you finish customizing the block, to use proceed to saving changes in templates, click **Next**.
If you want to save the block for future use, click **Save as**, in **Block name**, enter the name of the block and in **Block folder**, select the folder in which your block will be saved.
5. Save the template by clicking **Save as**.
6. In **Template name**, enter the name of the template.
7. In **Template directory**, select the folder in which the template will be saved.
Prepare an email template
## Create an email campaign
---
In this part of the process, you will create an email campaign with the list of the promotions available for the recipient.
1. Go to **Experience Hub > Email campaign > Create new**.
2. In the **Audience** section, choose the [segmentation created in the previous step](/use-cases/promotions-in-email#create-a-segmentation).
Please remember that the predefined HTML block with promotions works for a given customer only if they are in the audience of at least one promotion. If none of the selected promotions are available for the user, the email will not be sent.
4. To confirm you choice, click **Apply**.
3. Configure the **Content** section.
1. In **From email address*, select the email account from which you want to send your message.
2. In **From name**, enter the sender name that is displayed in the mailbox.
2. In the **Subject** field, enter your message subject.
2. Click **Create message** and choose an email template created in the [previous step](/use-cases/promotions-in-email#create-an-email-template).
3. Apply changes.
4. In the **Schedule** section, specify the time when you want to send your communication.
4. You can optionally define **UTM & URL parameters**.
4. Confirm by clicking **Apply**.
## Check the use case set up on the Synerise Demo workspace
---
In the Synerise Demo workspace, you can check:
- [segmentation](https://app.synerise.com/analytics-v2/segmentations/c39f2834-3f44-4f1d-96d8-0ed6fb272221)
- [example promotion](https://app.synerise.com/campaigns/promotions/dad398ae-ca99-421f-88d3-e21dcdf83564)
- [email campaign](https://app.synerise.com/campaigns/email/create/1dd5c37d-da50-42dc-a0aa-7eb48755bab6)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1).
## Read more
---
- [Creating email templates](/docs/campaign/e-mail/creating-email-templates)
- [Creating emails](/docs/campaign/e-mail/creating-email-campaigns)
- [HTML blocks](/docs/campaign/e-mail/creating-email-templates/creating-custom-html-block-basic-builder)
- [Promotions](/docs/ai-hub/promotions)
- [Segmentation](/docs/analytics/segmentations)
- [Workflows](/docs/automation).
# Personalized homepage with section recommendation
With Section recommendations, you can create a custom page with recommended products divided into sections. These sections display items based on a chosen item attribute and additionally they are automatically adjusted to match the customers' preference. This type of recommendation lets the customer have a product overview, with the items relevant for them, chosen by the AI-based models.
In this use case, you can find an instruction on creating a recommendation for a retail website that consists of 5 rows of categories with 4 items for each category type. The categories of the products are represented in the following way: "Clothing > t-shirts and tops > t-shirts > long sleeve". However, we would like to present the section with a smaller granularity of categories, for example, "Clothing > t-shirts and tops".
## Prerequisites
---
- The [items feed](/docs/ai-hub/recommendations-v2/item-feed-requirements) must be provided.
- You must [configure the AI engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations):
- Enable the Section page model.
- In the **Attributes for distinct filters** section, you must select the attributes which will be available for use in the **Item attribute** field when [creating a section page recommendation](/docs/ai-hub/recommendations-v2/creating-section-recommendations#configure-item-settings). In the **Item attribute** field you will choose the item feature (for example, brand) based on which the items will be selected for a slot in the recommendation. If this step is skipped, the field will remain empty, making it impossible to complete the recommendation.
Optionally, you can provide [metadata catalog](/docs/ai-hub/recommendations-v2/item-feed-requirements).
## Create a recommendation
---
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
3. In the top left corner, enter the name of your recommendation.
4. In the **Type & Items feed** section, click **Define**.
5. From the **Items feed** dropdown menu, choose the provided feed.
6. Choose the **Section** recommendation type.
7. Under the section types, from the dropdown list, choose your **Metadata catalog**.
8. Click **Apply**.
9. In the **Items** section, click **Define**.
10. Click **Add slot**.
11. Set the **Number of sections** option to 5.
12. Set the **Number of items per section** option to 4.
13. From the **Items attribute** dropdown, choose the `category` attribute.
14. In the **Category level** input area that appears, define the category level as a numeric value, in our case 2.
If your products categories have a `X > Y > Z` structure, level 0 will be `X > Y > Z`. Level 1 will be `X > Y` and so on. Here, you are defining how granular the category recommendations will be. For example, if you sell shoes, you will have a `Outdoor > Sport > Running` category and a `Outdoor > Sport > Football` category. If level 0 is provided, both categories can be recommended. If level 1 is provided, `Outdoor > Sport` category will be recommended to the customer.
15. Click **Apply**.
16. In the top right corner, click **Save**.
## What's next
---
You can display the recommendation on your home page, use [dynamic content](/docs/campaign/dynamiccontent).
1. Go to **Experience Hub > Dynamic content > New dynamic content**.
2. In the body of the dynamic content, use the recommendation insert.
Click here to display the insert
{% recommendations3 campaignId=aIEkwqXw0wLB %} {% for slot in slots_products3 %} {% for row in slot.rows %} <!-- Variable metadata which allows you to access the metadata catalog --> {{ row.metadata.itemId }} {{ row.metadata.imageLink }} <!-- Iterates through items in a given section --> {% for item in row.items %} {{ item.itemId }} {{ item.title }} {% endfor %} {% endfor %} {% endfor %} {% endrecommendations3 %}
Read more about how to use recommendation in inserts [here](/developers/inserts/recommendations-v2).
3. Add CSS and/or HTML to the dynamic content.
4. [Define the rest of the settings](/docs/campaign/dynamiccontent/creating-dynamic-content).
## Check the use case set up on the Synerise Demo workspace
---
You can check the [recommendations](https://app.synerise.com/ai-v2/recommendations/Ms42quPJDmQG) which let you implement described basic AI Search on your website.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per profile that completes the flow:
[`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1), [`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1).
## Read more
---
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Similar vs cross-sell recommendations with Variant optimizer
Similar and cross-sell item recommendations are both powerful tools for online retailers, helping guide customers toward products that align with their interests or complement their intended purchases. But which approach performs better in a specific context? With Variant optimizer, you can run real-time tests to compare dynamic content variations and automatically prioritize the version that drives the most engagement.
This use case explores the scenario of creating a dynamic content (DC) campaign featuring two types of product recommendations to users who have added items to their favorites. One variant shows similar product recommendations and the other features cross-sell ones. By running both variants in a single Dynamic Content campaign with a goal set to maximize performance based on a metric, AI engine allocates the best preforming content variant to more customers.
## Prerequisites
---
- [Implement SDK to a website](/developers/web/installation-and-configuration)
- [Configure the feed for recommendations](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations). Enable Similar and Cross-sell recommendations.
- Implement a custom event for adding a product to favorites, which will be available in the customer profile.
In this example, the event is called `product.addToFavorite`.
Implement custom events in your [mobile application](/developers/mobile-sdk/event-tracking#product-added-to-favorites) or [website](/developers/web/event-tracking#declarative-tracking-custom-events).
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate](#create-an-aggregate) that returns products added to favorites.
1. [Prepare similar AI recommendations](#prepare-similar-ai-recommendations).
2. [Prepare cross-sell AI recommendations](#prepare-cross-sell-ai-recommendations).
2. [Create two variants of the dynamic content campaign](#create-two-variants-of-the-dynamic-content-campaign) with two item recommendation variants (similar and cross-sell) using the predefined dynamic content web layer template.
## Create an aggregate
---
In this part of the process, create an aggregate that will return the products customers added to favorites.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last**.
4. Select the **product.addToFavorite** event.
5. Select the **sku** parameter.
6. Define the period from which the aggregate will return products from the event.
7. Save the aggregate.
Configuration of the aggregate
## Prepare similar AI recommendations
---
In this part of the process, you will configure a similar items recommendation with context of items that customers added to their favorites. This recommendation will be later used in the dynamic content.
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation (it is only visible on the list of recommendation).
3. In the **Type & Items feed** section, click **Define**.
4. From the **Items feed** dropdown list, select an item feed.
5. In the **Type** section, choose the **Similar items** recommendation type.
6. Confirm the settings by clicking **Apply**.
7. In the **Items** section, click **Define**.
1. Click **Add slot**.
2. Define the minimum and maximum number of items that will be recommended to the customer in each slot.
3. Optionally, define [Static filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#static-filters), [Elastic filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#elastic-filters) and [Distinct filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#distinct-filter)
4. Confirm by clicking **Apply**.
8. Optionally, you can define settings in the **Slots and items ordering** and **Boosting** sections.
9. In the **Additional settings** section click **Define**.
1. Enable the **Item context from analytics (aggregate, expression)** switch.
2. From the dropdown list, select the aggregate you created [in this part of the process](#create-an-aggregate).
3. Click **Apply**.
9. In the right upper corner, click **Save**.
10. Copy the recommendation ID from its URL and save it in the notepad. It will be needed in the further part of the process.
## Prepare cross-sell AI recommendations
---
In this part of the process, you will configure a cros-sell recommendation with context of items that customers added to their favorites. This recommendation will be later used in the dynamic content.
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation (it is only visible on the list of recommendation).
3. In the **Type & Items feed** section, click **Define**.
4. From the **Items feed** dropdown list, select an item feed.
5. In the **Type** section, choose the **Cross-sell** recommendation type.
6. Confirm the settings by clicking **Apply**.
7. In the **Items** section, click **Define**.
1. Click **Add slot**.
2. Define the minimum and maximum number of items that will be recommended to the customer in each slot.
3. Optionally, define [Static filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#static-filters), [Elastic filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#elastic-filters) and [Distinct filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#distinct-filter)
4. Confirm by clicking **Apply**.
8. Optionally, you can define settings in the **Slots and items ordering** and **Boosting** sections.
9. In the **Additional settings** section click **Define**.
1. Enable the **Item context from analytics (aggregate, expression)** switch.
2. From the dropdown list, select the aggregate you created [in this part of the process](#create-an-aggregate).
3. Click **Apply**.
9. In the right upper corner, click **Save**.
10. Copy the recommendation ID from its URL and save it in the notepad. It will be needed in the further part of the process.
## Create two variants of the dynamic content campaign
---
Create two variants of a dynamic content campaign (each must be a web layer type). Every variant must reference a recommendation generated earlier in the process. The dynamic content campaigns will be displayed as a pop-up on your site for the customers who have added products to their favorites.
1. Go to **Experience Hub > Dynamic content > Create new**.
2. Enter the name of the dynamic content.
3. Choose the **Web layer** type.
4. In the **Audience** section, click **Define**.
1. In the **New Audience** section, click **Define conditions**.
2. From **Choose filter** dropdown menu, choose **product.addToFavorite** event.
3. Define the period from which the segmentation will return customers.
4. Confirm the settings by clicking **Apply**.
5. Confirm the settings by clicking **Apply**.
### Define the first variant content
5. In the **Content** section, click **Define**.
6. In the **Content** tab, click **Create Message**.
7. From the list of template folders, select a folder with the predefined **Web layer templates**.
**Result**: You are redirected to the list of predefined templates.
Web layer templates folder
8. Select the **Recommendations** template.
**Result**: You are redirected to the template builder.
You can edit the template in two ways, by editing the code of the template ([add inserts](/docs/campaign/dynamiccontent/creating-dynamic-content-templates/dynamic-content-template-builder#adding-a-snippet-to-the-template-code), [add variables](/docs/campaign/dynamiccontent/creating-dynamic-content-templates/dynamic-content-template-builder#adding-a-variable)) and/or by [filling out the form in the Config tab](/use-cases/dynamic-content-item-context-recommendation#edit-the-form-in-the-config-tab). In this use case, we will use the capabilities of the predefined Config tab.
#### Edit the form in the Config tab
The form in the **Config** tab is already filled in with default values. You can keep them or change them to fit your business needs.
1. From the **Recommendation campaign** dropdown list, select the ID of the similar recommendation campaign you created [in the previous step](#prepare-similar-ai-recommendations). You can find it by typing its name or ID in the search box.
2. In the **Header text** field, define the header text to appear in the pop-up.
3. In the **Currency** field, specify the currency in which you want to display the prices of the recommended products.
4. In the **Bottom text** field, define the copy you want to appear in this section.
5. In the **Font** field, define the font of all text displayed in the dynamic content.
6. Define the colors in the **Bottom bar background** and **Bottom bar text color** fields.
7. Choose the most suitable carousel scrolling method for you by enabling one or all toggles at the same time:
- **Carousel autoplay**: activation of this toggle allows automatic scrolling of items in the carousel;
- **Carousel loop**: activation of this toggle allows users to navigate to the first item in the carousel by clicking the arrow after the last item displayed in the carousel;
- Enabling these two options at the same time will combine these functionalities. In this case, the recommendation carousel will scroll automatically and return to the first item automatically after displaying the last one.
- If you don't activate any of the toggles, users will have to scroll through the carousel on their own, and when they get to the last item, it won't automatically redirect them to the beginning of the carousel.
8. In the following fields, define the item amount that you would like to display in small, medium, large and extra large screens.
7. After you make changes to the template, you can check the preview.
1. Click the **Preview Contexts** button on the upper left side.
2. Enter the ID of a customer and define the product context.
3. Click **Apply**.
If you are using custom attributes in your product feed, you need to replace the names of the standard attributes used in the template code with the names of the attributes used in your feed. In our case, we changed the names of following attributes (according to the custom attribute names used in our product feed):
- `link` -> `productUrl`
- `imageLing` -> `image`
- `title` -> `name`
- `item.price.value`-> `item.price`
- `item.salePrice.value` -> `item.salePrice`
4. If the template is ready, in the upper right corner click **Save this template > Save as**.
5. On the popup:
1. In the **Template name field**, enter the name of the template.
2. From the **Template folder** dropdown list, select the folder where the template will be saved.
3. Confirm by clicking **Apply**.
6. To continue the process of configuring the dynamic content campaign, click **Next**.
7. To save your content changes, click **Apply**.
### Define the second variant content
5. In the **Content** section, duplicate the **Variant A** tile.
6. On the template preview, click **Edit content**.
#### Edit the form in the Config tab
1. From the **Recommendation campaign** dropdown list, select the ID of the cross-sell recommendation campaign you created [in the previous step](#prepare-cross-sell-ai-recommendations). You can find it by typing its name or ID in the search box.
2. Make changes to the template according to your needs.
4. If the template is ready, in the upper right corner click **Save this template > Save as**.
5. On the popup:
1. In the **Template name field**, enter the name of the template.
2. From the **Template folder** dropdown list, select the folder where the template will be saved.
3. Confirm by clicking **Apply**.
6. To continue the process of configuring the dynamic content campaign, click **Next**.
7. To save your content changes, click **Apply**.
#### Configure the content variants AI engine allocation
1. Enable the **Make allocation automatically** toggle to let the AI engine allocate the content variants to customers.
2. In the **Optimization goal** section that appears, define the goal of dynamic content to **Maximize**.
3. To define the metrics of the goal, click **Define goal**.
1. To select an event, click **Choose event**. In our case we want the AI engine to consider the **Clicked dynamic content** event.
2. Confirm the settings by clicking **Apply**.
4. Click **Apply**.
You can find more information about AI-driven variant allocation and how to check its performance in [the "Enabling AI-driven variant allocation" section](/docs/campaign/dynamiccontent/creating-dynamic-content/creating-dynamic-content#enabling-ai-driven-variant-allocation).
Example of how the traffic is divided among campaign variants and how those variants perform
### Define schedule and display settings
1. In the **Schedule** section, click **Define** and set the time when the message will be active.
2. In the **Display Settings** section, click **Define**.
3. Specify circumstances for dynamic content to be displayed. Optionally, you can also define the Advanced options.
4. Click **Apply**.
5. Optionally, you can define the UTM parameters and additional parameters for your dynamic content campaign.
6. Click **Activate**.
## What's next
---
After launching the campaign, you can check and export the results — see which variant won, view the conversion probability, and more. In addition, Variant optimizer generates a `variant.assign` event, which can be used to create your own analytics or dashboards.
Example of how the traffic is divided among campaign variants and how those variants perform
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of each step from this use case in our Synerise Demo workspace:
- [Aggregate](https://app.synerise.com/analytics/aggregates/8b2c2e9e-24e0-30ff-aca6-a9f024a99306)
- [Similar Recommendation](https://app.synerise.com/ai-v2/recommendations/CWP9JaQ05YAB)
- [Cross-sell Recommendation](https://app.synerise.com/ai-v2/recommendations/wE6iwEZvqwsg)
- [Dynamic content](https://app.synerise.com/campaigns/dynamic-content/create/98b9ba9e-2b6c-4aeb-9dd5-dcb7f4a29a7a)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 7 events per profile that completes the flow:
[`product.addToFavorite`](/docs/assets/events/event-reference/items#productaddtofavorite) (~1), [`variant.assign`](/docs/assets/events/event-reference/search#variantassign) (~1), [`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Dynamic content template builder](/docs/campaign/dynamiccontent/creating-dynamic-content-templates/dynamic-content-template-builder)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Abandoned search scenario
Recover customers who have abandoned their search. When customers conduct a search on your website without adding any items to their cart, this is known as search abandonment. When a customer doesn’t complete a purchase, send an email with products related to the phrase they searched.
This use case describes how to prepare an automated workflow that is triggered by customer searching a specific phrase and sends them an email with an offer based on the abandoned search after 48 hours. One of the challenges addressed in this use case is the use of outgoing integration.
## Prerequisites
---
- [Implement AI search](https://hub.synerise.com/api-reference/ai-search) in any of your channels (mobile app, website, and so on).
- Match customers using search in any of your channels with their emails. To do so, we suggest to implement customer identification [on the website](/developers/web/tracking-form-data) and [in your mobile app](/developers/mobile-sdk/user-identification-and-authorization).
- [Create an email account](/docs/campaign/e-mail/configuring-email-account).
- [Create an email template](/docs/campaign/e-mail/creating-email-templates).
## Prepare a workflow
---
Create a workflow which sends your customers an email offer with the products from their abandoned AI search. Optionally, you can add additional nodes, depending on your business needs.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Profile Event trigger node
At this stage, we will configure conditions that launch the workflow. As a trigger, we will use the `item.search` event.
1. As the first node of the workflow, add **Profile Event**. In the configuration of the node:
1. From **Choose event** dropdown menu, choose `item.search` event.
`item.search` is an event that our system generates automatically, when our AI search is implemented somewhere in any of your channels, when customer searches for a phrase. It contains `query` parameter which stores the phrase entered by customer.
2. Confirm by clicking **Apply**.
### Configure the Event Filter node
This node will set the workflow to wait for 48 hours for customer conversion (`product.buy`). If the purchase is made, then the workflow ends. If it doesn't happen, the workflow moves on because the customer meets the abandoned search scenario. This setting is just an example and can be configured according to your business needs.
1. As the next node, add **Event Filter**. In the configuration of the node:
1. In the **Check** field, from the dropdown menu choose **for period of time**.
2. Set the time range. In our case, it is 48 hours.
3. In the **Define conditions** field, from the **Choose event** dropdown menu, choose `product.buy` event.
2. Confirm by clicking **Apply**.
3. For the **Matched** path, add the **End** node .
### Configure the Outgoing Integration node
In this step, we will use the phrase that the customer has searched for (it is stored as a `query` event parameter in the trigger) to send a request to AI search for products related to this phrase. In further steps, we will use these products in the email which will be added to it through a dynamic insert. You can find the method to retrieve products related to the phrase [at this link](https://hub.synerise.com/api-reference/ai-search#operation/SearchAutocompletePost).
In order to create a request, we configure a custom webhook by defining the Endpoint URL, body request, and so on. This action allows you to send requests from Synerise to external systems.
1. To the **Not matched** path, add **Outgoing Integration**. In the configuration of the node:
1. Choose **Custom webhook**.
2. Name the webhook. In our case `get search result`.
3. In **Webhook event name**, click **Create event** and create a new event:
1. As **Name**, enter `search.ai.abandoned`
2. As **Display name**, enter `Abandoned AI search`
3. In the **URL** section, next to **POST**, type the endpoint of request: `https://api.synerise.com/search/v2/indices/{indexId}/autocomplete`, where `{indexId}` is the ID of your AI search index.
4. In the **Headers** section, click **Add header**. In the first field type `x-api-key`, and in the second, enter the tracker key from your [tracking code](/developers/web/installation-and-configuration).
5. In the **Body** section add the following JSON frame with Jinjava code:
{
"query": "{{event.params.query}}",
"limit":6
}
**Where:**
| Phrase | Explanation |
|------------ |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `query` | this is the phrase the customer used in their search, taken from the event triggering the workflow -
`item.search`. To insert this phrase dynamically we used [an insert](/developers/inserts/automation#event-parameters). |
| `limit` | this phrase limits how many products the customer will receive. |
6. Leave **None** as the the method of authorization.
2. Confirm by clicking **Apply**.
Outgoing Integration configuration
### Configure the Event Filter node
This node will allow you to use the products returned by the AI search in the previous step, to send an email with those products. The data of the returned products will be included in the parameters of the `search.ai.abandoned` event.
1. As the next node, add **Event Filter**. In the configuration of the node:
1. In the **Define conditions** field, from the **Choose event** dropdown menu, choose the `search.ai.abandoned` event.
2. Confirm by clicking **Apply**.
### Configure settings for email
1. As the next node, add **Send Email**. Configure it according to your business needs.
2. Configure the sender details section.
3. Configure the Content section.
1. In the **Subject** field, enter your message subject.
2. In the **Template** section, choose the template email template prepared earlier.
3. You can define **UTM & URL parameters**.
4. Confirm by clicking **Apply**.
You need to enrich your email template with products related to the phrase your customer searched. To do so, use [Jinjava code](/developers/inserts/automation#event-parameters) and correlate it with parameters from the `search.ai.abandoned` event.
### Add the finishing node
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
**Result**:
The workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
You can also check the [workflow configuration](https://app.synerise.com/automations/automation-diagram/b4661379-1a4e-4b32-a8c9-fd3aede43cdc) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 11 events per profile that completes the flow:
[`item.search`](/docs/assets/events/event-reference/search#itemsearch) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~4), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), `search.ai.abandoned` (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1).
## Read more
---
- [Automation inserts](/developers/inserts/automation)
- [Creating workflows](/docs/automation/creating-automation)
- [Outgoing Integration](/docs/automation/actions/webhook-node)
# Suggest items more expensive than customer's average purchase
AI search is a type of search engine that uses artificial intelligence to understand the user’s intent and provide the most relevant results. Synerise AI search, lets you manage the behavior of the search engine for example by promoting specific products or adding specific circumstances, and also try out various configurations of the search engine by [A/B tests](/docs/ai-hub/ai-search/configuring-ab-test).
AI Search not only can search relevant products in the feed based on custom rules but also provides the possibility of applying personalization and filters which can contain dynamic customer attributes such as aggregates and expressions.
This use case describes the process of calculating the average value of purchased items for a specific customer. Knowing this value, you will proceed to create a rule to present in the search results only those items whose price is above the average value a customers spent in the lat 30 days.
## Prerequisites
---
- Enable [the AI Search Engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-search) for your workspace.
- Create and configure [search index](/docs/ai-hub/ai-search/create-index) and in the [filterable attributes](/docs/ai-hub/ai-search/define-attributes#filterable-attributes) add `Price.Value` as a range attribute.
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- [Implement AI search](https://hub.synerise.com/api-reference/ai-search) in any of your channels (mobile app, website, and so on).
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate](/use-cases/query-filtering#create-an-aggregate) to calculate the average value a customer spent in the last 30 days.
2. [Create a query rule](/use-cases/query-filtering#create-a-query-rule) (based on the aggregate created in the first step) that enforces showing in the search results only more expensive products than customer's average purchase in the last 30 days.
## Create an aggregate
---
In this part of the process, create an aggregate that returns the average value of products bought by an individual customer.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Average**.
4. From the **Choose event** dropdown list, select the `product.buy` event.
5. As the event parameter, select **$finalUnitPrice**.
6. Define the period from which data will be analyzed. In our case it will be last 30 days.
7. Save the aggregate.
Aggregate settings
## Create a query rule
---
In this part of the process, create a query rule based on the [aggregate](/use-cases/query-filtering#create-an-aggregate) created in the previous step. The rule will enforce showing in search results only the products which are more expensive than the average purchase of a customer.
1. Go to **AI Hub > Indexes**.
2. Select an index from the list.
3. Go to the **Rules** section.
4. On the right side of the screen, click **Add rule**.
5. Name the rule.
6. To adjust the query conditions, in the **Conditions** section, click **Define**.
1. Choose the **All queries** tab.
2. Click **Apply**.
7. To define how the search engine reacts to the defined conditions, in the **Consequences** section, click **Define**.
1. Click **Add consequence** and choose **Filter query results** from the dropdown list.
9. From the **Attribute** dropdown list, choose `Price.Value`.
10. Choose the **More than** operator.
10. In the left field, click the **T** icon and from the dropdown list, select **Aggregate**.
11. From the list, choose [aggregate](/use-cases/query-filtering#create-an-aggregate) created in the previous step.
12. Enable the **Mark as elastic** option to make sure that the products more expensive than average value of products bought by a specific customer appear at the top of the search results. If you do not activate this option, search results will show only those products.
13. Click **Apply**.
8. In the **Schedule** section, you can define when the query rule applies.
8. Click **Save & Publish**.
Query rule settings
## Check the use case set up on the Synerise Demo workspace
---
You can check the [aggregate](https://app.synerise.com/analytics/aggregates/869e7abf-f235-3614-af7c-69b22ad88175) and [query rule settings](https://app.synerise.com/ai-v2/search/indices/98167fa2726dc2460deb41870c0e6d1c1729168383/query-rules/35599) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 2 events per profile that completes the flow:
[`item.search`](/docs/assets/events/event-reference/search#itemsearch) (~1), [`item.search.click`](/docs/assets/events/event-reference/search#itemsearchclick) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [AI Search](/docs/ai-hub/ai-search)
# Promote a brand in recommendations
You can tweak the results of recommendations by increasing the probability of certain brands appearing in the recommendation frames. Thanks to this, you can offer a brand to promote their items more often than those from their competition.
This can be done by using **recommendation boosting** to promote items from those brands. Boosting rules are built using the same editor as the filters, but unlike filtering, boosting does not entirely exclude items that do not meet the conditions - it only tells the AI model to assign more weight to the `brand` parameter when calculating the final recommendation score (relevance to a particular customer) of an item.
This is different from the [AI-Powered Personalized Brand Recommendations on Category Pages](/use-cases/personalized-brand-reco) use case, in which the other brands are completely removed from the recommendation.
In this use case example, items from two brands will be promoted in the recommendation results.
## Prerequisites
---
- **Recommended**: Become familiar with [creating recommendations](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign).
This article does not explain every step of creating a recommendation in detail.
- The item catalog must include an attribute that denotes the brand; the brands you want to promote must exist in that attribute's values.
## Creating the recommendation
---
### Choose source, type, and add slots
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. In the **Type & Items feed** section:
1. Select an item catalog.
2. Select a recommendation type.
Boosting can be used with all recommendation types.
3. Click **Apply**.
3. In the **Items** section, configure at least one slot and click **Apply**.
### Build the boosting rule
In this part of the process, you build a rule that promotes an item if its brand is **XYZ** or **ABC** (brand names in filters are not case-sensitive).
1. In the **Boosting** section, click **Define**.
2. Click **Add rule**.
3. Click **Define rule** and select **Visual Builder**.
**Result** The Visual Builder window opens.
4. From the **Select attribute** drop-down list, select the brand attribute.
You can use the search field.
5. From the **Operator** drop-down list, select **Equals**.
6. From the **Select value** drop-down list, select **xyz**.
7. Click **Add filter**.
8. Leave the operator between the filters at default (**OR**).
9. Add the filter for brand **abc** by repeating steps 4-6 and selecting **abc** as the value in step 6.
10. Click **Apply**.
11. In the **Promote/Demote** selector, select **Promote** (default value).
12. Use the slider to adjust how much you want the rule to affect the results.
The boosting strength slider
13. Save the **Boosting** section settings by clicking **Apply**.
After applying the settings, you can use the **Preview** tab (available in the upper left part of the recommendation creator screen) to see how your rule changed the recommendation result. If necessary, you can return to the settings and adjust the boosting strength to meet your expectations.
A boosting filter that matches one of two brands
### Additional settings and saving
1. Configure the **Additional settings** section and click **Apply**.
2. Save the recommendation.
## What's next
---
You can use the ID of the recommendation and [inject it with a snippet](/docs/assets/snippets) in other types of communication, such as:
- [dynamic content](/docs/campaign/dynamiccontent) - this way you can show the recommendations on your website.
- [email](/docs/campaign/e-mail) - this way you can send out recommended items through emails.
- mobile application - you can use [documents](/docs/assets/documents) to build your own mobile app and show the recommended items.
- [mobile push](/docs/campaign/Mobile) - you can send recommendations through notifications in your mobile application.
- [web push](/docs/campaign/Webpush) - this way you can send notifications to your customers through a web browser.
- [SMS](/docs/campaign/SMS) - this way you can reach your customers with recommendations on their mobile.
## Check the use case set up on the Synerise Demo workspace
---
In the Synerise Demo workspace, you can check:
- [Recommendation campaign settings](https://app.synerise.com/ai-v2/recommendations/Bn6BCxXNL2aX)
- [Email campaign](https://app.synerise.com/campaigns/create/5a0afcb8-bf8d-46a0-b7e5-a65fd4edd509)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Predictions](/docs/ai-hub/predictions)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Promoting customer favourite brands in search results
The main goal of AI search engine is to provide the best possible experience for the customer. That means delivering relevant and accurate results for their queries, whether they’re looking for information or looking to make a purchase. To that end, you should improve the customer experience on your site. One way is to use [A/B tests](/docs/ai-hub/ai-search/configuring-ab-test) and check whether the used filters have a positive effect on conversions.
Another way we can optimize search engine is by promoting products customer might actually like in the search results - for example those from their favorite brands.
Knowing that customers often use search engines when they’re shopping online, you should make sure that they can easily find the brands they like. Boosting search results with customer favorite brands makes it easier for customers to find the products they could be interested in and makes their shopping experience more enjoyable. In this way, you not only promote specific brands in the search results, but also personalize customer experience and make customers more satisfied.
In this use case, you will create an aggregate that returns 5 favorite brands. In the further part of the process, you will proceed to create a rule to present in the top of the search results items from the brands most often bought by the specific customer during last year.
## Prerequisites
---
- Enable [the Search Engine](/docs/ai-hub/ai-search/introduction-to-ai-search#configuring-ai-search) for your workspace.
- Create and configure [search index](/docs/ai-hub/ai-search/create-index) and in the [filterable attributes](/docs/ai-hub/ai-search/define-attributes#filterable-attributes) add `Brand` as an attribute.
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- [Implement AI search](https://hub.synerise.com/api-reference/ai-search) in any of your channels (mobile app, website, and so on).
### Process
---
1. [Create an aggregate](/use-cases/query-filtering-brand#create-an-aggregate) that returns the customer's 5 most frequently purchased product brands.
2. [Create a query rule](/use-cases/query-filtering-brand#create-a-query-rule) which promotes products from customers' favorite brands at the top of search results.
## Create an aggregate
---
In this part of the process, create an aggregate that returns customer's 5 most frequently purchased product brands during last year.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Top Multi**, and set the size to `5`.
4. From the **Choose event** dropdown list, select the **product.buy** event.
5. As the event parameter, select **brand**.
6. Define the period which the aggregate will analyze. In this case it will be 1 last year.
7. Save the aggregate.
Configuration of the aggregate
## Create a query rule
---
In this part of the process, create a query rule which promotes products from customer' 5 favorite brands at the top of search results.
1. Go to **AI Hub > Indexes**.
2. Select an index from the list.
3. Go to the **Rules** section.
4. On the right side of the screen, click **Add rule**.
5. Name the rule.
6. To adjust the query conditions, in the **Conditions** section, click **Define**.
1. Choose the **All queries** tab.
2. Click **Apply**.
7. To define how the search engine reacts to the defined conditions, in the **Consequences** section, click **Define**.
1. Click **Add consequence** and choose **Filter query results** from the dropdown list.
9. From the **Attribute** dropdown list, choose `Brand`.
10. Choose the **In** operator.
10. In the left field, click the **T** icon and from the dropdown list, select **Aggregate**.
11. From the list, choose [aggregate](/use-cases/query-filtering-brand#create-an-aggregate) created in the previous step.
12. Enable the **Mark as elastic** option, to make sure that the products from favorite brands appear at the top of search results. If you do not activate this option, search results will show only products from favorite brands.
13. Click **Apply**.
8. In the **Schedule** section, define when the query rule applies.
8. Click **Save & Publish**.
Query rule settings
## Check the use case set up on the Synerise Demo workspace
---
You can check the [aggregate](https://app.synerise.com/analytics/aggregates/a9adc80b-026b-3de6-9f33-215f289a6599) and [query rule settings](https://app.synerise.com/ai-v2/search/indices/98167fa2726dc2460deb41870c0e6d1c1729168383/query-rules/33492) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 2 events per profile that completes the flow:
[`item.search`](/docs/assets/events/event-reference/search#itemsearch) (~1), [`item.search.click`](/docs/assets/events/event-reference/search#itemsearchclick) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [AI Search](/docs/ai-hub/ai-search)
# Apply synonyms in the search engine
With Synerise AI search, you can effectively control how your search engine processes queries. By using synonyms, you can increase the reach of your products and make sure that customers always find what they are looking for.
This use case describes the process of creating synonyms for a headphones query.
## Prerequisites
---
- An item feed must be provided.
- Enable [The Search Engine](/docs/ai-hub/ai-search/introduction-to-ai-search) for your workspace and create an [index](/docs/ai-hub/ai-search/create-index).
- [Implement AI search](https://hub.synerise.com/api-reference/ai-search) in any of your channels (mobile app, website etc.)
## Add synonyms
---
In this use case, you add synonyms to a set of words: **headphones, headsets, earphones** so that when a user types any of these words into a search engine, they are all treated as synonyms of each other and will produce relevant search results.
1. Go to **AI Hub > Indexes**.
2. Select an index from the list.
3. Click the **Synonyms** tab.
4. Click **Add synonym > Add synonym**.
5. From the dropdown list, select **Two ways**.
5. In the **Synonyms** field, enter: `headphones, headsets, earphones`
In this configuration, each word in the list a synonym of the other words.
6. Confirm by clicking **Add**.
Example of synonym conditions
You can also import synonyms from a CSV file, follow instructions in the ["Add synonyms"](/docs/ai-hub/ai-search/add-synonyms#procedure) article.
## Check the use case set up on the Synerise Demo workspace
---
You can check the synonyms in [AI Search configuration](https://app.synerise.com/ai-v2/search/indices/bf68c73a3c0adae495e3dc67c8eb9b9a1657485148/synonyms) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 2 events per profile that completes the flow:
[`item.search`](/docs/assets/events/event-reference/search#itemsearch) (~1), [`item.search.click`](/docs/assets/events/event-reference/search#itemsearchclick) (~1).
## Read more
---
- [Configuring AI Search](/docs/ai-hub/ai-search/introduction-to-ai-search#configuring-ai-search).
# Promoting new items when a certain phrase is searched
AI Search Engine enables creating rules which can help you promote items with specific attributes, based on the searched phrase. One of the applications is to create a rule which shows new products to customers based on selected phrases.
This use case will help you create a rule in AI Search that promotes new models of TVs when the customer is searching for a TV.
## Prerequistes
---
- An item feed must be provided.
- Enable [the search engine](/docs/ai-hub/ai-search/introduction-to-ai-search) for your workspace and create an [index](/docs/ai-hub/ai-search/create-index).
- Add an attribute which marks items as new in your items catalog and add this attribute to filterable attributes. In this example, the attribute is the value "new" in the `G:adwords_labels` attribute.
- [Implement AI search](https://hub.synerise.com/api-reference/ai-search#tag/Search) in any of your channels (mobile app, website etc.).
## Create a rule
---
1. Go to **AI Hub > Indexes**.
2. Select an index from the list.
3. Go to the **Rules** section.
4. Click **Add Rule**.
5. Name the rule. In this case, it's "Promote new TVs".
6. To adjust the query conditions, in the **Conditions** section, click **Define**.
1. On the **Query** tab, to define the method of checking the query, choose **If query is**.
2. Click **Add phrase**.
3. Enter a phrase. You can do it in two ways:
- In text field, type a word (or a phrase) in a singular form.
- Next to the text field, click the button. From the dropdown list, select a facet. It is different from defining an exact query: you can define an attribute whose values the query looks for. For example, if you choose _brand_ as the facet, the query rule will apply its consequence whenever any brand name is detected in the query.
Example of phrases
4. If you want to add more phrases, repeat steps **b** and **c**.
5. Confirm the settings by clicking the **Apply** button.
7. To define how the search engine reacts to the defined conditions, in the **Consequences** section, click **Define**.
1. Click **Add consequence**.
2. From the dropdown list, select a consequence, in this case **Filter query results**.
3. Add filter and choose attribute **G: adwords_labels**.
The attribute can have a different name in your workspace, the above is an example.
4. In the next field choose **new**.
5. Enable the **Mark as elastic** option.
Example of condition consequences
6. Confirm by clicking **Apply**.
8. To define when the query rule applies, in the **Schedule** section, click **Define**.
1. Select an option:
- To launch query rules immediately, click **Active immediately**.
- To schedule the rules at specific time, click **Scheduled**. Set the schedule according to your business needs.
3. Confirm by clicking **Apply**.
8. To complete working on the query rule, you can either:
- Save it as a draft by clicking **Finish later**.
- Save and activate it by clicking **Publish**.
**Result:** If you chose **Publish** the rule will take effect in those areas where AI search has been implemented, according to the schedule you set.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [rule configuration](https://app.synerise.com/ai-v2/search/indices/2891e883b914a485c4f3f98b37b652271657484874/query-rules/14434) directly in Synerise demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 2 events per profile that completes the flow:
[`item.search`](/docs/assets/events/event-reference/search#itemsearch) (~1), [`item.search.click`](/docs/assets/events/event-reference/search#itemsearchclick) (~1).
## Read more
---
- [Configuring AI Search](/docs/ai-hub/ai-search/introduction-to-ai-search#configuring-ai-search)
- [Rules in AI Search](/docs/ai-hub/ai-search/query-rules)
# Manage loyalty points expiration with rolling logic
In many loyalty programs, points remain valid only for a limited period of time. To manage this process effectively, it is important to accurately calculate when points expire and update customer balances accordingly.
There are two common approaches to handling point expiration. The first is rolling cancellation, where each points-earning event has its own expiration date calculated from the moment the points were awarded. The second is batch expiration, where points are removed periodically for the entire customer base according to predefined rules.
In this use case, we focus on the more flexible rolling expiration model, in which points expire individually after a defined validity period. This approach allows you to maintain accurate point balances, monitor expiring points continuously, easily modify point expiration rules, and proactively inform customers about upcoming point reductions.
#### Use case assumptions
The expiration mechanism can be configured in many different ways depending on business requirements. For the purpose of this use case, we assume the following setup:
- Loyalty points are awarded through the `points.loyalty` event based on the `transaction.charge` event which generates the points. Optionally, you can implement other loyalty point-earning events for different actions (such as completing a survey, newsletter subscription, fast order pickup etc).
- Points can be spent on rewards through the `client.activatePromotion` event.
- The default retention of the two above mentioned events is set to 30 days, however we recommend to change it to infinite.
- Each point-earning event can have its own configurable expiration time, however in this case we assume that points which have not been redeemed expire after 6 months (182 days) from the moment they are awarded.
- Expired points are recorded with the `points.expire` event generated by workflow and later used in expressions calculating the current balance.
- The expiration process runs daily.
## Prerequisites
---
Integrate mechanism for awarding loyalty points. With the help of Synerise support implement the `points.loyalty` and `client.activatePromotion` events, as well as necessary custom loyalty events.
Find more in the [Loyalty programs basics](/use-cases/loyalty-programs-basics) use case.
## Security configuration
---
Before you start working with this hub, if you are a Synerise customer or partner, consider reading [the section about denylisting events](/docs/settings/tool/api#denylist). This natively accessible configuration will allow you to manage the restrictions in points management that may help you prevent fraud.
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate summing collected points](/use-cases/rolling-points-expiration#create-an-aggregate-summing-collected-points).
2. [Create an aggregate summing expired points](/use-cases/rolling-points-expiration#create-an-aggregate-summing-expired-points).
3. [Create an aggregate summing points redeemed on promotions](/use-cases/rolling-points-expiration#create-an-aggregate-summing-points-redeemed-on-promotions).
4. [Create an aggregate summing all points are to potentially expire](/use-cases/rolling-points-expiration#create-an-aggregate-summing-all-points-that-are-to-potentially-expire).
5. [Create an expression summing aggregates with all lost points](/use-cases/rolling-points-expiration#create-an-expression-summing-aggregates-with-all-lost-points)
6. [Create an expression calculating current point balance](/use-cases/rolling-points-expiration#create-an-expression-calculating-current-point-balance)
7. [Create an expression calculating points to expire](/use-cases/rolling-points-expiration#create-an-expression-calculating-points-to-expire)
8. [Create a segmentation of customers with points to expire](/use-cases/rolling-points-expiration#create-a-segmentation-of-customers-with-points-to-expire)
9. [Create a workflow](/use-cases/rolling-points-expiration#create-a-workflow)
## Create an aggregate summing collected points
---
Start with creating an aggregate which returns the sum of points for the `points.loyalty` event. We recommend setting the analyzed period to **Lifetime**. The result of the aggregate will be used in an expression calculating current point balance.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate.
4. Click **Analyze profiles by** and select **Sum**.
5. Select the `points.loyalty` event.
6. As a parameter, choose `points`.
7. Set the analyzed period to **Lifetime**.
8. Click **Save**.
The configuration of an aggregate summing all points.loyalty events in a customer’s lifetime
## Create an aggregate summing expired points
---
In this part of the process, create an aggregate which returns the sum of expired points based on the `points.expire` event. We recommend setting the analyzed period to **Lifetime**. The result of the aggregate will be used in an expression calculating all lost points.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate.
4. Click **Analyze profiles by** and select **Sum**.
5. Select the `points.expire` event.
6. As a parameter, choose `points`.
7. Set the analyzed period to **Lifetime**.
8. Click **Save**.
The configuration of an aggregate summing all points.expire events in a customer’s lifetime
## Create an aggregate summing points redeemed on promotions
---
In this stage of the process, create an aggregate that counts the sum of redeemed points based on `client.activatePromotion` event. We recommend setting the analyzed period to **Lifetime**. The result of the aggregate will be used in an expression calculating all lost points.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate.
4. Click **Analyze profiles by** and select **Sum**.
5. Select the `client.activatePromotion` event.
6. As the event parameter, select `promotionRequireRedeemedPoints`.
7. Set the analyzed period to **Lifetime**.
8. Click **Save**.
The configuration of an aggregate summing all client.activatePromotion events in a customer’s lifetime.
## Create an aggregate summing all points that are to potentially expire
---
In this step, create an aggregate that returns the total number of loyalty points awarded more than 182 days ago based on the `points.loyalty` event. These points may have reached the expiration threshold and could potentially expire at the time of calculation.
The analyzed time range is set from 20 years ago up to 182 days before today. This allows the aggregate to include all historical point-earning events that are old enough to be considered for expiration. Since the system does not allow setting an infinite time range, 20 years is safe to use instead of lifetime.
The result of this aggregate will be used later in an expression that calculates how many points should expire.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate.
4. Click **Analyze profiles by** and select **Sum**.
5. Select the `points.loyalty` event.
6. As a parameter, choose `points`.
7. Set the analyzed period to last **20 years** before **182 days**.
8. Click **Save**.
The configuration of an aggregate summing all points.loyalty historical events up to the date points are to potentially expire in 6 months
## Create an expression summing aggregates with all lost points
---
In this part of the process, prepare an expression which is a sum of two aggregates created in the previous steps: [aggregate summing expired points](#create-an-aggregate-summing-expired-points) and [aggregate summing redeemed points](#create-an-aggregate-summing-points-redeemed-on-promotions).
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. From the **Expressions for** dropdown list, select **Attribute**.
3. Build the following formula of the expression:
Formula of an expression summing up aggregates with all lost points
4. Save the expression.
## Create an expression calculating current point balance
---
In this part of the process, prepare a current point balance expression by substracting lost points (the sum of [aggregate summing expired points](#create-an-aggregate-summing-expired-points) and [aggregate summing redeemed points](#create-an-aggregate-summing-points-redeemed-on-promotions)) from all points gathered ([aggregate summing collected points](#create-an-aggregate-summing-collected-points)).
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. From the **Expressions for** dropdown list, select **Attribute**.
3. Build the following formula of the expression:
Formula of an expression calculating the current point balance
5. Save the expression.
## Create an expression calculating points to expire
---
In this part of the process, we create a formula that will tell how many points should be counted as expired, taking into account that some of them may already have been used on rewards. The result of this expression will be used in the segmentation of customers whose points should expire.
This expression is based on the condition that if the number of collected points returned by the [aggregate summing all points that reached the expiration threshold](#create-an-aggregate-summing-all-points-that-are-to- potentially-expire) is equal to or lower than the results of the [expression summing aggregates with all lost points](#create-an-expression-summing-aggregates-with-all-lost-points) which includes all points already deducted from the balance up to this moment (in this case, up to 6 months ago), then we assume that all points eligible for expiration have already been redeemed or expired. In this case, the expression returns 0.
Otherwise, we subtract the value of the [expression summing aggregates with all lost points](#create-an-expression-summing-aggregates-with-all-lost-points) from the result of the [aggregate summing all points that reached the expiration threshold](#create-an-aggregate-summing-all-points-that-are-to-potentially- expire). The returned value equals the number of points that should expire.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. From the **Expressions for** dropdown list, select **Attribute**.
3. Build the following formula of the expression:
Formula of an expression calculating points to expire
4. Save the expression.
## Create a segmentation of customers with points to expire
---
In this step, create a segment of users who have loyalty points eligible for expiration. This segment will serve as the audience for the daily workflow responsible for generating the `points.expire` event.
The segmentation is based on the following conditions:
- The user received loyalty points at least 182 days ago. In this simplified example, we check the occurrence of the `points.loyalty` event. If your loyalty program awards points through multiple events, you can include them using the OR operator.
- The result of the [expression calculating points to expire](#create-an-expression-calculating-points-to-expire) is greater than 0.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation.
3. Choose **Add condition**.
4. From the dropdown list, choose the `points.loyalty` event.
5. As a parameter, choose `points`.
6. Select the **More than** operator.
7. In the left field, leave the **#** icon and enter `0` in the value field.
8. Using the date picker in the lower-right corner, set the time range to **Last 24 hours before 182 days**.
9. Choose **Add condition** once again.
10. From the dropdown list, choose the [expression calculating points to expire](#create-an-expression-calculating-points-to-expire) you have created in the previous part of the process.
11. Select the **More than** operator.
12. In the left field, leave the **#** icon and enter `0` in the value field.
13. Save the segmentation.
The configuration of a segmentation of users who have points to expire
## Create a workflow
---
In this part of the process, you will create a simple workflow that runs daily, preferably shortly after midnight.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the trigger node
---
The workflow is triggered for customers who belong to the [segmentation](#create-a-segmentation-of-customers-with-points-to-expire) created in the previous step every day at a defined time.
1. As the first node, add the **Audience** node.
2. In the configuration of the node, set the **Schedule** option to **Repeat runs**.
3. Select the correct time zone.
4. Set the interval to 1 per day.
5. Choose the day and time when the process starts. We recommend scheduling it a few seconds (5–10) after midnight.
6. In **Define audience**, choose **Segments**, click **Select segments** and select the [segmentation](#create-a-segmentation-of-customers-with-points-to-expire) created in the previous step.
7. Click **Apply**.
The configuration of Audience node
### Define the Generate Event node
---
1. Add the **Generate Event** node. In the node settings:
1. In the **Event name**, enter `points.expire`.
2. In the **Body section**, use the following Jinjava, entering the UUID of the [expression calculating points to expire](#create-an-expression-calculating-points-to-expire) which allows to dynamically generate events with points number personalized for each user.
The result of such action will be such an event:
The view of the points.expire event on customer's profile
2. Click **Apply**.
The configuration of Generate Event node
### Add the finishing node
---
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
The configuration of the workflow for expiring points
## What's next
---
Once the rolling expiration mechanism is configured, you can extend this setup with additional communication scenarios.
For example, you can create a campaign that informs customers in advance about points that will expire soon. Sending a notification a few days or weeks before the expiration date helps customers use their points before they disappear.
Such communication can include personalized information about the number of points that will expire and highlight rewards or promotions where those points can be redeemed. This approach not only improves the customer experience but also increases engagement with the loyalty program and can boost the number of transactions.
## Check the use case set up on the Synerise Demo workspace
---
You can check all the analytics directly in the Synerise Demo workspace:
- [Aggregate returning the sum of collected loyalty points](https://app.synerise.com/analytics-v2/aggregates/2d104df4-9de2-378e-ad28-1e3e70b66a23)
- [Aggregate returning the sum of expired loyalty points](https://app.synerise.com/analytics-v2/aggregates/65310b9f-ec28-3317-8292-215891bb26a7)
- [Aggregate returning the loyalty points redeemed on promotions](https://app.synerise.com/analytics-v2/aggregates/2d7417d3-38ce-3704-9cea-9940cdb4d8aa)
- [Aggregate returning the sum of points that are potentially to expire](https://app.synerise.com/analytics-v2/aggregates/053abceb-b1a3-32f2-b960-fed98a97e4fa)
- [Expression returning the sum of aggregates with all lost points](https://app.synerise.com/analytics/expressions/23785c1e-9093-48cf-8c83-6b4f6099689e)
- [Expression calculating current point balance](https://app.synerise.com/analytics/expressions/66fa052f-434c-4a54-901f-0c7483c38160)
- [Expression calculating points to expire](https://app.synerise.com/analytics/expressions/8dfe993d-f84f-4608-a936-4f83a6d9acfa)
- [Segmentation of customers with points to expire](https://app.synerise.com/analytics-v2/segmentations/f616b0d0-d615-4f4a-af6c-4907d33f5b4a)
- [Workflow for expiring points](https://app.synerise.com/automations/workflows/automation-diagram/0c21290d-cdeb-4493-a83b-90a8db22d0b6)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per profile that completes the flow:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), `points.expire` (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Expressions](/docs/crm/expressions)
- [Segmentations](/docs/analytics/segmentations)
- [Audience node](/docs/automation/triggers/audience-node)
- [Generate Event node](/docs/automation/actions/send-client-event)
- [End node](/docs/automation/flow-control/end-node)
- [Loyalty events](/docs/assets/events/event-reference/loyalty)
Check our other [loyalty use cases](/use-cases/?ordering=DESC&sortBy=publishDate&filters=tags%3D%3D%22loyalty%22)
# Predict churn
Churn prediction is a business strategy that involves identifying customers who are likely to stop using a product or service in the near future. Churn prediction can help businesses reduce customer churn rates, increase customer loyalty, and improve overall business performance. With the Prediction feature you can create predictive models that accurately forecast customer behavior, enabling you to take targeted actions to reduce churn and improve customer satisfaction.
In this use case, we will create a prediction which will help us identify customers likely to churn. As the prediction target we will use an expression with the segmentation of customers who had a transaction and have not visited our page in the last 30 days.
Churn prediction
## Prerequisites
---
- [Integrate JS SDK](/developers/web/installation-and-configuration).
- [Enable the Custom prediction model](/docs/ai-hub/predictions/enabling-predictions#enabling-regression-and-classification-predictions).
## Process
---
In this use case, you will go through the following steps:
1. [Create a segmentation](#create-a-segmentation).
2. [Create an expression](#create-an-expression).
2. [Create a prediction](#create-a-prediction).
## Create a segmentation
---
In this step, we create a group of customers who have made at least one transaction but have not visited the site in the last 30 days. This segmentation will be used in an expression in the next step.
1. Go to **Decision Hub > Segmentations > New Segmentation**.
2. Optionally, switch the **Show in profile card** toggle on.
3. Enter the name of the segmentation.
4. From the **Add condition** dropdown list, select the `transaction.charge` event.
Events may have different labels between workspace, but you can always find them by their action name (in this step, it's **transaction.charge**).
5. Using the date picker in the lower-right corner, set the time range to **Relative time range > More > Lifetime**.
6. From the **Add condition** dropdown list, select the `Visited page` event.
7. Change **Performed** action to **Not performed**.
8. Using the date picker in the lower-right corner, set the time range to **Relative time range > Custom > Last 30 days**.
9. Save the segmentation.
## Create an expression
---
In this part of the process, create an expression that will serve as the target for the prediction model. The expression will return `1` if a customer belongs to the previously defined segmentation and `0` if they don't.
10. Go to **Behavioral Data Hub > Expressions > New expression**.
11. Enter the name of the expression.
12. From the **Expressions for** dropdown list, select **Attribute**.
Predictions work only with attribute expressions.
13. In the formula creator, click the **Select** node and from the drop-down list select **Function > If**.
14. As the first argument, select the segmentation you created earlier.
15. As the second argument, select **Constant** and set its value to `1`.
16. As the third argument, select **Constant** and set its value to `0`.
16. Save the expression.
Configuration of the expression
## Create a prediction
---
1. Go to **(AI Predictions) Models > New prediction**.
2. In the upper-right corner, enter a name for the prediction.
3. In the **Prediction type** section, click **Define**.
4. Select **Classification** and click **Apply**
### Select the audience
In this section you decide which segment of the customers should be taken into account while making a prediction. For every individual in the segment, Synerise produces a single prediction.
Segmentations can be very complex and the possibilities of building the conditions are practically unlimited. In this example, a simple segmentation will include customers who have a marketing agreement.
1. In the **Audience** section, click **Define**.
You can use existing segmentations. This example shows how to create a new one.
2. Click **Choose segmentation > Create new**.
3. Enter a segmentation name and click **Next step**.
4. Click **Choose filter**, from the dropdown list, select **Attribute> Email agreement**.
5. From the **choose operator** dropdown list, select **Equal (String)**.
6. In the text field, enter `enabled`.
7. Click **Create segmentation**.
**Result**: The segmentation is saved as the audience of the prediction and also becomes available in the **Decision Hub** for other uses.
8. Click **Apply**.
Audience configuration.
### Select prediction target
1. In the **What would you like to predict?** section, click **Define**.
2. Click **Select expression** and select the [expression created earlier](#create-an-expression).
3. Click **Apply**.
### Select inputs
In this section, you set up input [features](/docs/glossary#feature) based on which the prediction model will be trained.
It is possible to select feature inputs manually, but we recommend using the automatic selection, as explained below. Our algorithms evaluate feature relevance in context of the prediction target and are, in most cases, more effective than manual selection.
1. In the **Model inputs** section, click **Define**.
2. Click **Add feature > Automatically**.
**Result:** The list is populated with input features.
3. Click **Apply**.
### Configure additional settings
The additional settings define how often re-calculations are made and the content of events produced by the prediction.
1. In the **Settings** section, click **Define**.
2. From the **How many days in advance do you want to make a prediction** list, select **30 days**.
3. In the **Calculation frequency** section, select **Recurring calculation**.
4. From the **How frequently should the model be trained?** list, select **30 days**.
5. In the **Prediction start** section, select **Immediately**.
6. In **How would you like to display results**, select **5-point scale**.
The algorithm detects the importance of a prediction.
7. In the **Define the value of the score name parameter** section, enter a user-friendly name for the prediction score.
The name is shown as the value of the `scoreName` parameter in the `snr.prediction.score` event.
8. Click **Apply**.
9. To finish and calculate the prediction, click **Save & Calculate**.
**Result:**
The prediction results are saved as `snr.prediction.score` events in customer profiles.
## What's next
---
You can use the prediction results in your work, for example to [Automated Emails for Customer Retention Using Churn Predictions](/use-cases/predictions-automation) or [Evaluate results of churn prediction](/use-cases/predictions-dashboard).
A more advanced example of using a segmentation created from a churn prediction is described in [Promote discounted items to customers at risk of churn](/use-cases/boost-discounts-for-churn-risk).
## Check the use case set up on the Synerise Demo workspace
---
You can check all configurations directly in Synerise Demo workspace:
- [Segmentation](https://app.synerise.com/analytics/segmentations/81b51633-7dea-4c03-9d6a-9e385d337085)
- [Expression](https://app.synerise.com/analytics/expressions/2f5a598f-56db-4aa3-914e-567ec5de135b)
- [Audience segmentation](https://app.synerise.com/analytics-v2/segmentations/bd85a7e3-6700-4367-9906-471811dd1c76)
- [Prediction](https://app.synerise.com/ai-v2/predictions/generic-scoring/bgycsoovxgby)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates 1 event per profile that completes the flow:
[`snr.prediction.score`](/docs/assets/events/event-reference/predictions#snrpredictionscore) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Expressions](/docs/crm/expressions)
- [Predictions](/docs/ai-hub/predictions)
- [Segmentation](/docs/analytics/segmentations)
# Managing campaigns with priorities and weekly contact limit
When multiple campaigns are running within a single week, a customer may qualify for more than the desired number of messages. Without proper control, this leads to over-communication and a poor customer experience.
This use case describes how to orchestrate five weekly campaigns across three priority levels while enforcing a maximum of three messages per customer per week. The mechanism ensures that the highest-priority campaigns are always delivered first (as long as the weekly limit allows), and lower-priority campaigns only go out if the weekly contact limit has not yet been reached.
The example in this use case uses five campaigns and a limit of three messages per week, but both values are fully configurable. You can adjust the number of campaigns, priority levels, and the weekly cap to match your business needs.
This use case focuses on the **mobile push** channel, but the same logic and architecture can be applied to other communication channels such as email, SMS, or web push.
The key principles of this approach are:
- Each campaign has an assigned priority level (high, medium, or low).
- Each campaign has a specific scheduled send date and time within the week.
- The system runs cyclically (every hour) and checks whether the current moment matches a campaign's planned send time.
- Before sending, the system verifies how many messages the customer has already received and how many higher-priority campaigns the customer still qualifies for.
- Once the weekly limit is reached, all remaining campaigns are blocked for that customer.
This approach separates the scheduling logic (when a campaign should go out) from the priority logic (which campaigns are most important), and combines both with a hard weekly cap.
## Prerequisites
---
- Implement [tracking code](/docs/settings/tool/tracking_codes) on your website.
- Implement [Synerise SDK in your mobile app](/developers/mobile-sdk).
- Configure [mobile push](/docs/campaign/Mobile) as a communication channel.
- Define the criteria used to qualify customers for each campaign. These can be based on behavioral events, customer attributes, segmentation rules, or any combination of conditions available in Synerise. The first step of this process involves [creating segmentations](#create-individual-campaign-segmentations) that define the audience for each campaign.
- Create a mobile push template that will be used later in workflows.
## Process
---
In this use case, you will go through the following steps:
1. [Create individual campaign segmentations](#create-individual-campaign-segmentations) — one per campaign, defining who qualifies.
2. [Create expressions](#create-expressions) — for current timestamp comparison and counting higher-priority campaign eligibility.
3. [Create workflows](#create-workflows) — one per priority group, running cyclically and sending mobile pushes when conditions are met. These must be created before aggregates so that you have the diagram IDs needed in the next step.
4. [Create aggregates for counting sent pushes](#create-aggregates-for-counting-sent-pushes) — to track how many messages each customer has already received per priority level and in total.
5. [Create priority-level segmentations with split audience](#create-priority-level-segmentations-with-split-audience) — one per priority group, combining campaign eligibility, send-time matching, and contact-limit checks.
## Create individual campaign segmentations
---
Create five separate segmentations, one for each campaign planned for the week. Each segmentation defines the audience that qualifies for a given campaign. The conditions can be based on any criteria available in Synerise — behavioral events, customer attributes, transactional data, or other segmentation rules.
In this example, the five campaigns and their priority assignments are:
- **Campaign A** (high priority): customers who recently made a high-value purchase (for example, order total above 500) — targeting premium buyers with an exclusive loyalty offer
- **Campaign B** (high priority): customers who abandoned their cart in the last 7 days — a recovery campaign with a time-limited discount
- **Campaign C** (medium priority): customers who browsed a specific product category more than 3 times without purchasing — a nudge campaign with personalized recommendations
- **Campaign D** (medium priority): customers who haven't made a purchase in the last 30 days but were active on the website — a re-engagement campaign
- **Campaign E** (low priority): customers who signed up for the newsletter in the last 14 days — a welcome series follow-up
The priority labels used throughout this use case are: **high** (priority 1), **medium** (priority 2), and **low** (priority 3).
The segmentation conditions and business scenarios presented here are only illustrative examples. In practice, they can be freely defined and adjusted based on user behavior, available data, and any additional parameters relevant to your setup. You can tailor these conditions to reflect your specific business logic, campaign goals, and communication strategy.
The number of values returned by expressions (for example, 0, 1, or 2 for a two-campaign priority level) is specific to this example and depends on how many campaigns you assign to each priority level in your setup.
### Create Campaign A segmentation
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation, for example `Campaign A - high priority`.
3. Click **Add condition**.
4. From the dropdown list, select the `transaction.charge` event.
5. Click the **+ where** button, from the **Choose parameter** dropdown menu, choose `$totalAmount`.
6. From the **Choose operator** dropdown, choose **More than**.
7. In the next field, type the value `500`.
8. Using the date picker in the lower-right corner, set the time range to **Last 30 days**. Confirm by clicking **Apply**.
9. Save the segmentation.
Configuration of the Campaign A segmentation
### Create Campaign B segmentation
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation, for example `Campaign B - high priority`.
3. Click **Add condition**.
4. Define the conditions that identify customers who qualify for this campaign (for example, customers who performed the `product.addToCart` event but did not complete a purchase within the last 7 days).
5. Using the date picker in the lower-right corner, set the appropriate time range. Confirm by clicking **Apply**.
6. Save the segmentation.
### Create Campaign C segmentation
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation, for example `Campaign C - medium priority`.
3. Click **Add condition**.
4. Define the conditions that identify customers who qualify for this campaign (for example, customers who visited a specific product category page more than 3 times without purchasing).
5. Using the date picker in the lower-right corner, set the appropriate time range. Confirm by clicking **Apply**.
6. Save the segmentation.
### Create Campaign D segmentation
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation, for example `Campaign D - medium priority`.
3. Click **Add condition**.
4. Define the conditions that identify customers who qualify for this campaign (for example, customers who were active on the website but haven't purchased in the last 30 days).
5. Using the date picker in the lower-right corner, set the appropriate time range. Confirm by clicking **Apply**.
6. Save the segmentation.
### Create Campaign E segmentation
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation, for example `Campaign E - low priority`.
3. Click **Add condition**.
4. Define the conditions that identify customers who qualify for this campaign (for example, customers who signed up for the newsletter in the last 14 days).
5. Using the date picker in the lower-right corner, set the appropriate time range. Confirm by clicking **Apply**.
6. Save the segmentation.
## Create expressions
---
Expressions are central to this use case. They provide real-time computed values used inside segmentation conditions. You will create the following expressions:
- **Current timestamp expression** — returns the current date and hour so the system can match it against each campaign's planned send time.
- **High priority campaign count expression** — counts how many high priority campaigns the customer qualifies for (used in medium priority segmentations).
- **Medium priority campaign count expression** — counts how many medium priority campaigns the customer qualifies for.
- **Combined high + medium priority campaign count expression** — sums the two above expressions (used in low priority segmentations).
### Create the current timestamp expression
---
This expression returns the current date and hour in the format `yyyy-mm-ddThh`, which allows the system to compare the current moment against each campaign's scheduled send time. The first 13 characters of the timestamp are used so that when the workflow runs every hour, it matches exactly the planned send hour.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name, for example `Now (yyyy-mm-dd hh)`.
3. Set the expression type to **Attribute**.
4. In the **Formula definition** section, build the formula using the `Regexp` function.
5. Then add function `Now`.
6. Add the `Constant` pattern to extract the first 13 characters of the current timestamp, adding it as the value: `^.{13}`.
7. Save the expression.
Configuration of the current timestamp expression
The regular expression pattern `^.{13}` extracts the first 13 characters of the current timestamp, which corresponds to the date and hour portion (for example, `2026-04-30T08`). This expression is shared across all segmentation conditions and ensures that each segment (group within a segmentation) only returns customers at the exact planned hour of a campaign's send time. Every segmentation references this same expression, which means that it acts as an alternative schedule — the segmentation only becomes active when the current timestamp matches the planned send date and hour.
### Create the high priority campaign count expression
---
This expression calculates how many high priority campaigns the customer qualifies for. It checks whether the customer belongs to the Campaign A segmentation and the Campaign B segmentation, and sums the results. The output for this specific case is a number (0, 1, or 2) representing the potential number of high priority messages the customer may receive.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name, for example `How many high priority campaigns user qualifies for`.
3. Set the expression type to **Attribute**.
4. Build the formula to check membership in the [Campaign A](#create-campaign-a-segmentation) and [Campaign B](#create-campaign-b-segmentation) segmentations and return the sum.
5. Save the expression.
Configuration of the high priority campaign count expression
### Create the medium priority campaign count expression
---
This expression calculates how many medium priority campaigns the customer qualifies for. It checks whether the customer belongs to the Campaign C segmentation and the Campaign D segmentation, and sums the results. The output for this specific case is a number (0, 1, or 2) representing the potential number of medium priority messages the customer may receive.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name, for example `How many medium priority campaigns user qualifies for`.
3. Set the expression type to **Attribute**.
4. Build the formula to check membership in the [Campaign C](#create-campaign-c-segmentation) and [Campaign D](#create-campaign-d-segmentation) segmentations and return the sum. Build it in the same way as the [previous expression](#create-the-high-priority-campaign-count-expression), replacing the high priority segmentations with medium priority ones.
5. Save the expression.
Configuration of the medium priority campaign count expression
### Create the combined high and medium priority campaign count expression
---
This expression calculates how many campaigns the customer qualifies for across both high and medium priority levels. It sums the results of the [high priority campaign count expression](#create-the-high-priority-campaign-count-expression) and the [medium priority campaign count expression](#create-the-medium-priority-campaign-count-expression). The output is used in low priority segmentations to determine the remaining contact slots.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name, for example `How many high + medium priority campaigns user qualifies for`.
3. Set the expression type to **Attribute**.
4. Build the formula as a sum of the two previously created expressions: the high priority campaign count expression and the medium priority campaign count expression, as presented on the screen below.
5. Save the expression.
Configuration of the combined high + medium priority campaign count expression
## Create workflows
---
Create three workflows — one for each priority level. Each workflow uses the corresponding split audience segmentation (which you will create in a [later step](#create-priority-level-segmentations-with-split-audience)) and runs cyclically every hour. When the current hour matches a campaign's scheduled send time and all conditions are met, the mobile push is sent.
Workflows must be created **before** the [aggregates](#create-aggregates-for-counting-sent-pushes) because the aggregates need the diagram IDs of these workflows to correctly scope the push count. At this stage, create each workflow with its schedule and structure (Audience node, Send Mobile Push nodes, and End nodes). You can leave the split audience segmentation reference empty or use a placeholder — you will update it after creating the [priority-level segmentations with split audience](#create-priority-level-segmentations-with-split-audience) in a later step.
After saving each workflow, note the **diagram ID** from the workflow URL (the part after `/automation-diagram/`). You will need these IDs in the next step when configuring the aggregates.
### Create the workflow for high priority campaigns
---
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow, for example `Split audience - high priority`.
#### Define the Audience trigger node
1. Start the workflow with the **Audience** node. In the configuration:
1. Set the **Action limit** to `1` times per workflow.
2. In the **Schedule** section, select **Repeat runs**.
3. Select the timezone, for example `Europe/Warsaw (Central European Standard Time) UTC+01:00`.
4. Set the interval type to **Interval**.
5. Set the interval to `1 Hour`.
6. Set the **Begin at** date to the start of the campaign week.
7. In the **Audience** section, select **Split audience**.
8. Select the `Split audience - high priority` segmentation (you will create this segmentation in a [later step](#create-the-high-priority-split-audience-segmentation) — for now, you can leave this field empty or use a placeholder and update it later).
9. Map **Segment A** to **Path A** (Campaign A).
10. Map **Segment B** to **Path B** (Campaign B).
2. Click **Apply**.
#### Configure Path A (Campaign A)
1. On Path A (Segment A), add the **Send Mobile Push** node.
2. Configure the mobile push message content for Campaign A according to your business needs.
3. Add the **End** node after the Send Mobile Push node.
#### Configure Path B (Campaign B)
1. On Path B (Segment B), add the **Send Mobile Push** node.
2. Configure the mobile push message content for Campaign B.
3. Add the **End** node.
4. In the upper right corner, click **Save & Run**.
The complete high priority workflow configuration
### Create the workflow for medium priority campaigns
---
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name, for example `Split audience - medium priority`.
3. Configure the **Audience** node with the same settings as the high priority workflow:
- Action limit: `1`
- Repeat runs at an interval of `1 Hour`
- Begin at: the start of the campaign week
- Split audience using the `Split audience - medium priority` segmentation (to be created in a [later step](#create-the-medium-priority-split-audience-segmentation))
- Map Segment C → Path A, Segment D → Path B
4. On each path, add a **Send Mobile Push** node followed by an **End** node.
5. Click **Save & Run**.
The complete medium priority workflow configuration
### Create the workflow for low priority campaigns
---
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name, for example `Split audience - low priority`.
3. Configure the **Audience** node with the same settings:
- Action limit: `1`
- Repeat runs at an interval of `1 Hour`
- Begin at: the start of the campaign week
- Select the `Split audience - low priority` segmentation (to be created in a [later step](#create-the-low-priority-split-audience-segmentation))
4. Add a **Send Mobile Push** node followed by an **End** node.
5. Click **Save & Run**.
The complete low priority workflow configuration
The automation runs every hour and checks the segmentation conditions at each iteration. Since the `Now (yyyy-mm-dd hh)` expression is compared against the planned send timestamp, the segment will only return customers at the exact hour the campaign is scheduled. At all other hours, the segment will be empty and no messages will be sent.
## Create aggregates for counting sent pushes
---
To enforce the weekly contact limit, you need aggregates that count how many push notifications have already been sent to each customer. You will create three aggregates — one scoped to the high priority workflow, one scoped to the medium priority workflow, and one that counts all pushes sent across all campaign workflows.
Each aggregate is based on the `push.send` event and uses the `diagramId` parameter to scope the count to the relevant workflow. The `diagramId` is the unique identifier of a workflow and can be found in the URL when viewing the workflow in the Automation Hub (the part of the URL that comes after `/automation-diagram/`).
This step requires the diagram IDs of the workflows you created in the [previous step](#create-workflows). If you haven't noted them yet, open each workflow in the Automation Hub and copy the ID from the URL.
### Create the aggregate for high priority sent pushes
---
This aggregate counts how many push notifications were sent to a customer from the high priority workflow.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `Number of sent pushes - high priority`.
4. Click **Analyze profiles by** and select **Count**.
5. From the **Choose event** dropdown list, select the `push.send` event.
6. Click the **+ where** button.
7. From the **Choose parameter** dropdown list, select **diagramId**.
8. From the **Choose operator** dropdown list, select **Equal**.
9. In the value field, enter the diagram ID of the high priority workflow (for example, `71526b66-51e1-47b8-9ecb-6cc61f821dec`). You can find this ID in the URL of the workflow in the Automation Hub.
10. Define the period to **Last 30 days**.
11. Save the aggregate.
Configuration of the aggregate counting sent pushes for the high priority workflow
The time range of **Last 30 days** is intentionally set broader than the actual campaign week to ensure coverage regardless of which day the aggregate is evaluated. Since the workflow and segmentations are designed to operate within a single week, the aggregate will in practice only count pushes sent during that week. A broader time range provides a safety margin without affecting the logic.
### Create the aggregate for medium priority sent pushes
---
This aggregate counts how many push notifications were sent to a customer from the medium priority workflow. The configuration is identical to the high priority aggregate, but uses the diagram ID of the medium priority workflow.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `Number of sent pushes - medium priority`.
4. Click **Analyze profiles by** and select **Count**.
5. From the **Choose event** dropdown list, select the `push.send` event.
6. Click the **+ where** button.
7. From the **Choose parameter** dropdown list, select **diagramId**.
8. From the **Choose operator** dropdown list, select **Equal**.
9. In the value field, enter the diagram ID of the medium priority workflow.
10. Define the period to **Last 30 days**.
11. Save the aggregate.
### Create the aggregate for all sent pushes
---
This aggregate counts how many push notifications were sent to a customer across all campaign workflows combined. Unlike the per-priority aggregates, this one uses the **In array** operator to match against the diagram IDs of all three priority workflows at once.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `Number of sent pushes - all`.
4. Click **Analyze profiles by** and select **Count**.
5. From the **Choose event** dropdown list, select the `push.send` event.
6. Click the **+ where** button.
7. From the **Choose parameter** dropdown list, select **diagramId**.
8. From the **Choose operator** dropdown list, select **In array**.
9. In the value field, enter the diagram IDs of all three priority workflows (the high priority workflow ID, the medium priority workflow ID, and the low priority workflow ID).
10. Define the period to **Last 30 days**.
11. Save the aggregate.
Configuration of the aggregate counting all sent pushes across all campaign workflows
The `push.send` event is automatically generated by Synerise when a mobile push notification is sent through a workflow. The `diagramId` parameter identifies the specific workflow (diagram) that triggered the send.
## Create priority-level segmentations with split audience
---
Create three segmentations — one per priority level — that combine campaign eligibility, scheduled send-time matching, and weekly contact-limit enforcement. Each segmentation uses the **split audience** feature to create separate segments (groups within a segmentation) for each campaign within the priority level.
Within a single priority level, only **one campaign can be scheduled per hour**. The split audience mechanism processes segments sequentially — if two campaigns within the same priority are scheduled for the same hour, only the first segment will be processed. For example, if Campaign A and Campaign B are both high priority, Campaign A could be scheduled for 10:00 and Campaign B no earlier than 11:00.
In the examples below, all campaigns are planned within a single week (Monday through Friday). The specific dates used here are illustrative — adjust them to match your actual campaign week.
Each split audience segmentation groups campaigns by priority level, not by campaign name. This means that the segments within each segmentation are labeled sequentially (Segment A, Segment B, etc.) and correspond to the campaigns assigned to that priority level. For example, in the high priority segmentation, Segment A corresponds to Campaign A and Segment B to Campaign B. In the medium priority segmentation, Segment A corresponds to Campaign C and Segment B to Campaign D. In the low priority segmentation, Segment A corresponds to Campaign E. The segment labels (A, B) are internal to each segmentation and reset for each priority level.
### Create the high priority split audience segmentation
---
This segmentation contains two segments — one for Campaign A and one for Campaign B. Since high priority is the highest level, these campaigns are sent as long as the scheduled time matches and the weekly limit has not been exceeded. No checks against higher-priority campaigns are needed.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name, for example `Split audience - high priority`.
#### Configure Segment A (Campaign A)
3. In the first segment, add the following conditions connected by the **AND** operator:
1. **Condition A** — Has property: `Campaign A - high priority` segmentation **Is true**. This checks if the customer qualifies for Campaign A.
2. **Condition B** — Has property: `Now (yyyy-mm-dd hh)` expression **Contain** the value representing Campaign A's planned send date and hour (for example, `2026-04-15T10`). This ensures the campaign only triggers at the exact scheduled hour.
3. **Condition C** — Has property: `Number of sent pushes - high priority` aggregate **Less than** `3`. This enforces the weekly contact limit within the high priority workflow.
4. **Condition D** — Has property: `Number of sent pushes - all` aggregate **Less than** `3`. This enforces the overall weekly contact limit.
4. Click **Apply**.
#### Configure Segment B (Campaign B)
5. Click **Add segment** and add the following conditions connected by the **AND** operator:
1. **Condition A** — Has property: `Campaign B - high priority` segmentation **Is true**.
2. **Condition B** — Has property: `Now (yyyy-mm-dd hh)` expression **Contain** the value representing Campaign B's planned send date and hour (for example, `2026-04-16T10`).
3. **Condition C** — Has property: `Number of sent pushes - all` aggregate **Less than** `3`.
4. **Condition D** — Has property: `Number of sent pushes - high priority` aggregate **Less than** `3`.
6. Save the segmentation.
Configuration of segments in the high priority split audience segmentation
After saving this segmentation, go back to the [high priority workflow](#create-the-workflow-for-high-priority-campaigns) and update the Audience node to reference this segmentation. Do the same for the medium and low priority workflows after creating their respective segmentations.
### Create the medium priority split audience segmentation
---
This segmentation contains two segments — one for Campaign C and one for Campaign D. In addition to the send-time and contact-limit checks, each segment includes a condition that verifies how many high priority campaigns the customer qualifies for. This prevents medium priority campaigns from consuming contact slots that should be reserved for higher-priority ones.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name, for example `Split audience - medium priority`.
#### Configure Segment A (Campaign C)
3. In the first segment, add the following conditions connected by the **AND** operator:
1. **Condition A** — Has property: `Campaign C - medium priority` segmentation **Is true**.
2. **Condition B** — Has property: `Now (yyyy-mm-dd hh)` expression **Contain** the value representing Campaign C's planned send date and hour (for example, `2026-04-13T09`).
3. **Condition C** — Has property: `Number of sent pushes - all` aggregate **Less than** `3`.
4. **Condition D** — Has property: `How many high priority campaigns user qualifies for` expression **Less than** `3`. This ensures that the total number of potential high priority sends plus this send would not exceed the weekly limit.
5. **Condition E** — Has property: `Number of sent pushes - high priority` aggregate **Less than** `3`.
4. Click **Apply**.
#### Configure Segment B (Campaign D)
5. Click **Add segment** and add the following conditions connected by the **AND** operator:
1. **Condition A** — Has property: `Campaign D - medium priority` segmentation **Is true**.
2. **Condition B** — Has property: `Now (yyyy-mm-dd hh)` expression **Contain** the value representing Campaign D's planned send date and hour (for example, `2026-04-13T14`).
3. **Condition C** — Has property: `Number of sent pushes - all` aggregate **Less than** `3`.
4. **Condition D** — Has property: `How many high priority campaigns user qualifies for` expression **Less than** `3`.
5. **Condition E** — Has property: `Number of sent pushes - high priority` aggregate **Less than** `3`.
6. Save the segmentation.
Configuration of segments in the medium priority split audience segmentation
### Create the low priority split audience segmentation
---
This segmentation contains one segment for Campaign E. It includes the broadest set of checks — verifying the weekly limit and counting how many campaigns the customer qualifies for across both high and medium priority levels.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name, for example `Split audience - low priority`.
#### Configure Segment A (Campaign E)
3. In the first segment, add the following conditions connected by the **AND** operator:
1. **Condition A** — Has property: `Campaign E - low priority` segmentation **Is true**.
2. **Condition B** — Has property: `Now (yyyy-mm-dd hh)` expression **Contain** the value representing Campaign E's planned send date and hour (for example, `2026-04-14T10`).
3. **Condition C** — Has property: `Number of sent pushes - all` aggregate **Less than** `3`.
4. **Condition D** — Has property: `How many high + medium priority campaigns user qualifies for` expression **Less than** `3`. This ensures that the combined potential sends from higher priorities plus this send would not exceed the weekly limit.
4. Save the segmentation.
Configuration of the segment in the low priority split audience segmentation
## How the priority logic works in practice
---
Consider the following example scenario where high priority campaigns are scheduled **later** in the week than medium and low priority ones. This demonstrates how the slot reservation mechanism ensures that lower-priority campaigns do not consume contact slots that are reserved for higher-priority campaigns — regardless of chronological order.
- A customer qualifies for all five campaigns: Campaign A (high priority), Campaign B (high priority), Campaign C (medium priority), Campaign D (medium priority), and Campaign E (low priority).
- The weekly contact limit is 3 messages.
- Campaign C is scheduled for Monday at 09:00, Campaign D for Monday at 14:00, Campaign E for Tuesday at 10:00, Campaign A for Wednesday at 10:00, and Campaign B for Thursday at 10:00.
The system processes the campaigns as follows:
1. **Monday at 09:00 — Campaign C (medium priority)**. The medium priority workflow runs. The customer qualifies for Campaign C and the time matches. Before sending, the system checks the expressions: the customer qualifies for 2 high priority campaigns (A and B). This means 2 of the 3 weekly slots are reserved for high priority. Only 1 slot remains available for medium priority. Since no medium priority pushes have been sent yet, Campaign C is sent. Push count becomes 1.
2. **Monday at 14:00 — Campaign D (medium priority)**. The medium priority workflow runs again. The customer qualifies for Campaign D and the time matches. However, the system checks: the customer still qualifies for 2 high priority campaigns (A and B are not yet sent but are planned). Since 1 medium priority campaign was already sent and only 1 slot was available for this priority level (3 total minus 2 reserved for high), Campaign D is **blocked**.
3. **Tuesday at 10:00 — Campaign E (low priority)**. The low priority workflow runs. The customer qualifies for Campaign E and the time matches. The system checks how many campaigns the customer qualifies for across high and medium priority: 2 (high) + 2 (medium) = 4, but the weekly limit is 3. In practice, 1 push has already been sent and 2 slots are reserved for high priority. No remaining capacity exists for low priority. Campaign E is **blocked**.
4. **Wednesday at 10:00 — Campaign A (high priority)**. The high priority workflow runs. The customer qualifies for Campaign A, the time matches, and the overall push count is 1 (below 3). No additional reservation checks are needed at the highest priority level. Campaign A is sent. Push count becomes 2.
5. **Thursday at 10:00 — Campaign B (high priority)**. The high priority workflow runs again. The customer qualifies for Campaign B, the time matches, and the push count is 2 (below 3). Campaign B is sent. Push count becomes 3.
**Result:** The customer received 3 messages — Campaign C (medium), Campaign A (high), and Campaign B (high). Despite Campaigns A and B being scheduled later in the week, their slots were reserved from the beginning. Campaign D (medium) and Campaign E (low) were correctly blocked because the remaining weekly capacity was already allocated to higher-priority campaigns.
This mechanism ensures that high priority campaigns are always delivered as long as the weekly limit allows, medium priority campaigns are sent only when there is remaining capacity after accounting for higher-priority reservations, and low priority campaigns fill any leftover slots.
Keep in mind that segmentations are evaluated dynamically. A customer's eligibility for a given campaign may change during the week — for example, if a customer performs an action that adds them to a new segmentation, or if their behavior causes them to leave a segmentation they were previously in. This means that the slot reservation calculations (based on how many higher-priority campaigns the customer qualifies for) reflect the state at the moment of evaluation, not a fixed snapshot from the beginning of the week.
The expressions that count potential higher-priority campaign eligibility effectively **reserve contact slots** for higher-priority campaigns. This means that regardless of how campaigns are distributed across the week, lower-priority campaigns will not consume slots that could be needed by higher-priority ones — even if the higher-priority campaigns are scheduled later in the week.
However, keep in mind that within a single priority level, if you have more campaigns than the weekly limit allows, only the first campaigns (in chronological order) will be sent. For example, if you assign 5 campaigns to high priority with a weekly limit of 3, only the first 3 scheduled campaigns will go out.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of each step directly in the Synerise Demo workspace:
**Individual campaign segmentations:**
- [Campaign A - high priority](https://app.synerise.com/analytics-v2/segmentations/70120506-a0f3-49bf-81b7-9741d5be3515)
- [Campaign B - high priority](https://app.synerise.com/analytics-v2/segmentations/32e043c4-1c03-443d-8e2b-3e5556e95027)
- [Campaign C - medium priority](https://app.synerise.com/analytics-v2/segmentations/962b7546-9ec9-45e3-955e-43e40c510a22)
- [Campaign D - medium priority](https://app.synerise.com/analytics-v2/segmentations/af0a9237-8352-4d6c-9dca-960894be7801)
- [Campaign E - low priority](https://app.synerise.com/analytics-v2/segmentations/2016e126-55d0-4f7d-a19d-76b433d9d824)
**Priority-level split audience segmentations:**
- [Split audience - high priority](https://app.synerise.com/analytics-v2/segmentations/cb7ecafa-64e5-4e98-b675-85094de41aba)
- [Split audience - medium priority](https://app.synerise.com/analytics-v2/segmentations/ad2871e1-5d93-4168-a45e-0d43b1f11d9d)
- [Split audience - low priority](https://app.synerise.com/analytics-v2/segmentations/7e46627b-ef8e-45bb-8674-f5f823824983)
**Aggregates:**
- [Number of sent pushes - high priority](https://app.synerise.com/analytics-v2/aggregates/df5bc4aa-971b-3a55-bd95-3c6c21adfc25)
- [Number of sent pushes - medium priority](https://app.synerise.com/analytics-v2/aggregates/0bb96bcd-1906-3603-b1aa-6f3891b7279c)
- [Number of sent pushes - all](https://app.synerise.com/analytics-v2/aggregates/1f9250a1-83e3-3ee2-8439-6d7b4846c7e8)
**Expressions:**
- [Now (yyyy-mm-dd hh)](https://app.synerise.com/analytics/expressions/363d0fc1-bf57-481e-ad02-7715fd7ba81c)
- [High priority campaign count](https://app.synerise.com/analytics/expressions/794299b1-8e4c-496c-94fa-4a188f970fcf)
- [Medium priority campaign count](https://app.synerise.com/analytics/expressions/971bb8bd-15ce-457b-b2e4-8647b745cfc9)
- [High + medium priority campaign count](https://app.synerise.com/analytics/expressions/3b79df31-920d-4977-96c8-592a2b3cc068)
**Workflows:**
- [Workflow for high priority](https://app.synerise.com/automations/workflows/automation-diagram/76e67c89-5300-4a9e-b371-df64edf274f4)
- [Workflow for medium priority](https://app.synerise.com/automations/workflows/automation-diagram/eafba479-ec37-47e7-9763-40efe1a5f767)
- [Workflow for low priority](https://app.synerise.com/automations/workflows/automation-diagram/84b6be35-4775-4ef1-a75c-20942d62635a)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 21 events per profile that completes the flow:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~3), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~6), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~3), [`push.send`](/docs/assets/events/event-reference/mobile-push#pushsend) (~3), [`push.view`](/docs/assets/events/event-reference/mobile-push#pushview) (~3), [`push.click`](/docs/assets/events/event-reference/mobile-push#pushclick) (~3).
## Read more
---
- [Segmentations](/docs/analytics/segmentations)
- [Expressions](/docs/crm/expressions)
- [Aggregates](/docs/crm/aggregates)
- [Automation Hub](/docs/automation)
- [Creating workflows](/docs/automation/creating-automation)
- [Mobile push campaigns](/docs/campaign/Mobile)
- [Branching logic in workflows](/docs/automation)
# Predict Customer Propensity to Buy Items from Specific Brands
You can use the Predictions feature to calculate the probability of customers buying items from a particular brand. The results can be used for better targeting of your marketing efforts.
In this use case, we present a prediction that returns the probability of purchase if the item matches one of two brands selected for the analysis. If you want to create a prediction for only one brand, you will need to skip a few steps in the instructions.
Propensity to buy items from one of the brands added to the analysis
## Prerequisites
---
- [Enable the Propensity prediction type](/docs/ai-hub/predictions/enabling-predictions#enabling-propensity-and-best-fit-predictions).
- The item catalog must include information about item brand and that attribute must be added to [filterable attributes](/docs/ai-hub/ai-search/define-attributes#filterable-attributes).
## Creating the prediction
---
1. Go to **(AI Predictions) Models > New prediction** and select **Propensity** as the prediction type.
2. Select an audience for the prediction.
For more information, see the [Predictions quick start article](/docs/ai-hub/predictions/propensity#select-customers-to-be-analyzed).
### Define the brands
In this section, you define the brands for which you want to calculate the prediction. This is done by creating a filter that will limit the calculation to items that match one of the selected brands
1. In the **Item feed** section, click **Define**.
2. Click **Choose item feed**.
3. Select the catalog that contains the items you want to make the prediction for.
**Result**: the **Item filter** section appears.
4. Click **Define item filter**.
5. From the **Select attribute** drop-down list, select the attribute that denotes the brand in your item feed.
You can use the search field.
6. From the drop-down list that appears, select the **Equal** operator.
7. From the list of available values that appears, select a brand.
You can use the search field.
You can only choose brands which already exist in the item feed.
8. If you want to add a second brand to the analysis:
1. Under the condition, click **Add filter**.
2. From the list that opens, select the same item filter as before.
3. Add the second brand by repeating steps 5-7.
4. Between the two brand filters, click **AND** and change the logic to **OR**.
Item filter that matches one of two brands
9. Click **Save**.
10. Save the item feed configuration by clicking **Apply**.
### Additional settings and saving
Configure the [additional settings](/docs/ai-hub/predictions/propensity#additional-settings) (or leave them at default) and click **Save & Calculate**.
## What's next
---
After the calculation is completed, a `snr.propensity.score` event is saved in the profiles of each customer in the audience. The event data includes detailed results of the prediction.
Based on the `snr.propensity.score` event, you can create segmentations of customers with different propensity and use those segmentations as campaign targets:
- [email](/docs/campaign/e-mail)
- [SMS](/docs/campaign/SMS)
- [web push](/docs/campaign/Webpush)
- [mobile push](/docs/campaign/Mobile)
- [dynamic content](/docs/campaign/dynamiccontent)
- [screen views](/docs/campaign/screen-views)
Email, SMS, web push and mobile push can be sent manually or you can launch them by using [Automation Hub](/docs/automation).
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the [Propensity prediction](https://app.synerise.com/ai-v2/predictions/propensity/ozylkkojxbru) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates 1 event per profile that completes the flow:
[`snr.propensity.score`](/docs/assets/events/event-reference/predictions#snrpropensityscore) (~1).
## Read more
---
- [Predictions](/docs/ai-hub/predictions)
# Sending Mobile Push Birthday Discounts at the Best Time
A properly designed and executed mobile push campaign can help attract users' attention and increase the conversion rate. Sending a push notification at the optimal time, when the customer is active in the app, increases the chances that the customer will read the communication.
Customers may feel happy if you offer them a birthday discount to celebrate their big day. In this use case, you will learn how to prepare a mobile push campaign with a discount on products from specific categories for customers who have a birthday on the current day. The promotion will be available for 14 days after the birthday.
You can optimize time of sending push notifications with the help of our time optimizer and connect with your customers at the right hour. The sending time is adjusted to the customers' activity in the mobile app.
## Prerequisities
---
- Implement promotions in your [mobile application](/developers/mobile-sdk/loyalty), [API](https://hub.synerise.com/api-reference/loyalty-and-engagement#operation/profileLogin).
- Implement mobile pushes in your mobile application: [iOS](/developers/mobile-sdk/configuring-push-notifications/ios), [Android](/developers/mobile-sdk/configuring-push-notifications/android).
- [Import your product feed to a catalog](/use-cases/import-product-feed-to-catalog).
- Collect data about customers' birthdays in their profiles.
- If you want to limit the promotion to only some of your stores, add the list of stores to a catalog. Such a catalog must contain a unique store ID and any other store attributes by which you will filter stores, such as city, zip code, and so on. More information about catalogs can be found [here](/docs/assets/catalogs).
## Security configuration
---
Before you start working with this hub, if you are a Synerise customer or partner, consider reading [the section about denylisting events](/docs/settings/tool/api#denylist). This natively accessible configuration will allow you to manage the restrictions in points management that may help you prevent fraud.
## Process
---
1. [Enable time optimizer](/use-cases/mobile-push-birthday-best-time#enable-time-optimizer).
2. [Create a mobile mode](/use-cases/mobile-push-birthday-best-time#create-a-mobile-mode) in time optimizer.
3. Create segmentations:
1. [A segmentation of customers whose birthday is on the current day](/use-cases/mobile-push-birthday-best-time#create-a-segmentation-of-customers-whose-birthday-is-on-the-current-day) - needed to send the push notification.
2. [A segmentation of customers whose birthday was in the last 14 days](/use-cases/mobile-push-birthday-best-time#create-a-segmentation-for-customers-whose-birthday-was-in-the-last-14-days) - needed to keep the promotion active for 14 days after the birthday.
2. [Create a promotion](/use-cases/mobile-push-birthday-best-time#create-a-promotion) for customers who have celebrated their birthday within the last 14 days on products in specific categories.
3. [Prepare a mobile push notification](/use-cases/mobile-push-birthday-best-time#prepare-a-mobile-push-notification).
4. [Create a workflow](/use-cases/mobile-push-birthday-promotion#create-a-workflow) to send the mobile push. The workflow runs once a day.
## Enable time optimizer
---
1. Go to **Settings > AI Engine Configuration**.
2. Select **Time optimizer** tab.
3. Click **Define**.
4. Switch the toggle on.
## Create a mobile mode
---
Create a Mobile mode for Time Optimizer that will calculate the time when the customer is most active in the mobile application based on the events such as `screen.view` and `screen.interaction`.
1. Go to **Settings > AI Engine Configuration**.
2. Select the **Time optimizer** tab.
3. Click **Define**.
4. Click **Add new mode**.
5. To create a new mode, select **Custom**:
1. In the **Mode name** field, enter the name for the custom mode.
2. From the **Predicted event** dropdown list, select the `screen.view` activity to calculate the most probable time of occurrence.
3. From the **Input events** dropdown list, select the events: `screen.interactions`, `screen.click` and `screen.view`, based on which the engine will perform the predictions.
4. Click **Apply**.
6. Click **Apply** to save the new mode.
To keep the time optimizer enabled, at least one mode must be active.
Configuration of custom mode in time optimizer
## Prepare segmentations
---
### Create a segmentation of customers whose birthday is on the current day
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of segmentation.
3. Click **Conditions**.
4. From the **Add condition** dropdown list, select the birthday attribute.
4. In the operator selection menu that opens:
1. Click the calendar icon.
3. Click **Matches current day**.
5. From the **Add condition** dropdown list, select the birthday attribute.
6. In the operator selection menu that opens:
1. Click the calendar icon.
3. Click **Matches current month**.
7. Click **Save**.
Segment of customers who have a birthday on the current day
### Create a segmentation for customers whose birthday was in the last 14 days
This segment identifies customers who have received a mobile notification about the birthday promotion within the last 14 days.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of segmentation.
3. Click **Conditions**.
3. From the **Add condition** dropdown list, select the **Mobile push sent** event.
4. Add the **campaignName** parameter.
5. As the logical operator, select **Equal**.
6. In the blank field enter the campaign name.
You must use the same name later, when creating the mobile push template.
7. In the time range settings:
1. Click **Custom**.
2. Set the range to last 14 days.
8. Add additional filters identical to those in the previous segmentation, with the condition that today is the user's birthday. Choose **Add condition**. The `OR` operator should be applied between the "Mobile push sent" filter and the birthday date filter for the first contact.
This ensures that customers who respond immediately to the push notification will have the promotion activated, even if there is a delay in processing the `push.send` event.
Segment of customers who have received a mobile notification of a birthday promotion within the last 14 days.
## Create a promotion
---
Create a promotion for customers whose birthday was within the last 14 days (including the current day) on products from the following categories: sweets, cosmetics, and coffee.
1. Go to **AI Hub > Regular Promotions > Add promotion**.
2. Select the **For selected items** option.
3. In the **Audience** section, select the segment created in [this step](/use-cases/mobile-push-birthday-best-time#create-a-segmentation-for-customers-whose-birthday-was-in-the-last-14-days).
4. In the **Content** section:
1. Define the name, description, and image of the promotion.
2. In the price field, enter `0`.
3. Confirm the settings by clicking **Apply**.
Example of birthday promotion content
5. In **Type & limits**, define the settings so that the promotion is available for use for up to 6 products in the cart, while giving a 20% discount on products defined in the **Items** section.
1. As the **Discount type**, choose **Percentage**.
2. In the **Limit per profile**, as the maximum value, enter `6`.
3. In the **Value** section, define the discount as `20`.
6. In the **Schedule** section, define the distribution period of your promotion.
7. **Optional** In the **Stores** section, specify stores where the promotion is available.
This is possible only if the list of stores is imported into a [catalog](/docs/assets/catalogs).
8. In the **Items** section, define a product catalog and a filter - specifying the products that will be discounted.
Example of a catalog filter with products from specific categories
You can define the filter directly in the catalog with the products for which the promotion is created. To do this, go to **Catalogs** located in **Data Modeling Hub**, select the catalog you need and define a filter for the products in the categories that are included in the promotion.
Catalog filter
10. To apply all changes and run the promotion, click **Publish**.
## Prepare a mobile push notification
---
Prepare a mobile push with information about the promotion.
1. Go to **Experience Hub > Mobile > Template**.
2. You can use the template from the folder or create your own one using the mobile push code editor. Click **New Template > Simple Push**.
2. Create your mobile push in the code editor.
For more information on creating a simple mobile push, visit our [User Guide](/docs/campaign/Mobile/creating-mobile-push).
The template name must be the same as the one you used in the filter when [creating the segmentation](/use-cases/mobile-push-birthday-best-time#create-a-segmentation-for-customers-whose-birthday-was-in-the-last-14-days) earlier!
Example of mobile push notification
## Create a workflow
---
In this part of the process, prepare a workflow that sends notifications for customers celebrating their birthday on the current day, delivering their birthday promotion at the optimal time determined by the Synerise Time Optimizer.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
3. As the first node of the workflow, add **Audience**. In the node settings:
1. As the **Run trigger** option, select **repeatable**.
2. Set the interval to 1 day.
3. In the **Begin at** field, select the date, select the hour as 00:00.
4. From the **Timezone** dropdown list, select the time zone consistent with the time zone of your workspace.
5. In the **Define audience** section, click **Segments**.
6. Click **Select segment**.
7. Select the segment of [customers whose birthday is on the current day](/use-cases/mobile-push-birthday-best-time#create-a-segmentation-of-customers-whose-birthday-is-on-the-current-day).
8. Confirm by clicking **Apply**.
4. Add an **Optimize time** node. In the configuration of the node:
1. Select the [custom mode](/use-cases/mobile-push-birthday-best-time#create-a-mobile-mode) you created in previous part of the process.
2. Set the time period to analyze according to your business needs by clicking **Custom time period**.
3. In the **Time period** field, enter `24`
3. Confirm by clicking **Apply**.
4. As the next node, add **Send Mobile Push**.
5. In the configuration of the **Send Mobile Push** node:
1. From the **Template type** dropdown list, select **Simple Push**.
2. Select the **Push template** created in [this part](/use-cases/mobile-push-birthday-best-time#prepare-a-mobile-push-notification) of the process.
6. Confirm by clicking **Apply**.
7. Add the **End** node to finish the workflow.
8. Click **Save & Run**.
Final configuration of a workflow that sends a mobile push to customers whose birthday is on the current day
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the segmentations directly in Synerise demo workspace:
- [a segmentation of customers whose birthday is on the current day](https://app.synerise.com/analytics/segmentations/eb0dc5de-da7b-420e-a20a-3f96e57546ff),
- [a segmentation of customers whose birthday was in the last 14 days](https://app.synerise.com/analytics/segmentations/5c1343d0-c156-4f1f-9389-b04b5bf8da24).
Check also the [configuration of the promotion](https://app.synerise.com/campaigns/promotions/42cfd4d0-dea4-43b5-aa19-34440a3ca350) and [workflow](https://app.synerise.com/automations/automation-diagram/aad0b2b5-401c-43f4-8f1a-48c8f2e265af) created for this use case.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 9 events per profile that completes the flow:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`snr.ate.prediction`](/docs/assets/events/event-reference/predictions#snrateprediction) (~1), [`push.send`](/docs/assets/events/event-reference/mobile-push#pushsend) (~1), [`push.view`](/docs/assets/events/event-reference/mobile-push#pushview) (~1), [`push.click`](/docs/assets/events/event-reference/mobile-push#pushclick) (~1), [`client.activatePromotion`](/docs/assets/events/event-reference/loyalty#clientactivatepromotion) (~1).
## Read more
---
- [Creating promotions](/docs/ai-hub/promotions)
- [Mobile push notifications](/docs/campaign/Mobile)
- [Time optimizer](/docs/settings/configuration/time-optimizer)
- [Workflow](/docs/automation/creating-automation)
# User Intelligence Panel with real-time profile data in an in-app message
Customers expect personalized, data-driven experiences that reflect their real activity and status. Instead of building separate dashboards or static profile pages, you can use [Brickworks](/docs/assets/brickworks) to create a single, structured data model that dynamically assembles customer profile information and serves it directly inside an in-app message.
In this use case, you will build a **User Intelligence Panel** — a self-updating profile view displayed as an in-app message in a mobile application. The panel aggregates the following data for each customer in real time:
- First name
- Loyalty level (derived from an expression based on loyalty points thresholds)
- Total transaction value
- Total loyalty points (earned minus expired)
- Number of transactions
- Top visited product categories
- Active promotions assigned to the customer (fetched dynamically via an External Source)
- Historical transaction list with product names, amounts, dates, and loyalty points earned
Each customer sees a personalized version of the panel based on their own behavioral and transactional data. Every new purchase or interaction automatically updates what is displayed.
This approach eliminates the need for custom frontend-backend integrations by leveraging Brickworks as the single source of truth for the profile UI.
## Prerequisites
---
- [Implement Synerise SDK in your mobile app](/developers/mobile-sdk).
- Implement the [transaction events](/developers/web/transactions-sdk) using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- Implement [tracking code](/developers/web/installation-and-configuration) on your website.
- Have a loyalty program configured in Synerise with loyalty points earning and expiration logic, including the `points.loyalty` event. Check this [use case](/use-cases/rolling-points-expiration)
- Have [promotions](/docs/ai-hub/promotions) configured and assigned to customers.
- [Create API keys](/docs/settings/tool/api#adding-api-keys) with permissions required for the Promotions API (used in the External Source configuration for the Brickworks schema).
## Process
---
In this use case, you will go through the following steps:
1. [Create aggregates for loyalty points](#create-aggregates-for-loyalty-points) to compute earned and expired points.
2. [Create aggregates for transaction and behavioral data](#create-aggregates-for-transaction-and-behavioral-data).
3. [Create expressions](#create-expressions) to compute loyalty points balance and loyalty level.
4. [Create segmentations for loyalty tiers](#create-segmentations-for-loyalty-tiers) that define thresholds for each loyalty level.
5. [Create additional aggregates for transaction history](#create-aggregates-for-transaction-history) to power the transaction list in the panel.
6. [Create a Brickworks schema](#create-a-brickworks-schema) that defines the data structure.
7. [Create a record](#create-the-record) that binds schema fields to actual data sources.
8. [Create an in-app campaign](#create-an-in-app-campaign) that renders the panel using the Brickworks schema.
## Create aggregates for loyalty points
---
In this part of the process, you will create two aggregates based on the `points.loyalty` event. These aggregates are later used in the expression that calculates the customer's net loyalty points balance, and in segmentations that determine the loyalty tier.
### Aggregate for earned loyalty points sum
---
This aggregate sums all loyalty points ever earned by the customer.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `[UC] loyalty points sum`.
4. Click **Analyze profiles by** and select **Sum**.
5. From the **Choose event** dropdown list, select the `points.loyalty` event.
6. As the event parameter, select `points`.
7. Define the period to **Lifetime**.
8. Save the aggregate.
Configuration of the earned loyalty points sum aggregate
### Aggregate for expired loyalty points
---
This aggregate sums only the loyalty points that have expired.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `[UC] expired loyalty points`.
4. Click **Analyze profiles by** and select **Sum**.
5. From the **Choose event** dropdown list, select the `points.loyalty` event.
6. As the event parameter, select `points`.
7. Click the **+ where** button and add the condition: `$source` **Equal** `expiration`.
8. Define the period to **Lifetime**.
9. Save the aggregate.
Configuration of the expired loyalty points aggregate
## Create aggregates for transaction and behavioral data
---
In this part of the process, you will create aggregates that supply transaction and browsing data to the Brickworks schema fields.
### Aggregate for sum of transactions
---
This aggregate calculates the total monetary value of all customer transactions.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `[UC] Sum of transactions`.
4. Click **Analyze profiles by** and select **Sum**.
5. From the **Choose event** dropdown list, select the `transaction.charge` event.
6. As the event parameter, select `$totalAmount`.
7. Define the period to **Lifetime**.
8. Save the aggregate.
Configuration of the sum of transactions aggregate
### Aggregate for number of transactions
---
This aggregate counts the total number of transactions for each customer.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `[UC] Number of transactions`.
4. Click **Analyze profiles by** and select **Count**.
5. From the **Choose event** dropdown list, select the `transaction.charge` event.
6. Define the period to **Lifetime**.
7. Save the aggregate.
Configuration of the number of transactions aggregate
### Aggregate for top 5 visited categories
---
This aggregate returns the most frequently visited product categories for each customer.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `[UC] Top 5 visited categories`.
4. Click **Analyze profiles by** and select **Top Multi**.
5. From the **Choose event** dropdown list, select the `page.visit` event.
6. As the event parameter, select `product:category`.
7. Click the **+ where** button and add the condition that `product:category` **is not null**.
8. In the **Size** field, enter `5`.
9. Define the period to the **Last 30 days**.
10. Save the aggregate.
Configuration of the top 5 visited categories aggregate
## Create expressions
---
In this part of the process, you will create expressions that compute derived values used in the Brickworks schema.
### Expression for loyalty points
---
This expression calculates the customer's current net loyalty points balance by subtracting expired points from the total earned points.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression, for example `[UC] Loyalty points`.
3. Set **Expressions for** to **Attribute**.
4. Enable **Show in profile card** if you want the result visible on customer profiles.
5. In the **Formula definition**, define the formula as:
- `earned loyalty points sum` **minus** `expired loyalty points`
where the first operand references the `[UC] loyalty points sum` aggregate and the second references the `[UC] expired loyalty points` aggregate, both created in the [previous step](#create-aggregates-for-loyalty-points).
6. Click **Publish**.
Configuration of the Loyalty points expression
### Expression for loyalty level
---
This will expression determine the customer's loyalty tier based on the segmentations.
#### Create segmentations for loyalty tiers
---
In this part of the process, you will create segmentations that define the loyalty point thresholds for each tier.
The loyalty tiers in this example are based on the following point thresholds:
| Tier | Condition |
|---|---|
| Base | Loyalty points sum ≤ 1 |
| Silver | Loyalty points sum > 1 AND < 4,000 |
| Gold | Loyalty points sum ≥ 4,000 AND < 10,000 |
| Premium | Loyalty points sum ≥ 10,000 |
##### Segmentation for Gold loyalty level
---
This example shows how to configure a loyalty tier segmentation. The remaining tiers follow the same pattern with different thresholds.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation, for example `[UC] Loyalty level - Gold`.
3. Name the segment `Gold`.
4. Click **Add condition**.
5. From the dropdown list, select **Has property**.
6. Choose the `[UC] loyalty points sum` expression.
7. From the **Choose operator** dropdown, select **Less than** and enter the value `10 000`.
8. Click **Add condition**.
9. Again select **Has property** and choose the `[UC] loyalty points sum` expression.
10. From the **Choose operator** dropdown, select **More than** and enter the value `4 000`.
11. Connect these conditions with the **And** operator.
12. Save the segmentation.
Configuration of the Gold loyalty level segmentation
##### Remaining loyalty tier segmentations
---
Create the remaining segmentations following the same approach as above, adjusting the thresholds:
- **[UC] Loyalty level - Silver**: `[UC] loyalty points sum` **More than** `1` **AND** `[UC] loyalty points sum` **Less than** `4 000`.
Configuration of the Silver loyalty level segmentation
- **[UC] Loyalty level - Premium**: `[UC] loyalty points sum` **More or equal to** `10 000`.
Configuration of the Premium loyalty level segmentation
- **[UC] Loyalty level - Base**: `[UC] loyalty points sum` **Less or equal to** `1`.
Configuration of the Base loyalty level segmentation
#### Create Expression with Loyalty Tiers
For this expression use segmentation created in the [previous step](#create-segmentations-for-loyalty-tiers).
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression, for example `[UC] Loyalty level`.
3. Set **Expressions for** to **Attribute**.
4. Enable **Show in profile card** if desired.
5. In the **Formula definition**, build a conditional formula using the following logic:
- If `[UC] Loyalty level - Base` → return `Base member`
- If `[UC] Loyalty level - Silver` → return `Silver member`
- If `[UC] Loyalty level - Gold` → return `Gold member`
- If `[UC] Loyalty level - Premium` → return `Premium member`
- Otherwise → return `null`
Each condition references the corresponding segmentation created in the [next step](#create-segmentations-for-loyalty-tiers).
6. Click **Publish**.
Configuration of the Loyalty level expression
## Create aggregates for transaction history
---
The transaction history section of the panel requires six additional aggregates that are referenced inside a Jinjava code field in the Brickworks schema. Each aggregate collects a specific dimension of transaction data so it can be combined into a structured JSON list.
### Aggregate for transaction IDs
---
Collects the order IDs of the customer's transactions.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `[UC] Transaction IDs`.
4. Click **Analyze profiles by** and select **Last Multi**.
5. From the **Choose event** dropdown list, select the `transaction.charge` event.
6. As the event parameter, select `$orderId`.
7. In the **Size** field, enter `25`.
8. Define the period to **Lifetime**.
9. Save the aggregate.
Configuration of the transaction IDs aggregate
### Aggregate for transaction loyalty points
---
Collects the loyalty points associated with each transaction.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `[UC] Transaction loyalty points`.
4. Click **Analyze profiles by** and select **Last Multi**.
5. From the **Choose event** dropdown list, select the `points.loyalty` event.
6. As the event parameter, select `points`.
7. Click the **+ where** button and add the condition: `$revenue` **Is not null**.
8. In the **Size** field, enter `25`.
9. Define the period to **Lifetime**.
10. Save the aggregate.
Configuration of the transaction loyalty points aggregate
### Aggregate for transaction amounts
---
Collects the monetary amount of each transaction.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `[UC] Transaction amounts`.
4. Click **Analyze profiles by** and select **Last Multi**.
5. From the **Choose event** dropdown list, select the `transaction.charge` event.
6. As the event parameter, select `$totalAmount`.
7. In the **Size** field, enter `25`.
8. Define the period to **Lifetime**.
9. Save the aggregate.
Configuration of the transaction amounts aggregate
### Aggregate for transaction dates
---
Collects the timestamps of each transaction.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `[UC] Transaction dates`.
4. Click **Analyze profiles by** and select **Last Multi**.
5. From the **Choose event** dropdown list, select the `transaction.charge` event.
6. As the event parameter, select `TIMESTAMP`.
7. In the **Size** field, enter `25`.
8. Define the period to **Lifetime**.
9. Save the aggregate.
Configuration of the transaction dates aggregate
### Aggregate for product names from transactions
---
Collects the product names from individual bought items.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `[UC] Transaction product names`.
4. Click **Analyze profiles by** and select **Last Multi**.
5. From the **Choose event** dropdown list, select the `product.buy` event.
6. As the event parameter, select `$name`.
7. In the **Size** field, enter `1 000`.
8. Define the period to **Lifetime**.
9. Save the aggregate.
Configuration of the transaction product names aggregate
### Aggregate for order IDs from product buy events
---
Collects the order IDs associated with each product buy event, so products can be grouped by transaction.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `[UC] Product buy order IDs`.
4. Click **Analyze profiles by** and select **Last Multi**.
5. From the **Choose event** dropdown list, select the `product.buy` event.
6. As the event parameter, select `$orderId`.
7. In the **Size** field, enter `1 000`.
8. Define the period to **Lifetime**.
9. Save the aggregate.
Configuration of the product buy order IDs aggregate
## Create a Brickworks schema
---
In this part of the process, you will create a [Brickworks](/docs/assets/brickworks) Simple schema that defines the structure of the User Intelligence Panel. The schema specifies the field names, types, and configuration options. The actual binding of fields to data sources (expressions, aggregates, profile attributes) happens at the [record level](#create-the-record), where values are resolved via API at generation time for the requesting customer.
Use a **Simple Schema**. Simple schemas support [External Sources](/docs/assets/brickworks/quick-start/creating-a-schema) fields (such as the Promotion list), which is required for dynamically fetching promotion data in the in-app context.
1. Go to **Data Modeling Hub > Brickworks > New schema**.
2. Choose **Simple Schema**.
3. Enter the **Display name**, for example `User Intelligence Panel`.
4. Optionally, add a description.
### Add First name field
---
1. Click **Add new field** and choose the appropriate field type.
2. In the **Field basics** section, complete the fields:
- **Display name**: `First name`
- **API name**: `firstName`
3. In the **Configuration** section, enable the **Return null when object is missing** checkbox.
4. In the **Validation** section, enable the **Required field** checkbox.
5. Click **Apply**.
Configuration of the First name field in the Brickworks schema
### Add Loyalty level field
---
1. Click **Add new field** and choose the appropriate field type.
2. In the **Field basics** section, complete the fields:
- **Display name**: `Loyalty level`
- **API name**: `loyaltyLevel`
3. In the **Configuration** section, enable the **Return null when object is missing** checkbox.
4. In the **Validation** section, enable the **Required field** checkbox.
5. Click **Apply**.
Configuration of the Loyalty level field in the Brickworks schema
### Add Transaction total field
---
1. Click **Add new field** and choose the appropriate field type.
2. In the **Field basics** section, complete the fields:
- **Display name**: `Transaction total`
- **API name**: `transactionTotal`
3. In the **Configuration** section, enable the **Return null when object is missing** checkbox.
4. In the **Validation** section, enable the **Required field** checkbox.
5. Click **Apply**.
Configuration of the Transaction total field in the Brickworks schema
### Add Loyalty points total field
---
1. Click **Add new field** and choose the appropriate field type.
2. In the **Field basics** section, complete the fields:
- **Display name**: `Loyalty points total`
- **API name**: `loyaltyPointsTotal`
3. In the **Configuration** section, enable the **Return null when object is missing** checkbox.
4. In the **Validation** section, enable the **Required field** checkbox.
5. Click **Apply**.
Configuration of the Loyalty points total field in the Brickworks schema
### Add Number of transactions field
---
1. Click **Add new field** and choose the appropriate field type.
2. In the **Field basics** section, complete the fields:
- **Display name**: `Number of transactions`
- **API name**: `numberOfTransactions`
3. In the **Configuration** section, enable the **Return null when object is missing** checkbox.
4. In the **Validation** section, enable the **Required field** checkbox.
5. Click **Apply**.
Configuration of the Number of transactions field in the Brickworks schema
### Add Top visited categories field
---
1. Click **Add new field** and choose the appropriate field type.
2. In the **Field basics** section, complete the fields:
- **Display name**: `Top visited categories`
- **API name**: `topVisitedCategories`
3. In the **Configuration** section, enable the **Return null when object is missing** checkbox.
4. In the **Validation** section, enable the **Required field** checkbox.
5. Click **Apply**.
Configuration of the Top visited categories field in the Brickworks schema
### Add Promotions field
---
This field uses the [External Source](/docs/assets/brickworks/quick-start/creating-a-schema) type to dynamically fetch the customer's active promotions from the Synerise Promotions API. Unlike other fields in the schema which only define a name and configuration, this field includes a data source configuration directly — it specifies an HTTP request that will be executed at generation time to retrieve the current list of promotions assigned to the customer.
1. Click **Add new field** and choose **External Data** > **Promotion list**.
2. In the **Field basics** section, complete the fields:
- **Display name**: `Promotions`
- **API name**: `promotions`
3. In the **Configuration** section, the field is preconfigured as a **Promotion list**. The **Preview cURL** section shows the HTTP request that will be sent:
```
curl -X GET "https://api.synerise.com/v4/promotions/v2/promotion/get-for-client/clientId/{{customer.id}}?status=ACTIVE,ASSIGNED&fields=code,name,expireAt,discountType,discountValue,uuid,description" \
-H "Authorization: Basic USERNAME:PASSWORD"
```
4. Click **Apply**.
Configuration of the Promotions field in the Brickworks schema
### Add Transaction data field
---
This field uses **Jinjava code** that is executed at generation time. Inside the Jinjava code, six aggregates created in the [transaction history step](#create-aggregates-for-transaction-history) are called directly by their hashes using the `{% aggregate HASH %}` syntax. These aggregates are **not** configured as separate fields in the schema — they exist only inside this Jinjava code, which combines their results into a single structured JSON output.
1. Click **Add new field** and choose **Jinjava code**.
2. In the **Field basics** section, complete the fields:
- **Display name**: `Transaction data`
- **API name**: `transactionData`
3. In the **Configuration** section:
1. Enable the **Cast to** toggle and select **JSON Object** as the type.
4. In the **Validation** section, enable the **Required field** checkbox.
5. In the **Jinjava code** editor, paste the following code. Replace the aggregate hashes with the hashes of the aggregates you created in the [transaction history step](#create-aggregates-for-transaction-history):
{% set txn_ids = [] %}{% set txn_points = [] %}{% set txn_amounts = [] %}{% set txn_dates = [] %}{% set buy_names = [] %}{% set buy_order_ids = [] %}{% aggregate TRANSACTION_IDS_AGGREGATE_HASH %}{%- for res in aggregate_result -%}{% do txn_ids.append(res) %}{%- endfor -%}{% endaggregate %}{% aggregate TRANSACTION_POINTS_AGGREGATE_HASH %}{%- for res in aggregate_result -%}{% do txn_points.append(res) %}{%- endfor -%}{% endaggregate %}{% aggregate TRANSACTION_AMOUNTS_AGGREGATE_HASH %}{%- for res in aggregate_result -%}{% do txn_amounts.append(res) %}{%- endfor -%}{% endaggregate %}{% aggregate TRANSACTION_DATES_AGGREGATE_HASH %}{%- for res in aggregate_result -%}{% set splitDate = res|split(':') %}{% set splitDateLength = splitDate|length %}{% set finalDate = splitDate[0:splitDateLength-1]|join(':') ~ splitDate[splitDateLength-1] %}{% set finalDateFormatted = datetimeformat(finalDate|strtotime("yyyy-MM-dd'T'HH:mm:ss.SSSZ"), '%b %d, %Y') %}{% do txn_dates.append(finalDateFormatted) %}{%- endfor -%}{% endaggregate %}{% aggregate PRODUCT_NAMES_AGGREGATE_HASH %}{%- for res in aggregate_result -%}{% do buy_names.append(res) %}{%- endfor -%}{% endaggregate %}{% aggregate PRODUCT_ORDER_IDS_AGGREGATE_HASH %}{%- for res in aggregate_result -%}{% do buy_order_ids.append(res) %}{%- endfor -%}{% endaggregate %}{% set orders = [] %}{% for i in range(txn_ids | length) %}{% set order_id = txn_ids[i] %}{% set products = [] %}{% for j in range(buy_order_ids | length) %}{% if buy_order_ids[j] == order_id %}{% set _ = products.append(buy_names[j]) %}{% endif %}{% endfor %}{% set _ = orders.append({'orderId': order_id,'date': txn_dates[i],'amount': txn_amounts[i],'loyaltyPoints': txn_points[i],'products': products}) %}{% endfor %}{{ orders | reverse | tojson }}
This Jinjava code collects data from six aggregates (transaction IDs, loyalty points per transaction, transaction amounts, transaction dates, product names, and product order IDs), then combines them into a JSON array of order objects. Each order object contains the order ID, formatted date, total amount, loyalty points earned, and a list of product names. The result is reversed so the most recent transactions appear first.
6. Click **Apply**.
Configuration of the Transaction data field in the Brickworks schema
### Overview of the complete schema
---
After adding all fields, the schema should contain the following fields:
Overview of all fields in the User Intelligence Panel Brickworks schema
### Set up the Audience & Settings
---
1. Click the **Audience & Settings** tab.
2. In the **Audience** section, click **Define**.
3. Choose **Everyone**.
4. Click **Apply**.
5. In the upper-right corner, click **Save**.
## Create the record
---
[Creating a record](/docs/assets/brickworks/quick-start/creating-a-record) means filling the schema structure with actual data source bindings. In a Simple schema, the record is where you assign concrete expressions, aggregates, and profile attributes to the fields defined in the schema. When the in-app message is displayed, the Brickworks engine uses the record configuration to resolve all field values via API in real time for the requesting customer.
1. Go to **Data Modeling Hub > Data collections > Select schema**.
2. Choose the [schema created in the previous step](#create-a-brickworks-schema).
3. Click **Add record**.
4. Add a name for the record, for example `User Intelligence Panel`.
5. Add a slug for the record. Slug is a unique, URL-friendly version of the name containing only lowercase letters, numbers, and hyphens. For example: `user-intelligence-panel`.
6. Fill in the field values by assigning the appropriate data sources to each field:
- **First name** → select the `firstname` profile attribute
- **Loyalty level** → select the [`[UC] Loyalty level` expression](#expression-for-loyalty-level)
- **Transaction total** → select the [`[UC] Sum of transactions` expression](#aggregate-for-sum-of-transactions)
- **Loyalty points total** → select the [`[UC] Loyalty points` expression](#expression-for-loyalty-points)
- **Number of transactions** → select the [`[UC] Number of transactions` expression](#aggregate-for-number-of-transactions)
- **Top visited categories** → select the [`[UC] Top 5 visited categories` aggregate](#aggregate-for-top-5-visited-categories)
- **Promotions** → pre-configured via External Source (Promotion list) at the [schema level](#add-promotions-field)
- **Transaction data** → pre-configured via Jinjava code at the [schema level](#add-transaction-data-field)
7. Click **Publish** to publish your record.
After publishing the record, note the **schema ID** and **record ID** from the URL. You will need these IDs in the in-app template code to reference the Brickworks data via the `{% brickworksgeneratevar %}` tag.
## Create an in-app campaign
---
In this part of the process, you will create an [in-app campaign](/docs/campaign/in-app-messages/create-inapp-message) that renders the User Intelligence Panel using data from the Brickworks schema.
1. Go to **Experience Hub > In-app messages > Create in-app**.
2. Enter the name of the in-app message.
### Define the audience
---
1. In the **Audience** section, click **Define**.
2. Click **Everyone** (or define a specific segment according to your needs).
3. Click **Apply**.
### Define content
---
1. In the **Content** section, click **Define**.
2. Click **Create message**.
3. In the code editor, paste the in-app template code provided below.
The template uses the `{% brickworksgeneratevar %}` tag to fetch all schema fields for the current customer and renders the profile panel with sections for stats, top interests, dynamically loaded promotions, and past transactions.
Replace `SCHEMA_ID` and `RECORD_ID` with the actual IDs of your Brickworks schema and record. You can find the schema ID and the record ID in the URL when viewing them in the Synerise platform.
4. Add the appropriate CSS styles to the template to style the profile panel (avatar, stats row, section cards, transaction list, promotion badges, and so on).
5. If the template is ready, in the upper right corner click **Save this template > Save as**.
6. On the pop-up, enter the template name and select the folder. Confirm by clicking **Apply**.
7. To continue configuring the in-app campaign, click **Next**.
8. Click **Apply**.
### Select events that trigger the in-app message display
---
Define which event triggers the display of the User Intelligence Panel. For example, you can display it when the customer opens a specific section of the application or taps a profile button.
1. In the **Trigger events** section, click **Define**.
2. Select **Add event** and from the dropdown list, choose the appropriate event (for example, `screen.view` with a parameter matching your profile screen).
3. Configure the event parameters according to your application's navigation structure.
4. Click **Apply**.
### Schedule the message and configure display settings
---
1. In the **Schedule** section, click **Define** and set the time when the message will be active.
2. In the **Display Settings** section, click **Change**.
3. Define the **Delay display**, **Priority index**, and enable the **Frequency limit** toggle to manage the frequency of display according to your business needs.
4. Click **Apply**.
5. Optionally, define UTM parameters and additional parameters.
6. Click **Activate**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of each step directly in the Synerise Demo workspace:
- [Aggregate - loyalty points sum](https://app.synerise.com/analytics-v2/aggregates/27578b05-c68e-364d-be42-bd5034604a1b)
- [Aggregate - expired loyalty points](https://app.synerise.com/analytics-v2/aggregates/4963fed8-1784-352c-8777-27138eb9ded0)
- [Aggregate - Sum of transactions](https://app.synerise.com/analytics-v2/aggregates/55cf86a5-acd9-3540-8293-13737a495300)
- [Aggregate - Number of transactions](https://app.synerise.com/analytics-v2/aggregates/24011aa2-632d-319f-9047-8f13712105c8)
- [Aggregate - Top 5 visited categories](https://app.synerise.com/analytics-v2/aggregates/3280a45c-9319-364a-9b56-4a2b99ae6116)
- [Expression - Loyalty points](https://app.synerise.com/analytics/expressions/5b71b588-0088-4170-8489-6d18ab5ae010)
- [Expression - Loyalty level](https://app.synerise.com/analytics/expressions/08075ec6-e77e-40ef-a13e-f65e40e67369)
- [Segmentation - Gold loyalty level](https://app.synerise.com/analytics-v2/segmentations/64f1fa6e-a5aa-49ce-843f-a434b6bde9a0)
- [Brickworks schema](https://app.synerise.com/assets/brickworks/schemas/556629ff-fac9-494b-9471-45b9c689443e)
- [In-app campaign](https://app.synerise.com/communications/in-app/4f575259-5ce9-4e34-bd3d-e1d29d147352)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 4 events per profile that completes the flow:
[`screen.view`](/docs/assets/events/event-reference/web-and-app#screenview) (~1), [`inApp.show`](/docs/assets/events/event-reference/inapp#inappshow) (~1), [`inApp.click`](/docs/assets/events/event-reference/inapp#inappclick) (~1), [`brickworks.generated`](/docs/assets/events/event-reference/brickworks#brickworksgenerated) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Brickworks](/docs/assets/brickworks)
- [Expressions](/docs/crm/expressions)
- [In-app messages](/docs/campaign/in-app-messages)
- [Promotions](/docs/ai-hub/promotions)
- [Segmentations](/docs/analytics/segmentations)
# Optimizing Voucher Campaigns for First-Time Website Visitors
Engaging new visitors effectively is crucial for driving conversions and building customer loyalty. Dynamic Content campaigns tailored for first-time visitors, such as offering a voucher, can create a strong initial impression and encourage users to complete their first transaction. However, when running such campaigns, there is a risk of missing new users who are not in the database at the time of campaign launch. This is where the **Include first time visitors in audience** option becomes invaluable, ensuring convenient targeting for these users.
In this use case, we will describe a voucher campaign targeted at new users who have never made a transaction. By enabling the **Include first time visitors in audience** option in the campaign, we ensure that new users visiting the website are not overlooked. Even if they were not yet in the database at the moment the campaign started, they will still see the dynamic content and receive their voucher. This ensures that the campaign reaches its intended audience and no opportunities to engage first-time visitors are missed.
## Prerequisites
---
[Implement a tracking code](/docs/settings/tool/tracking_codes).
## Process
---
In this use case, you will go through the following steps:
1. [Create a voucher pool](/use-cases/voucher-for-new-users-optimization#create-a-voucher-pool).
3. [Create a dynamic content](/use-cases/voucher-for-new-users-optimization#create-a-dynamic-content) campaign, which displays the voucher code on the website.
## Create a voucher pool
---
In this use case, the ID of this voucher pool will be used as a dynamic value during the message creation process, allowing discount codes to be assigned to each customer participating in this scenario.
1. Go to **Settings > [Voucher pools](https://app.synerise.com/spa/modules/vouchers/pools/)** and click **Add pool**.
2. In the voucher pool configuration form:
1. In the **Pool name** field, enter the name of the pool.
2. Select the dates for the **Emission start** and **Emission end** fields.
3. Complete the form by clicking **Apply**.
**Result**: The pool is created.
3. Open the voucher pool by clicking its name on the voucher pool list.
4. Add codes to the voucher pool by clicking **Add record** button.
You can also import records to the voucher pool. You can learn more about it in ["Importing vouchers"](/docs/assets/imports/importing-vouchers).
## Create a dynamic content
---
Create a dynamic content campaign.
This dynamic content will be displayed on your site with the unique voucher from the voucher pool.
1. Go to **Experience Hub > Dynamic content > Create new**.
2. Enter the name of the dynamic content.
1. Choose **Insert Object** type.
2. To select the recipients of the dynamic content, on the **Audience** tab, click **Define**.
3. Select **New Audience** and click **Define conditions**. In this step, you define the group of customers who have never bought anything from your shop.
1. Choose **Add condition** and find the `transaction.charge` event.
5. Set the time as **Lifetime**.
6. Click **Performed** and change it to **Not Performed**.
7. Click **Apply**.
The audience settings
9. Click **Advanced options** and choose the **Include first time visitors in audience** option.
10. Click **Apply**.
The audience settings
### Create the Dynamic Content template
3. In the **Content** section, specify the CSS selector where you want to insert your campaign.
4. Click **Create Message**.
5. In the code editor, create a dynamic content campaign based on your preferences and your own CSS styles. Remember about the predefined templates in Synerise, which you can use to simplify the process and avoid building everything from scratch.
2. Click **Inserts** and **Pools** and choose the voucher pool created in the [previous step](#create-a-voucher-pool).
Check also the voucher pools inserts documentation, based on different possible options:
- [If you want to always display the same code for a customer,](/developers/inserts/insert-usage#retrieving-the-same-code-every-time)
- [If you need to display barcodes.](/developers/inserts/insert-usage#barcodes)
4. Customize the design and content of your dynamic content campaign to suit your business needs.
3. Click **Use in communication** and then click **Apply**.
### Define schedule and display settings
1. In the **Schedule** section, click **Define** and set the time when the message will be active.
2. In the **Display Settings** section, click **Define** and specify circumstances for dynamic content to be displayed. Optionally, you can also define the Advanced options. You can define the frequency of dynamic content to be displayed. You can also define the type of device you want to show your dynamic content.
3. Optionally, you can define the type of device you want to show your dynamic content on.
4. Click **Apply**.
5. Optionally, you can define the UTM parameters and additional parameters for your dynamic content campaign.
6. Click **Activate**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of [dynamic content campaign](https://app.synerise.com/campaigns/dynamic-content/create/1cb07032-a65c-44fe-9d09-1b3db3c811c0), directly in Synerise.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`voucherCode.assigned`](/docs/assets/events/event-reference/loyalty#vouchercodeassigned) (~1).
## Read more
---
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Voucher pools](/docs/assets/code-pools)
# Web push with recommended products
Web push messaging is an effective form of communication that allows businesses to communicate directly with people who visit their website, even when they are not actively using it. Compared to other forms of communication, web push notifications allow you to deliver concise, clickable messages directly to users' devices, making them an ideal channel for delivering product recommendations and driving traffic back to your website.
This campaign is targeted at all users and includes additional action buttons that direct them straight to a page to the product card or to a dedicated page with a list of recommendations.
## Prerequisites
---
- [Configure an item catalog for recommendations](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations). Enable personalized recommendations.
- [Import your product feed to AI engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations).
- [Configure web push notifications](/docs/campaign/Webpush/configuring-web-push)
- Create a workspace [API Key](/docs/settings/tool/api) with the permission - API_CUSTOM_EVENTS_CREATE.
## Process
---
In this use case, you will go through the following steps:
1. [Create a personalized recommendation campaign](/use-cases/webpush-with-recommended-products#create-personalized-recommendation-campaign).
2. [Create a webpush template](/use-cases/webpush-with-recommended-products#create-a-web-push-template).
3. [Prepare a workflow](/use-cases/webpush-with-recommended-products#create-workflow) that creates an event with recommended products and sends a web push to customers who receive any recommendation in the campaign.
## Create personalized recommendation campaign
In this part of the process, you will create a personalized recommendation campaign, the ID of which will later be used during [workflow creation](/use-cases/webpush-with-recommended-products#create-workflow).
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation (it is only visible on the list of recommendations).
3. In the **Type & Items feed** section, click **Define**.
4. From the **Items feed** dropdown list, select a product feed that has a trained model.
5. Select the **Personalized** recommendation type.
6. Confirm the recommendation type by clicking **Apply**.
7. In the **Items** section, click **Define**.
8. Click **Add slot**.
9. Click the **Unnamed slot** that was created.
10. Set the minimum and maximum number of products displayed in the frame to 1.
11. Optionally, you can use filters to include specific items in the recommendation frame.
12. Confirm the configuration by clicking **Apply**.
13. Optionally, you can define the settings in the **Boosting** and **Additional settings** sections.
Learn more about [boosting](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-the-boosting-factors) and [additional settings](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#additional-settings).
14. Click **Save**.
AI recommendation campaign configuration
## Create a web push template
---
In this part of the process, you will create a web push template with recommended products with two action buttons. The first button links to the product card and the second to the list of recommended products.
1. Go to **Experience Hub > Web Push > Templates > New template**.
2. Enter the name of the template.
3. In the **Title** field, define the title you want to display in the web push.
4. In the **Message** field, define the copy you want to appear in the web push. In our case it will be an insert with product title:
`{{ event.params.title }}`
5. In the **Destination URL** field, define the link you want to redirect your customers by clicking the web push notification. In our case, it will be link to the homepage: `https://demoshop.synerise.com/` (clicking the web push will redirect to homepage, action buttons will redirect to more specific pages).
6. In the **Icon URL** field, define the icon you want to display in the web push.
1. To get the URL of the icon, go to **Data Modeling Hub > Files**.
2. Find the icon on the list.
3. Hover the mouse cursor over the icon on the list.
4. Click **Copy URL**.
5. Paste the URL in the **Icon** field.
7. In the **Image URL** field, define the image you want to display in the web push. In our case it will be an insert with product image: `{{ event.params.imageLink }}`
1. To get the URL of the image, go to **Data Modeling Hub > Files**.
2. Find the image on the list.
3. Hover the mouse cursor over the image on the list.
4. Click **Copy URL**.
5. Paste the URL in the **Image** field.
8. Select **Action button** and to add two buttons to your web push template by clicking **Add item** twice. In the button's settings:
1. The first button link to product card. In the **URL** field, paste the following insert: `{{ event.params.link }}` and in the **Button Label** field, enter the text on the first button.
2. The second button links to a listing of product recommendations. In **URL** field, paste the link to the listing. In our case, it's `https://demoshop.synerise.com/product-personalized-listing` and in the **Button Label** field, enter the text on the second button.
To create a page with a list of recommended products, please refer to the [Creating section recommendations](/docs/ai-hub/recommendations-v2/creating-section-recommendations) article.
9. Save the template clicking the button **Save as**, and choose the folder where the template will be saved.
10. Confirm by clicking **Save**.
## Create workflow
---
In this part of the process, create a workflow that will be triggered by the `session.end` event and create an event with the recommended products that you will refer to in the webpush template. If the customer receives any recommended products in the event, then a webpush message will be sent.
### Define the Profile Event trigger node
At this stage, configure conditions that launch the workflow. As a trigger, we will use the `session.end` event.
1. As the first node of the workflow, add **Profile Event**. In the configuration of the node:
1. From **Choose event** dropdown menu, choose `session.end` event.
2. Confirm by clicking **Apply**.
### Define the Outgoing Integration node
In the **Outgoing Integration** node, create a webhook that will generate event with recommended products. In our case it is a `webpush.recommendation` event.
1. After the trigger node, add **Outgoing Integration**.
1. Choose the authentication method. In our case, it will be **API key**.
2. Click **Add connection**, and on the pop-up, enter the name of the connection and from the dropdown list, select the API Key created as a part of prerequisites.
2. Click **Apply**.
3. In the **Webhook name**, field enter a name for the webhook. In this case `Webpush recommendation`.
4. Select the **POST** method.
3. In the URL of the endpoint, enter `https://api.synerise.com/v4/events/custom`.
5. Leave **content-type** at default: `application/json`.
6. Click **Add header**.
7. Add **Api-Version** with the value set to `4.4`
8. Enter the request body. For the sheet used in this case, the body is as follows:
Where:
- The `campaignId=nBzlR4BQtyvD` is the Id of the recommendation campaign you created earlier [in this step](/use-cases/webpush-with-recommended-products#create-personalized-recommendation-campaign).
- All params contain information about recommended product are used in the [webpush template](/use-cases/webpush-with-recommended-products#create-a-web-push-template).
6. Click **Apply**.
Configuration of the Outgoing Integration node
### Configure the Event Filter node
This node will set the workflow to wait for 2 minutes for the creation of a `webpush.recommendation` event for the client. If a customer has not received any recommended products in the event, the workflow ends. However, if a customer receives any recommended products in the event, the workflow goes to the next step, in which a web push will be sent to that customer.
1. As the next node, add **Event Filter**. In the configuration of the node:
1. In the **Check** field, from the dropdown menu choose **for period of time**.
2. Set the time range. In our case, it is 2 minutes.
3. In the **Define conditions** field, from the **Choose event** dropdown menu, choose `webpush.recommendation` event.
4. Click the + where button, from the **Choose parameter** dropdown menu, choose **title**.
5. From the **Choose operator** dropdown, choose **Regular expression**.
6. As the value, enter `.+`
The `.+` value means at least 1 character. This excludes events where the item title is empty, meaning there is no recommended item.
2. Confirm by clicking **Apply**.
3. At the **Not Matched** path, add the **End** node .
### Configure Send Web Push node
In this part of the process you will define the Webpush message to be sent.
1. To the **Matched** path, add **Send Web Push**. In the configuration of the node:
1. In the **Content** section, from the **Webpush template** dropdown, select [the template you created in the previous step](/use-cases/webpush-with-recommended-products#create-a-web-push-template).
2. In the **Schedule** section, set the **Webpush lifespan (TTL)** according to your business needs.
3. You can describe campaigns with [additional parameters](/docs/campaign/Webpush/creating-webpush-campaigns#adding-custom-parameters).
2. Click **Apply**.
Configuration of the Send Configuration node
### Add the finishing node
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
The workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
You can check the all the configurations directly in Synerise Demo workspace:
- [Personalized recommendation campaign](https://app.synerise.com/ai-v2/recommendations/nBzlR4BQtyvD)
- [Workflow](https://app.synerise.com/automations/automation-diagram/e02a94cc-dc7c-4df3-9ef3-e03c64d90307)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 11 events per profile that completes the flow:
[`session.end`](/docs/assets/events/event-reference/web-and-app#sessionend) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), `webpush.recommendation` (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`webpush.send`](/docs/assets/events/event-reference/webpush#webpushsend) (~1), [`webpush.show`](/docs/assets/events/event-reference/webpush#webpushshow) (~1), [`webpush.click`](/docs/assets/events/event-reference/webpush#webpushclick) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Jinjava inserts](/developers/inserts)
- [Recommendations](/docs/ai-hub/recommendations-v2)
- [Web push](/docs/campaign/Webpush)
# In-app abandoned cart message
In-app messaging feature allows businesses to target customers who have abandoned their shopping carts, encouraging them to complete their purchases. The messaging can be personalized and triggered based on specific actions, such as how long the item has been in the cart or the customer's browsing history, increasing the chances of conversion. This can help boost revenue and improve the overall customer experience.
This use case describes the process of creating a reminder that a customer did not complete a purchase and sending it through an in-app message. In this case, we assume that the customer added products to cart and hasn't finalized a purchase in the following hour.
This use case provides you with an instruction how to use a ready-made in-app template that can be used 1:1 in a business scenario.
## Prerequisites
---
- [Implement Synerise SDK](/developers/mobile-sdk) in your mobile app.
- Implement the [transaction events](/developers/web/transactions-sdk) using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- [Implement the `cart.status` event](/developers/web/cart), which stores the current status of the basket in the form of an event on the customer's card. Event has to be sent to Synerise, after every change in the cart status.
- Collect [product.addToCart event](/docs/assets/events/event-definitions).
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate](#create-an-aggregate) with abandoned products.
2. [Create an in-ap message](#create-an-in-app-message) with abandoned cart using the predefined template.
## Create an aggregate
---
In this step, create an aggregate that will be used to display products in your in-app message.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last**.
5. From the **Choose event** dropdown list, select the `cart.status` event.
6. As the event parameter, select **products**.
7. Set the period from which the aggregate will analyze the results to **Lifetime**.
12. Save the aggregate.
Configuration of the aggregate
## Create an in-app message
---
In this part of the process, you create an in-app campaign triggered by the `session.start` event for customers who haven't made a transaction within an hour from adding the product to cart. We will use a predefined template for the message about abandoned cart, so there is no need to create a template from scratch.
1. Go to **Experience Hub > In-app messages> Create in-app**.
2. Enter the name of the in-app.
### Define the audience
---
As the first step, define the target group of customers for the in-app message. In this case, the group will consist of the customers who abandoned their cart within an hour from adding the product to cart.
1. In the **Audience** section, click **Define**.
4. Click **New Audience** and then **Define conditions**.
5. Click **Add condition**, from the dropdown list, select the `product.addToCart` event.
7. Click the calendar in the right bottom of the page.
1. In the **Relative date range** section define the period from which the segmentation will return the customers. In this case, choose **Today**.
2. Click **Apply**.
8. Click **Add condition**, from the dropdown list, select the `product.addToCart` event.
9. Click **and then...**, from the dropdown list, select the `transaction.charge` event.
10. Change **Performed** to **Not performed**.
11. Click the calendar in the right bottom of the page.
1. In the **Relative date range** section define the period from which the segmentation will return the customers. In this case, choose **Today**.
2. Click **Apply**.
12. Click the clock next to the calendar.
1. Type `1` and from the dropdown list, select **Hours**.
In-app Audience configuration
9. Click **Apply**.
8. To save the audience, click **Apply**.
### Define content
---
In this part of the process, you will create the content of the in-app message that will appear in the mobile application with the help of ready-made template.
1. In the **Content** section, click **Define**.
2. Click **Create message** and from the list of template folders, select **Predefined templates**.
3. Select the **Abandoned cart** template.
**Result:** You are redirected to the code editor.
You can edit the template in two ways, by editing the code of the template ([add snippets](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-snippet-to-the-template-code), [add variables](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-variable) and/or by filling out the form in the Config tab. In this use case, we will use the capabilities of the predefined Config tab.
#### Edit form in the Config tab
---
The form in the **Config** tab is already filled in with default values. You can keep them or change them to fit your business needs.
The fields in Config are split into two types: ones for dynamic content (related to Jinja) and ones for in-app appearance. The dynamic content fields must match the values in the catalog and the names of the attributes returned by the recommendations. The appearance fields only affect how the information presents itself in the in-app.
1. From the **Aggregate with products left in the cart** drop-down list, select the [aggregate you created in the previous step](#create-an-aggregate). You can find it by typing its name or ID in the search box.
2. In the **Header text** text box, type the header you want to display in the in-app message.
3. In the **Header description text** text box, type the header description you want to display in the in-app message.
4. In the **Name of the catalog with product information** field, change the default `Snrs-produktu-ogTag` value to the catalog name with product information. In our case, it's `store-1`.
5. In the **Name of the column with image link** field, change the default `og:image` value to the name of the column with image link in your catalog with product information. In our case, the name of the column with image link is `image`.
6. In the **Name of the column with title** field, change the default `og:title` value to the name of the column with the title in your catalog with product information. In our case, the name of the column with title is `name`.
7. In the **Name of the column with price** field, change the default `product:original_price:amount` value to the name of the column with original price in your catalog with product information. In our case, the name of the column with original price is `price`.
8. In the **Name of the column with product link** field, change the default `og:url` value to the name of the column with product link in your catalog with product information. In our case, the name of the column with product link is `productUrl`.
9. Define the colors for the following fields: **Wrapper background, Header background, Header text, Header description text, Close icon background** and **Close icon** to your needs.
10. After you make changes to the template, you can check the preview.
1. Click the **Preview** button on the upper left side.
2. Enter the ID of a customer.
Select a customer who has the `product.AddtoCart` event in their activity list in **Behavioral Data Hub > Profiles**.
3. Click **Apply**.
Considering that the in-app is very interactive, the preview in the platform may not be enough to test the in-app performance. That’s why we suggest checking the preview directly in the mobile app.
In-app preview
11. If the template is ready, in the upper right corner click **Save this template > Save as**.
12. On the pop-up:
1. In the **Template name field**, enter the name of the template.
2. From the **Template folder** dropdown list, select the folder where the template will be saved.
3. Confirm by clicking **Apply**.
13. To continue the process of configuring the in-app campaign, click **Next**.
14. To save your content changes, click **Apply**.
### Select events that trigger the in-app message display
---
In this part of the process, you will define the event triggering the display of the in-app message.
1. In the **Trigger events** section, click **Define**.
2. Select **Add event** and from the dropdown list, choose `session.start` event.
3. Click the **+ where** button and select `mobile`.
4. As the logical operator, select **Exists**.
5. Click **Apply**.
In-app trigger event configuration
### Schedule the message and configure display settings
---
As the final part of the process, you will set the display settings of the in-app message such as schedule, capping, priority of the message among other in-app messages.
1. In the **Schedule** section, click **Define** and set the time when the message will be active.
2. In the **Display Settings** section, click **Change**.
3. Define the **Delay display**, **Priority index** and enable the **Frequency limit** toggle to manage the frequency of in-app message display in the application.
In our case, we want to display the message to the customer a maximum of 1 time in period of 7 days.
You can additionally enable the **Capping limit** toggle to limit the amount of time the in-app message can be displayed to a user in general.
16. Click **Apply**.
In-app schedule and display configuration
17. Optionally, you can define the UTM parameters and additional parameters for your in-app campaign.
18. Click **Activate**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [Aggregate](https://app.synerise.com/analytics/aggregates/17d214c4-5644-33b1-b0c6-9fab96b26b3e) and [In-app message](https://app.synerise.com/communications/in-app/91c87167-7881-4c9d-a0a2-52d68f2dfd25) configuration directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per profile that completes the flow:
[`product.addToCart`](/docs/assets/events/event-reference/items#productaddtocart) (~1), [`cart.status`](/docs/assets/events/event-reference/items#cartstatus) (~1), [`session.start`](/docs/assets/events/event-reference/web-and-app#sessionstart) (~1), [`inApp.show`](/docs/assets/events/event-reference/inapp#inappshow) (~1), [`inApp.click`](/docs/assets/events/event-reference/inapp#inappclick) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [In-app messages](/docs/campaign/in-app-messages)
- [Snippets](/docs/assets/snippets)
- [Mobile campaigns](/docs/campaign/Mobile)
- [Using in-app template builder](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template)
# Personalized recommendations compliant with the Omnibus Directive
The e-commerce industry is the new frontier of innovation, providing both consumers and companies with a better experience. However, there are some issues that can disrupt the relationship between the two parties. The volatility of pricing information along with promotions and discounts is one of them: it often leads to situations where users have been misled or deceived by a company's promotional scenarios. That's why the Omnibuse Directive was introduced to strengthen consumer rights and ensure a better customer experience.
The directive implements a new obligation to regulate price transparency for discounts and promotions. The purpose of this new regulation is to strengthen control over misleading business practices, ensure free access to price information, and guarantee that citizens and businesses can benefit from clear and effective information. To comply with the Omnibus Directive, for discounted products/services, companies must additionally display the lowest price that was applied during the 30-day period before the price reduction.
In this case, you will learn how to create personalized recommendations that additionally include the price that must be mandatorily displayed for discounted products using dynamic content. We want customers to know the real deal when they shop, so we've got three prices for discounted products:
- **The current promotional price**,
- **The lowest price in the last 30 days (the omnibus price)**,
- **The regular price outside the promotional period.**
This way, customers can see all the savings and get even more motivated to grab that sweet promo offer!
The most important step to take before creating a recommendation is to update your product feed. You need to expand your product feed with an additional attribute that indicates the lowest price of the discounted product from the last 30 days. In our case, this attribute is marked as **c:omnibus_price**.
Later in the process, you will see a Jinjava code containing a rule that checks if the sale price (**g:salePrice.value**) of the product is lower than the actual price (**g:price.value**). If so, this indicates that the product is discounted and the omnibus will be displayed with the discount percentage.
Note that all attribute names shown in this use case are just examples, you can use any naming for your own purposes.
If you don’t want to use dynamic content, you can retrieve recommendations through API, [using this method](https://hub.synerise.com/api-reference/ai-recommendations#operation/GetRecommendationsByCampaignV2). This way, you may keep fragile or frequently changing parameters at your end. Using the mentioned method, you retrieve the product ID from Synerise via API and pull all other necessary product information on your side.
## Prerequisites
---
- [Configure an item catalog for recommendations](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations). Enable personalized recommendations.
- [Import your product feed to AI engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations).
## Process
---
In this use case, you will go through the following steps:
1. [Prepare AI recommendations](/use-cases/recommendations-bestsellers#prepare-ai-recommendation).
2. [Create dynamic content campaign](/use-cases/recommendations-bestsellers#create-dynamic-content).
## Prepare AI recommendation
---
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation (it is only visible on the list of recommendations).
3. In the **Type & Items feed** section, click **Define**.
4. From the **Items feed** dropdown list, select a product feed that has a trained model.
5. Select the **Personalized** recommendation type.
6. Confirm the recommendation type by clicking **Apply**.
7. In the **Items** section, click **Define**.
8. Click **Add slot**.
9. Click the **Unnamed slot** that was created.
10. Define the minimum and maximum number of products displayed in the frame according to your needs.
11. Optionally, you can use filters to include specific items in the recommendation frame.
12. Confirm the configuration by clicking **Apply**.
13. Optionally, you can define the settings in the **Boosting** and **Additional settings** sections.
Learn more about [boosting](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-the-boosting-factors) and [additional settings](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#additional-settings).
14. Click **Save**.
AI recommendation campaign configuration
## Create dynamic content
---
1. Go to **Experience Hub > Dynamic content > Create new**.
2. Enter the name of the dynamic content.
3. Choose the **Insert Object** type.
4. As an audience, select the user segment for which you want to display the recommendation.
5. In the **Content** section, select **Simple message**, and specify the CSS selector where you want to insert the dynamic content with recommendations.
6. In the **Content** tab, click **Create Message**.
7. In the code editor, insert Jinjava with the AI recommendation.
Replace `your_campaign_ID` with the ID of the AI recommendation. The ID of the AI campaign is contained in the URL of the recommendation.
Replace the price attributes used in the jinjava below with price attributes with the nomenclature you have implemented at your site. In this use case, we use **g:price.value** for the original price of the product, **g:salePrice.value** for the sale price of the product and **c:omnibus_price** for the omnibus price.
8. Save the template.
9. In the **Schedule** section, select the date when the dynamic content is activated.
10. In **Display settings**, define the circumstances for displaying the content.
Instructions how to do it are available [here](/docs/campaign/dynamiccontent/creating-dynamic-content/creating-dynamic-content).
11. Confirm by clicking **Apply**.
12. In the **UTM & URL parameters** section, click **Skip step**.
13. Activate the dynamic content.
## What's next
---
You can also use the ID of the recommendation in other types of communication, described [here](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#distributing-recommendations).
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the campaign components directly in Synerise Demo workspace:
- [AI recommendation](https://app.synerise.com/ai-v2/recommendations/Bav1emo6BnwX),
- [Dynamic content](https://app.synerise.com/campaigns/preview/75feed6e-fee2-4562-bc63-6248714c8ed1).
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per profile that completes the flow:
[`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Recommendations](/docs/ai-hub/recommendations-v2/recommendation-statistics)
- [Using recommendations in dynamic content](/developers/inserts/recommendations-v2)
# Daily additional points for the fastest buyers
Synerise offers endless possibilities for creating business loyalty scenarios. One of them may be a campaign that ends after a specific number of redemptions and revokes every day. It can increase the traffic in your mobile app. Combining this with additional loyalty points may bring you new customers.
In this use case, you will create a scenario that awards customers with additional 1500 loyalty points for the purchase of a soda. The promotion works every day for the first 1000 buyers. The mechanism controls the number of purchases and informs the mobile app user if they can still get the additional points, or if they are late and need to try again on another day.
## Prerequisites
---
- [Create a workspace API key](/docs/settings/tool/api#adding-api-keys) with permissions allowing to calculate metrics and update the catalog.
- [Create a schema type](https://hub.synerise.com/api-reference/asset-management#operation/addSchemaType).
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- Integrate Synerise [mobile SDK](/developers/) in your mobile application.
- Integrate mechanism for awarding loyalty points.
Find more in the [Loyalty programs basics](/use-cases/loyalty-programs-basics) use case.
## Security configuration
---
Before you start working with this hub, if you are a Synerise customer or partner, consider reading [the section about denylisting events](/docs/settings/tool/api#denylist). This natively accessible configuration will allow you to manage the restrictions in points management that may help you prevent fraud.
## Process
---
In this use case, you will go through the following procedures:
1. [Create a metric](#create-a-metric) that calculates the number of purchases of soda on the current day.
2. [Create a catalog](#create-a-catalog) which stores the current information for the customers: whether they can get additional points or not.
3. [Create an automation updating the catalog content and awarding points](#create-an-automation-updating-the-catalog-content-and-awarding-points).
4. [Create an automation updating the catalog content to the default value](#create-an-automation-updating-the-catalog-content-to-the-default-value). Thanks to this, the mechanism will reset the information about promotion availability every day.
5. [Create a document with a catalog content](#create-a-document-with-a-catalog) which sends the content of the catalog with information for the customer to the mobile app.
## Create a metric
---
In this part of the process, you will create a metric which counts how many times the product on promotion was bought on the current day.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
2. As the metric type, select **Simple metric**.
3. Leave the **Aggregator** at default (Count).
5. As the occurrence type, set **All**.
6. From the **Choose event** dropdown list, select the **product.buy** event.
7. Click the button.
8. From the **Choose parameter** dropdown list, select **$sku**.
10. From the **Choose operator** dropdown list, select **Equal**.
12. As the value of the operator, add the SKU of the product for which you award the additional points.
13. Open the time range settings by clicking the calendar icon.
1. In the **Relative date range** section, choose **Today**.
2. Click **Apply**.
13. Click **Save**.
Configuration of the metric
## Create a catalog
---
In this part of the process, you need to create a catalog, which will store the current information about promotion availability. At later stages of the process, this catalog will be updated on the basis of how many soda transactions have been made on a given day. Also, it will be separately updated at midnight every day when resetting the daily redemption counter.
1. Prepare a CSV file of your promotion content, according to [requriements](/docs/assets/catalogs/creating-catalogs#requirements).
Below is the sample file used in this article. It consists of two columns, where the first is a message that will be shown to customers and the second is the key of the promotion.
```
copy;key
Buy a soda and get extra loyalty points!;copyKey
```
You can use this file in your implementation, after changing the message to your business needs.
2. Go to **Data Modeling Hub > Catalogs > New Catalog**.
3. Enter the name of the catalog.
4. Click **Apply** to confirm. The catalog will appear on the list.
5. Click on the created catalog.
5. In the upper right corner, click **Import**.
**Result:** A pop-up appears.
6. As the import method, select **Import a local file**.
7. Click **Next**.
7. Upload the CSV file you prepare by using the **+ Upload file or drop one here** field.
8. Optionally, you can customize the file metacharacters by clicking the arrow down icon.
1. From the **Delimiter** dropdown, select the character that marks the end of a column.
2. From the **Quotation** mark dropdown list, select the characters that contain the text or data type.
4. From the **Escape character** dropdown lists, select the character which changes the default interpretation of a character or a string followed by the escape character.
9. To proceed to the next step, click the **Next** button.
10. Select the name of the column which is treated as the primary key.
In our example, it’s `key`.
11. Click **Next**.
12. Click **Run import**.
Configuration of the catalog
## Create an automation updating the catalog content and awarding points
---
In this part, you will create a workflow which triggers when the product for which you assign additional points is bought. If the [result of the metric created earlier](#create-a-metric) is greater than 1000, it will update the catalog with the message that the promotion is over today. If the metric's result is smaller than 1000, it will grant extra points to the customer.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the trigger node
---
At this stage, you will configure the conditions that trigger the workflow.
1. Add the first node - **Profile Event**. In the node configuration:
1. From the **Choose event** dropdown list, choose the **product.buy** event.
2. Click button.
3. From the **Choose parameter** dropdown list, select **$sku**.
5. From the **Choose operator** dropdown list, select **Equal**.
7. As the value of the operator, add the SKU of the product for which you want to award additional points.
2. Click **Apply**.
Configuration of the Profile Event node
### Define the Outgoing Integration node
---
In the **Outgoing Integration** node, you will create a webhook calculating the metric from [the previous step](/use-cases/limited-promotion#create-a-metric). The continuation of the workflow will depend on the result of the metric.
1. After the trigger node, add **Outgoing Integration**.
2. Select **Synerise API key** as your method of authorization.
1. From the dropdown list below, select your **API key**.
3. In the **Webhook name**, field enter a name for the webhook. In this case, `Metric recalculation`.
4. Optionally, in the **Webhook event name** field, choose an action name for the event that will be generated when Synerise receives a response from your selected endpoint.
4. In the **URL** section, select the **POST** method.
1. In the URL of the endpoint, enter `https://api.synerise.com/analytics/analytics/v3/metrics/ID/recalculate`, where the **ID** is the ID of your [metric created earlier](#create-a-metric).
5. Optionally, add key-value pairs for headers and the body of the request in the **Body** section.
5. Confirm the settings by clicking **Apply**.
Configuration of the Outgoing Integration node
### Define two Event Filter nodes on the metric result
---
In this step, you will split the automation path, so different actions can happen according to the [metric result created earlier](#create-a-metric). If the result is greater than 1000, it will update the catalog with copy that today the promotion is over. If the metrics result is smaller than 1000, it will grant extra points to the customer.
1. Click **THEN** on the **Outgoing Integration** node, and add **Split Path**.
2. Add two **Event Filter** nodes.
3. Configure the first **Event Filter** node:
1. Enter the meaningful name of the node, ex. `when promotion is over on the current day`.
1. From the **Choose event** dropdown list, choose the **webhook.response** event.
2. Click button.
3. From the **Choose parameter** dropdown list, select **name**.
5. From the **Choose operator** dropdown list, select **Equal**.
6. As the value of the operator, add the name of [the webhook created earlier](#define-the-outgoing-integration-node).
In this case, it's `Metric recalculation`.
7. Click the button.
8. From the **Choose parameter** dropdown list, choose **body.result**.
9. From the **Choose operator** dropdown list, select **More than (Number)**.
10. As the value of the operator, type `1000`.
11. Click **Apply**.
Configuration of the first Event Filter node
4. Configure the second **Event Filter** node:
1. Enter the meaningful name of the node, ex. `when promotion still lasts on the current day`.
1. From the **Choose event** dropdown list, choose the **webhook.response** event.
2. Click button.
3. From the **Choose parameter** dropdown list, select **name**.
5. From the **Choose operator** dropdown list, select **Equal**.
6. As the value of the operator, add the name of [the webhook created earlier](#define-the-outgoing-integration-node).
In this case, it's `Metric recalculation`.
7. Click button.
8. From the **Choose parameter** dropdown list, choose **body.result**.
9. From the **Choose operator** dropdown list, select **Less or equal to (Number)**.
10. As the value of the operator, type `1000`.
11. Click **Apply**.
Configuration of the second Event Filter node
### Define the Outgoing Integration node changing the catalog copy
---
This **Outgoing Integration** node will be connected to the first **Event Filter** node (where the condition is that the metric result is above 1000). When the number of sold sodas exceeds 1000, the automation will update the text in the catalog to inform that the offer is no longer available for the current day and the customer will receive such information in the mobile app.
1. To the first **Event Filter**, add the **Outgoing Integration** node.
2. As your method of authorization, select **Synerise API key**.
1. From the dropdown list below, select your **API key**.
3. In the **Webhook name**, field enter name for the webhook. In this case, it's `change.documentCopy`.
4. Optionally, in the **Webhook event name** field, choose an action name for the event that will be generated when Synerise receives a response from your selected endpoint.
4. In the **URL** section, select the **POST** method.
1. In the URL of the endpoint, enter `https://api.synerise.com/catalogs/bags/ID/items`, where the **ID** is the ID of your [catalog created earlier](#create-a-catalog).
5. Enter the request body. For the form used in this case, the body is as follows:
{
"value": {
"key": "copyKey",
"copy": "Today, the use limit on this offer has already been reached 😞 Come back tomorrow!"
},
"itemKey": "copyKey"
}
You can use this JSON code in your implementation, but change the names of the columns within the catalog and `copy` content according to your business needs.
7. Click **Apply**.
8. Add the **End** node.
### Define Generate Event node
---
This **Generate event** node will be connected to the second **Event Filter** node. When the number of sold sodas is below 1000, the automation will generate an event granting extra loyalty points to the customers.
1. To the second **Event Filter**, add the **Generate Event** node.
2. In the **Define event** section:
1. As the **Event name** choose `points.upcharge`.
3. Enter the request body. For the form used in this case, the body is as follows:
{
"name": "Extra points for buying a soda",
"points": "1500"
}
3. Click **Apply**.
Configuration of the Generate Event node
4. Add the **End** node.
**Result**:
Automation updating the catalog copy or awarding points
## Create an automation updating the catalog content to the default value
---
In this part of the process, you will create a workflow which triggers at midnight every day and changes the message in the catalog to its default value: information that you can buy a soda and get extra loyalty points.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
3. As the trigger node, add **Scheduled Run**.
4. In the configuration of the node:
1. Leave the **Run trigger** setting at default (**all time**).
2. In the **Repeat runs** section, set your **Timezone**, then choose **Everyday** and set the time to `0:00`.
3. Click **Apply**.
5. Add the **Outgoing Integration** node.
6. In the configuration of the node:
1. As your method of authorization, select **Synerise API key**.
1. From the dropdown list below, select your **API key**.
2. In the **Webhook name**, field enter name for the webhook. In this case, it's `change.documentCopy`.
3. Optionally, in the **Webhook event name** field, choose an action name for the event that will be generated when Synerise receives a response from your selected endpoint.
4. In the **URL** section, select the **POST** method.
1. In the URL of the endpoint, enter `https://api.synerise.com/catalogs/bags/ID/items`, where the **ID** is the ID of your [catalog created earlier](#create-a-catalog).
5. Enter the request body. For the form used in this case, the body is as follows:
{
"value": {
"key": "copyKey",
"copy": "Buy a soda and get extra 1500 loyalty points!
Take advantage of this offer while you still can!"
},
"itemKey": "copyKey"
}
You can use this JSON code in your implementation, but change the names of the columns within the catalog and `copy` content according to your business needs.
8. Click **Apply**.
7. Add the **End** node.
**Result**:
Workflow updating the message in the catalog to the default value
## Create a document with a catalog
---
In the final step of this process, you will create a document with [the catalog created earlier](#create-a-catalog) in order to be able to return the catalog content to the mobile application. This will let you display information for the customer whether they can still use the promotion or not.
1. Go to **Data Modeling Hub > Documents > Add document**.
2. Enter the name for your document.
A slug (the ID of the document) is filled in automatically.
3. To select the type of schema, in the **Type** section, open the dropdown list.
A schema defines the method of validating the data included in the document.
4. Optionally, in the **Description** field, you can add a description of the document.
5. In the **Content (JSON)** section, paste the JSON code:
The above code contains the JSON object that will be returned to your mobile app. It contains one field (`copy`) with the value of message that should be displayed to the customer. This value is retreived using [the Jinjava insert](/developers/inserts/insert-usage#extracting-values-from-catalogs) that enables to extract values form catalogs. You can use the code in your implementation but change the name of the catalog to the one you have created, as well as the names of the columns within it.
6. Click **Apply** to save the document.
Configuration of the document
## What's next
---
For this business scenario and automation to work, creating a document with a catalog is crucial. The mobile application will be able to retrieve the document with the current copy content, with the download document method ([Android](/developers/mobile-sdk/method-reference/android/content#generate-document), [iOS](/developers/mobile-sdk/method-reference/ios/content#generate-document), [React Native](/developers/mobile-sdk/method-reference/react-native/content#generate-document)). Then, a JSON file with the raw content will be returned, which the app must properly display to the customer.
## Check the use case set up on the Synerise Demo workspace
---
You can check the:
- [catalog](https://app.synerise.com/assets/catalogs/14170)
- [metric](https://app.synerise.com/analytics/metrics/5f7a2aff-27bd-4045-9d9b-e88837d41d25)
- [automation updating the catalog copy or awarding points](https://app.synerise.com/automations/automation-diagram/271368bf-51f3-49a8-b172-b5509104f8e4)
- [automation updating the catalog to the default value](https://app.synerise.com/automations/automation-diagram/dce35c9c-926a-4306-9404-28fffd40229c)
- [document](https://app.synerise.com/assets/documents/a2cc179a-8d44-4555-9ac2-6d4c0723ccbb)
configurations directly in the Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 9 events per profile that completes the flow:
[`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~4), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`webhook.response`](/docs/assets/events/event-reference/integration#webhookresponse-and-custom-webhook-response-names) (~1), `points.upcharge` (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Catalogs](/docs/assets/catalogs/introduction-to-catalogs)
- [Documents](/docs/assets/documents/introduction-to-documents)
- [Metrics](/docs/analytics/metrics)
# Landing page with personalized promotions shared via SMS channel
In a highly competitive digital environment, personalization is key to capturing user attention and driving higher conversion rates. Personalized promotions based on customer behavior, purchase history, and preferences can significantly enhance user experience, especially when delivered through targeted channels such as SMS notifications. By redirecting users to a personalized landing page with tailored promotions, businesses can increase engagement and sales.
This use case illustrates how personalized promotional offers can be curated and presented on a landing page that is customized for each user. The landing page displays a list of promotions based on the user’s profile, with the information gathered from their purchase history, on-site activity, and preferences. Users are directed to this landing page through an SMS campaign. This process ensures that the user is exposed only to the most relevant offers, increasing the likelihood of conversion.
In this use case, we will configure a promotion in Synerise, create an SMS campaign, and set up a landing page displaying the promotions. When the customer clicks the link in the SMS, they will be redirected to the personalized landing page with the relevant promotional content. The landing page will be created based on a predefined template which make the scenario easy to prepare by adapting the ready project to your business needs.
## Prerequisites
---
To be able to implement this use case, you must:
- [SMS account](/docs/settings/configuration/sms-account) configuration (integration e.g. with SMS API).
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- If you plan to publish a landing page within your own domain, follow [the listed requirements in "Creating landing page" documentation in "Requirements for custom domains" section](/docs/campaign/landing-page/creating-landing-page); if you choose to publish it on the Synerise domain, no additional requirements are necessary.
## Process
---
In this use case, you will go through the following steps:
1. [Create promotions](/use-cases/landing-page-promotions#create-promotions).
4. [Create a landing page](/use-cases/landing-page-promotions#create-a-landing-page).
3. [Create a SMS campaign](/use-cases/landing-page-promotions#create-a-sms-campaign).
## Create promotions
---
In this part of the process, create a promotion (or more) which will be displayed on the landing page. You can create a promotion with the following scopes:
- [For selected items](/docs/ai-hub/promotions/creating-promotions) - you can select items to which you want to apply a discount
- [For entire basket](/docs/ai-hub/promotions/creating-promotions-for-entire-basket) - you can reduce the value of the whole shopping cart if its value matches the fixed price limit,
Regardless of the promotion scope, in the configuration of the promotion, in the **Content** section:
- find the **Add tag** field and add a tag of your choice. The selection of the promotions of the landing page will be narrowed down to those labeled with this tag.
Example of tag
- include all necessary promotional elements such as the product image, promotion name, description, and any other details required for displaying the promotion on the landing page. This ensures a clear presentation of the promotion to the customer, enhancing their engagement and understanding of the offer.
Make sure that all necessary promotional elements are included in the content, such as the product image, name, description, and any other details required for displaying the promotion on the landing page. Including all key elements ensures that the promotion is presented clearly and effectively to the customer, enhancing their engagement and understanding of the offer.
Alternatively, if you already created promotions in an external service, you can [import them to Synerise](/docs/automation/actions/synerise-integrations#import-promotions).
## Create a Landing Page
---
In this part of the process, you will create a landing page. We will use a predefined one, so there is no need to create the content from scratch.
1. Go to **Experience Hub > Landing Page**.
2. Enter the name of the campaign.
### Define content
---
1. In the **Content** section, click **Create Message**.
2. From the list of template folders, select a folder with the predefined **Landing Page templates**.
**Result:** You are redirected to the list of predefined templates.
3. Select the **Promotions** template. The form in the **Config** tab is pre-filled with default values, which you can modify to suit your business needs.
**Result:** You are redirected to the code editor.
4. In the **Promotions section** set up all the settings connected with promotions like the **Number of promotions** and **Number of promotions in row**. Add additional elements like **Space between promotions**, **Gap between elements in promotion**, **Background**.
Optionally: If you used a tag to categorize promotions while creating them and want to display only those with the selected tag, click **Filter promotions by tag** option and enter the tag in the **Tag name** field. This way, only the active promotions that have the specified tag will be shown on the landing page. If you leave this field empty, all activated promotions available for the given customer will be displayed.
5. In the **Enable Elements** you can decide which element should be visible on your landing page.
6. In the **Buttons, Hero, Footer,** and **General** sections, you can configure the layout and appearance of your landing page, including fonts, colors, and backgrounds, to ensure it matches your branding.
To preview the template without switched off sections, use the **Preview Contexts** option.
7. After you make changes to the template, you can check the preview.
1. Click the **Preview Contexts** button on the upper left side.
2. Enter the ID of a customer.
3. Click **Apply**.
Edit form in the Config tab
8. If the template is ready, click the arrow next to **Use in communication** in the upper right corner.
### Define schedule settings
---
1. In the **Schedule** section, click **Define**.
1. Select the timezone.
2. Select the time when the landing page will be active.
6. Click **Apply**
### Define the SEO settings
---
In this part of the process you can define technical details concerning search engine optimization and increase the chances of placing high in search results.
### Set up the URL
---
In this part of the process, you will define the URL to your landing page.
1. From the **Domain** dropdown list, select the address of your landing page.
2. Optionally, if you want to add a part to the address after the domain, in **Nice URL** provide this part, for example, `dresses-and-skirts` (don't use a slash, it is added automatically).
3. In **URL for redirecting users when the landing expires (optional)** enter the URL to which you will redirect users after the landing page expires.
4. Optionally, in **Fallback URL** enter the URL to which users will be redirected if your landing page is unavailable due to errors (for example, when it can't be rendered due to Jinjava syntax error). If you leave this field empty, users will be redirected to a generic error page.
4. In **URL preview**, you are provided with a final link to your landing page. The preview is in real time, so if you fill a domain or URL, you get the preview of the address simultaneously.
5. Confirm the settings by clicking **Apply**.
### Add optional settings
---
1. In the **HTTP headers** section, you can add custom HTTP headers to your landing page. In the **Key** and **Value** fields, enter a header and its value, respectively.
2. In the **Customize** section:
- you can add CSS and scripts to your landing page
- you can define the URLs to external sources or paste the snippets
- in the JS section under the **Advanced options** option, to enable tracking users on your landing page, you can paste the [tracking code](/developers/web/installation-and-configuration#adding-the-tracking-code-to-your-site).
### Save your campaign
---
1. After you make changes to the campaign, you can check the preview. Click the **Preview** button on the upper right side.
2. When your landing page is ready you can **Save it as a draft** or directly click **Publish**.
## Create a SMS campaign
---
In this step, create the SMS campaign with the link to the landing page with personalized list of promotions.
1. Go to **Experience Hub > SMS > Create new**
2. In the **Audience** section, choose the campaign recipients.
3. In **Content** section, click **Define**.
4. From the **Sender name** dropdown list, select the account from which the campaign will be sent.
5. Click **Create message > New template**.
The template must contain a link to the landing page. You can read more on SMS templates in ["Creating SMS templates" documentation](/docs/campaign/SMS/creating-SMS-template) .
To ensure that the landing page content is personalized and rendered specifically for the customer who is being redirected, you must pass the UUID of the customer in the link. This can be done by adding `snrs_cl` parameter in the URL in the following ways:
- by adding manually the Jinjava insert that retrieves UUID to the link, for example: `https://your.landingpage.com?snrs_cl={{customer.uuid}}`
- by inserting the link using `{% preparelink %}YOUR_LANDING_PAGE_URL{% endpreparelink %}` tags which automatically adds the `snrs_cl` parameter to the link.
You can read more about customer context in landing pages in ["Establishing customer context" section](/docs/campaign/landing-page/creating-landing-page).
6. After finishing the template, click **Use in communication**.
7. In the **Content** section, confirm the settings by clicking **Apply**.
7. In **Schedule** section, choose what time the campaign will be sent.
8. If you want to test your SMS, add your phone number and click **Send test** to check how the message is displayed.
9. To launch the campaign, in the upper right corner, click **Send**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the [landing page](https://app.synerise.com/campaigns/landing-pages/create/357dd8d8-e298-4254-9dd6-d2cf66269ee6:2024-10-07T07:58:32.436674852) with personalized product listing directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 4 events per profile that completes the flow:
[`sms.send`](/docs/assets/events/event-reference/sms#smssend) (~1), [`sms.click`](/docs/assets/events/event-reference/sms#smsclick) (~1), [`landingpage.visit`](/docs/assets/events/event-reference/landing-page#landingpagevisit) (~1), [`client.activatePromotion`](/docs/assets/events/event-reference/loyalty#clientactivatepromotion) (~1).
## Read more
---
- [Jinjava inserts](/developers/inserts)
- [Landing page](/docs/campaign/landing-page)
- [Promotions](/docs/ai-hub/promotions)
- [SMS campaigns](/docs/campaign/SMS)
# Event authorization in JS SDK with Flask
In the digital age, understanding and engaging with your customers on a personalized level has become a pivotal factor in business success. Synerise provides an efficient solution to this with its advanced tracking capabilities. By implementing the authorization of events with the Synerise tracking script, businesses can open doors to a plethora of opportunities.
Employing JWT (JSON Web Tokens) authentication for these events ensures data security, giving businesses the confidence in knowing their customer data is protected. JWT, being a compact and self-contained way for securely transmitting information, is an industry-standard for authorization. Synerise's insistence on using JWT with the RS256 algorithm provides an additional layer of security.
In essence, authorizing events with Synerise is not just about sending and receiving data. It's about transforming the way businesses interact with their customers, providing them with unique, personalized experiences, all the while ensuring the utmost data security. This integration is an essential step for companies aiming for growth, increased customer satisfaction, and improved ROI.
In our step-by-step guide to authorizing events with Synerise, we'll be leveraging two prominent technologies: Python Flask and JavaScript React. Flask is a lightweight web framework for Python, ideal for creating small to medium-sized web applications with ease and efficiency. On the other hand, React is a renowned JavaScript library developed by Facebook, designed for building user interfaces in a modular and reactive manner. Together, Flask will power our backend, providing necessary endpoints and logic, while React will drive our frontend, ensuring a seamless user experience. This combination allows for a robust and scalable solution, optimized for both development and production scenarios.
After you complete this integration and your website is ready to authorize events with JWT, you can start requiring authorization for sensitive events. For details on enabling JWT requirements for events, see ["Event authentication settings"](/docs/assets/events/event-settings).
Overview of JWT implementation logic
### Prerequisites
---
- Public RSA key added to Synerise. If keys were not added before, check how you can add them [here](/developers/web/jwt-auth#prerequisites).
- Local machine with installed Python and Node environments.
- Tracking code added to your React website.
- Basic skills in React and Python.
### Process
---
The logic is described in [Authenticating requests with JSON Web Tokens (JWT)](/developers/web/jwt-auth) and this use case presents an example implementation step by step.
1. [Implement back-end](/use-cases/anonymous-profile-to-recognized#implement-back-end)
2. [Implement front-end](/use-cases/anonymous-profile-to-recognized#implement-front-end)
### Implement back-end
---
Before creating the front-end, we must create a backend—our bridge to the Synerise platform. The PyJWT and cryptography libraries ensure that a secure JWT is created according to Synerise's standards. The primary endpoint, **/generate-jwt** (created with Flask), facilitates this by generating a JWT from customer data.
#### Install libraries
Using the `pip install Flask PyJWT cryptography` command, install three Python packages: Flask, PyJWT, and cryptography.
Explanation of these packages:
- **[Flask](https://flask.palletsprojects.com/en/3.0.x/)** - Lightweight web framework for Python. We will use it to create the web server and define the API endpoint to generate JWT and return it to our React application.
- **[PyJWT](https://pyjwt.readthedocs.io/en/stable/)** - Python library which allows encoding and decoding JSON Web Tokens (JWT).
- **[cryptography](https://github.com/pyca/cryptography)** - Python library that offers secure cryptographic operations, essential for RS256 algorithm support in generating JWTs in our project.
When developing any Python application, it’s a best practice to use virtual environments! Virtual environments allow you to create isolated Python environments for different projects, avoiding conflicts between dependencies.
#### Implement the Flask application
The application imports the private RSA key, which is needed to sign the JWT.
The **/generate-jwt** endpoint of the application accepts POST requests with customer information (email and UUID) and uses that data to generate a JWT compliant with Synerise's requirements.
Error handling is included in the code. To better understand the code, read the comments.
from flask import Flask, jsonify, request
import jwt
import datetime
app = Flask(__name__)
## Load the RSA private key for JWT signing.
## Synerise requires JWTs to be signed with RSA.
with open('private.pem', 'r') as f:
PRIVATE_KEY = f.read()
@app.route('/generate-jwt', methods=['POST'])
def generate_jwt():
"""
Endpoint to generate JWT using the RS256 algorithm, as required by Synerise. This method expects a JSON payload containing the "email" and "uuid" of a customer.
"""
# Retrieve the JSON payload from the request
data = request.get_json()
# Ensure both 'email' and 'uuid' are present in the request
# As per documentation, the JWT payload should include customer's email and UUID.
if not data or 'email' not in data or 'uuid' not in data:
return jsonify({'error': 'Missing email or uuid in request'}), 400
email = data['email']
uuid = data['uuid']
# JWT header as defined in the documentation
# Synerise requires the JWT to use the RS256 algorithm.
headers = {
"alg": "RS256",
"typ": "JWT"
}
# JWT payload as per Synerise's requirements
payload = {
"exp": datetime.datetime.utcnow() + datetime.timedelta(days=7), # Token expiry set to 7 days as stated in the documentation
"uuid": uuid, # customer's UUID
"email": email # customer's email
}
# Generate the JWT token
# The token is signed with the RSA private key as required by the documentation.
token = jwt.encode(payload, PRIVATE_KEY, algorithm="RS256", headers=headers)
return jsonify({'jwt': token})
if __name__ == '__main__':
# Start the Flask application
app.run(debug=True)
### Implement front-end
---
The front-end part is modular to ensure efficiency and easier maintenance.
The **useSyneriseAuthentication** hook creates an UUIDv5 for the customer and uses it in the request for a JWT.
Next, the hook is used in the **LoginForm** component, which collects the customer's email that's passed to the hook for creating a JWT.
To better understand the code, read the comments.
#### Implement custom authentication hook
import { useState } from 'react';
/**
* Custom hook to handle Synerise authentication.
*/
function useSyneriseAuthentication() {
const [loading, setLoading] = useState(false);
const [error, setError] = useState(null);
// Function to generate UUIDv5 based on a salt and unique identifier
const generateUUIDv5 = (uniqueIdentifier) => {
const salt = "someString";
return uuid.uuid5(uuid.NAMESPACE_URL, (salt + uniqueIdentifier));
};
// Function to fetch JWT from the backend
const fetchJWT = async (email, uuidValue) => {
const response = await fetch('/generate-jwt', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ email, uuid: uuidValue }),
});
if (!response.ok) {
throw new Error("Failed to fetch JWT");
}
const { jwt } = await response.json();
return jwt;
};
// Function to authenticate a user with Synerise
const authenticate = async (email) => {
setLoading(true);
setError(null);
try {
const existingIdentityHash = SR.client.getIdentityHash();
const hashedEmail = SR.client.hashIdentity(email);
let uuidValue;
if (!existingIdentityHash || hashedEmail !== existingIdentityHash) {
uuidValue = generateUUIDv5(email); // Derive from a cookie in a real-world scenario
const jwt = await fetchJWT(email, uuidValue);
SR.client.setUuidAndidentityHash(hashedEmail, uuidValue);
SR.client.setAccessToken(jwt);
} else {
// Identity matches the current customer; Continue with the existing JWT
// This can be enhanced based on specific requirements
}
setLoading(false);
} catch (err) {
setError(err.message);
setLoading(false);
}
};
return { authenticate, loading, error };
}
export default useSyneriseAuthentication;
#### Implement LoginForm component
Below you can find the example of useSyneriseAuthentication usage:
import { useState } from 'react';
import useSyneriseAuthentication from './useSyneriseAuthentication'; // Ensure you've created this hook as mentioned earlier.
function LoginForm() {
const [email, setEmail] = useState('');
const syneriseAuth = useSyneriseAuthentication();
const handleSubmit = async (event) => {
event.preventDefault();
// Initiate authentication process using the provided email
const success = await syneriseAuth.authenticate(email);
if (success) {
console.log("Authentication successful.");
// Here, you can redirect or update the UI as necessary.
} else {
console.log("Authentication failed.");
// Handle failure, maybe show an error message or retry.
}
};
return (
<div>
<h2>Login</h2>
<form onSubmit={handleSubmit}>
<div>
<label>Email:</label>
<input
type="email"
value={email}
onChange={e => setEmail(e.target.value)}
required
/>
</div>
<div>
<button type="submit">Login</button>
</div>
</form>
</div>
);
}
export default LoginForm;
Test the solution and adapt it to fit your specific needs. For example, we recommend adding authentication on your website before a visitor can request the JWT and start sending events.
### What's next
---
Send events from your website as described in ["Event tracking"](/developers/web/event-tracking).
### Generated events
This use case does not generate any events.
### Read more
---
[Introduction to events](/docs/assets/events/introduction-to-events).
# Personalize item suggestions based on a clicked advertisement
In today's digital landscape, delivering personalized experiences to customers has become essential for businesses to stand out and engage their audience effectively. One powerful approach to personalization is tailoring the content and product offerings based on the traffic source that brings visitors to a personalized landing page.
This use case describes the process of implementing a dynamic content that displays item suggestions which are based on the clicked ad.
Before you proceed to implementing this use case, you must configure an external advertisement campaign within which UTMs are added to URLs. These UTMs will be used in the targeting options of the dynamic content campaign, enabling the display of items suggestions based on the clicked ad.
This use case provides you with an HTML code for the dynamic content to be edited in the [dynamic content template builder](/docs/campaign/dynamiccontent/creating-dynamic-content-templates/dynamic-content-template-builder). When you paste it to the editor, you will be able to configure the fields in the template by means of a user-friendly configuration form.
The HTML code of the dynamic content consists of the following configurable elements:
- The banner field in which you can paste a link to the image of the collection
- The field with the main title displayed in the dynamic content
- One object, dedicated to one item. The object let you define the title of the product, its description and price, and the link to the product's image.
- Recommendation selection section.
## Prerequisites
---
- [Configure AI engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations) and enable it for personalized recommendations.
- Prepare an external advertising campaign for specific product category and configure UTM parameters for the ads.
- Create a [landing page](/docs/campaign/landing-page). The dynamic content will be displayed on this page.
## Process
---
In this use case, you will go through the following steps:
1. [Create a recommendation campaign](/use-cases/personalization-based-on-traffic-source#create-a-recommendation-campaign) which promotes the specific product category.
2. [Create a dynamic content](/use-cases/personalization-based-on-traffic-source#create-an-editable-dynamic-content) that will display the item collection based on the ad a customer has been redirected from.
## Create a recommendation campaign
---
Create a recommendation campaign that will return the items of the specific category. Such recommendation will return the items based on customer's behavior on the website and browsing history.
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**
2. Enter the meaningful name of the recommendation.
3. In the **Type & Items feed** section, click **Define**.
1. From the **Items feed** dropdown list, select the main catalog with all products and categories.
2. As the type, select **Personalized**.
4. Click **Apply**.
4. In the **Items** section, click **Define**.
5. Click **Add slot**. You can name the slot for later reference.
6. In the **Number of items** subsection, set the minimum and maximum number of items to `6`.
Setting the minimum and maximum number of items to the same number ensures that exactly this many items will appear in the slot.
7. From the **Statics filters** dropdown, click **define filter** and choose **Visual Builder**.
8. In the visual builder, choose the **category** (or **brand**) attribute and set its value to the category from which the items will be presented in the recommendation.
8. Additionally, if you want to, you can apply [other filters types](/docs/ai-hub/recommendations-v2/recommendation-filters) to specify the range of items displayed in the recommendation.
9. In the **Items** section, click **Apply**.
10. In the **Boosting** section, you can enable [define boosting rules](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-the-boosting-factors).
11. Optionally, in the **Additional settings** section, you can exclude the items which were already purchased or select the metric according to which the items will be ordered in the recommendation.
12. Save the recommendation by clicking **Save**.
## Create an editable dynamic content
---
In this part of the process, you will create a dynamic content campaign dedicated to a specific category. The provided HTML code has defined variables that can be easily customized to meet your unique business needs using the configuration form. The variables that are defined include: title, description, price, item link, and image link.
1. Go to **Experience Hub > Dynamic Content > Create new**.
2. Enter the name of the content.
3. Choose the **Insert object** type.
2. In the **Audience** section, select **Everyone**.
3. In the **Content** section, select **Simple message**, and specify the CSS selector where you want to insert dynamic content to your website.
4. Click **Create Message > New template**.
5. In the code editor, insert Jinjava with the configurable boxes and add your own CSS.
Below you will find the ready-to-use code with variables that will appear in the configuration form. You can implement it in your campaign, add CSS with specific styles and fill the config boxes based on your preferences. What is important, the code contain information about one exemplary item. You can add as many items as you want.
Dynamic content settings
6. Additionally, you can add to the campaign as an insert link to the recommendation campaign with products from a specific brand. Click **Insert**, select **AI Recommendations 2** from the list and choose the recommendation campaign crated in the [previous step](/use-cases/personalization-based-on-traffic-source#create-a-recommendation-campaign).
7. Click **Get HMTL code**, click **Copy to clipboard** button visible on the upper right side of the screen.
8. Go to the HTML tab of the campaign editor on the right side of the screen and paste the code below the code added before.
7. Add CSS styles based on your business assumptions.
8. Save the template.
5. In the **Schedule** section, select the date when the dynamic content is activated.
6. In **Display settings**, define the circumstances for displaying the content.
1. In the **Triggers** section, select **on landing**.
2. Click **Advanced options**, go to the **Page targeting** section.
3. Below the **Display on pages** banner, click **Add rule**.
4. From the left dropdown list, select **RegExp**.
5. In the right field set the URL where you want your dynamic content to be shown. Add the UTMs of the external campaign. It will decide which DC campaign should be displayed.
3. In the **Frequency** section, select **Always**.
4. In the **stop display** section, select **Never**.
5. In the **Device** section, select on which device you want to show the dynamic content.
6. Confirm by clicking **Apply**.
7. In the **UTM & URL parameters** section, click **Skip step**.
8. Activate dynamic content.
Dynamic content settings
## What’s next
---
To measure campaign performance, you can create various custom analytics. Once these analytics are created, they can be brought together in a single dashboard to provide a holistic view of campaign performance, allowing you to quickly assess whether the given results met your specific campaign goals and objectives.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of every element of this process directly in Synerise [Demo workspace](https://demo.synerise.com/request):
- [Recommendation campaign](https://app.synerise.com/ai-v2/recommendations/rotdrWmS5iJU)
- [Dynamic content campaign](https://app.synerise.com/campaigns/create/ee4bbc3a-627d-4e20-bd95-9288cf411b23)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 4 events per profile that completes the flow:
[`page.visit`](/docs/assets/events/event-reference/web-and-app#pagevisit) (~1), [`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1).
## Read more
---
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Referral program
Want an effective way to attract new customers? Use referral programs to work for you. Referral marketing is a great way to reach out to future customers while engaging your current ones to endorse your brand. A win-win benefit for both parties.
Referral programs are one of the most powerful tools in building your sales by encouraging your customers to share something valuable with their friends. The power of a customer recommending your product to their friends is undeniable. When they do, they not only help you win business, but also increase awareness of your brand, which ultimately helps you reap big profits.
This use case describes the process of creating a refferal program by which current users of a mobile app can refer it to their friends and earn additional loyalty points for this action.
**The main principles of the referral program:**
**Referrer**
An active user of the application can refer it by distributing its unique code among friends and will receive 500 loyalty points as a reward.
The list below contains the business assumptions this use case is based on:
- A unique code is generated for each active app user, which they can share with their friends as a part of the referral program. In order to see their code, users must verify phone number first. Only after the phone number is correctly verified, the code is displayed in the user's account.
- A user can only receive 500 loyalty points when the invitee downloads the app, makes a purchase for min. $20, and has a verified phone number.
- A user can recommend the app to a maximum of 3 people. When as all 3 invited users make a purchase, the referrer receives points (3x500) and the code section disappears which means the user can no longer continue to refer the app.
- Loyalty points can only be awarded to the referrer.
- The referrer is informed each time after receiving loyalty points for referring the application through a mobile push.
**Invitee**
- A new user does not receive additional loyalty points for using the provided code.
- The new user must have a verified phone number for the referrer to receive loyalty points.
To simplify naming in this use case, in further steps of the process referrer will be represented as `user 1` and invitee will be described as `user 2`.
## Prerequisites
---
- Implement [loyalty programs basics](/use-cases/loyalty-programs-basics)
- Integrate Synerise [mobile SDK](/developers/) in your mobile application.
- Implement [mobile pushes](/developers/mobile-sdk/configuring-push-notifications) in your mobile application.
- [Configure mobile push notifications](/docs/campaign/Mobile/mobile_campaign)
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate](/use-cases/referral-program#create-an-aggregate-that-counts-the-sum-of-all-user-transactions) that counts the sum of all user transactions.
2. [Create a segment](/use-cases/referral-program#create-a-segment-of-users-who-meet-the-requirements-of-the-referral-program) of users who meet the requirements of the referral program.
3. [Create an expression](/use-cases/referral-program#create-an-expression-that-determines-the-number-of-points-awarded-for-each-referral) that determines the number of points awarded for each referral.
4. [Create an expression](/use-cases/referral-program#create-an-expression-to-determine-the-maximum-number-of-points-to-be-awarded) to determine the maximum number of points to be awarded.
5. [Create a workflow](/use-cases/referral-program#create-a-workflow-that-generates-a-unique-referral-code) that generates a unique referral code for the user 1.
6. [Create a workflow](/use-cases/referral-program#create-a-workflow-that-adds-referral-points) that adds referral points to user 1.
7. [Create an expression](/use-cases/referral-program#create-an-expression-that-calculates-the-number-of-points-remaining-for-user-1) that calculates the number of points left.
8. [Prepare a mobile push notification](/use-cases/referral-program#prepare-a-mobile-push-notification).
9. [Create a workflow](/use-cases/referral-program#create-a-workflow-that-assigns-the-number-of-points-awarded) that assigns the number of codes awarded to user 1.
## Create an aggregate that counts the sum of all user transactions
---
In this part of the process, create an aggregate that returns the sum of all transactions a user made. This aggregate will be used to describe a condition (an invited user must spend at least $20, so the referring person can receive loyalty points for a referral) in a segmentation that will be created in further part of the proces.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Sum**.
4. From the **Choose event** dropdown list, select the **transaction.charge** event.
5. As the event parameter, select **$revenue**.
6. Set the period from which the aggregate will analyze results to **Lifetime**.
7. Save the aggregate.
Aggregate settings
## Create a segment of users who meet the requirements of the referral program
---
The conditions that **user 2** must meet include:
- execution of transactions for a minimum of $20,
- verification of the phone number,
- user 1 can receive loyalty points for a successful referral of a friend only once - the last condition is a security feature: **webhook.response** with the addition of points to **user 1** can not occur more than 1 time.
1. Go to **Decision Hub > Segmentations > New Segmentation**.
2. Enter the name of the segmentation.
3. Choose **Add condition** and find the [aggregate counting the sum of all user transactions](/use-cases/referral-program#create-an-aggregate-that-counts-the-sum-of-all-user-transactions), created in the previous step.
4. From the **Choose operator** dropdown, choose **Number**, and then select **More or equal to**.
5. In the next field, enter the required transaction value, in our case it is `20`.
6. Choose **Add condition** and find **phoneVerified** tag.
7. From the **Choose operator** dropdown, choose **Is true**.
8. Choose **Add condition** and find **webhook.response** event.
9. Click the + where button, from the **Choose parameter** dropdown menu, choose **name**.
10. From the **Choose operator** dropdown, choose **Contain**.
11. In the next field, type `add points to user 1`.
`add points to user 1` is the name of the Outgoing Integration node used in [this automation](/use-cases/referral-program#create-a-workflow-that-adds-referral-points).
12. Change the **Performed** action to **Not performed** by clicking the **Performed** word.
13. Set the period from which the aggregate will analyze results to **Lifetime**.
14. Save the aggregate.
The segmentation settings
This segmentation will be used [in a workflow that assigns loyalty points to user 1](/use-cases/referral-program#create-a-workflow-that-adds-referral-points).
## Create an expression that determines the number of points awarded for each referral
---
In this part of the process, create an expression that will later be used to assign a defined number of points to **user 1** for an application referral. In our case, each user receive 500 points for each referral.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression.
3. Leave the **Expression** option at default (**Attribute**).
4. Click the **Select** button.
5. Choose **# Constant**.
6. Open the settings of Constant value by clicking `0`.
7. In the field below, type `500`
8. Click **Save**.
## Create an expression to determine the maximum number of points to be awarded
---
In this part of the process, you will create an expression that determines the maximum number of points that can be awarded to **user 1**. In our case, it is 1500 points. This expression will be used to [calculate the number of points remaining for user 1](/use-cases/referral-program#create-an-expression-that-calculates-the-number-of-points-remaining-for-user-1).
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression.
3. Leave the **Expression** option at default (**Attribute**).
4. Click the **Select** button.
5. Choose **# Constant**.
6. Open the settings of Constant value by clicking `0`.
7. In the field below, type `1500`
8. Click **Save**.
## Create a workflow that generates a unique referral code
---
In this part of the process, you will create a workflow that will generate a unique referral code for both new users who are about to join the application and existing ones, which will be stored in the **my_referral_code** attribute. In addition, you will generate a special attribute that will be used to count the number of codes granted to **user 1** - **referral_points_received**.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the trigger nodes
Configure the conditions that will trigger the workflow. In this case, you will run a workflow for new users who are just joining the application and for existing users for whom the code has not been generated yet.
#### Define the Profile Event node
1. As the first node of the workflow, add **Profile Event**. In the configuration of the node:
1. From **Choose event** dropdown menu, choose `client.add` event.
2. Confirm by clicking **Apply**.
#### Define the Audience node
1. Add the **Audience node**.
2. In the configuration of the node, leave the value of the **Run trigger** option at default (**one time**).
3. In **Define audience**, choose **New Audience** and click **Define conditions**.
1. As the first condition, from **Choose filter** dropdown menu, choose `anonymous_type` attribute.
2. From the **Choose operator** dropdown list, select **Equal**.
3. **Result**: A text field appears.
4. In the text field type `NONE`.
The `anonymous_type` attribute determines whether the profile is anonymous or recognized. By selecting the value `NONE`, you will include only recognized users.
5. Click **Choose filter** and from the dropdown list, select **my_referral_code**.
6. From the **Choose operator** dropdown list, select **Boolean - Is true**.
7. Change the **Profiles matching attribute** option to **Profiles not matching attribute** by clicking the **matching** word.
8. Click **Apply**.
### Add the Merge Paths node
Join the paths of the triggers created in the previous step by adding a **Merge Paths** node.
### Configure the Delay node
1. Add the **Delay** node. In the node settings:
1. In the **Delay** field, type `3`.
2. From the dropdown list, choose **Second**.
2. Click **Apply**.
### Define the Profile Filter node
In this step, you will check whether the user passing this workflow already has the **my_referral_code** attribute assigned to their profile. If the user does not have the **my_referral_code** attribute, it will be generated in the next step of the workflow. If the user already has this attribute assigned, the flow ends.
1. Add the **Profile Filter** node.
2. In the settings of the node, click **Choose filter** and from the dropdown list, select **my_referral_code**.
3. As the **Operator**, choose **Boolean - Is false**.
4. Click **Apply**.
5. Add the **End** node to the unmatched path from the **Profile Filter** node.
### Define the Update Profile node
In this part of the process, you will create an attribute **my_referral_code** for users who do not have this attribute yet.
- The attribute value with a unique referral code will be generated using the Jinjava code presented in the following steps.
- The generated code will be used by **user 1** to invite friends to the application.
For later tracking of points received by **user 1**, an additional attribute is added - **referral_points_received**, which is initially assigned the value `0`, since the user has not yet received points for the referral.
1. Join the matched paths from the **Profile Filter** node with the **Update Profile** node.
2. From the left dropdown list, select **Attributes > my_referral_code**.
3. From the right dropdown list, select **Change**.
4. In the text field, add Jinjava that will generate a unique reference code for **user 1** based on the user's unique client ID.
For security reasons, we do not publish any examples. In case you need any support in creating such a unique mechanism, do not hesitate to contact us, we will be happy to help.
5. Click **Add field** and from the dropdown list, select **Attributes > referral_points_received**
6. From the right dropdown list, select **Change**.
7. In the text field, enter `0`.
8. Click **Apply**.
The configuration of the Update Profile node
9. Select the **End** node.
Final configuration of the workflow
## Create a workflow that adds referral points
---
In this part of the process you will create a workflow that will add points to **user 1** if all the necessary conditions are met, such as:
- **user 2** has made a transaction for a minimum of $20,
- **user 2** has a verified phone number,
- **user 1** has not exceeded the limit of the possible number of referrals (3 referrals).
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the trigger nodes
Configure the conditions that will trigger the workflow. In this case, the workflow is triggered for invited users who have already verified their phone number or completed a transaction. Meeting both conditions will also be checked in a further step of the workflow.
#### Define the Profile Event node
1. As the first node of the workflow, add **Profile Event**. In the configuration of the node:
1. From **Choose event** dropdown menu, choose `transaction.charge` event.
2. Confirm by clicking **Apply**.
#### Define the Profile Event node
1. Add **Profile Event**. In the configuration of the node:
1. From **Choose event** dropdown menu, choose `client.addTag` event.
2. Click the + where button, from the **Choose parameter** dropdown menu, choose **name**.
3. From the **Choose operator** dropdown, choose **Equal**.
4. In the next field, type `phoneVerified`.
The tag name shown in this case is only an example. You can use any other tag that is dedicated to recognizing a verified phone number.
2. Confirm by clicking **Apply**.
### Add the Merge Paths node
Join the nodes defined in the previous step into a single path using the **Merge Paths** node.
### Configure the Delay node
1. Add the **Delay** node. In the node settings:
1. In the **Delay** field, type `10`.
2. From the dropdown list, choose **Second**.
2. Click **Apply**.
### Define the Profile Filter node
In this step, you will verify if all conditions have been met in order to assign points to **user 1** . If not, the workflow ends for a user.
1. Add the **Profile Filter** node.
2. In the settings of the node click **Choose filter** and from the dropdown list, select the segmentation you already created in [this step](/use-cases/referral-program#create-a-segment-of-users-who-meet-the-requirements-of-the-referral-program).
3. As the **Operator**, choose **Boolean - Is true**.
4. Click **Apply**.
### Define the Outgoing Integration node
In the **Outgoing Integration** node, you will create a webhook that will find the user to whom the points should be assigned - **user 1**.
Outgoing Integration will be performed only for users who meet the conditions defined in the **Profile Filter** node, otherwise the flow is finished - to the **Not matched** path from the **Profile Filter** node, add the **End** node.
1. Add the **Outgoing Integration** node for the matching path.
2. In the **Definition** section, choose the **Custom webhook** tab.
3. In the **Webhook name** field, enter a name for the webhook. In this case `find user 1`.
4. Select the **GET** method.
3. In the URL of the endpoint, enter `https://api.synerise.com/crm/v1/list?search=my_referral_code:{{client.friends_referral_code}}`.
We are looking for a profile in Synerise whose attribute value corresponds to the referrer.
5. In the **Authorization** section, select **by API key** as your method of authorization.
6. From the dropdown list below, select your **API key**.
7. Click **Apply**.
### Define the Event Filter node
In this step, you will check whether:
- **user 1** has been found,
- **user 1** has already reached the maximum number of possible points received from the referral program,
- there are no phone fraud tags for this user (the number of that user isn't used in more than one profile).
1. As the next node, add **Event Filter**. In the configuration of the node:
1. In the **Check** field, leave the default value **without limits**.
2. In the **Define conditions** field, from the **Choose event** dropdown menu, choose `webhook.response` event.
3. Click the + where button, from the **Choose parameter** dropdown menu, choose **name**.
4. From the **Choose operator** dropdown, choose **Equal**.
5. In the next field, type `find user 1`.
6. From the **Choose parameter** dropdown menu, choose **body.customers[0].referral_points_received**.
In order for such a parameter to appear in the webhook.response options, you need to launch the automation at least once for a test user.
7. From the **Choose operator** dropdown, choose **Less or equal**.
8. In the next field, type `3`
2. Confirm by clicking **Apply**.
### Define the Outgoing Integration node
In this **Outgoing Integration** node, you will create a webhook that sends the **points.upcharge** event that adds points to **user 1**.
1. Add the **Outgoing Integration** node for the matching path.
2. In **Definition** section, choose the **Custom webhook** tab.
3. In the **Webhook name**, field enter a name for the webhook. In this case `add points to user 1`.
4. Select the **POST** method.
3. In the URL of the endpoint, enter `https://api.synerise.com/v4/events/custom`.
5. In the headers section:
- set `content-type` value to `application/json`
- set`accept` value to `application/json`
- define `api-version` to `4.4`
6. Enter the request body. The structure of the request body includes:
- the expression created in [this step](/use-cases/referral-program#create-an-expression-that-determines-the-number-of-points-awarded-for-each-referral)
- dynamic reference to a customer ID
7. In the **Authorization** section, select **by API key** as your method of authorization.
1. From the dropdown list below, select your **API key**.
8. Click **Apply**.
### Add the End node
1. On the **Outgoing Integration** node, click the plus button.
2. From the dropdown list, select **End**.
3. Save and activate the automation by clicking **Save&Run**.
Final configuration of the workflow
## Create an expression that calculates the number of points remaining for user 1
---
In this part of the process, you will create a formula that will calculate the number of points remaining for **user 1**. To do this, you will subtract the value of the **points.upcharge** event from [the expression with the maximum number of points](/use-cases/referral-program#create-an-expression-to-determine-the-maximum-number-of-points-to-be-awarded).
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression.
3. Leave the **Expression** option at default (**Attribute**).
4. In the formula of the expression:
1. Click **Select**.
2. From the dropdown list, select **Function > Profile**.
3. Click the **unnamed** node.
4. At the bottom of the page, click **Choose attribute**.
5. From the dropdown list, select the [expression with the maximum number of points](/use-cases/referral-program#create-an-expression-to-determine-the-maximum-number-of-points-to-be-awarded) you created earlier.
6. Click + button and from the dropdown list select **Profile**.
7. Click the **unnamed** node.
8. At the bottom of the page, click **Choose attribute**.
9. From the dropdown list, select the **points.upcharge** attribute.
10. Click the + button and change it to `-`.
11. In the upper-right corner, click **Save**.
12. In the upper-right corner, click **Publish**.
Final configuration of the expression
## Prepare a mobile push notification
---
Prepare a mobile push notification informing about the number of points awarded and points remaining for **user 1**, which will be used in the workflow created in the next steps of the process.
1. Go to **Experience Hub > Mobile > Templates**.
2. Create your mobile push using the code editor or Drag&drop builder.
3. If you use the code editor, you can use the code sample available below and adjust it as needed.
Remember to change the expression IDs in this code, as they refer to the expressions created in this use case.
Check the Jinjava code
{ "notification": { "title": "You have earned 500 points!", "body": "Congratulations!!! You just earned 500 points for the registration of a new referred user!", "sound": "default", "priority":"high" }, "data": { "issuer": "Synerise", "message-type": "static-content", "content-type": "simple-push", "content": { "notification": { "action": { "type": "OPEN_APP" } } }, "payload": { "type": "points-earned", "pointsReward": "{% expression %} f05e644c-7009-49d0-9208-18e9319af4a5 {% endexpression %}", "title": "You have earned 500 points!", "subtitle": "Thank you for being with us!", "description": "You receive 500 points for the registration of a new user. You can earn {% expression %} 819f23f5-4f97-4039-b3ef-eb83130ac7c6 {% endexpression %} more points for the registration of additional users in the application." } } }
## Create a workflow that assigns the number of points awarded
---
In this part of the process, you will create a workflow that will assign the amount of times that points have been awarded to **user 1**. This information is stored in the **referral_points_received** attribute. Once the **referral_points_received** attribute is updated, **user 1** will receive information about the number of points still to be earned, in the form of a mobile push.
### Define the Profile Event node
Configure the condition that will trigger the workflow. This workflow will be triggered by the event generated in the previuos step - `points.upcharge`.
1. Add the **Profile Event** node. In the configuration of the node:
2. From **Choose event** dropdown menu, choose `points.upcharge` event.
3. Click the + where button, from the **Choose parameter** dropdown menu, choose **description**.
4. From the **Choose operator** dropdown, choose **Contain**.
5. In the next field, type `referral_points`.
6. Confirm by clicking **Apply**.
### Configure the Delay node
1. Add the **Delay** node. In the node settings:
1. In the **Delay** field, type `3`.
2. From the dropdown list, choose **Second**.
2. Click **Apply**.
### Define the Profile Filter node
In this step, as well as in further steps related to the **Profile Filter** node, you will check whether the **user 1** **referral_points_received** attribute is equal to `0`, `1` or `2`, presenting the total number of times user 1 has received referral points.
Depending on the value of the attribute, it will be increased by one.
For example:
- if the attribute value is equal to `0`, it will be updated to `1`;
- if the attribute value is equal to `1`, it will be updated to `2`;
- if the attribute value is equal to `2`, it will be updated to `3`.
1. Add the **Profile Filter** node.
2. In the settings of the node, click **Choose filter** and from the dropdown list, select **referral_points_received**.
3. As the **Operator**, choose **Equal**.
4. In the next field, enter `0`.
5. Click **Apply**.
6. To the **Matched** path, add the **Update Profile** node.
### Define the Update Profile node
In this part of the process you will update the **referral_points_received** attribute by increasing its value by a unit.
1. Select the **Update Profile** node.
2. From the left dropdown list, select **Attributes > referral_points_received**.
3. From the right dropdown list, select **Change**.
4. In the text field, type `1`.
5. Click **Apply**.
### Define the Send Mobile Push node
Add **Send Mobile Push** node. This node will send a mobile push to **user 1** with information about the number of points still available to earn from the referral campaign.
1. Select the type of the mobile push notification as **Simple Push**.
2. Select the push template, created [in this step](/use-cases/referral-program#prepare-a-mobile-push-notification) with the information about points gained.
3. Skip the **Additional parameters**.
3. Confirm the settings by clicking **Apply**.
### Add the End node
Add the **End** node for this part of the flow.
To the **Not Matched** path from the [Profile Filter node](/use-cases/referral-program#define-the-profile-filter-node-2) add **Profile Filter node**.
### Define the Profile Filter node
In this step, you will check whether the attribute **referral_points_received** of **user 1** is equal to `1`.
1. Add the **Profile Filter** node after the first **Profile Filter** node.
2. In the settings of the node, click **Choose filter** and from the dropdown list, select **referral_points_received**.
3. As the **Operator**, choose **Equal**.
4. In the next field, type `2`.
5. Click **Apply**.
6. Define the **Update Profile** node for the **Matched** path.
For the **Matched** path:
1. Define the **Update Profile** node in the same way as in the [previous node](/use-cases/referral-program#define-the-update-profile-node-1), but updating the value of the **referral_points_received** attribute to `2`.
2. Add **Send Mobile Push** node with the same settings as in [this step](/use-cases/referral-program#define-the-send-mobile-push-node) of the process.
3. Add the **End** node.
For the **Unmatched** path of the [Profile Filter node](/use-cases/referral-program#define-the-profile-filter-node-3):
1. Define **Profile Filter** node that will check whether the attribute **referral_points_received** of **user 1** is equal to `2`.
For the **Unmatched** path, add the **End** node.
2. For the **Matched** path:
1. Define **Update Profile** node updating the value of the **referral_points_received** attribute to `3`.
2. Add **Send Mobile Push** node.
3. Add the **End** node.
3. Save and activate the automation by clicking **Save&Run**.
Final configuration of the workflow
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of all process steps directly in the Synerise Demo workspace:
- [Aggregate that counts the sum of all user transactions](https://app.synerise.com/analytics/aggregates/8072b100-e090-3d59-8067-c27df1e1d735)
- [Segment of users who meet the requirements of the referral program](https://app.synerise.com/analytics-v2/segmentations/9323140e-6226-4117-8b79-06bb088d828c)
- [Expression that determines the number of points awarded for each referral](https://app.synerise.com/analytics/expressions/f05e644c-7009-49d0-9208-18e9319af4a5)
- [Expression to determine the maximum number of points to be awarded](https://app.synerise.com/analytics/expressions/3581a34e-6dbb-431a-a84d-987826a28b94)
- [Workflow that generate a unique refferal code for user 1](https://app.synerise.com/automations/automation-diagram/5928505b-2814-4f20-b160-405bb2607877)
- [Workflow that add referral points to the user 1](https://app.synerise.com/automations/automation-diagram/5c270e53-3b72-462e-985b-b2eac91e5a0e)
- [Expression that calculate the number of points remaining for user 1](https://app.synerise.com/analytics/expressions/819f23f5-4f97-4039-b3ef-eb83130ac7c6)
- [Workflow that assign the number of codes granted by user 1](https://app.synerise.com/automations/automation-diagram/91b849b9-0196-4e5a-aa04-8db479c9143c)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 31 events per profile that completes the flow:
[`client.add`](/docs/assets/events/event-reference/profiles#clientadd) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~3), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~14), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~3), [`profile.updated`](/docs/assets/events/event-reference/profiles#profileupdated) (~2), [`transaction.charge`](/docs/assets/events/event-reference/items#transactioncharge) (~1), [`client.addTag`](/docs/assets/events/event-reference/profiles#clientaddtag) (~1), [`webhook.response`](/docs/assets/events/event-reference/integration#webhookresponse-and-custom-webhook-response-names) (~2), `points.upcharge` (~1), [`push.send`](/docs/assets/events/event-reference/mobile-push#pushsend) (~1), [`push.view`](/docs/assets/events/event-reference/mobile-push#pushview) (~1), [`push.click`](/docs/assets/events/event-reference/mobile-push#pushclick) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Automation Hub](/docs/automation)
- [Expressions](/docs/crm/expressions)
- [Segmentation](/docs/analytics/segmentations)
# Personalized promotion tailored to last visited main category
In online retail, timing and relevance are key when presenting promotions. Shoppers often browse multiple sections of a website but don’t always convert immediately. By leveraging the last visited main category, businesses can deliver contextually relevant promotions that feel timely and personalized.
This use case illustrates how to dynamically display a promotion related to the last main category visited by the user — for example, if the customer recently viewed items from "Electronics", a banner or content block can highlight current deals or featured products from that specific category. This approach increases the chance of re-engagement and encourages return visits or immediate conversions by matching promotional content to current user interest.
In this use case, we return personalized promotions based on the last visited main category by the user. However, the same configuration logic can be easily adapted to display category-specific promotions directly on each category page.
To do this, you simply skip the use of segments and aggregates related to browsing history and instead implement static personalization rules per category. For example, on the “Electronics” category page, you display promotions tailored specifically to electronics products. This approach allows for consistent and relevant promotional messaging across the entire website structure.
## Prerequisites
---
- [Import your product feed to catalog](/use-cases/import-product-feed-to-catalog).
- [Integrate Synerise promotions](/docs/ai-hub/promotions/introduction-to-promotions).
- Implement transaction events using [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
## Process
---
2. [Create an aggregate](/use-cases/personalized-category-promotions#create-an-aggregate) which returns the last visited category.
1. [Create a segmentation](/use-cases/personalized-category-promotions#create-a-segmentation) for each category.
1. [Create a promotion](/use-cases/personalized-category-promotions#create-a-promotion) for each category.
4. [Create a dynamic content](/use-cases/personalized-category-promotions#create-a-dynamic-content) with the personalized promotions.
## Create an aggregate
---
In this part of the process, create an aggregate that will return the category that the user last visited.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last**.
5. From the **Choose event** dropdown list, select the `page.visit` event.
6. As the event parameter, select **category**.
7. Add the value **product:retailer_part_no**.
8. As the value add **Is true**.
7. Set the period from which the aggregate will analyze the results to **Lifetime**.
12. Save the aggregate.
Configuration of the aggregate
## Create a segmentation
---
Create a segmentation for each category on your page. It will group the users based on the specific category being the last one they visited.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation.
3. From the **Choose filter** dropdown list, select the [aggregate you created](#create-an-aggregate).
4. As the logical operator, select **Equal**.
5. Next to the logical operator, in the text field enter the name of the specific category.
Configuration of the segmentation
Duplicate the segmenaton, and repeat this step as many times as you have categories on your website, changing only the name of the category.
## Create a promotion
---
In this step, create set of promotions for each category on the website. It will be good, if all of them will be connected to categories choosen in the segmentation. In this way we will have minimum 1 promo for each form choosen categories. What is more aeach of them will be **marked with a special tag** to distinguish them from other promotions.
You can create a promotion with the following scopes:
- [For selected items](/docs/ai-hub/promotions/creating-promotions) - you can select items to which you want to apply a discount
- [For entire basket](/docs/ai-hub/promotions/creating-promotions-for-entire-basket) - you can reduce the value of the whole shopping cart if its value matches the fixed price limit
1. In the **Audience** section, choose the [segmentation](#create-a-segmentation). This way you make sure that, for example, the promotion for Electronics is only visible on the main page to users for whom Electronics was the last visited category.
Configuration of the the audience of the promotion
2. Include all necessary promotional elements such as the product image, promotion name, description, and any other details required for displaying the promotion on the landing page. This ensures a clear presentation of the promotion to the customer, enhancing their engagement and understanding of the offer.
3. In **Content** section add informaton about promotion and its details. Also add there a tag of your choice. The selection of the promotions of the dynamic content will be narrowed down to those labeled with this tag. In our case they can be tagged as **CategoryPromo**.
Configuration of the the content of the promotion
3. In the **Items** section, select the specific products or categories to which the promotion should apply.
3. In the **Types & Limits** section, define the logic of the promotion — for example, whether it’s a fixed discount, a percentage-based reduction, or a special offer limited to a certain number of uses. This configuration determines how the promotion behaves and under what conditions it is applied.
Make sure that all necessary promotional elements are included in the content, such as the product image, name, description, and any other details required for displaying the promotion on the landing page. Including all key elements ensures that the promotion is presented clearly and effectively to the customer, enhancing their engagement and understanding of the offer.
Alternatively, if you already created promotions in an external service, you can [import them to Synerise](/docs/automation/actions/synerise-integrations#import-promotions).
## Create a dynamic content
---
You can display the promotions on your home page (or category page) by using [dynamic content](/docs/campaign/dynamiccontent).
1. Go to **Experience Hub > Dynamic content > Create new**
2. Enter the name of the dynamic content.
3. Choose the **Insert Object** type.
2. As the audience, select **New Audience**.
1. Click **Define conditions**.
2. Click **Add condition** and choose the [aggregate, created in the previous step](#create-an-aggregate).
4. As the operator choose **Is not null**. In this way, the campaign will be visible only for users who have any value in the aggregate, so they have visited any category previously.
2. Confirm by clicking **Apply**.
Configuration of the the dc
2. In the body of the dynamic content, use the promotion snippet.
Read more about how to use snippets [here](/docs/assets/snippets).
Configuration of the the snippet
4. Click the snippet widget, providing quick access to a variety of useful code sections.
5. Select a category of snippets: **Profiles promotions** and add them to the template.
3. In the template editor add CSS and/or HTML to the dynamic content.
Be cautious when using the default Profile’s Promotions insert, as it may display more promotions than intended for the current campaign. To maintain control over the display, use tags specifically designated for the promotions in this use case
4. In this step, we will customize the snippet by including a line that limits the selection of promotions to those from the current campaign. In case you need to add more personalized options - read more about inserts [here](/developers/inserts/insert-usage).
5. Add **tagNames=["XXX"]** to the code in the place presented below in the example code. Remember to add the name of the tag created earlier in the place of **XXX**.
{%- set getFields=["code"] -%}
{%- promotions fields=getFields tagNames=["categoryPromo"] -%}
{%- for item in promotions_result -%}
{{ item }}{%- endfor -%}
{%- endpromotions -%}
4. [Define the rest of the settings](/docs/campaign/dynamiccontent/creating-dynamic-content).
## Check the use case set up on the Synerise Demo workspace
---
You can check the [aggregate](https://app.synerise.com/analytics-v2/aggregates/78b590fc-88bd-3831-8419-5c080efceeec), [segmentation](https://app.synerise.com/analytics-v2/segmentations/3ae2e8a9-8f63-4c51-978b-32e245cfb331) and [promotion configuration](https://app.synerise.com/campaigns/promotions/ca9b580d-e0a6-47ad-9c65-520dd68398ae) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`client.activatePromotion`](/docs/assets/events/event-reference/loyalty#clientactivatepromotion) (~1).
## Read more
---
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Send customers SMS with link to download the application
In today's retail landscape, engaging customers through smart technology is essential. This use case demonstrates how a customer service system, integrated with automation and messaging tools, can boost customer interaction. By using Synerise's API, retailers can send timely SMS notifications, promoting app downloads and driving personalized marketing campaigns.
The workflow is triggered when a customer contacts a consultant, sending an SMS with an app download link. This enhances the customer experience by providing immediate app access, improving efficiency, and encouraging deeper engagement with the platform.
This strategy fosters customer loyalty, ensures relevant, well-timed communications, and respects preferences with a weekly message cap. The integration is simple, scalable, and adaptable to future needs.
## Prerequisites
---
- [Implement a dedicated custom event](/developers/api/events/sending-events#send-custom-event-endpoint), triggered when a customer contacts a consultant, sending an SMS with an app download link. In this use case, we use `customer.call` event.
- [Integrate with the SMS provider](/docs/campaign/SMS/configuring-sms-gateway).
## Create a workflow
---
You will create a workflow which will be triggered by a custom.call event and send an SMS to a customer with a link to the application.
### Select the trigger
1. Go to **Automations > Workflow > New workflow**.
2. Enter a name of the workflow.
2. Define the trigger by choosing **Profile Event**.
3. To open the settings of the node, click the node.
4. In the settings of the node, from the **Choose event** dropdown list, select **customer.call**.
5. Confirm the settings by clicking **Apply**.
### Select the action node
1. To add a node, click **THEN**.
2. From the dropdown list, select **Send SMS**.
3. To open the settings of the node, click the node.
4. In the settings of the node, in the **Content** section, click **Define**.
5. From the **From phone number** dropdown list, select the SMS account from which the message will be sent.
6. Click **Create message**.
7. In the upper right corner, click **New template**.
8. In the **SMS Message** field, enter the contents of your message. You can [use inserts to personalize](/docs/campaign/SMS/creating-SMS-template#personalization) the message, you can use emoji to make the message look breezy or use [short links](/docs/campaign/SMS/creating-SMS-template#short-links).
Profile Event trigger configuration
9. After the content is ready, click **Use in Node**.
10. In the **Content** section, click **Apply**.
24. If you want to add custom parameters to the events generated automatically by this workflow (for example, sms.send), in the **Additional parameters** section, click **Define** and add a pair or more of parameter and value. Confirm the settings by clicking **Apply**.
25. If you want to send a test SMS, perform the instructions in the [Sending a test message](/docs/automation/actions/send-sms-node#sending-a-test-message) section.
26. You can define additional node setting such as enabling ignoring limits or global control group. You can find more information about it in [Defining additional node settings](/docs/automation/actions/send-sms-node#defining-additional-node-settings) section.
Profile Event trigger configuration
27. To confirm the node settings, click **Apply**.
**Result**:
Profile Event trigger configuration
### Add finishing node
1. To add a node, click **THEN**.
2. From the dropdown list, select **End**. This node doesn't require configuration.
Remember to define additional settings for the workflow, in this case: capping, for example 1x per week.
3. In the upper-right corner, click **Save & Run**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [workflow](https://app.synerise.com/automations/workflows/automation-diagram/5201cfbf-e695-406a-858c-949ff34e367f) configuration directly in Synerise demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 6 events per profile that completes the flow:
`customer.call` (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~1), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`sms.send`](/docs/assets/events/event-reference/sms#smssend) (~1), [`sms.click`](/docs/assets/events/event-reference/sms#smsclick) (~1).
## Read more
---
[Send SMS node](/docs/automation/actions/send-sms-node)
# Low-stock abandoned cart campaign
In the constantly evolving e-commerce landscape, optimizing sales and minimizing shopping cart abandonment rates is crucial. There are several ways to prevent the abandoned cart scenarios. While the classic approach to solving this problem is well known, there is an even more effective strategy - low-stock campaigns.
To keep your potential customers from abandoning their shopping carts, consider implementing a low-stock campaign, which is a comprehensive solution that applies not only to abandoned shopping carts, but also to abandoned pages or abandoned favorite lists.
Here's how a low-stock campaign strategy unfolds, especially for abandoned shopping carts. When users add products to their shopping carts that either already have low-stock levels or are predicted to have limited availability in the near future, and fail to complete the purchase, you can capitalize on the situation by triggering your low-stock abandoned cart communication.
By promptly informing customers that the products they are at risk of selling out due to declining inventory, you provide them with a compelling reason to complete their purchase. This urgency can become a key element in the decision-making process, potentially leading to higher conversion rates.
The beauty of a low inventory campaign is that it is highly customizable. What constitutes "low inventory" is entirely up to your discretion and tailored to your specific business needs. Whether you have 10 units left or even 1000 , the definition of low inventory can fit perfectly with your inventory management strategy. This flexibility ensures that your campaign can be tailored to different product categories and customer preferences, optimizing its effectiveness.
In this use case you will learn how to create a low-stock campaign for customers with an abandoned shopping cart.
## Prerequisites
---
- [Implement a tracking code](/docs/settings/tool/tracking_codes) into your website.
- [Implement the `cart.status` event](/developers/web/cart), which stores the current status of the basket in the form of an event on the customer's card. This event must to be sent to Synerise after every change in the cart status.
- [Import product feed into the Synerise catalog](/use-cases/import-product-feed-to-catalog).
Click to see a sample catalog
Example of a catalog
- Prepare an email template for Low stock campaign. This template will be used later in the workflow.
In the template, you can retrieve the event context from the preceding nodes. In this case, you can reuse the context of a product that has been added to the cart, but has not been purchased and is running out of stock. For more information on how to reuse event parameters, check out this [article](/developers/inserts/automation).
## Process
---
In this use case, you will go through the following steps:
1. [Create a product.LowInStock event](/use-cases/low-stock-campaign#create-a-productlowinstockevent)
2. [Create an aggregate that returns products in a cart](/use-cases/low-stock-campaign#create-an-aggregate-that-returns-the-products-in-a-cart)
3. [Create a workflow](/use-cases/low-stock-campaign#create-a-workflow)
## Create a product.LowInStock event
---
In this part of the process, add the **product.LowInStock** event, which will later be generated in the workflow that checks whether the product is low in stock. In addition, this event must include the **sku** parameter, which contains the SKU of the low-in-stock product which the customer added to the shopping cart.
1. Go to **Data Modeling Hub > Events > Add event**.
3. In the **Name** field, enter `product.LowInStock`
In the API and SDK, the name parameter is usually called `action` or `action name`
4. Optionally, define a human-friendly display name that will be shown in **Data Modeling Hub** and **Decision Hub Hub**.
5. Optionally, in the **Description** field, enter the description of the event.
6. Enable the **Make this event available to anonymous profiles without JWT** toggle.
7. Click **Apply**.
8. In the list of events, find the event you just created.
9. On the right side of the screen, click **Add property**.
10. In the **Source parameter** field, enter `lowstock_cart`.
This parameter will be used to save the SKUs of items which are low in stock.
11. In the **Property name** field, enter a human-readable label of the property for display in the Synerise platform.
12. Optionally, in the **Description** field, you can add an explanation about the purpose of this parameter.
13. To complete the process, click **Save**.
## Create an aggregate that returns the products in a cart
---
This aggregate will be used later in the **product.LowInStock** event to get products a customer added to their cart.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last**.
4. From the **Choose event** dropdown list, select the `cart.status` event.
5. As the event parameter, select **ItemIds**.
6. Set the period from which the aggregate will analyze the results. In our case, we set the time period to **Lifetime**.
7. Save the aggregate.
Configuration of the aggregate
## Create an aggregate that returns the number of products in a cart
---
This aggregate will be used in the first workflow to check if a customer has any products in the shopping cart.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last**.
5. From the **Choose event** dropdown list, select the `cart.status` event.
6. As the event parameter, select **totalQuantity**.
7. Set the period from which the aggregate will analyze the results to **Lifetime**.
12. Save the aggregate.
Configuration of the aggregate
## Create a workflow
---
In this part of the process, we create a workflow to send an email campaign to customers who have added products to their cart but haven't completed their purchase. The workflow follows this logic:
1. Target customers who:
- Have added products to their cart.
- Haven't made a purchase in the last 60 minutes.
- Have agreed to receive email communications.
2. If a customer meets all these conditions, we generate a **product.LowInStock** event. This event contains information about the items in the customer's cart that are running low in stock.
3. The workflow then waits for 10 minutes for the event to be generated.
4. Once the event is generated, the customer receives an email message with details about the products mentioned in the **product.LowInStock** event.
### Configure a trigger
---
In this part of the process, select the segmentation for which you want to target low-stock campaign.
1. As the first node of the workflow, add **Profile Event**.
2. From **Choose event** dropdown menu, choose the **product.addToCart** event.
3. Confirm by clicking **Apply**.
### Define the Delay node
---
This node creates an hour's delay before moving to the next condition of the workflow.
1. Add the **Delay** node. In the node settings:
1. In the **Delay** field, type `1`.
2. From the dropdown list, choose **Hour**.
2. Click **Apply**.
Configuration of the Delay node
### Configure the Profile Filter node
---
This part of the process defines the conditions that the customer should meet in order to move to the next step of the workflow. If the customer does not meet the defined conditions, the workflow ends for them.
1. Add the **Profile Filter** node. In the node settings:
1. Click **Choose filter** and select the [aggregate](/use-cases/low-stock-campaign#create-an-aggregate-that-returns-the-number-of-products-in-a-cart) you created earlier in the process.
2. From the **Choose operator** dropdown, choose **More than (Number)** and type `0` in the empty field.
3. From the **Choose filter** dropdown list, select the **transaction.charge** event.
4. Change the funnel type from **profiles matching** to **profiles not matching**.
5. Click the calendar icon and set the date/time filter to **Last 60 minutes**.
6. From the **Choose filter** dropdown list, select the **newsletter_agreement** attribute.
7. From the **Choose operator** dropdown, choose **Equal (String)** and type `enabled` in the empty field.
2. Click **Apply**.
Profile Filter node configuration
### Configure the Generate Event node for the Matched path
---
Before sending the email to the customer, an event must be generated on the customer's profile. The event must contain the IDs of products that are running low in stock (these are the products that will be sent to the customer in the email).
1. Add the **Generate Event** node to the **Matched** path.
In the configuration of the node:
1. In **Event name**, enter `product.LowInStock`
2. In the **Body** section, use the following Jinjava and modify it to your needs:
{{< note >}} Jinjava inserted in **Generate event** body must have all empty spaces deleted. {{< /note >}}
{{< highlight jinja >}}
{
"lowstock_cart":
"{% set skus = [] %}
{% aggregate PRODUCTS-IN-CART %} {# replace PRODUCTS-IN-CART with the ID of the aggregate that returns products in the cart #}
{% for items in aggregate_result %}
{% do skus.append(items) %}
{%endfor%}
{% endaggregate %}
{% set lowstock = []%}
{% for sku in skus %}
{% catalogitemv2.CATALOG-NAME(sku) %} {# replace CATALOG-NAME with the name of your feed catalog #}
{% set object = catalog_result %}
{% if object.get('Quantity')|int < NUMBER %} {# NUMBER defines the amount of products you consider as low in stock #}
{% set quantity = object.get('Quantity') %}
{% do lowstock.append(sku) %}
{%else%}
{%endif%}
{% endcatalogitemv2 %}
{%endfor%}
{% if lowstock|count==0 %}0{% else %}{{lowstock[0]}}{% endif %}"
}
{{< /highlight >}}
**Result:** a **product.LowInStock** event is generated. Its **lowstock_cart** parameter contains the ID of a product that is low in stock.
An example of a generated event:
Profile Filter node configuration
### Configure the Event Filter node
---
This filter serves as a security measure to ensure that the **product.LowInStock** event was generated in the previous step.
1. Add the **Event Filter** node. In the configuration of the node:
1. Set **Check** to **for period of time**.
2. Define the time range to **10 minute**.
3. From the **Choose event** dropdown list, select the **product.LowInStock** event.
4. As the event parameter, select **lowstock_cart**.
5. From the **Choose operator** dropdown list, select **Regular expression**.
6. In the text field, type `.`
{{< note >}}
This regular expression is necessary to exclude product.LowInStock events with the empty value of the lowstock_cart parameter.
{{< /note >}}
2. Confirm by clicking **Apply**.
The final configuration of the workflow
If an event was not generated for a customer, then the workflow ends for this customer. If the event is generated, then the next step is sending an email to the customer.
### Configure the Send Email node
---
In this part of the process, send email communication to customers for whom the **product.LowInStock** event was generated. The email should contain the products returned in the event.
1. Add the **Send Email** node and open its settings.
2. In the **Sender details** section, choose the email account from which the email is sent.
3. In the **Content** section, select the template that you prepared as a part of the prerequisites.
4. **Optional**: In the **UTM & URL parameters** section, define the UTM parameters added to the links included in the email.
5. **Optional**: In the **Additional parameters** section, describe the campaign with [additional parameters](/docs/campaign/e-mail/creating-email-campaigns#adding-custom-parameters).
6. Click **Apply**.
### Add final settings to your workflow
---
1. Add the **End** nodes.
2. Launch the workflow by clicking **Save&Run**.
The final configuration of the workflow
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of each step from this use case in our Synerise Demo workspace:
- [Aggregate](https://app.synerise.com/analytics/aggregates/da49583b-f35a-349b-9906-55d5c1e820df) that returns the itemIds of products in the shopping cart for each customer.
- [Aggregate](https://app.synerise.com/analytics/aggregates/0d351702-fb43-356e-a90a-c405fa0a388c) that returns the total quantity of products in the shopping cart for each customer.
- [Workflow](https://app.synerise.com/automations/workflows/automation-diagram/e48f3760-2799-43d4-ae12-338ef8af0ea3)
- [Catalog](https://app.synerise.com/assets/catalogs/183729)
{{% include "/reuse/use-cases/synerise-demo-workspace.md" %}}
## Generated events
This use case generates approximately 12 events per profile that completes the flow:
[`product.addToCart`](/docs/assets/events/event-reference/items#productaddtocart) (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~5), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), `product.LowInStock` (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Automation Hub](/docs/automation)
- [Catalogs](/docs/assets/catalogs/introduction-to-catalogs)
- [Email campaigns](/docs/campaign/e-mail)
- [Jinjava inserts](/developers/inserts)
- [Segmentation](/docs/analytics/segmentations)
# Personalized Checkout Promotions Based on Category Slots in Offline Stores
Don't ignore dedicated discounts in your brick-and-mortar stores and their possibilities to increase revenue. To keep customers, give them an additional reason to come back and buy with a personalized promotion.
This use case will help you create a set of personalized promotions for customers to receive at check-out in physical stores. The set contains slots of customer-dedicated promotions from specific categories. Promotions will work for 24 hours from the date of assigning and can be printed together with the receipt after the transaction. Personalization of promotions on check out can work for both recognized customers, for example paying with card, or those paying with cash.
## Prerequisites
---
- Implement transaction events using [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
We recommend implementation of transactional events so that the hash of the card can become an identifier for the customer when they are paying by card. Thanks to this, a customer who will come to the store and pay with the same card can get personalized offer (even if they are not recognized, for example does not scan the mobile application at checkout), because we will be able to properly collect their transaction history.
- [Import the product feed to a catalog](/use-cases/import-product-feed-to-catalog).
## Security configuration
---
Before you start working with this hub, if you are a Synerise customer or partner, consider reading [the section about denylisting events](/docs/settings/tool/api#denylist). This natively accessible configuration will allow you to manage the restrictions in points management that may help you prevent fraud.
## Process
---
In this use case, you will go through the following steps:
1. [Create personalized promotion](#create-personalized-promotions).
2. [Define groups of promotions](/use-cases/personalized-promotions-on-checkout#define-groups-of-promotions) to use them as base for AI engine.
3. [Define a personalized promotion](/use-cases/personalized-promotions-on-checkout#define-a-personalized-promotion).
## Create personalized promotions
---
In this part of the process, create personalized promotion. Further on, the AI engine selects among the available candidates the best tailored promotions to display in personalized promotions.
1. Go to **> Regular Promotions > Add promotion**.
2. According to your buissness needs select one of the scopes:
- **For selected items**
- **For entire basket**
3. Define **Audience**. Select the group of customers for whom you want to prepare promotion.
4. In the **Content** section:
1. Define the name, description, and image of the promotion.
2. In the **Price** field, enter `0`.
Example of promotion content
3. Confirm the settings by clicking **Apply**.
4. Add [customer tags](/docs/crm/customer-tag). In our case, to each promotion we will add a customer tag with the name of category it concerns - so that we can make groups of promotions dedicated for the certain category.
5. In the **Types & limits** section, select **Handbill** as the promotion type.
1. Leave the rest of the settings in this section at default.
2. Confirm by clicking **Apply**.
Handbill type of promotion
7. In the **Schedule** section, define the promotion distribution period according to your business needs.
8. Optionally, in the **Stores** section, specify stores where the promotion is available.
This is possible only if the list of stores is imported into a [catalog](/docs/assets/catalogs).
9. In the **Items** section, select the item catalog from which the items will be discounted:
1. From the **Source catalog** dropdown list, select the item catalog.
2. Select the **Entire catalog** tab using the **Select items** option, as in this use case promotion works on all items.
10. To apply configuration and run the promotion, click **Publish.**
11. Repeat all the steps and create more personalized promotions. In step 9, instead of entire catalog, select specific items (for example, a brand, a category of items - depending on your business assumptions).
## Define groups of promotions
---
In this part of the process, you create a filter of promotions which will be used in a personalized promotion.
1. In **Promotions**, above the list of promotions, click **> Define.**
2. Click **Choose filters**.
3. Use the tag you assigned to [personalized promotion](#create-personalized-promotions) for categories you selected. This filter will be used while creating a personalized promotion.
Example of filters
4. Save the filter
5. Confirm the settings by clicking **Apply**.
## Define a personalized promotion
---
In this part of the process, create a personalized promotion. The AI engine will select items from the group of personalized promotion [created in the previous step](#define-groups-of-promotions) based on the customer preferences. In personalized promotions you can also set how many products will be shown and adjust the variety of the offer.
1. Go to **AI Hub > Personalized Promotions > New personalized promotion**.
1. As a type, choose **Check-out**.
2. In the **A/B Test settings**, click **Define**.
3. Click .
4. Click **Advanced options**.
5. Select **AI Engine**.
6. Confirm by clicking **Apply**.
7. In the **Filters and limits** section, define two slots and to each slot assign the filter created before. Also, define the number of promotions in each slot that will be allocated for the customer.
1. In the **Promotions in set**, enter a number of personalized promotion to be used as candidates to display in a slot.
2. Click **Define filter**.
3. Select the filter you created in this [step](/use-cases/personalized-promotions-on-checkout#define-groups-of-promotions).
4. To add more slots, click **Ad another** and repeat steps i-iii.
5. Confirm by clicking **Apply**.
8. Define **Exclude items** section accordingly to your business needs.
9. In the **Activity** section:
1. Leave the **Lasting** option at default (**Relative**).
2. Set the activity time according to your business needs. In our case it is 24 hours.
3. Confirm by clicking **Apply**.
10. Configure the **Engine settings** section according to your needs.
You can read more about engine settings [here](/docs/ai-hub/personalized-promotions/creating-ai-promotions#ai-engine-boosting-settings).
2. To apply configuration and run the promotion, click **Publish.**
## What's next
---
For this promotion to work you need to implement the personalized promotion in stores. Personalization of promotions on check out works for any customer, even for the anonymous ones.
When the customer is anonymous/paying in cash, the personalization engine takes into consideration the current transaction that the customer makes in the store - and gives promotions with the context of products bought in this transaction.
- To assign checkout personalized promotions coupons for anonymous profile/customer paying in cash, based on items in basket - implement anonymous Profile's checkout process in POS [using the API method](https://hub.synerise.com/api-reference/loyalty-and-engagement#operation/processAnonymousCheckout_POST).
If the customer is recognized, the engine takes into consideration the whole history of their transactions and gives the most relevant results. For this to work we recommend using hash of the payment card as an identifier of the customer - for better personalization.
- To assign checkout personalized promotions coupons for a profile, based on items in the basket and historical transactions - implement checkout process in POS [using the API method](https://hub.synerise.com/api-reference/loyalty-and-engagement#operation/processCheckout_POST).
As the `identifierType` use `externalId`, where the `identifierValue` will be the hash of the payment card.
## Check the use case set up on the Synerise Demo workspace
---
In the Synerise Demo workspace, you can check the:
- [handbill promotions](https://app.synerise.com/campaigns/promotions/27ea16b6-521b-448c-9551-2f12d96257ad)
- [personalized promotion](https://app.synerise.com/campaigns/handbills/ec712c10-dad1-407e-afe5-0344ab9321e7)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 6 events per profile that completes the flow:
[`transaction.charge`](/docs/assets/events/event-reference/items#transactioncharge) (~1), [`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~2), [`snr.bestfit.score`](/docs/assets/events/event-reference/predictions#snrbestfitscore) (~1), [`client.activatePromotion`](/docs/assets/events/event-reference/loyalty#clientactivatepromotion) (~2).
## Read more
---
[Personalized promotions](/docs/ai-hub/personalized-promotions/creating-ai-promotions#create-promotion-candidates)
# Gamified quest with personalized reward offer loop
Modern engagement strategies go beyond static campaigns. By combining gamification with real-time personalization, you can create experiences that react to user behavior instantly — rewarding action, adapting to inaction, and delivering the right incentive to the right person at the right moment.
This use case describes a gamified in-app flow where a user completes a quest (for example, browsing 3 product categories). Upon completion, the system immediately evaluates the user's profile — their spending history and recency of activity — to assign them to a segment (VIP, at-risk, or standard). A personalized offer with a time-limited voucher is then presented directly in the app.
If the user dismisses the offer or does not interact before it expires, the system sets a profile attribute and a workflow sends a mobile push notification after a delay, bringing the user back to the app where a modified offer with a higher discount is presented. Different users receive different rewards and timeout windows, even though the entire logic runs within a single flow.
The key value of this approach is **event-driven orchestration in one place** using [Brickworks](/docs/assets/brickworks). All segmentation logic, voucher pool selection, offer copy, and escalation rules are defined within a single schema — eliminating the need to chain multiple campaign tools or maintain separate backend logic.
## Prerequisites
---
- [Implement Synerise SDK in your mobile app](/developers/mobile-sdk).
- Implement [transaction events](/developers/web/transactions-sdk) using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- [Create voucher pools](/docs/assets/code-pools) for each customer segment:
- A voucher pool for VIP customers (for example, 20–25% discount on premium items).
- A voucher pool for at-risk customers (for example, 30–40% discount).
- A voucher pool for standard customers (for example, 10–15% discount).
- [Configure Google Firebase](/docs/settings/tool/firebase) for mobile push notifications.
## Process
---
In this use case, you will go through the following steps:
1. [Create aggregates](#create-aggregates) to collect customer spending and transaction recency data.
2. [Create expressions](#create-expressions) that reference the aggregates to calculate customer spend and inactivity.
3. [Create a Brickworks schema](#create-a-brickworks-schema) with the offer logic.
4. [Create an in-app campaign](#create-an-in-app-campaign) with the gamified quest and reward flow.
5. [Create a workflow](#create-a-workflow) that sends a mobile push after the user dismisses or ignores the offer.
## Create aggregates
---
In this part of the process, you will create two [aggregates](/docs/crm/aggregates) that collect the data needed for customer segmentation. These aggregates will be referenced by the expressions in the next part of the process.
### Aggregate for lifetime transaction sum
This aggregate calculates the total value of all transactions made by a customer over their lifetime.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `Sum of transactions lifetime`.
4. Click **Analyze profiles by** and select **Sum**.
5. From the **Choose event** dropdown list, select the `transaction.charge` event.
6. As the event parameter, select `$totalAmount`.
7. Set the time range to **Lifetime**.
8. Save the aggregate.
Configuration of the lifetime transaction sum aggregate
### Aggregate for last transaction timestamp
This aggregate returns the timestamp of the customer's most recent transaction where revenue was greater than zero.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter the name of the aggregate, for example `Last transaction time`.
4. Click **Analyze profiles by** and select **Last**.
5. From the **Choose event** dropdown list, select the `transaction.charge` event.
6. As the event parameter, select `TIMESTAMP`.
7. Click the **+ where** button. From the **Choose parameter** dropdown list, select `$revenue`. From the **Choose operator** dropdown, select **More than (Number)**. In the value field, enter `0`.
8. Set the time range to **Last 30 days**.
9. Save the aggregate.
Configuration of the last transaction timestamp aggregate
## Create expressions
---
In this part of the process, you will create two [expressions](/docs/crm/expressions) that reference the aggregates created in the previous step. These expressions are later used inside the Brickworks schema to determine which segment a customer belongs to.
### Expression for total spend
This expression returns the result of the lifetime transaction sum aggregate.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression, for example `Total customer spend`.
3. In the **Expressions for** dropdown, select **Attribute**.
4. In the **Formula definition** area, add the aggregate created in the [previous step](#aggregate-for-lifetime-transaction-sum) (`Sum of transactions lifetime`).
5. Set the expression **Type** to **Profile**.
6. Click **Publish**.
Configuration of the total spend expression
### Expression for last transaction time
This expression returns the result of the last transaction timestamp aggregate.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression, for example `Last transaction time`.
3. In the **Expressions for** dropdown, select **Attribute**.
4. In the **Formula definition** area, add the aggregate created in the [previous step](#aggregate-for-last-transaction-timestamp) (`Last transaction time`).
5. Set the expression **Type** to **Profile**.
6. Click **Publish**.
Configuration of the last transaction time expression
## Create a Brickworks schema
---
In this part of the process, you will [create a Brickworks schema](/docs/assets/brickworks/quick-start/creating-a-schema) that contains all the personalization logic. The schema uses expressions and Jinjava logic to determine the customer's segment, select the appropriate voucher pool, and output a structured JSON payload consumed by the in-app message.
The schema checks the `questOfferShown` profile attribute to determine whether the customer has already seen the initial offer. If the attribute exists, the schema returns the modified offer with a higher discount. Otherwise, it returns the initial offer. The `questOfferShown` attribute is set from the in-app JavaScript code when the user dismisses or ignores the offer — it does not need to be created manually in advance.
The voucher is not assigned at schema level — instead, the schema returns the voucher pool UUID so the mobile app can handle voucher assignment directly. The voucher pool selection also differs between the initial and modified offer, allowing you to use separate pools for each stage if needed.
### Segmentation logic
The Jinjava code inside the schema evaluates two data points:
- **Spend** (from the total spend expression): customers who spent more than 200 and were active in the last 14 days are classified as **VIP**.
- **Inactivity** (from the last activity expression): customers inactive for more than 14 days are classified as **at-risk**.
- All other customers are classified as **standard**.
### Offer configuration per segment
| Segment | Initial offer | Timeout | Modified offer |
|---|---|---|---|
| VIP | 20% off premium items | 30 seconds | 25% VIP flash deal |
| At-risk | 30% flash comeback deal | 5 seconds | 40% emergency deal |
| Standard | 10% off + 2x loyalty points | 15 seconds | 15% off + 2x points |
### Schema creation steps
1. Go to **Data Modeling Hub > Brickworks > New schema**.
2. Choose **Singleton**.
3. Enter a name for the schema, for example `Quest reward offer`.
#### Add the Offer field
4. Click **Add new field** and choose **Jinjava code**.
5. Complete the fields:
- In the **Display name** field, enter `Offer`.
- The **API name** will be pre-filled automatically.
6. In the **Cast to** field, select `JSON`.
7. In the Jinjava code editor, paste the following code:
{%- set spendArr = [] -%}
{%- set inactiveArr =[] -%}
{%- expressionvar EXPRESSION_ID_SPEND -%}
{%- do spendArr.append(expression_result) -%}
{%- endexpressionvar -%}
{%- expressionvar EXPRESSION_ID_INACTIVITY -%}
{%- do inactiveArr.append(expression_result) -%}
{%- endexpressionvar -%}
{%- set spend = spendArr[0] -%}
{%- set inactive = inactiveArr[0] -%}
{%- set now_dt = timestamp|timestamp_to_time -%}
{%- set event_dt = '' -%}
{%- if inactive == 'null' -%}
{%- set event_dt = timestamp|timestamp_to_time -%}
{% else %}
{%- set event_dt = inactive|iso8601_to_time -%}
{%- endif -%}
{%- set now_day = now_dt|datetimeformat('%Y')|int * 365 + now_dt|datetimeformat('%j')|int -%}
{%- set event_day = event_dt|datetimeformat('%Y','UTC')|int * 365 + event_dt|datetimeformat('%j','UTC')|int -%}
{%- set days = now_day - event_day -%}
{% set seg = '' %}
{%- if spend > 200 and days < 14 -%}{% set seg = 'vip'%}
{%- elif days > 14 -%}{% set seg = 'atrisk'%}
{%- else -%}{% set seg = 'standard'%}
{%- endif -%}
{%- set isMutated = [] -%}
{%- if customer.questOfferShown -%}
{% do isMutated.append(true)%}
{%- else -%}
{% do isMutated.append(false)%}
{%-endif-%}
{%- set mutated = isMutated[0] -%}
{#- Resolve voucher pool UUID per segment and mutation state -#}
{%- set code = [] -%}
{%- if mutated -%}
{%- if seg == "vip" -%}
{% do code.append('VIP_VOUCHER_POOL_UUID') %}
{%- elif seg == "atrisk" -%}
{% do code.append('ATRISK_VOUCHER_POOL_UUID') %}
{%- else -%}
{% do code.append('STANDARD_VOUCHER_POOL_UUID') %}
{%- endif -%}
{%- else -%}
{%- if seg == "vip" -%}
{% do code.append('VIP_VOUCHER_POOL_UUID') %}
{%- elif seg == "atrisk" -%}
{% do code.append('ATRISK_VOUCHER_POOL_UUID') %}
{%- else -%}
{% do code.append('STANDARD_VOUCHER_POOL_UUID') %}
{%- endif -%}
{%-endif-%}
{%- if seg == "vip" -%}
{%- if mutated -%}
{%- set title = "25% VIP flash deal" -%}
{%- set desc = "We've upgraded your offer! 25% off premium items." -%}
{%- set discount = 25 -%}
{%- set cta = "Claim 25% off" -%}
{%- else -%}
{%- set title = "20% Exclusive deal" -%}
{%- set desc = "As a VIP member, you've unlocked an exclusive discount on premium items." -%}
{%- set discount = 20 -%}
{%- set cta = "Claim 20% off" -%}
{%- endif -%}
{%- set timeout = 30 -%}
{%- elif seg == "atrisk" -%}
{%- if mutated -%}
{%- set title = "40% emergency deal" -%}
{%- set desc = "Final offer: 40% off anything. This won't come back." -%}
{%- set discount = 40 -%}
{%- set cta = "Claim 40% off NOW" -%}
{%- else -%}
{%- set title = "Flash 30% off" -%}
{%- set desc = "Welcome back! Here's a special comeback deal. Don't let it slip away." -%}
{%- set discount = 30 -%}
{%- set cta = "Grab 30% off now" -%}
{%- endif -%}
{%- set timeout = 5 -%}
{%- else -%}
{%- if mutated -%}
{%- set title = "15% off + 2x points" -%}
{%- set desc = "We've boosted your offer! 15% off and double loyalty points." -%}
{%- set discount = 15 -%}
{%- set cta = "Claim 15% off" -%}
{%- else -%}
{%- set title = "10% off + 2x points" -%}
{%- set desc = "Great job! Enjoy a 10% coupon and double loyalty points on your next order." -%}
{%- set discount = 10 -%}
{%- set cta = "Claim reward" -%}
{%- endif -%}
{%- set timeout = 15 -%}
{%- endif -%}
{
"segment": "{{ seg }}",
"offerTitle": "{{ title }}",
"offerDescription": "{{ desc }}",
"discountValue": {{ discount }},
"ctaLabel": "{{ cta }}",
"offerTimeout": {{ timeout }},
"offerStyle": "{{ seg }}",
"voucherCode": "{{ code[0] }}",
"isMutated": {{ mutated }}
}
Replace the following placeholders with your actual IDs:
- `EXPRESSION_ID_SPEND` — the ID of the [total spend expression](#expression-for-total-spend).
- `EXPRESSION_ID_INACTIVITY` — the ID of the [last transaction time expression](#expression-for-last-transaction-time).
- `VIP_VOUCHER_POOL_UUID`, `ATRISK_VOUCHER_POOL_UUID`, `STANDARD_VOUCHER_POOL_UUID` — the UUIDs of the voucher pools for each segment. You can use different pool UUIDs for the initial and modified branches if needed.
The schema does not assign voucher codes directly. Instead, it returns the voucher pool UUID in the `voucherCode` field. The mobile application is responsible for calling the voucher assignment API using this UUID when the user accepts the offer. The voucher pool resolution is split into two branches (mutated and non-mutated), so you can configure separate pools for each stage if your business logic requires it.
8. Click **Apply** to save the field.
### Set up the Audience & Settings
1. Click the **Audience & Settings** tab.
2. In the **Audience** section, click **Define**.
3. Choose the schema recipients, in this case, choose **Everyone**.
4. Click **Apply**.
5. In the upper-right corner, click **Save**.
## Create an in-app campaign
---
In this part of the process, you will [create an in-app campaign](/docs/campaign/in-app-messages/create-inapp-message) that renders the gamified quest interface. The in-app message uses JSON to call the Brickworks schema once and handle the quest and reward flow client-side.
1. Go to **Experience Hub > In-app > Create new**.
2. Enter the name of the in-app campaign, for example `Quest reward offer loop`.
### Define the audience
---
1. In the **Audience** section, click **Define**.
2. Choose **Everyone** or specify the audience according to your business needs.
3. Click **Apply**.
### Define content
---
In this part of the process, you will create the in-app message template containing the quest UI and reward overlay.
1. In the **Content** section, click **Define**.
2. Click **Create message**.
3. Click **+ New template** in the upper right corner.
3. Choose **Code editor**.
#### HTML tab
The HTML defines the key structural elements required for the flow to work. The essential parts are:
- **Quest area** (`#mainArea`) — dynamically rendered quest card with progress bar and claim button.
- **Reward overlay** (`#overlay`) — bottom sheet that displays the personalized offer, countdown timer, and action buttons.
#### CSS tab
Define styles for the quest card, progress bar, overlay, reward sheet, and buttons according to your brand guidelines. The key functional styles that must be present are:
- `.overlay` — must be hidden by default and shown via a `.show` class (for example, using `display: none` / `display: flex` or opacity transitions).
- `.progress-bar` and `.progress-fill` — the fill element's `width` is set dynamically via inline styles in JavaScript.
- `.claim-btn[data-state="locked"]` — should appear disabled; `[data-state="ready"]` should appear active and clickable.
All other visual styling (colors, fonts, spacing, animations) can be customized to match your brand.
#### JavaScript tab
The JavaScript manages the core flow. The critical part is the **Brickworks integration at the top** — the Jinjava block that calls the Singleton schema and injects the offer payload as a JavaScript constant. Since the schema type is Singleton, the same schema ID is used for both `schemaId` and `recordId`:
This produces a single JavaScript object at render time containing the full offer payload (`segment`, `offerTitle`, `offerDescription`, `discountValue`, `ctaLabel`, `offerTimeout`, `voucherCode`, `isMutated`). Whether this is the initial or escalated offer is determined automatically by the Brickworks schema based on the `questOfferShown` profile attribute.
The rest of the JavaScript implements the following flow logic:
1. **Quest progress tracking** — increments a counter on each user action. When the counter reaches the target (for example, 3 steps), the claim button becomes active.
2. **Claim action** — when the user taps the claim button, a `form.submit` event with `fd:formType = quest` is fired and the offer from `BW_OFFER` is presented in the overlay.
3. **Offer presentation** — the overlay is populated with data from the Brickworks payload (title, description, CTA label) and a countdown timer is started using the `offerTimeout` value.
4. **Accept** — the user taps the CTA button. The mobile app uses the voucher pool UUID from `BW_OFFER.voucherCode` to assign a voucher via the API. A success state is shown.
5. **Dismiss / Timeout** — if the user taps "Maybe later" or the timer expires, an `offer.dismissed` event is fired and the `questOfferShown` attribute is set to `true` on the customer's profile. This triggers the [workflow](#create-a-workflow) that sends a mobile push notification after a delay.
Replace `SCHEMA_ID` in the Jinjava block with the actual ID of the [schema](#create-a-brickworks-schema) you created. For Singleton schemas, the same ID is used for both `schemaId` and `recordId`. You can find the ID in the URL when viewing the schema in the Synerise platform.
4. To continue the process of configuring the in-app campaign, click **Next**.
5. Click **Apply**.
### Select events that trigger the in-app message display
---
In this part of the process, you will define the event that triggers the display of the in-app message. The quest interface should appear when the user opens a specific screen or section in the app.
1. In the **Trigger events** section, click **Define**.
2. Select **Add event** and from the dropdown list, choose `screen.view` event.
3. Click the **+ where** button and select the appropriate parameter to target the quest hub screen according to your app structure.
4. Click **Apply**.
### Schedule the message and configure display settings
---
1. In the **Schedule** section, click **Define** and set the time when the message will be active.
2. In the **Display Settings** section, click **Change**.
3. Define the **Delay display**, **Priority index** and enable the **Frequency limit** toggle to manage how often the quest is shown. For example, display the quest a maximum of 1 time per day.
You can additionally enable the **Capping limit** toggle to limit the total number of times the in-app message can be displayed to a user.
4. Click **Apply**.
5. Optionally, define UTM parameters and additional parameters for your in-app campaign.
6. Click **Activate**.
## Create a workflow
---
In this part of the process, you will create a [workflow](/docs/automation/creating-automation) that sends a mobile push notification to users who dismissed the offer or let it time out. The push brings them back to the app, where the Brickworks schema — now reading `questOfferShown = true` on their profile — returns the escalated (mutated) offer automatically.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow, for example `Quest offer follow-up push`.
### Define the Profile Event trigger nodes
---
The workflow uses two trigger nodes connected via a Merge Paths node, so the push is sent regardless of whether the user completed the quest without claiming or dismissed the offer.
#### First trigger — quest completed without claim
1. As the first node of the workflow, add **Profile Event**. In the configuration of the node:
2. From the **Choose event** dropdown menu, choose the `form.submit` event.
3. Click the **+ where** button. From the **Choose parameter** dropdown menu, choose `fd:formType`. From the **Choose operator** dropdown, choose **Equal**. In the value field, enter `quest`.
2. Confirm by clicking **Apply**.
Configuration of the first Profile Event trigger node
#### Second trigger — offer dismissed
1. Add a second **Profile Event** node. In the configuration of the node:
2. From the **Choose event** dropdown menu, choose the `offer.dismissed` event.
2. Confirm by clicking **Apply**.
Configuration of the second Profile Event trigger node
### Configure the Delay node
---
1. Add the **Merge Paths** node and connect both Profile Event trigger nodes to it.
1. Add the **Delay** node. Configure the delay duration according to your business needs (for example, 15 minutes). This gives the user time before receiving the follow-up push.
2. Confirm by clicking **Apply**.
### Configure the Send Mobile Push node
---
1. Add the **Send Mobile Push** node. In the configuration of the node:
1. Define the push notification content. For example:
- **Title:** `Look at your new offer`
- **Body:** `We have a new deal for you`
2. Optionally, enable the **Send without marketing agreement** option if your business requirements allow it.
2. Confirm by clicking **Apply**.
### Add the finishing node
---
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
The workflow configuration
## Summary
---
The following describes the end-to-end flow from the user's perspective and how the system components interact:
1. **Quest phase:** The user sees a quest card (for example, "Browse 3 product categories"). As they complete each step, the progress bar advances. The quest progress is tracked client-side in the in-app message.
2. **Claim phase:** When all steps are completed, the "Claim your reward" button becomes active. Tapping it fires a `form.submit` event with `fd:formType = quest` and triggers the offer presentation.
3. **Initial offer:** The in-app reads the `BW_OFFER` payload (generated from the Brickworks schema). Since the `questOfferShown` attribute does not exist yet on the profile, the schema returns the initial offer. A bottom sheet overlay appears showing the personalized offer with the segment-appropriate discount, copy, and a countdown timer.
4. **User interaction paths:**
- **Accept:** The user taps the CTA button. The app uses the voucher pool UUID from the payload to assign a voucher via the API, and shows a success confirmation.
- **Dismiss / Timeout:** The `offer.dismissed` event is fired and the `questOfferShown` attribute is set to `true` on the profile. The overlay closes.
5. **Follow-up push:** The workflow detects either the `form.submit` or `offer.dismissed` event and, after the configured delay, sends a mobile push notification encouraging the user to return to the app.
6. **Escalated offer:** When the user opens the app via the push, the in-app campaign triggers again. This time, the Brickworks schema reads `questOfferShown = true` on the profile and returns the modified offer with a higher discount.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of each step directly in the Synerise Demo workspace:
- [Aggregate — Sum of transactions lifetime](https://app.synerise.com/analytics-v2/aggregates/bb592bec-43b6-3577-8e98-bf3a95a87f23)
- [Aggregate — Last transaction time](https://app.synerise.com/analytics-v2/aggregates/6be97f2c-ace2-3d9c-9da1-d9d6e2fdf0e0)
- [Expression — Total customer spend](https://app.synerise.com/analytics/expressions/8b0c8d34-f3ef-4368-bc51-dcdf198eb6f9)
- [Expression — Last transaction time](https://app.synerise.com/analytics/expressions/b7e698f6-9da1-4c98-aed5-e0e6a0130f22)
- [Brickworks schema](https://app.synerise.com/assets/brickworks/schemas/751096cf-b7a8-45b8-b673-c191bbe0d30f)
- [In-app campaign](https://app.synerise.com/communications/in-app/ee3fa59b-bd5c-4449-bf29-86f90f4f9431/content-manager/template/editor?variant=0)
- [Workflow — Quest offer follow-up push](https://app.synerise.com/automations/workflows/automation-diagram/542b1d19-6901-4880-99dd-b8c21143e2ea)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 20 events per profile that completes the flow:
[`screen.view`](/docs/assets/events/event-reference/web-and-app#screenview) (~1), [`inApp.show`](/docs/assets/events/event-reference/inapp#inappshow) (~2), [`inApp.click`](/docs/assets/events/event-reference/inapp#inappclick) (~2), [`brickworks.generated`](/docs/assets/events/event-reference/brickworks#brickworksgenerated) (~2), [`form.submit`](/docs/assets/events/event-reference/web-and-app#formsubmit) (~1), `offer.dismissed` (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~4), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`push.send`](/docs/assets/events/event-reference/mobile-push#pushsend) (~1), [`push.view`](/docs/assets/events/event-reference/mobile-push#pushview) (~1), [`push.click`](/docs/assets/events/event-reference/mobile-push#pushclick) (~1), [`voucherCode.assigned`](/docs/assets/events/event-reference/loyalty#vouchercodeassigned) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Brickworks](/docs/assets/brickworks)
- [Creating workflows](/docs/automation/creating-automation)
- [Expressions](/docs/crm/expressions)
- [In-app messages](/docs/campaign/in-app-messages)
- [Mobile push](/docs/campaign/Mobile/mobile_campaign)
- [Voucher pools](/docs/assets/code-pools)
- [Using in-app template builder](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template)
# In-app personalized recommendations with dynamic resize
Returning users who revisit a product category but haven’t purchased anything often face the same friction as during their first visit — large assortment, filters, and product overload.
To re-engage them effectively, you can display a personalized top (or bottom) bar that appears only for this specific audience.
The bar acts as a shortcut to AI-based personalized recommendations from a category that the user viewed before, and allows them to explore those items on a personalized in-app.
This campaign will be visible only for customers who have visited the specific category during the past 30 days but have not made any purchase.
This approach works best on product or category-level pages and for users who already showed intent but didn’t complete a purchase.
It combines behavioral segmentation and personalization in a single, adaptive in-app campaign.
## Prerequisites
---
- [Configure AI engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations) for recommendations; enable the personalized recommendation type.
- Implement the transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- [Implement Synerise SDK in your mobile app](/developers/mobile-sdk).
## Process
---
In this use case, you will go through the following steps:
1. [Prepare the segmentation](#prepare-the-segmentation) of users who have visited the specific category during last 30 days but have not made a purchase from this category.
2. [Prepare the recommendations](#prepare-the-recommendations) of personalized products from the category.
2. [Create an in-app campaign](#create-an-in-app-campaign) as a top bar which, after tapping, resizes to full screen with personalized products recommendations.
## Prepare the segmentation
---
In this part of the process, you will create a segmentation of users who have visited the `women/shoes` category in the last 30 days (mobile/web) but have not made any transaction during that time.
In this part of the process, we will create a segmentation of users who have visited the `women/shoes` category in the last 30 days (website of mobile) but have not made any transaction during that time.
1. Go to **Decision Hub > Segmentations > New segmentation**.
3. Enter the name of the segmentation.
4. Click **Add condition**.
4. From the dropdown list, select the `page.visit` event.
6. Click **+ where** and from the dropdown list, select `url`.
7. Choose the **Contain** operator and enter the fragment of the URL for the specific category. In our case it will be `women-shoes`. Alternatively, you can build the following condition: **category equal [category name]**.
7. Using the date picker in the lower-right corner, set the time range to **Last 30 days**.
8. Click **Add condition**.
10. From the list, choose the `screen.view` event.
6. Click **+ where** and from the dropdown list, select `url`.
7. Choose the **Contain** operator and enter the fragment of the URL for the specific category. In our case it will be `women-shoes`. Alternatively, you can build the following condition: **category equal [category name]**.
12. Connect these conditions by the **OR** operator.
7. Using the date picker in the lower-right corner, set the time range to **Last 30 days**.
8. Click **Add condition**.
9. From the list, choose the `transaction.charge` event.
10. By clicking **Performed** above the event name change the condition to **Not performed**.
6. Save the segmentation.
Segmentation configuration
## Prepare the recommendations
---
In this part of the process, you will prepare the personalized recommendations of products from a specific category.
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the name of the recommendation (it is only visible on the list of recommendations).
3. In the **Type & Items feed** section, click **Define**.
4. From the **Items feed** dropdown list, select an item feed that has a the **Personalized** model ready to use.
5. Select the **Personalized** recommendation type.
6. Confirm the recommendation type by clicking **Apply**.
7. In the **Items** section, click **Define**.
8. Click **Add slot**.
9. Click the **Unnamed slot** that was created.
10. Define the minimum and maximum number of products displayed in the frame according to your needs.
3. Define [Static filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#static-filters).
4. Click **Define filter**.
5. Select **Visual Builder**.
6. Click **Select value**.
5. Choose **category**.
6. As the operator, choose **Equals**.
7. Click the icon which appeared next to the field with the operator and from the dropdown list, select **Context** (eye icon).
7. As the value, choose `category`, to be sure that the category of recommended products will be the same as the category of the currently viewed item.
8. In the **Category level** input, select **Take first subcategories**.
9. In this use case, the **how many levels** setting is **2**, but remember to adjust it to how your item feed is built.
9. In the items, choose a category. In this case: `women/shoes`.
Recommendation configuration
11. Optionally, you can use filters to include specific items in the recommendation frame.
12. Confirm the configuration by clicking **Apply**.
13. Optionally, you can define the settings in the **Boosting** and **Additional settings** sections.
Learn more about [boosting](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-the-boosting-factors) and [additional settings](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#additional-settings).
## Create an in-app campaign
---
In this part of the process, you’ll use a predefined "Resize Recommendations" template that starts as a compact top bar and expands into a full screen view with personalized recommendations.
1. Go to **Experience Hub > In-app messages> Create in-app**.
2. Enter the name of the in-app.
### Define the audience
---
As the first step, define the target group of customers for the in-app message. In this case, we will use the segmentation created in the [previous step](#prepare-the-segmentation).
1. In the **Audience** section, click **Define**.
2. Click **Segmentations**.
3. Click **Select segmentation** and choose the segmentation created in the [previous step](#prepare-the-segmentation).
3. Save settings in the **Audience** section by clicking **Apply**.
### Define content
---
In this part of the process, you will use a ready-made template to create the content of the in-app message that will be displayed in the mobile application.
1. In the **Content** section, click **Define**.
2. Click **Create message** and from the list of template folders, select **Predefined templates**.
3. Select the **Resize Recommendations** template.
**Result:** You are redirected to the code editor.
You can edit the template in two ways:
- by editing the code of the template, [adding inserts](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-snippet-to-the-template-code), [adding variables](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template#adding-a-variable)
- by filling out the form on the **Config** tab.
In this use case, we will use the capabilities of the predefined Config tab.
#### Edit form in the Config tab
---
The form in the **Config** tab is already filled in with default values. You can keep them or change them to fit your business needs.
In-app configuration
1. In the **Bar settings** section, set up the copy and style of the first banner. Choose the bar position (top or bottom bar).
2. In the **General Settings** section:
- In **Title** and **Subtitle**, define the title and subtitles for the in-app. If you don't want to display them, enter a dash (-).
3. In the **AI Recommendations** section:
- Enter your **AI Recommendation Campaign Hash** based on the [previously created campaign](#prepare-the-recommendations).
- Decide if you want to display special price and cross out regular price when available
3. In the **CTA** section:
- Customize the action button by defining the text on the button (**Text on the button**), the URL to which a user will be redirected (**Destination link**), colors of the button (**Button text color** and **Button color**).
5. After you complete editing the form, disable the **Config mode** option.
5. After you make changes to the template, you can check the preview.
1. Click the **Preview contexts** button on the upper left side.
2. Enter the ID of a customer.
3. Click **Apply**.
Considering that the in-app is very interactive, the preview in the platform may not be enough to test the in-app performance. That’s why we suggest checking the campaign preview directly in the mobile app.
6. If the template is ready, in the upper right corner click **Save this template > Save as**.
7. On the pop-up:
1. In the **Template name field**, enter the name of the template.
2. From the **Template folder** dropdown list, select the folder where the template will be saved.
3. Confirm by clicking **Apply**.
8. To continue the process of configuring the in-app campaign, click **Use in communication**.
9. To save your content changes, click **Apply**.
### Select events that trigger the in-app message display
---
In this part of the process, you will define the event triggering the display of the in-app message. In this case, it will be visible after opening the application but - as it was specified in the campaign settings - only for a specific segment as it was set up before.
1. In the **Trigger events** section, click **Define**.
2. Select **Add event** and from the dropdown list, choose `screen.view` event.
3. Click the **+ where** button and select `source`.
4. As the logical operator, select **Equal**.
5. As the value add `MOBILE`.
5. Click **Apply**.
In-app trigger event configuration
### Schedule the message and configure display settings
---
As the final part of the process, you will set the display settings of the in-app message such as schedule, capping, priority of the message among other in-app messages.
1. In the **Schedule** section, click **Define** and set the time when the message will be active.
2. In the **Display Settings** section, click **Change**.
3. Define the **Delay display**, **Priority index** and enable the **Frequency limit** toggle to manage the frequency of in-app message display in the application.
16. Click **Apply**.
17. Optionally, you can define the UTM parameters and additional parameters for your in-app campaign.
18. Click **Activate**.
### Test the in-app campaign
---
Read the ["Testing" section](/docs/campaign/in-app-messages/create-inapp-message#testing) to discover how to test your in-app campaign.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [segmentation](https://app.synerise.com/analytics-v2/segmentations/e9ba4f5e-76e6-4782-8bc5-3bdb72281688), [AI recommendations](https://app.synerise.com/ai-v2/recommendations/yYjFMYPeofN5) and [in-app message campaign](https://app.synerise.com/communications/in-app/1edbf12c-47c2-4c20-83b8-a7c8edb0cff5) configuration directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 6 events per profile that completes the flow:
[`screen.view`](/docs/assets/events/event-reference/web-and-app#screenview) (~1), [`inApp.show`](/docs/assets/events/event-reference/inapp#inappshow) (~1), [`inApp.click`](/docs/assets/events/event-reference/inapp#inappclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [In-app messages](/docs/campaign/in-app-messages)
- [Using in-app template builder](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template)
# Earn and Burn - Exchange points for rewards
In this use case, we will walk you through implementation of Earn & Burn model within your loyalty program, where customers can see their current point balance and exchange the points for available rewards directly from their profile. Customers will only see the rewards that are currently available and stay within the range of their available points.
To follow this process, it’s important that you’ve already implemented the foundation of your loyalty program, where customers earn points for money they spent. If you haven’t yet, start with our [Loyalty Programs: Basics article](/use-cases/loyalty-programs-basics).
In the next steps, we’ll show how to use the point balance to:
- display the current points balance for each customer,
- configure a promotion to become a reward,
- display available rewards,
- activate a promotion (reward),
- redeem the promotion after it is used.
In this use case, we’ll show how to implement each part of this Earn & Burn process using the Synerise platform interface and Synerise API.
## Prerequisites
---
- Get familiar with how [documents](/docs/assets/documents/introduction-to-documents) work in Synerise, as creating a document is a key part of the procedure in this use case.
- [Integrate mechanism for awarding loyalty points](/use-cases/loyalty-programs-basics).
For example, you can award loyalty points after a transaction. In such case, create an [expression that counts how many loyalty points](/docs/crm/expressions/loyalty-point-count) are assigned to a customer for a transaction. Once you prepare the expression, please contact [Support Team](https://synerise.com/support) to configure materialization of loyalty points. After such configuration, every time loyalty points are assigned to a customer, the `points.loyalty` event will be generated in a customer’s profile with information about the number of loyalty points they received after a transaction (the `points` parameter).
Learn more about events in the [Events documentation](/docs/assets/events/event-definitions).
- [Integrate Synerise promotions](/docs/ai-hub/promotions/introduction-to-promotions) and create first promotions in Synerise.
- Use the points balance as a condition for displaying targeted promotions (for example, show only to users who have more than 500 points) which will be important in this specific case.
## Process
---
**Points Balance:**
1. [Create an aggregate](/use-cases/earn-burn#create-an-aggregate-counting-the-number-of-points) which counts the number of points gained by customer.
3. [Create an aggregate](/use-cases/earn-burn#create-an-aggregate-counting-the-redeemed-points) which counts the number of points used for activating the promotion.
4. [Create an expression which returns points balance](/use-cases/earn-burn#create-an-expression-which-returns-points-balance)
5. [Display points balance](/use-cases/earn-burn#display-points-balance)
**Retrieve, activate and redeem promotions:**
6. [Configure a promotion to become a reward](/use-cases/earn-burn#configure-a-promotion-to-become-a-reward)
7. [Retrieve all available promotions through API](/use-cases/earn-burn#retrieve-all-available-promotions-through-api).
7. [Activate promotions](/use-cases/earn-burn#activate-promotions).
8. [Redeem promotions](/use-cases/earn-burn#redeem-promotions) - (burn promotions).
## Points balance
---
### Create an aggregate counting the number of points
---
In this part of the process, you will create an aggregate which counts the total number of points received by a user in a loyalty program.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Sum**.
4. From the **Choose event** dropdown list, select the **points.loyalty** event.
5. As the event parameter, select **points**.
6. Set the date filter to **Lifetime**.
7. Click **Save**.
Aggregate counting the number of points
### Create an aggregate counting the redeemed points
---
In this part of the process, you will create an aggregate which returns the number of points which were redeemed.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Sum**.
4. From the **Choose event** dropdown list, select the **client.activatePromotion** event.
5. As the event parameter, select **promotionrequireRedeemedPoints**.
6. Set the date filter to **Lifetime**.
7. Click **Save**.
Aggregate counting the number of redeemed points
## Create an expression which returns points balance
---
Create an expression that calculates the current points balance. This expression allows you to dynamically track the total number of loyalty points each customer currently holds.
The described expression configuration is just an example. You can define additional conditions according to your business specifications and requirements. Such additional conditions can be, for example, taking into account points burned or considering points added additionally for completing some other extra activity. It all depends on how your loyalty program is implemented.
For more advanced scenarios with loyalty points, check out [Transfer loyalty points between customers](/use-cases/loyalty-points-transfer-with-push) describing the process of configuring the transfer of loyalty points between customers.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter a meaningful name of the expression.
3. Leave the expression type at default (**Attribute**).
4. Build the formula of the expression.
1. Click the **Select** node.
2. From the dropdown list, select **Profile**.
3. Click the **unnamed** node that appeared on the canvas.
4. Scroll down the page and click **Choose attribute**.
5. From the dropdown list, select the aggregate counting the number of points that you created [earlier](#create-an-aggregate-counting-the-number-of-points).
6. Click **+** and from the dropdown list, select **Profile**.
3. Click the **unnamed** node that appeared on the canvas.
4. Scroll down the page and click **Choose attribute**.
5. From the dropdown list, select the aggregate counting the number of redeemed points that you created [earlier](#create-an-aggregate-counting-the-redeemed-points).
7. Add **-** sign between the both elements.
6. Save the expression.
The configuration of the expression
## Display points balance
---
To display the current loyalty points balance for a customer in a mobile application or on a website, you can retrieve the value of the [expression which returns points balance](#create-an-expression-which-returns-points-balance) in a [document](/docs/assets/documents) and then retrieve this document through API. To do so, follow instructions in this section:
### Create a document with an expression
---
1. In the Synerise platform, go to **Data Modeling Hub > Documents > Add document**.
2. Configure the settings in the **Audience** and **Configuration** sections, according to the instructions in the ["Procedure" section](/docs/assets/documents/creating-documents#procedure).
1. In **Body** include the following expression reference:
This value of the PointsBalance parameter will dynamically show the points value for the specific customer when the document is accessed in a context of a customer. Replace the ID of the expression with the ID of the [expression from the previous step](#create-an-expression-which-returns-points-balance) - you can find on the list of expressions by clicking the icon
### Retrieve the document in profile context (API)
---
To get the value of PointBalance for a specific customer, use the [`generateDocumentWithProfileContext` method](https://hub.synerise.com/api-reference/asset-management#tag/Documents/operation/generateDocumentWithProfileContextPost) through API.
This method renders the document based on the actual profile data.
Request (example using email as identifier):
Replace:
- `{DOCUMENT_UUID}` with the UUID of your document (you can find it by entering the configuration form of the document - it will be in the final part of the URL).
- `customer@email.com` with the **customer’s identifier** (email, clientId, etc.).
- If you're using Azure instead of Google Cloud Platform, use this link for **curl**: `https://api.synerise.com/schema-service/v2/documents/{DOCUMENT_UUID}/generate/by/email`
Example response will look like this:
### Connect the expression to promotions
---
If you want to enable the ability to connect the expression to promotions, we recommend contacting the Service Desk at Synerise to request activation of the rewards module. This is required to use expressions in promotion logic.
If you prefer to proceed independently, you can follow the optional instructions below.
Connect the expression to promotions
To make this expression usable in other areas (for example, for filtering available promotions for the user), you must add the expression to the workspace settings. The expression field should contain the UUID of the expression used to calculate points.balance.
Use the PUT `/v4/promotions/settings` endpoint to configure which expression should be used globally in promotion logic. Use this endpoint: `https://hub.synerise.com/api-reference/loyalty-and-engagement#tag/Promotion-settings/operation/endpointSettingsUpdateSettingsPUT`.
## Configure a promotion to become a reward
---
If you want to configure a promotion into a loyalty-based reward, you can configure it to be available only to customers who have collected a specific number of loyalty points. Follow the steps below to set up this condition.
1. In the configuration of Promotion - in the **Loyalty** section, click **Change**.
2. If you want to enable the promotion only to customers who gathered a certain number of loyalty points, perform the following actions:
1. Select the **Minimum loyalty score** checkbox.
2. In the **Value** field, enter the number of required points.
3. Click **Apply**.
The configuration
## Retrieve all available promotions through API
---
In this part of the process, we’ll show you how to retrieve a list of promotions that are available to a specific customer based on audience targeting and publication status — using the Synerise API.
### Use the “Get all client promotions” endpoint
---
When a user enters your website (or a mobile app) you can call the following endpoint to check if any promotions are assigned to them using the [Get a Profile's promotions as Workspace (v2)
method](https://hub.synerise.com/api-reference/loyalty-and-engagement#operation/GetAllClientPromotionsV2).
An examplary cURL:
This API returns only the promotions that meet these two conditions:
- The promotion is published
- The user is included in the audience segment of the promotion
Replace the email with the actual customer's identifier.
You can also use other types of identifiers, such as `custom_identify` or `uuid`.
This does not check if the customer has enough points.
This endpoint only confirms promotion eligibility based on:
- Targeting (segment)
- Publication (is the promotion active?)
To optionally show if user has enough points to use the specific promotion, use the `requireRedeemedPoints` parameter in the response. Compare it with the user's PointsBalance, obtained as described in step 1. Based on that comparison, you can:
- Show or hide promotions,
- Mark unavailable ones as "locked",
- Display a personalized message, for example: "You need 200 more points".
**Note:** You don’t need to modify the request.
The `requireRedeemedPoints` value is returned as part of each promotion in the response — simply compare it with the user’s CurrentBalance to determine which promotions they can afford.
## Activate promotions
---
After a customer selects a promotion they wish to use from the previously retrieved list, the next step is activating the selected promotion for them using the API. Activation ensures the promotion is reserved for the customer along with the required number of points, if applicable. Depending on the promotion's configuration, this process may trigger a `client.removePoints` event, indicating that loyalty points have been deducted from the customer's balance. This signifies that the promotion has been fully used and is now unavailable for the customer. Unless explicitly configured otherwise, the promotion cannot be reused.
Promotion statuses in Synerise database
### Make an API call to activate the promotion
---
Use the [ActivateAPromotionAsProfile method](https://hub.synerise.com/api-reference/loyalty-and-engagement#operation/ActivateAPromotionAsProfile) to activate a promotion for a customer. You must provide their identifier (such as email or custom_identify), and the code of the promotion you want to activate.
Check the cURL to request to activate promotion:
The value field should contain the promotion code, which you get from the [previous step](#retrieve-all-available-promotions-through-api).
Depending on the customer’s eligibility and points balance, the response will look as follows:
{
"message": "You don't have required amount of points"
}
This means the customer tried to activate a promotion that requires more points than they currently have.
If the request is valid and the user has enough points, the promotion will be successfully activated. In this case - if we receive the 200 status it means that:
- The customer had enough loyalty points
- The promotion was available and matched to the customer
- The promotion has now been activated specifically for this customer
The `client.activatePromotion` event will appear on the activity list on the profile card. This event contains info about:
- the promotion code,
- the number of points that were used (defined in `requireRedeemedPoints`),
- the timestamp of activation and so on.
Using an expression to calculate points balance, it will automatically subtract the redeemed points from the customer’s available balance. The updated balance is always accurate and can be reused in real time across all channels.
Event configuration
## Redeem promotions
---
After a promotion has been activated, and the user actually uses it, the final step is to mark the promotion as redeemed in Synerise. This is known as burning the promotion, and it helps track usage, prevent multiple redemptions, and close the promotion lifecycle.
### Make the API call to redeem the promotion
---
Once the customer confirms usage, call the following endpoint: `https://hub.synerise.com/api-reference/loyalty-and-engagement#tag/Promotions/operation/RedeemAPromotion`
The **code** should be the promotion code the customer activated [earlier](#retrieve-all-available-promotions-through-api)
Use either email or clientId as clientKey, depending on your setup.
If the promotion is properly redeemed, the API will return a **201** status with a success message:
{
"message": "Promotion redeemed successfully"
}
Once redemption is confirmed, a promotion redemption event is automatically added to the customer’s profile in Synerise as `client.removePoints`.
This event confirms that the promotion has been fully used and is now closed from the customer’s perspective — it cannot be used again unless configured otherwise.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of each step directly in the Synerise Demo workspace:
- [Aggregate](https://app.synerise.com/analytics/aggregates/174ba14c-b0d7-372d-acb2-8f1365af3083) which counts the number of points gained by customer.
- [Aggregate](https://app.synerise.com/analytics-v2/aggregates/f7d84d87-5a2b-3c4d-9aa2-c007850c5716) which counts the number of points used for activating the promotion.
- [Expression with the points balance](https://app.synerise.com/analytics/expressions/787c2cb5-15a7-4d90-ac37-d812803bcb20)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`points.loyalty`](/docs/assets/events/event-reference/loyalty#pointsloyalty) (~1), [`client.activatePromotion`](/docs/assets/events/event-reference/loyalty#clientactivatepromotion) (~1), [`client.removePoints`](/docs/assets/events/event-reference/loyalty#clientremovepoints) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Expressions](/docs/crm/expressions)
- [Loyalty introduction](/loyalty/lesson-1/ )
- [Promotions](/docs/ai-hub/promotions)
# Import Customer Profiles to Synerise Using CSV Files
To leverage the AI capabilities of Synerise, personalize communication, and explore numerous other possibilities, you need a seamless method of importing your customer profiles. Whether you're migrating from another system or starting from scratch, our Imports feature, available in Data Modeling Hub, offers a streamlined process for importing profiles into our platform. Unlock the complete potential of your customer data with Synerise and gain invaluable insights to drive your business forward. By utilizing the Imports feature, you can conveniently upload and integrate customer data in CSV files, ensuring a smooth transition and accurate representation of your customer base.
In this use case, you will import customers' data to Synerise using a `.csv` file in a seamless and efficient manner.
## Prerequisites
---
- Prepare a `.csv` file that contains one of the following profile identifiers: (the list contains recommended column names, if you use different names you will be able to map data during the process):
- `email`,
- `uuid`,
- `clientID`,
- or `customID`.
This is the only required column, the rest is optional.
If you choose an email as an identifier, pay attention to the correct format of emails. Otherwise, your import will fail.
In this case, we will use data from a sample file, which can be downloaded during the [Select the file for import](#select-the-file-for-import) step, using the **Get Sample File** button.
- `.CSV` files must be UTF-8 encoded, spaces and special characters in the column headers are not allowed. Check [tips for preparing a CSV file](/docs/assets/imports/importing-clients#tips-for-preparing-a-csv-file).
## Select the file for import
---
In this part of the process, you will upload a file from your device.
1. Go to **Data Modeling Hub > Imports> New import**.
2. As the data type for import, select **Profiles**.
3. As the import method, to import a single `.csv` file to Synerise, select **Import a local file**.
4. To upload the `.csv` file, click the **+ Upload file or drag one here field** .
5. Optionally, you can customize the file metacharacters by clicking the arrow down icon next to **Customize file markup**.
1. From the **Delimiter** dropdown, select the character that marks the end of a column.
2. From the **Quotation mark** dropdown list, select the characters that contain the text.
3. From the **Escape character** dropdown lists, select the character which changes the default interpretation of a character or a string followed by the escape character.
6. You can preview the data output by clicking **Preview data**.
7. Click the **Next** button to upload the file.
8. When the file is uploaded, click **Next** to proceed.
Import Profiles configuration
## Mapping the columns with parameters in Synerise
---
In this part of the process, you will connect the columns from the file with their counterparts (the existing attributes) in Synerise. This way, you will point which parameters in Synerise will contain the profile information from the imported file.
You can also exclude parameters from the import.
On the user interface, you will be presented with two columns - the left column displays the names of the columns from the imported file, the other contains dropdown lists with the parameters available in Synerise. The dropdown lists indicate required parameters for a successful import.
If you skip mapping the non-required parameters, the name of these parameters will be the same as the names from the imported file. If parameters don't exist in Synerise, they will be imported as new parameters.
1. Next to the file column name, from the dropdown list, select the corresponding parameter in Synerise. Perform this step for all columns in your file.
In our case, we do not need to map the parameters, because the uploaded file meets all the requirements from the prerequisites.
2. To exclude a parameter from import, next to the column name, click this icon: Mapping
3. To proceed to the summary of the import, click **Next**.
**Result:** The summary of the import is displayed.
Import summary
4. After checking the import summary, to start the import, click **Run import**.
5. You can monitor the status of your import and potential errors due to incorrect data in the **Imports List**.
## Generated events
This use case generates 1 event per profile that completes the flow:
[`client.add`](/docs/assets/events/event-reference/profiles#clientadd) (~1).
## Read more
---
- [Imports](/docs/assets/imports/introduction-to-imports)
# Show basket value needed to enable a promotion
Personalized in-app campaigns within a mobile application can improve your customers' experience and help you increase your revenue from mobile shopping.
Targeted in-app marketing campaigns are most effective when they’re personalized based on each individual’s in-app behavior and provide a better customer experience than campaigns developed for a general audience.
Using [inserts](/developers/inserts/insert-usage) in your in-app campaigns, you can refer to analyses results, customer's attributes, prediction results, and so on created in the platform. It can be used in the content of various campaigns such as discount threshold campaign, which offers a discount to customers when the total value of a cart reaches a specified amount.
In this use case, you will create an in-app campaign displayed in your mobile app. In the content of the message, you will inform the mobile app user about the amount of money they still have to spend to be able to use the discount. The campaign will be triggered when a product is added to a cart. This way you will encourage app users to spend more money and increase the value of the basket in the mobile application. Additional benefit of this campaign is a promotion support as every customer who adds the first product to the basket is informed about this campaign.
The promotion used as an example in this use case is a 10% discount triggered when the cart value reaches 200 PLN.
This use case contains ready-to-use code snippets. You can use them in your campaign as-is.
## Prerequisites
---
- [Implementation of Synerise SDK in your mobile app](/developers/mobile-sdk).
- Implementation of the [transaction events](/developers/web/transactions-sdk) using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#operation/CreateATransaction).
- [Implementation of the `cart.status` event](/developers/web/cart), which stores the current status of the basket in the form of an event on the customer's card. Event has to be sent to Synerise, after every change in the cart status.
- Collect [product.addToCart event](https://hub.synerise.com/api-reference/data-management#operation/ClientAddedProductToCart).
- Implement a [promotion](/docs/ai-hub/promotions) which gives a discount after the customer reaches the discount threashold. In our case we assume a 10% discount for 200 PLN (or more) basket value.
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate](/use-cases/in-app-with-discount-threshold#create-an-aggregate) which shows the last cart status with the information about the total value of the cart.
2. [Create an expression](/use-cases/in-app-with-discount-threshold#create-an-expression) which returns information on how much money the customer has to spent to reach the discount threshold.
2. [Create an in-app message](/use-cases/in-app-with-discount-threshold#create-an-in-app-message) triggered by the `product.addToCart` event with information about the amount of money the customer still needs to spend to get the discount.
## Create an aggregate
---
In this part of the process, create an aggregate, which returns the last cart status with the information about the current value of the customer's cart. This aggregate will be used later in an expression that counts the remaining amount of money that must be spent to get the discount.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate.
3. Set **Analyze profiles by** to **Last**.
4. From the **Choose event** dropdown list, select the `cart.Status` event.
5. As an event parameter, select `totalAmount`.
6. Set the date range to **Lifetime**.
6. Save your aggregate.
Aggregate settings
## Create an expression
---
In this step, you will create an expression which returns the difference between the current basket value and the discount threshold (in our case 200 PLN or more). If the basket value exceeds the discount threshold, the result of the expression is a negative number (for example, -40, which means that the customer exceeded the threshold by 40). If not, the result of the expression is higher than 0 and it means that the customer hasn't reached the threshold yet.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression.
2. As a type of expression, select **Attribute**.
3. In the **Formula definition** section, click **Select**.
4. From the list that opens, select **Constant** and set its value to the discount threshold value.
5. Click + button and from the dropdown list select **Profile**.
6. Click the **unnamed** node that appeared.
8. At the bottom of the page, click **Choose attribute**.
9. On the list of attributes, choose **Aggregates**, find and select the [aggregate](/use-cases/in-app-with-discount-threshold#create-an-aggregate) you have prepared in the previous part of the process.
10. Click the + button and change it to `-`.
11. In the upper-right corner, click **Save**.
12. In the upper-right corner, click **Publish**.
Expression settings
## Create an in-app message
---
In this part of the process, you create an in-app campaign triggered by the `product.addToCart` event. The message contains information about the amount of money the customer needs to spend to get the discount. The audience of this campaign are the customers for whom the [expression](/use-cases/in-app-with-discount-threshold#create-an-expression) result is higher than 0.
The capping for the in-app campaign is set to 1 time a week.
1. Go to **Experience Hub > In-app messages > Create in-app**
2. Enter a meaningful name for the in-app campaign.
1. In the **Audience** section:
1. Click **Define**.
2. Select the **New audience** tab.
3. Select **Define conditions**.
4. Choose **Add condition** and find the [expression](/use-cases/in-app-with-discount-threshold#create-an-expression) created in the previous part of the process.
5. As an operator, choose **More** and set the value to `0`. This way, the message will be displayed to the customers who haven't reached the threshold yet.
3. Click **Apply**.
Audience settings
1. In the **Content** section:
1. Click **Define**.
2. Click **Create message** and select **Code Editor**
2. Create the content of your in-app campaign. You can reuse the code snippets presented below in your in-app template. The code snippet includes the [expression](/use-cases/in-app-with-discount-threshold#create-an-aggregate) that returns the amount of money customer has to spend to be given a discount.
Check the HTML code
<div class="in-app-wrapper"> <div class="in-app-wrapper-inner"> <div class="in-app__upper"> <div class="in-app-close"></div> <p class="in-app-title"> Hello {% customer firstname %}</p> </div> <div class="in-app__middle"> <div class="in-app__content"><h1>Get</h1> <div class="in-app__flexbox"> <div class="in-app__number">10</div> <div class="in-app__off">% <br> OFF</div> </div> <p>When you spend <br> 200 PLN or more! </p> </div> </div> <div class="in-app__lower"> <p class="in-app__lower--text">You need to spend <span class="in-app__lower--span">{% expression %} d3b58957-febf-4374-b96e-85f1f3e462a0 {% endexpression %} PLN</span><br> more to use our special<br>discount!</p> <button>Close</button> </div> </div> </div>
(function () { var closeButton = document.querySelector(".in-app-close"); closeButton.addEventListener("click", function () { SRInApp.close(); SRInApp.trackCustomEvent( "inapp.custom", { action: "close", }, "Custom event from In-App message" ); }); var ctaButton = document.querySelector('.in-app-wrapper-inner button'); ctaButton.addEventListener('click', function () { SRInApp.trackCustomEvent('inapp.custom', { 'action': 'call to action' }, 'Custom event from In-App message'); SRInApp.close(); }); var modalBackground = document.querySelector(".in-app-wrapper"); modalBackground.addEventListener("click", function (event) { if (event.target.getAttribute("class") == "in-app-wrapper") { SRInApp.close(); SRInApp.trackCustomEvent( "inapp.custom", { action: "click outside modal", }, "Custom event from In-App message" ); } }); })();
The CSS and JS codes snippets presented above let you create ready-to-use in app campaign presented in the example. In the HTML code snippet, replace the expression ID with the expression you created in your workspace.
1. In the **Trigger events** section:
1. Click **Define**.
2. Select **Add event** and from the dropdown list, choose the `product.addToCart` event.
2. Click the **+ where** button and as the parameter, choose `finalUnitPrice`.
3. As the logical operator, select **Less than** and set the value to the discount threshold value.
4. Click **Apply**.
Trigger event settings
1. In the **Schedule** section:
1. Click **Define**.
2. Choose **Run immediately** option.
3. Click **Apply**.
2. In the **Display settings** section:
1. Click **Change**.
2. Define the **Delay display** and **Priority index** option according to your business requirements. Enable the **Frequency limit** toggle to manage the frequency of in-app message display in the application, and set it to once per week.
3. Click **Apply**.
The mobile application can display one in-app message at a time. If the conditions allow the display of several in-apps at a time, the priority is a decisive factor for displaying the message. The messages with lower priority aren’t queued.
1. Optionally, you can define the **UTM parameters**. Otherwise, click **Skip step**.
2. Optionally, you can add the custom parameters in the **Additional parameters** section. Otherwise, click **Skip step**.
3. To start your campaign, click **Activate**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [aggregate](https://app.synerise.com/analytics/aggregates/79712849-4a22-3ef4-8cec-fe36d5a6eb0f), [expression](https://app.synerise.com/analytics/expressions/d3b58957-febf-4374-b96e-85f1f3e462a0) and the final [in-app campaign configuration](https://app.synerise.com/communications/in-app/0a26a269-b22d-44a5-8034-3edf27037a42) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 4 events per profile that completes the flow:
[`product.addToCart`](/docs/assets/events/event-reference/items#productaddtocart) (~1), [`inApp.show`](/docs/assets/events/event-reference/inapp#inappshow) (~1), [`inApp.click`](/docs/assets/events/event-reference/inapp#inappclick) (~1), `inapp.custom` (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [In-app messages](/docs/campaign/in-app-messages)
- [Mobile campaigns](/docs/campaign/Mobile)
- [Promotion for entire basket](/use-cases/promotion-for-entire-basket#create-a-promotion)
# Campaign optimizer
Campaign optimization is very important and allows you to increase the effectiveness of the campaign using data already available. The two main factors that should be optimized are the communication channel tailored to the user and the optimization of the campaign delivery time.
## Example of use - Retail Industry
**Challenge**
A client from the retail industry expressed the need to optimize their campaigns.
Their main goals were:
- Personalization of sending time for campaign messages
- Selecting the optimal communication channel for each particular client (depending on which communication channel the client responds better to)
**Solution**
We created the solution in the form of channel and time optimization. Both options are available in the campaign creator (channel optimization can be chosen in the Audience tab, and time optimization in the Schedule tab).
Based on predefined aggregates, expressions and automation, the algorithm automatically **compares all the channels our customer has contact with and selects the best one**. Based on that one customer will get a SMS message with the promotion and another one will get an email based on individual preferences.
What is more, our AI algorithm will automatically select **the best time to send specific campaigns**, taking into consideration not only data about previous campaigns but also customer activity.
Based on those recommendations, Synerise users do not need to analyze channel effectiveness or any other data, because everything is generated and selected in real time by Synerise.
## Prerequisites
---
**General**
- Implement [Synerise tracker](/developers/web/installation-and-configuration#creating-a-tracking-code) on your website.
- Channel optimization configuration.
- [Email account configuration](/docs/campaign/e-mail/configuring-email-account).
- [SMS account](/docs/settings/configuration/sms-account) configuration (integration e.g. with SMS API).
- [Webpush integration](/docs/campaign/Webpush/configuring-web-push).
- [Mobile Push integration](/docs/campaign/Mobile/mobile_campaign).
- [Transactional events](/developers/web/transactions-sdk) implemented (optional).
**AI time optimizer configuration**
- Page visits & other campaign visits.
## Process
---
1. [Configure campaigns](/use-cases/campaign-optimizer#configure-campaigns).
2. [Create a workflow](/use-cases/campaign-optimizer#configure-a-workflow).
## Configure campaigns
---
1. Go to **Campaigns** and create a new one for a specific channel, e.g. SMS.
2. **In the Audience tab**, choose a specific predefined segment of customers created for a specific type of campaign.
3. **In the Schedule tab** you can also choose the recommended time of campaign delivery based on our AI algorithms. You need to define the time range during which you would like to send the campaign. Based on the time range the optimal time will differ.
4. Save the campaign.

5. Do the same for other channels you want to use, e.g. email, webpush etc.
Learn how to do It – check [advanced optimizer configuration](/use-cases/campaign-optimizer2)
## Configure a workflow
---
1. Go to the **Automation Hub > Workflow > New workflow**.
2. As a trigger choose **Audience** node.
3. As an audience define the group of users to which you would like to send the campaign, e.g. you can add here a whole database or a segment of people.
4. Add **Generate Event** event. It is responsible for calculating the channel scoring. The effect of this calculation is the “optimal.channel” event sent to everyone you selected in the Audience trigger.
5. **Split Path** into different campaigns.
6. The next step is the **Event Filter** node. Here we check the result of the scoring calculation. Each of those four nodes allow the selected campaign to be sent. The journey will proceed in one path – the one that will be calculated as a result of Send Event node
7. The last step is responsible for **sending the campaign** in selected channel: sms/email/webpush/mobile push. The action required in this step is to setup the proper template for each channel.
8. Save & Run the automation and wait for your campaign to be sent.

It is recommended to collect the history of customer interactions before preparing the optimization process. You should have as much data as possible to prepare it in a more precise way and to make it more accurate.
We require at least one month of history for particular users to create an optimization of this type for them. But remember that more data you have, the more accurate your algorithms are. For the optimization of channels, we need to have at least 5 campaigns based on our assumptions.
To learn more about the next step and the usage of predefined analytics in the advanced optimizer configuration, read this [case](/use-cases/campaign-optimizer2)
## Generated events
This use case generates approximately 10 events per profile that completes the flow:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), `optimal.channel` (~1), [`snr.ate.prediction`](/docs/assets/events/event-reference/predictions#snrateprediction) (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1).
## Read more
---
- [Advanced optimizer configuration](/use-cases/campaign-optimizer2)
- [Aggregates](/docs/crm/aggregates/introduction-to-aggregates)
- [Automation Hub](/docs/automation)
- [Build segmentation](/docs/analytics/segmentations/creating-segmentations)
- [Expressions](/docs/crm/expressions)
- [Metrics](/docs/analytics/metrics)
# Send customer data to SFTP server
The SFTP integration allows you to send data from Synerise to your other platforms and vice versa, ensuring that all your customer data is synchronized across all platforms. By using the Synerise Automation Hub and the Create Directory node, you can streamline your data management process, saving time and resources while ensuring that all your customer data is organized and up-to-date. This ensures that any data exports can be automatically saved in the correct folder in your resources, making it easier to manage and analyze your data.
This use case describes how to prepare an automated workflow that exports customer data with the agreement for email communication to SFTP. This workflow will be triggered everyday and before it sends a file with extracted customer data, it will send a request to your SFTP to create a directory whose name will be a date of the export.
## Prerequisites
---
- You must have customers in **Behavioral Data Hub > Profiles**.
- You must have a target resource with which you synchronize the data (in this use case, an SFTP server is used).
## Process
---
In this use case, you will go through the following steps:
1. [Create a segmentation](#create-a-segmentation) of customers whose data you want to send to the external resource.
2. [Create a workflow](#create-a-workflow) that sends a request to your SFTP server to create a new file with customer data from Synerise in a dedicated folder.
## Create a segmentation
---
As the first part of the process, create a segmentation of customers who agreed to receive emails. Data of these customers will be sent to the external resource.
1. Go to **Decision Hub > Segmentation > New segmentation**.
2. Enter the name of the segmentation.
3. Click **Choose filter**.
4. From the dropdown list, select `Email agreement`.
5. As the logical operator, select **Equal**.
6. In the text field, enter `enabled`.
7. Click **Save**.
The configuration of the segmentation
## Create a workflow
---
In the final part of the process, create a workflow which will send everyday a request to your SFTP server to deposit customers' data in a dedicated folder.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Scheduled Run trigger node
1. As the trigger node, add **Scheduled Run**.
2. In the configuration of the node:
1. Leave the **Run trigger** option at **all time**.
2. From the **Timezone** dropdown list, select the time zone consistent with the timezone selected for your workspace.
3. Leave the **Everyday** tab.
3. In the **Select time** field, choose the time when the workflow will be triggered.
4. Confirm by clicking **Apply**.
The configuration of the Scheduled Run node
### Select customers to export
1. Add the **Get Profiles** node.
2. In the configuration of the node:
1. Select the segmentation you [created in the previous step](#create-a-segmentation) to extract customers’ data.
2. In the **Attributes** section, select **newsletter_agreement** and **email**.
3. Confirm by clicking **Apply**.
The configuration of the Get Profiles node
### Create a new directory in your SFTP
The **Create Directory** node allows you to send a request to your SFTP server to create a new folder.
1. Add a **Create Directory** node.
2. In the configuration of the node:
1. In the **Server** field, enter the URL of the server.
2. In the **Port** field, set the port. The default value is the most commonly used SFTP port.
3. In the **Path to directory** field, provide a path where your new directory will be created (for example: `/home/file-directory/`).
4. In the **Directory name**, you can use the following Jinjava code to use a date of launching the node as the directory name.
The Jinjava code returns the date in the following format: `08-03-2023`.
5. In the **Authentication** section, select the method of authentication.
6. Test the connection by clicking **Check connection**.
7. Confirm by clicking **Apply**.
### Configure settings for SFTP protocol
1. Add the **Send File** node by clicking **THEN > SFTP**.
2. In the configuration of the node:
1. In the **Server** field, enter the URL of the server.
2. In the **Port** field, set the port.
3. In the **Path to directory** field, provide the path to the directory.
4. In the **File name** field, enter the name of the file under which it will be passed to your SFTP server.
5. If needed, in the **File name suffix**, select the suffix of the file name.
6. From the **File format** dropdown list, select the **CSV** format.
7. Verify and modify the delimiters if needed.
8. In the **Authentication** section, select the method of authentication.
9. Confirm by clicking **Apply**.
The configuration of the SFTP node
### Add the finishing node
12. Add the **End** node.
13. In the upper right corner, click **Save & Run**.
**Result**:
The workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
You can check all the configurations directly in Synerise Demo workspace:
- [Segmentation](https://app.synerise.com/analytics/segmentations/7655038e-99bc-4876-9d7a-90f801ae6a5c)
- [Workflow](https://app.synerise.com/automations/automation-diagram/a82d48de-f57c-4b18-a48f-c07e26dd630f)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 5 events per workflow execution:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- The ["Create Directory" node](/docs/automation/integration/sftp-integrations/create-directory)
- The ["Send File" node](/docs/automation/integration/sftp-integrations/sftp-send-file)
- [Segmentation](/docs/analytics/segmentations)
# OAuth Integration via Firebase JWK Authentication
OAuth-based authentication is one of the most secure and scalable ways to identify users across platforms. In this use case, we show you how to integrate Firebase Authentication with Synerise Identity and Access Management (IAM) using the JWK method. This setup allows you to authenticate users via Firebase and automatically create or update their Synerise profiles — all based on validated token data, without handling credentials directly.
This method is ideal for mobile and web applications that use Firebase for user authentication and need to seamlessly connect those identities with Synerise.
## Prerequisites
---
- Firebase project with OAuth enabled. More info in [Firebase documentation](https://firebase.google.com/docs).
## Process
---
In this use case, you will go through the following steps:
1. [Enable OAuth Method in IAM](/use-cases/firebase#enable-oauth-method-in-iam).
6. [Integrate the method in the mobile application](/use-cases/firebase#integrate-in-mobile-application).
## Enable OAuth Method in IAM
---
In this part of the process, you will activate OAuth-based authentication in Synerise.
1. Go to **Settings > Authentication for mobile apps**
2. Choose and click **OAuth** from Authentication methods.
3. Enable the OAuth method.
4. Provide a name for this authentication method.
5. Select JWT_TOKEN as the authentication method.
6. In **Endpoint URI** provide the URI where the JSON Web Key (JWK) is stored. For Firebase, use: `https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com`
7. Enable the **Identification based on OAuth response data** option.
8. Specify a unique identifier key from the token (for example, `user_id` or `sub`).
9. Map any additional fields from the OAuth response token to corresponding Synerise profile attributes as needed.
**Example of a decoded Firebase token:**
10. Enable Claim Validation. It is recommended to enable claim validation to verify token claims during the authentication process. This ensures that only valid and trusted tokens are accepted.
11. To save your settings, click **Apply**.
## Integrate in mobile application
--
In this final step, you will implement login via the Synerise Mobile SDK.
After a user successfully logs in via OAuth, invoke the authentication method from the Synerise mobile SDK: [Authenticate Customer by Identity Provider – Mobile SDK](/developers/mobile-sdk/method-reference/android/client-authentication#authenticate-customer-by-identityprovider).
Upon successful authentication, a customer profile is automatically created and recognized within Synerise. This integration ensures that users authenticated via Firebase are automatically recognized in Synerise without managing credentials separately. It allows seamless identity synchronization, enabling consistent user data for personalization, analytics, and automation.
Profile
## More information
---
If you need more information about the autentication process, we recommend you to start the [free course](https://academy.synerise.com/course/android-integration-labs) on our Synerise Academy platform.
This course will teach you how to implement Synerise features in your mobile applications by using an example application and explaining how to add functionalities to it, step-by-step. After each codelab, you can check the related folders in our Github repository to see if your code matches the expected results.
You need to just create a free account to be able to start the course.
## Generated events
This use case generates approximately 2 events per profile that completes the flow:
[`client.add`](/docs/assets/events/event-reference/profiles#clientadd) (~1), [`client.identify`](/docs/assets/events/event-reference/profiles#clientidentify) (~1).
## Read more
---
- [Method reference - Android - Mobile SDK - mobile SDK help](/developers/mobile-sdk/method-reference/android/client-authentication#authenticate-customer-by-identityprovider)
- [OAuth - OAuth documentation](/docs/settings/tool/iam-for-apps/oauth)
# Landing page with personalized listing and brand-focused product recommendations
In today's competitive e-commerce landscape, personalization plays a crucial role in improving customer engagement and increasing conversion rates. By leveraging customer data such as purchase history, browsing patterns, and product preferences, businesses can provide a tailored shopping experience. This is especially critical during high-stakes sales events like Black Friday, when customers are bombarded with a vast range of products and deals. A well-executed personalized approach not only enhances user experience but also helps in reducing decision fatigue and boosting conversion rates.
This use case demonstrates how a dynamically personalized product listing can be integrated into a landing page. The listing presents products that are relevant to each customer's interests, based on their past purchases and browsing activities. With the use of Synerise Predictions, presented results will be even more accurate.
**Here’s how it works**:
- Customers with a high propensity to purchase from a particular brand will receive an email that guides them to a personalized landing page.
- The page features an **automatically filtered product listing that spotlights items from their preferred brand**.
- Customers can further refine their browsing experience by applying additional filters, such as product category or price, for an even more tailored shopping journey.
For special occasions such as Black Friday or Power Monday, you can enrich this scenario and apply additional settings, such as showcasing only offers with a specific "black-friday" tag.
In this use case, we will guide you through every step of the scenario. We will prepare the email campaign as well as the landing page which will be created based on a predefined template that makes the scenario easy to prepare by adapting the ready project to your business needs.
## Prerequisites
---
To be able to implement this use case, you must:
- [Create a sender account](/docs/campaign/e-mail/configuring-email-account)
- Configure AI Engine for:
- [AI Search](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-search)
- [Propensity predictions](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-propensity#enabling-propensity-and-best-fit-predictions)
- Create and configure [search index](/docs/ai-hub/ai-search/create-index) and add the desired [filterable attributes](/docs/ai-hub/ai-search/define-attributes#filterable-attributes)
- [Predict propensity to buy items from specific brand](/use-cases/propensity-brand)
- If you plan to publish a landing page within your own domain, follow instructions from ["Requirements for custom domains" section](/docs/campaign/landing-page/creating-landing-page#requirements-for-custom-domains); if you choose to publish it on the Synerise domain, no additional requirements are necessary
- Optionally you can [configure AI engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations) to be able to add personalized AI recommendations to your landing.
- Optionally create [AI recommendations](/docs/ai-hub/recommendations-v2) which you can add to your landing page.
## Process
---
Perform the steps in the following order:
2. [Create a landing page](/use-cases/landing-page-personalized-listing#create-a-landing-page).
2. [Create an email campaign](/use-cases/landing-page-personalized-listing#create-an-email-campaign).
## Create a landing page
---
In this part of the process, you will create a landing page with personalized product listing. The listing will have filtering options (such as filters by brand, by category or price) as well as sorting. We will use a predefined template so there is no need to create a template from scratch.
In this example we will use a landing page approach, but you can implement the same scenario in any other structure or flow that fits your project.
1. Go to **Experience Hub > Landing Page > Create new**.
2. Enter the name of the campaign.
### Define content
---
1. In the **Content** section, click **Create message**.
2. From the list of template folders, select the **Predefined templates** folder.
**Result:** You are redirected to the list of predefined templates.
3. Select the **Personalized Listing** template.
**Result:** You are redirected to the code editor. The form in the **Config** tab is pre-filled with default values, which you can modify to suit your business needs.
5. In the **General** section:
1. In the **ID of AI search index** field, enter the ID of search index you created as a part of [prerequisites](/use-cases/landing-page-personalized-listing#prerequisites).
10. In **Additional Recommendation**, you can select an AI recommendation that will be used to present additional product offers, if switched on. In this section, apart from selecting the recommendation, define the header for the recommendation frame, and the number of items to display in the recommendation frame.
6. In the **Buttons, Hero, Footer** sections, you can configure the layout and appearance of your landing page, including fonts, colors, and backgrounds, to ensure it matches your branding.
7. After you make changes to the template, you can check the preview.
1. Click the **Preview Contexts** button on the upper left side.
2. Enter the ID of a customer.
3. Click **Apply**.
Edit form in the Config tab
8. If the template is ready, click **Use in communication** in the upper right corner.
### Define schedule settings
---
1. In the **Schedule** section, click **Define**.
1. Select the timezone.
2. Select the time when the landing page will be active - in this case, choose the start and end date, so they overlap the period before and after Black Friday.
6. Click **Apply**
Edit form in the Schedule tab
### Define the SEO settings
---
In this part of the process you may define technical details concerning search engine optimization and increase the chances of placing high in search results.
### Set up the URL
---
In this part of the process, you will define the URL to your landing page.
1. From the **Domain** dropdown list, select the address of your landing page.
2. Optionally, if you want to add a part to the address after the domain, in **Nice URL** provide this part, for example, `black-friday` (don't use a slash, it is added automatically).
3. In **URL for redirecting users when the landing expires (optional)**, enter the URL to which you will redirect users after the landing page expires.
4. Optionally, in **Fallback URL**, enter the URL to which users will be redirected if your landing page is unavailable due to errors (for example, when it can't be rendered due to Jinjava syntax error). If you leave this field empty, users will be redirected to a generic error page.
4. In **URL preview**, you are provided with a final link to your landing page. The preview is in real time, so if you fill a domain or URL, you get the preview of the address simultaneously.
5. Confirm the settings by clicking **Apply**.
### Adjust optional settings
---
1. In the **HTTP headers** section, you can add custom HTTP headers to your landing page. In the **Key** and **Value** fields, enter a header and its value, respectively.
2. In the **Customize** section:
- you can add CSS and scripts to your landing page
- you can define the URLs to external sources or paste the snippets
- in the JS section under the **Advanced options** option, to enable additional tracking on your landing page, you can paste the [tracking code](/developers/web/installation-and-configuration#adding-the-tracking-code-to-your-site).
### Save your campaign
---
1. After you make changes to the campaign, you can check the preview. Click the **Preview** button on the upper right side.
2. When your landing page is ready you can **Save it as a draft** or directly click **Publish**.
## Create an email campaign
---
In this part of the process, you will create an email campaign with the link to the landing page with personalized listing, automatically filtered to the brand you specified while [building prediction](/use-cases/landing-page-personalized-listing#prerequisites). The campaign will be directed to all customers with high propensity to buy items from that brand.
1. Go to **Experience Hub > Email campaign > Create new**.
2. In the **Audience** section, choose the **New audience**.
3. Define the conditions:
1. Choose event `snr.propensity.score`.
2. As the parameter, choose **modelId**.
3. As the operator, choose **Equal**.
4. In the text field, enter the ID of the prediction you created as a part of [prerequisites](/use-cases/propensity-brand).
5. Click **+ where**.
6. From the dropdown list, select **source_label**.
7. As the operator, choose **Equal**.
8. Depending on the scale selected in the prediction, please enter the highest possible value that can be achieved here. In our case, in the text field, enter `high`.
The conditions for the audience of the email
4. Apply and save your changes.
3. Configure the **Content** section.
3. Choose the email account from which you want to send your message.
2. In the **Subject** field, enter your message subject.
2. Click **Create message**.
You can create a template out of scratch or use the ready-made templates in the **Predefined dynamic templates** and **Predefined simple templates** folders.
An email template must contain a link to the landing page with brand filter passed in the link. Based on the personalized listing on our predefined template, the link would look in the following way: `https://your.landingpage.com/black-friday?brand=xyz`.
To ensure that the landing page content is personalized and rendered specifically for the customer who is being redirected, you must also pass the UUID of the customer in the link. This can be done by adding `snrs_cl` parameter in the URL in the following ways:
- by adding manually the Jinjava insert that retrieves UUID to the link, for example: `https://your.landingpage.com?snrs_cl={{customer.uuid}}`
- by inserting the link using `{% preparelink %}YOUR_LANDING_PAGE_URL{% endpreparelink %}` tags which automatically adds the `snrs_cl` parameter to the link.
Taking the above into consideration, the final link that must be embedded in email template will look in the following way: `{% preparelink %}https://your.landingpage.com/black-friday?brand=xyz{% endpreparelink %}`.
You can read more about customer context in landing pages in ["Establishing customer context" section](/docs/campaign/landing-page/creating-landing-page).
4. After finishing email template, click **Use in communication**.
5. In the **Content** section, to confirm the settings, click **Apply**
4. In the **Schedule** section, specify the time when you want to send your communication.
4. You can optionally define **UTM & URL parameters**.
4. To send the email, click **Send**.
Example of email template
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the [landing page](https://app.synerise.com/campaigns/landing-pages/create/d2fffb37-e736-4ef2-acd7-e80c23516b01:2024-11-13T11:06:52.595559351) with personalized product listing directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 7 events per profile that completes the flow:
[`snr.propensity.score`](/docs/assets/events/event-reference/predictions#snrpropensityscore) (~1), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`newsletter.open`](/docs/assets/events/event-reference/email#newsletteropen) (~1), [`newsletter.click`](/docs/assets/events/event-reference/email#newsletterclick) (~1), [`landingpage.visit`](/docs/assets/events/event-reference/landing-page#landingpagevisit) (~1), [`item.search`](/docs/assets/events/event-reference/search#itemsearch) (~1), [`item.search.click`](/docs/assets/events/event-reference/search#itemsearchclick) (~1).
## Read more
---
- [Email communication](/docs/campaign/e-mail/creating-email-campaigns)
- [Jinjava inserts](/developers/inserts)
- [Landing page](/docs/campaign/landing-page)
# Personalized search on "no results" website
Your search engine should understand even poorly worded queries and return a good set of results – you can optimise it using [Synerise AI search](/use-cases/search-multiple-languages). It will handle misspellings, but what’s more, you can use synonyms and query rules to help customers find what they are looking for.
But if you don’t use AI search yet, or your clients are searching for new queries, don’t let them waste time on a ‘No Results’ page. Instead of this, prepare personalized recommendations, which will show products suited to users based on their activity.
## Example of use - Home appliances industry
A client from the electronics industry had their own search solution, but noticed that very often users were getting **zero page results**. The fastest way to improve the customer experience was to add additional recommendation frames on such subpages. Users were informed that there were no results matching their queries, but maybe they will be interested in some recommended products.
Search on a website with no results
**Results**
- **3,1%** CTR
## Prerequisites
---
To implement this use case:
- Add [tracking code](/docs/settings/tool/tracking_codes) to your website.
- Import [product feed](/developers/product-feed).
- Import [transaction events](/developers/web/transactions-sdk).
## Process
---
To create AI recommendation adjusted to the customer's preferences, perform the steps in the following order:
1. [Prepare AI recommendation](/use-cases/personalized-search-no-results#prepare-ai-recommendation).
2. [Prepare dynamic content ](/use-cases/personalized-search-no-results#prepare-dynamic-content).
## Prepare AI recommendation
---
To show recommendations on the website, first you must prepare AI recommendations.
1. Go to **Experience Hub** > **Recommendations**.
2. Add **New recommendation**.
3. Choose personalized recommendation type and define the number of products you want to show in the frame. You can add additional filters if needed.
more information about using filters you will find in [these](/docs/ai-hub/recommendations-v2/recommendation-filters) articles.
AI campaign
## Prepare dynamic content
---
Use dynamic content to insert recommendations in the specific place on your website - you can recognize zero search results in two ways:
- You can prepare a unique CSS selector which will be added only on zero search result pages.
- If you won’t have such a selector, you will have to additionally use JS to check if there is no product on the page. It will depend on your website structure how to check it.
To prepare dynamic content:
1. Go to **Experience Hub > Dynamic content > Add new**
2. Choose **Insert Object** type.
2. Select **Everyone** in the Audience.
3. In **Content** section, select **Simple message**, and specify CSS selector in which you want to insert recommendations.
4. In the **Content** tab, add appropriate **CSS selector** and click **Create message**. Insert Jinjava code with AI recommendation - let’s look at how to prepare the appropriate Jijnava code (you will have to add your own CSS to it).
Check the jinja code
<!-- Downloading the AI campaign --> {% recommendations2 campaignId=cg3HBgRC5P2h %} {% for p in recommended_products2 %} <li data-snr-ai-product-id="{{p.productRetailerPartNo}}"> <a class="snrs-AI--item-link" href="{{p.link}}" title="{{p.title}}"> <img src="{{ p.imageLink }}" class="products-slider__item-image snrAI-product-image snrAI-product-image-{{p.productRetailerPartNo}}" width="90" alt="{{p.title}}" id="snrAI-image-{{p.productRetailerPartNo}}"> <h3 class="snrs-AI-product--product-name"> <span class="snrs-AI-product--name-first">{{p.title}}</span> </h3> </a> </li> {% endfor %} {% endrecommendations2 %}
5. Schedule when the dynamic content has to be active.
6. In **Display settings**, specify that dynamic content has to be shown **Always, On landing, on Specific URL** which indicates its search page.
If you don’t want to use dynamic content, you can implement recommendations via API request, you can find details [here.](https://hub.synerise.com/api-reference/ai-recommendations#tag/Recommendations/)
## Generated events
This use case generates approximately 5 events per profile that completes the flow:
[`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`recommendation.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [AI API](https://hub.synerise.com/api-reference/ai-recommendations#tag/Recommendations/)
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Jinjava inserts](/developers/inserts/insert-usage)
- [Personalized recommendations](/docs/ai-hub/recommendations-v2/recommendation-types#personalized)
# Promotions for customers at risk of churning
An essential aspect of churn prediction is preventing customer from leaving. Because it is more expensive to acquire new consumers than it is to keep existing ones, you might try to entice them back with special offers.
In this use case, you wil create a buy one, get one free (BOGO) promotion for a group of customers who are most likely to churn.
## Prerequisites
---
- [Integrate JS SDK](/developers/web/installation-and-configuration).
- [Enable the Custom prediction model](/docs/ai-hub/predictions/enabling-predictions#enabling-regression-and-classification-predictions).
- Implement promotions in your [mobile application](/developers/mobile-sdk/loyalty), [API](https://hub.synerise.com/api-reference/loyalty-and-engagement#operation/profileLogin).
- [Import your product feed to catalog](/use-cases/import-product-feed-to-catalog).
- If you want to limit the promotion to only some of your stores, add the list of stores to a catalog. Such a catalog must contain a unique store ID and any other store attributes by which you will filter stores, such as city, zip code, and so on. More information about catalogs can be found [here](/docs/assets/catalogs).
- Predict churn for a group of customers. The [Predict churn](/use-cases/churn-prediction) use case includes detailed instructions.
## Security configuration
---
Before you start working with this hub, if you are a Synerise customer or partner, consider reading [the section about denylisting events](/docs/settings/tool/api#denylist). This natively accessible configuration will allow you to manage the restrictions in points management that may help you prevent fraud.
## Process
---
1. [Prepare a segmentation](/use-cases/promotions-for-customers-at-risk-of-churning#prepare-a-segmentation-based-on-prediction) of customers who are at high risk of churn.
2. [Create a promotion](/use-cases/promotions-for-customers-at-risk-of-churning#create-a-promotion).
## Prepare a segmentation based on prediction
---
As the first part of the process, create a segmentation of customers based on the prediction results.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Give the segmentation a meaningful name, for example `Customers at risk of churn`.
3. Click **Choose filter** and select the `snr.prediction.score` event.
The event may have a custom label in the list, but can always be found by entering the system name (`snr.prediction.score`) in the search field.
3. Add the following conditions to the event:
- `score_label` parameter equals `High`
- `modelId` parameter equals the ID of the prediction you want to use.
The model ID can be copied from the menu in the Prediction list.
4. Click **Save**.
**Result:** The segmentation is saved and can be used as an audience for a promotion.
Segment
## Create a promotion
---
1. Go to **AI Hub > Regular Promotions > Add promotion**.
2. Select the **For selected items** option.
3. In the **Audience** section, select the segmentation created in [this step](/use-cases/promotions-for-customers-at-risk-of-churning#prepare-a-segmentation-based-on-prediction).
4. In the **Content** section:
1. Define the name, description, and image of the promotion.
2. In the **Price** field enter `0`.
3. Confirm the settings by clicking **Apply**.
Example of promotion content
5. In the **Type and limits** section:
1. In the **Type** dropdown list, choose **Members only**.
2. In the **Discount type** dropdown list, choose **Exact price**.
3. Leave the **Discount mode** field value at default (**Static**).
4. In the **Limit per profile** section, enter `1`.
5. In the **Value** section, define the discount as `0`.
6. Enable the **Buy one, get one promotion** toggle.
7. Define the number of required and discounted items.
8. Enable the **Turn on required items** toggle.
Example of Type and limits settings
6. In the **Schedule** section, define the promotion distribution period according to your business needs.
7. *Optionally*: In the **Stores** section, specify stores where the promotion is available.
This is possible only if the list of stores is imported into a [catalog](/docs/assets/catalogs).
8. In the **Items** section, specify the catalog item to be discounted:
1. From the **Source catalog** dropdown list, select an item catalog from which the items will be selected.
2. Select the **Select items** tab.
3. Click the **Select items** button.
4. On the list, select the item a customer will get for free.
9. In the **Required Items** section, choose the items a customer must buy to unlock "buy one, get one" discount:
1. From the **Source catalog** dropdown list, select an item catalog from which the items will be selected.
2. Select the **Select items** tab.
3. Click the **Select items** button.
4. On the list, select the item a customer will get for free.
11. To apply configuration and run the promotion, click **Publish**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of every element of this process directly in Synerise Demo workspace:
- [Propensity prediction](https://app.synerise.com/ai-v2/predictions/generic-scoring/bgycsoovxgby)
- [Segmentation](https://app.synerise.com/analytics-v2/segmentations/9ec901b4-2ea0-47dc-9285-023d2000e8cf)
- [Promotion](https://app.synerise.com/campaigns/promotions/c4b75133-6235-42c4-98fd-0956def1f96a)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates 1 event per profile that completes the flow:
[`client.activatePromotion`](/docs/assets/events/event-reference/loyalty#clientactivatepromotion) (~1).
## Read more
---
- [Promotions](/docs/ai-hub/promotions)
- [Propensity predictions](/docs/ai-hub/predictions)
- [Segmentations](/docs/analytics/segmentations)
# Mobile Push Campaign Targeting Local Customers for New Store Opening
In this use case, mobile push campaign in the application is sent to customers located in a specific city (in our case Warsaw) to inform them about the opening of a new offline store. The message includes details about an exclusive, limited-time promotion: an extra 20% off for the first 50 customers who visit the store. This targeted approach not only builds excitement around the new location but also encourages immediate foot traffic by rewarding early visitors with a special discount.
## Prerequisites
---
- [Implement Synerise SDK in your mobile application](/developers/mobile-sdk).
- Implement mobile push notifications in your mobile application:
- [iOS](/developers/mobile-sdk/configuring-push-notifications/ios),
- [Android](/developers/mobile-sdk/configuring-push-notifications/android).
- [Create a mobile push template](/docs/campaign/Mobile/creating-mobile-push).
## Process
---
1. [Create geoanalysis](/use-cases/mobile-push-offline-store#create-geoanalysis) that groups customers based on the specific location (in our case - Warsaw).
2. [Create a mobile push campaign](/use-cases/mobile-push-offline-store#create-a-mobile-push-campaign).
## Create geoanalysis
---
As the first part of the process, create a geoanalysis that returns a list of customers who generated a [`session.start` event](/docs/assets/events/event-reference/web-and-app#sessionstart) (opened a mobile application) in a specific location (Warsaw).
1. Go to **Decision Hub > Geoanalytics**.
2. In the upper right corner of the map, click the **Add selection** button.
**Result**: A box appears on the map.
3. To select the location for analysis, drag the box to a place on the map.
4. Adjust the size of the selected area by clicking, holding, and moving the borders of the selection.
4. To proceed to the settings, click **Go to analytics**.
4. To proceed to the settings, click **Go to analytics**.
**Result**: You are redirected to the segmentation configuration form. The first step is already done for you - a `session.start` event with the geographical coordinates are already selected. The system selects the group of customers which performed this event in the location you selected. Out of the group selected this way, you can select customers who meet your conditions specified in the further steps.
5. Enter the name of the segmentation.
8. To create the next step in the segmentation, click the **and then...** button.
9. From the dropdown list, choose `page.visit`.
6. To determine the time range from which the data will be analyzed, click the [calendar](/docs/analytics/i_date-filters) icon, and choose **Lifetime**.
7. To complete the process, click the **Save** button.
**Result**: When you save the segmentation based on geoanalytics, you can find it on the list of segmentations under the given name.
Example of geoanalytics
## Create a mobile push campaign
---
Prepare a mobile push with information about the promotion.
1. Go to **Experience Hub > Mobile > Create new**.
2. Add a name and optionally the description for your campaign.
2. Choose **Simple Push**.
3. In **Device type**, choose **All**.
4. In **Audience** section, click the **Segments** and choose the segmentation created in the [previous step](#create-geoanalysis) based on the geoanalysis.
5. Click **Apply**.
6. In the **Content** section, click **Create message**. From the list of templates, select the one you prepared as a part of prerequisites. If you haven't done that, you can use the a predefined template from the folder or create your own one using the mobile push code editor, in such case, click **New template**.
For more information on creating a mobile push templates, read [Creating mobile push templates](/docs/campaign/Mobile/creating-mobile-push-templates).
8. To use the template in the campaign, click **Use in communication**.
9. Set up your schedule in **Schedule** section.
10. Optionally send a test mobile push and add [additional parameters](/docs/campaign/Mobile/creating-mobile-push#define-additional-parameters) to the events generated by this mobile campaign.
11. To send your campaign, click **Send** .
Example of mobile push
## Check the use case set up on the Synerise Demo workspace
---
You can check the [segmentation configuration](https://app.synerise.com/analytics-v2/segmentations/d3e88fb4-2cb0-48b4-a489-abb7d0b3efdc) and [mobile push campaign](https://app.synerise.com/campaigns/mobile-push/create/26129088-3b81-4f04-a15b-3499f3a4fcac) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`push.send`](/docs/assets/events/event-reference/mobile-push#pushsend) (~1), [`push.view`](/docs/assets/events/event-reference/mobile-push#pushview) (~1), [`push.click`](/docs/assets/events/event-reference/mobile-push#pushclick) (~1).
## Read more
---
- [Configuring mobile notifications](/docs/campaign/Mobile/mobile_campaign)
- [Creating geoanalytics](/docs/analytics/geoanalytics/creating-geoanalytics)
# Labeling Best-Selling Products Automatically in Synerise Catalog
Automating the extraction of sales data and updating product catalogs with accurate information is vital for businesses aiming to streamline operations and improve customer experiences. In this specific scenario, the objective is to achieve precisely that by utilizing automation to identify best-selling products in the Synerise catalog and label them on the website.
Implementing this scenario offers several key advantages. Firstly, it enables the efficient transmission of sales data for frequently purchased products within a specific category directly to the catalog. By eliminating manual data extraction, this automated approach reduces human errors and saves valuable time and resources.
The goal of this use case is to - using automation - send the sales for a particular product category (in this instance: smartphones) and upload it to the Synerise catalog through automation. The data corresponds to the best-selling items from the last 30 days. The process involves generating a JSON report via an API, manipulating the response using Jinja, and sending a request to the Synerise catalog to add the sales data with sequential numbers. Additionally, a dynamic content script is utilized to verify if the Stock Keeping Unit (SKU) exists in the top 100 product catalog and apply a "Bestseller" label to the corresponding elements on a webpage daily, based on the most recent data.
## Prerequisites
---
- Create a catalog, that consists of two columns: `no` (number) and `sku`. This catalog will serve as the foundation for importing data automatically. The objective is to import data of the top 100 bestselling products in the `smartphones` category from the last 30 days.
- Create a [Workspace API key](/docs/settings/tool/api) that has the following permissions: `ANALYTICS_BACKEND_REPORT_READ` and `CATALOGS_ITEM_BATCH_CATALOG_CREATE`
- In order for the bestseller label to be added to an element, the SKU (Stock Keeping Unit) needs to be included as an attribute called `data-sku.` On the webpage, there should be an element, preferably an `` tag, with the `data-sku` attribute whose value corresponds to the SKU from the list of bestsellers in the catalog.
## Process
---
In this use case, you will go through the following steps:
1. [Create a metric](/use-cases/bestsellers-in-catalog#create-a-metric) that calculates the number of purchases within the `smartphones` category over the last 30 days.
2. [Create a report](/use-cases/bestsellers-in-catalog#create-a-report) that presents the top 100 bestselling products based on the metric created in the previous step.
3. [Retrieve request body of the report](/use-cases/bestsellers-in-catalog#retrieve-request-body-of-the-report) and use it in the next step during creating a workflow (in the Outgoing Integration node).
3. [Create a workflow](/use-cases/bestsellers-in-catalog#create-a-workflow) that facilitates the transmission of transaction data to the catalog, ensuring accurate and up-to-date information.
2. [Create a dynamic content campaign](/use-cases/bestsellers-in-catalog#create-a-dynamic-content-campaign) that adds labels to the bestselling products, enhancing their visibility and recognition.
## Create a metric
---
To create a metric that counts the number of frequently purchased products in a specific category (in this case: `smartphones`) within the last 30 days, follow the steps below:
1. Go to **Decision Hub > Metrics > New mertic**.
2. Enter a name of the metric.
3. As a metric kind, select **Simple metric**.
4. As the aggregator, set **Count**.
5. As the occurrence type, set **All**.
6. From the **Choose event*** dropdown list, select **product.buy** event.
7. Click on the **Where** button.
Result: The **Choose parameter** button will appear.
8. Click the **Choose parameter** button.
Result: A pop-up window will appear.
9. Choose the `category` parameter.
12. Click the **Choose parameter** button.
13. From the dropdown, select **Contain**.
14. In the text field, enter the name of the chosen category. In our case `smartphones`.
15. To specify the analyzed period, click on the **calendar** icon.
15. Choose the last 30 days.
16. Confirm your selection by clicking the **Apply** button.
17. Save the metric.
Metric
## Create a report
---
To create a report that presents the top 100 bestselling products from the last 30 days, follow the steps below:
1. Go to **Decision Hub > Report > New report**.
2. Enter a name of the report.
3. Select the metric you created in [the previous part](/use-cases/bestsellers-in-catalog#create-a-metric) of the process.
4. From the **Range** dropdown list, choose **100 top** to display the most frequently bought products in the report preview.
5. In the **Dimension** section, select the parameter from the **product.buy** event and as the parameter, select **$sku** to display the SKU of each product.
6. For the date range, select the time period you want to analyze. In this case, choose 30 days.