> Synerise Documentation — Use Cases (Part 2 of 3)
>
> This is part 2 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
# 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#tag/Events/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), [`brickwork.generated`](/docs/assets/events/event-reference/brickworks#brickworkgenerated) (~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)
# Free shipping promotion
Encouraging customers to increase the value of their basket is very important in commerce activities. With Synerise promotion engine you can use free shipping promotion to grant discounts only when a transaction value exceeds the minimum amount.
Free shipping promotion
## Prerequisites
---
- Implement [tracking code](/developers/web/installation-and-configuration#creating-a-tracking-code) on your website.
- POS should be integrated with Synerise promotion engine to calculate discounted values of basket items.
## Create a promotion
---
1. Go to **AI Hub > Regular Promotions > Add promotions**.
2. Select the **For selected items** option.
3. Define **Audience** (you can narrow down the promotion only to defined segments) and **Content** of the promotion (including a name, desription or image).
4. In **Type & limits** section, choose **Exact price** as discount type and set **Value** to '0'.
5. In **Items** section, select an item which indicates shipping cost.
6. Define distribution period in the **Schedule** section and publish the promotion to apply all changes and run the promotion.
Item related to shipping cost has to be sent to promotion engine along other basket items.
## 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
---
- [Promotions](/docs/ai-hub/promotions)
# 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#tag/Events/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)
# Spin the Wheel pop-up powered by a Brickworks schema
Adding interactive elements to your website is an effective way to capture attention and encourage users to engage with your brand. A gamified “Spin the Wheel” experience introduces an element of chance and reward, making promotional campaigns more engaging and memorable.
In this use case, you will create a Spin the Wheel promotional pop-up triggered by a bottom bar on the website. Instead of displaying the pop-up automatically, the interaction is initiated by the user, which makes the experience less intrusive and more intentional.
What makes this scenario different is the use of [Brickworks](/docs/assets/brickworks) to manage reward configuration. Each wheel segment is defined as a structured record containing properties such as label, color, probability, and assigned voucher pool. This approach separates presentation from data, making it easier to update rewards, adjust probabilities, and scale the campaign without modifying the main dynamic content.
As a result, you can deliver a flexible and maintainable gamified experience in which users spin the wheel to receive a discount code that can be redeemed during checkout.
Before implementing this use case in a production environment, please review local regulations related to promotional lotteries and games of chance. We recommend consulting your legal or compliance team to confirm all requirements. Any additional formalities, such as preparing terms and conditions or submitting the promotion to the relevant tax or regulatory authorities, remain the responsibility of the implementing company.
## Prerequisites
---
- Implement a [tracking code](/developers/web/installation-and-configuration) on your website.
- [Create an API Key](/docs/settings/tool/api#adding-api-keys) with basic authentication and permissions connected with the vouchers such as `VOUCHERS_ITEM_LIST_BY_POOL_READ` (used in the External Source configuration for the Brickworks schema).
- Create separate [code pools](/docs/assets/code-pools#creating-a-code-pool) for each prize on the wheel.
## Process
---
In this use case, you will go through the following steps:
- [Create a HTTPS connection](#create-a-https-connection). The external source uses this connection to get data from the the voucher API.
- [Create an external source](#create-an-external-source) that will be used by Brickworks schema to get up-to-date informations about vouchers.
- [Create a main dynamic content](#create-a-main-dynamic-content) that customer will interact with.
- For each reward [create a dedicated dynamic content](#create-a-dynamic-content-for-each-prize).
- [Create a Brickworks schema](#create-a-brickworks-schema) that defines the data structure for wheel rewards.
- [Create records](#create-records) that store individual reward definitions (text, colors, probabilities, voucher pools) and bind schema fields to actual data.
- [Adjust the snippet](#adjust-the-snippet-template) that pulls Brickworks records at render time and exposes them to the main dynamic content, where they are used by JavaScript to render the wheel and apply reward logic.
## Create a HTTPS connection
---
In this part of the process, you will create HTTPS connection with Synerise.
1. Go to **Settings > Connections > New connection**.
2. Choose **HTTPS**.
3. Choose **Login & Password**.
4. Complete the fields:
- **Connection name**
- **Login**
- **Password**
5. Click **Apply**.
Configuration of the HTTPS connection
## Create an external source
---
In this part of the process, you will create an external source that connects to API and lets you get up-to-date information about number of active and assigned vouchers per voucher pool.
Responses are cached for 60 seconds. This is a platform-level TTL you **can not** change.
1. Go to **Data Modeling Hub > External Sources > New external source**.
2. Select the method of authorization as **Login & Password**.
3. Select a connection you created in [HTTPS connection step](#create-a-https-connection).
4. From the **Method** dropdown list, select **POST**.
5. In **URL**, provide the endpoint adress: `https://api.synerise.com/v4/vouchers/item/count/{{record.voucherpoolid}}`
6. In **TTL** field enter `60`.
7. In the **Headers** section, by clicking **Add header** three times define such request headers:
- In the key field, enter **Accept** and provide the `application/json` as the value
- In the next key field, enter **Api-version** and provide the `4.4` as the value
- In the last key field, enter **content-type** and provide the `application/json` as the value
Configuration of the external source
## Create a main dynamic content
---
Create a dynamic content that will be displayed to all website visitors. You can use a [ready-made template](https://app.synerise.com/campaigns/dynamic-content/content-manager/template/281906) available on the Synerise Demo workspace.
1. Go to **Experience Hub > Dynamic Content > Create new**.
2. Enter the name of the content.
3. Choose the **Insert object** type.
### Define audience
1. To select the recipients of the dynamic content, on the **Audience tab**, click **Define**.
2. Select **Everyone**.
3. Click **Apply**.
### Define content
In the next step, you will create the dynamic content 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 **Spin the Wheel**.
3. Select the **[UC] Spin&win** template.
**Result**: You are redirected to the code editor.
4. Edit the template according to your needs.
DC template
5. After customizing your dynamic content, click **Save**.
6. Set an appropriate **CSS selector** to define the placement of the banner that releases the pop-up. The correct selector depends on your website’s structure, so make sure to reference an element that ensures the bar is displayed in the intended position.
7. Click **Apply**.
### Define schedule and display settings
As the final part of the section, 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 dynamic content will be active.
2. Click **Apply**.
3. In the **Display Settings** section, click **Define**. If you want the banner to be displayed to all users continuously across the website upon landing, keep the default settings.
4. Click **Apply**.
5. Optionally, you can define the UTM parameters and additional parameters for your dynamic content.
6. Click **Activate**.
## Create a dynamic content for each prize
---
In this part of the process, you will create dynamic content templates that will be assigned to different [voucher pools](/docs/assets/code-pools). They will be later needed in Brickworks schema. This time you will use [Jinjava insert](/developers/inserts/insert-usage#code-pools).
1. Go to **Experience Hub > Dynamic Content > Create new**.
2. Enter the name of the content.
3. Choose the **Insert object** type.
### Define audience
1. To select the recipients of the dynamic content, on the **Audience tab**, click **Define**.
2. Select **Everyone**.
3. Click **Apply**.
### Define content
In the next step, you will create the dynamic content with the [Jinjava tag for vouchers](/developers/inserts/insert-usage#code-pools).
1. In the **Content** section, click **Define**.
2. Click **Create message** and then **New template**.
3. Select the **Code editor** type.
**Result**: You are redirected to the code editor.
4. Enter this code in the **HTML** tab replacing `pool-uuid` with those from your voucher pools:
```jinjava
{% vouchervar id=pool-uuid %}
{{ voucher_result }}
{% endvouchervar %}
```
Code editor with jinjava insert
5. After customizing your dynamic content, save the changes by clicking on **Use in communication** button.
6. Set **CSS selector** to `#synSpinPromoCode` and its **location** to `Inner`. Those settings define the placement of the prize that can be claimed through modal showed after spin. The correct selector depends on your main dynamic content template’s structure, so make sure to reference an element that ensures the result is displayed in the intended position.
7. Click **Apply**.
### Define schedule and display settings
As the final part of the section, you will define the display settings of the dynamic content such as schedule, triggers, and delay.
Make sure that all dynamic content templates have the same schedule options as it is required for use case to work correctly.
1. In the **Schedule** section, click **Define** and set the time when the campaign will be active.
2. Click **Apply**.
3. In the **Display Settings** section, click **Define**. If you want the banner to be displayed to all users continuously across the website upon landing, keep the default settings.
4. Click **Apply**.
5. Optionally, you can define the UTM parameters and additional parameters for your dynamic content.
6. Click **Activate**.
Repeat [this step](#create-a-dynamic-content-for-each-prize) for each voucher pool that should be included in the wheel.
## Create a Brickworks schema
---
In this step of the process, you will create a [Brickworks](/docs/assets/brickworks) simple schema that defines the structure of the spin&win. The schema specifies the field names, types, and configuration options.
1. Go to **Data Modeling Hub > Schemas > New Schema**.
2. Choose **Simple Schema**.
3. Enter the **Display name**, for example `spin&win`.
4. In **API name** field enter `spinWin`.
5. Optionally, add a **description**.
### Add id field
1. Click **Add new field** and choose the **String** field type.
2. In the **Field basics** section, complete the fields:
- **Display name**: `id`
- **API name**: `id`
3. In the **Validation** section, enable the **Required field** checkbox.
4. In the **Advanced** section, enable the **Unique values only** checkbox.
5. Click **Apply**.
Configuration of the id field in the Brickworks schema
### Add displayColor field
1. Click **Add new field** and choose the **String** field type.
2. In the **Field basics** section, complete the fields:
- **Display name**: `displayColor`
- **API name**: `displaycolor`
3. In the **Validation** section, enable the **Required field** checkbox.
4. Click **Apply**.
Configuration of the displayColor field in the Brickworks schema
### Add displayText field
1. Click **Add new field** and choose the **String** field type.
2. In the **Field basics** section, complete the fields:
- **Display name**: `displayText`
- **API name**: `displaytext`
3. In the **Validation** section, enable the **Required field** checkbox.
4. Click **Apply**.
Configuration of the displayText field in the Brickworks schema
### Add probability field
1. Click **Add new field** and choose the **Number** field type.
2. Select **Integer**.
3. In the **Field basics** section, complete the fields:
- **Display name**: `probability`
- **API name**: `probability`
4. In the **Validation** section, enable the **Required field** checkbox.
5. Click **Apply**.
Configuration of the probability field in the Brickworks schema
### Add winChance field
1. Click **Add new field** and choose the **Number** field type.
2. Select **Integer**.
3. In the **Field basics** section, complete the fields:
- **Display name**: `winChance`
- **API name**: `winchance`
4. In the **Validation** section, enable the **Required field** checkbox.
5. Click **Apply**.
Configuration of the winChance field in the Brickworks schema
### Add resultText field
1. Click **Add new field** and choose the **String** field type.
2. In the **Field basics** section, complete the fields:
- **Display name**: `resultText`
- **API name**: `resulttext`
3. In the **Validation** section, enable the **Required field** checkbox.
4. Click **Apply**.
Configuration of the resultText field in the Brickworks schema
### Add voucherCampId field
1. Click **Add new field** and choose the **String** field type.
2. In the **Field basics** section, complete the fields:
- **Display name**: `voucherCampId`
- **API name**: `vouchercampid`
3. In the **Advanced** section, enable the **Unique values only** checkbox.
4. Click **Apply**.
Configuration of the voucherCampId field in the Brickworks schema
### Add voucherPoolId field
1. Click **Add new field** and choose the **String** field type.
2. In the **Field basics** section, complete the fields:
- **Display name**: `voucherPoolId`
- **API name**: `voucherpoolid`
3. In the **Advanced** section, enable the **Unique values only** checkbox.
4. Click **Apply**.
Configuration of the voucherPoolId field in the Brickworks schema
### Add voucherData field
1. Click **Add new field** and choose the **External Data** field type.
2. In the **Field basics** section, complete the fields:
- **Display name**: `voucherData`
- **API name**: `voucherdata`
3. In the **Configuration** section, select an [external source](#create-an-external-source) you made at the beginning of the process.
4. Click **Apply**.
Configuration of the voucherData 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 spin&win 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**.
Configuration of the Audience tab in the spin&win Brickworks schema
5. In the upper-right corner, click **Save**.
## Create records
---
In this part of the process you will define the prizes that will be displayed on the wheel.
1. Go to **Data Modeling Hub > Records**.
2. Click **Select schema** and choose Brickworks schema you created in [previous step](#create-a-brickworks-schema).
3. Click **New record**.
4. Add a name for the record, for example `reward1`.
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: `reward-1`.
6. Fill in the field values by assigning the appropriate data to each field:
- **id** → provide unique reward identifier, for exaple `reward1`.
- **displayColor** → provide hex color of the segment, for example: `#47002c`.
- **displayText** → provide text that will be displayed on the wheel segment, for example: `5% OFF`.
- **probability** → provide relative weight for segment selection, for example: `35`.
Total probability weight of all prizes **must** sum up to 100. More details on how the algorithm works are provided in the [snippet](#adjust-the-snippet-template).
- **winChance** → provide percentage chance of acually winning once the wheel land on that segment (in scale from 0 to 100), for example: `98`.
- **resultText** → provide text shown in the result modal, for example: `You won 5% off your next purchase!`.
- **voucherCampId** → provide **dynamic content ID** that assigns the voucher.
- **voucherPoolId** → provide **voucher pool's ID** inside dynamic content pointed by voucherCampId.
7. Click **Publish** to publish your record.
After publishing the record, note the **schema ID** and **record ID** from the [URL](/docs/assets/brickworks/core-concepts#record-identifiers). You will need these IDs in the [snippet template](#adjust-the-snippet-template) to reference the Brickworks data via the `{% brickworksgeneratevar %}` tag, which is later used in the main dynamic content (in its JavaScript layer) to load reward data at render time.
Repeat [this step](#create-records) for each prize that should be included in the wheel.
## Adjust the snippet template
---
To conclude this process, adjust the snippet template to your needs. This snippet pulls reward data from Brickworks at render time and is used directly in the main dynamic content, where it acts as a single source of truth for reward configuration, probability rules, and real‑time voucher availability, keeping the campaign logic centralized and easy to maintain.
1. Go to **Data Modeling Hub > Snippets**.
2. Select the **spin&win-config & analytics** snippet.
3. Go to the **Code** tab.
4. Add one block per reward, swapping `SCHEMA_ID` and `RECORD_ID` for each [Brickworkd schema record](#create-records) from its URL:
```jinjava
{% brickworksgeneratevar schemaId=SCHEMA_ID recordId=RECORD_ID %}
{% do entries.append(
"{id: \"" ~ brickworks_result.id ~ "\", displayText: \"" ~ brickworks_result.displaytext ~ "\", remaining: " ~ (brickworks_result.voucherdata.data.activeCount - brickworks_result.voucherdata.data.assignedCount) ~ ", displayColor: \"" ~ brickworks_result.displaycolor ~ "\", winChance: " ~ brickworks_result.winchance ~ ", probability: " ~ brickworks_result.probability ~ ", voucherPoolId: \"" ~ brickworks_result.vouchercampid ~ "\",timestamp: \"" ~ brickworks_result.voucherdata.data.countAt ~ "\", resultText: \"" ~ brickworks_result.resulttext ~ "\"}"
) %}
{% endbrickworksgeneratevar %}
```
5. Click **Save**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of each step directly in Synerise Demo workspace:
- [External Source](https://app.synerise.com/assets/brickworks/external-sources/29e9a4cc-ae0a-4ad5-923b-7f4dc4d9f4ed)
- [Dynamic Content- main template](https://app.synerise.com/campaigns/dynamic-content/content-manager/template/281906)
- [Dynamic Content - templates assigned to vouchers](https://app.synerise.com/campaigns/dynamic-content/content-manager/template-directories/27c4b548-8f8b-497c-984e-fdb164b5d380)
- [Brickworks schema - fields definition](https://app.synerise.com/assets/brickworks/schemas/cf9c1db3-bcf8-468a-9718-453a6b6c8873)
- [Brickworks schema - records](https://app.synerise.com/assets/brickworks/schemas/cf9c1db3-bcf8-468a-9718-453a6b6c8873/records)
- [Snippet](https://app.synerise.com/assets/snippets/ea31c15a-2be6-4a85-a66c-3b69ef3fc410)
Also, implemented use case is avalible on our [demo shop](https://demoshop.synerise.com/#spintest).
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://www.synerise.com/demo-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) (~2), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`brickwork.generated`](/docs/assets/events/event-reference/brickworks#brickworkgenerated) (~1), [`voucherCode.assigned`](/docs/assets/events/event-reference/loyalty#vouchercodeassigned) (~1).
## Read more
---
- [External Source](/docs/assets/brickworks/creating-external-source)
- [Dynamic Content](/docs/campaign/dynamiccontent)
- [Jinjava Interts](/developers/inserts)
- [Brickworks](/docs/assets/brickworks)
- [Snippets](/docs/assets/snippets)
# Calculate duration of the last session on website
You can calculate the duration of the last session of a customer on a website by creating aggregates and expressions.
## 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 aggregate](/use-cases/calculate-time-spent-on-website#create-aggregates) that return the timestamps of the session start and session end events.
2. [Create an expression](/use-cases/calculate-time-spent-on-website#create-an-expression) that deducts the time of session start from the session end.
## Create aggregates
---
As the first part of the process, create aggregates that return the timestamps of the session start and session end events.
### Session start time
In this part of the process, create an aggregate that collects session start times.
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 **Aggregate** to **Last**.
4. From the **Choose event** dropdown list, select **session.start**.
5. Click **+ where**.
6. On the modal, select **Specials**.
7. From the dropdown list, select **TIMESTAMP**.
8. In the date range, select **Lifetime**.
9. Save the aggregate.
The configuration of the start session aggregate
### Session end time
In this part of the process, create an aggregate that collects session end times with a condition that the end time is later than the start time.
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 the **Aggregate** to **Last**.
4. From the **Choose event** dropdown list, select **session.end**.
5. Click **+ where**.
6. On the modal, select **Specials**.
7. From the dropdown list, select **TIMESTAMP**.
8. Click **+ where**.
9. On the modal, select **Specials**.
10. From the dropdown list, select **TIMESTAMP**.
11. As the logical operator, select **Date**, and then select **More than**.
12. Click the icon next to the logic operator and keep clicking until you get .
13. Click **Choose values**.
14. Use the search box to find the **Session start** aggregate you created in the previous part of the process.
8. In the date range, select **Lifetime**.
9. Save the aggregate.
The configuration of the end session aggregate
## Create an expression
---
In this part of the process, create an expression that deducts the time of session start from the session end.
1. Go to **Behavioral Data Hub > Expression > 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:
Formula of the expression Formula explanation
The results of the aggregates used in the expression are converted to numbers. The time of session start is deducted from the session end and the result is divided by 1000 to show the session length in seconds.
5. Save the expression.
## What's next
---
You can preview the results of the expression for individual customers in two ways:
- **Customer's profile**
In a profile of a customer, if you enabled the **Show in Profiles** option in the expression.
Expression on a profile of a customer
- **Analytical dashboard**
By creating an analytical dashboard and adding this expression to the dashboard.
Expression used in the dashboard
## Check the use case set up on the Synerise Demo workspace
---
Check the [session start aggregate](https://app.synerise.com/analytics/aggregates/7e15f3ba-49e7-37ac-bd63-b7702e18e301) and [session end aggregate](https://app.synerise.com/analytics/aggregates/af9bb0f4-96fb-3fa1-a4fc-4fa82f533052) configuration in Synerise Demo workspace.
You can check also the configuration of the [expression](https://app.synerise.com/analytics/expressions/5f0a9b76-000c-4368-858d-253ea23a08d8).
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)
# 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/authorization#tag/Authorization/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#tag/Analytics:-Segmentations/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)
# Show Customer’s Recent Searches Before Typing in AI Search
An AI-powered Search is a great tool that can help you to create greater customer satisfaction resulting in higher conversions. To ensure a seamless customer search experience, you must anticipate their expectations and needs.
One of the ways to do so is possible by displaying customers’ recent searches just before they start typing their queries. This way, you deliver personalized search results, which allow you to pursue the shopping path of customers and allow them to return in an easy way to the items which they were interested in earlier.
This use case describes the process of creating an AI search extension that will display customers’ recent searches before they start typing.
## Prerequisites
---
- [Implement AI search](https://hub.synerise.com/api-reference/ai-search) in any of your channels (mobile app, website, and so on).
## Create an aggregate
---
Create an aggregate based on `item.search` event which is collected on the customer's profile when they search for the certain phrase.
`item.search` is an event that our system generates automatically when a customer searches for a phrase, if our AI search is implemented somewhere in any of your channels. It contains `query` parameter which stores the phrase entered by the customer.
This aggregate returns last 5 searches for every customer from last 30 days.
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 as a size set `5`.
4. Select the `item.search` event.
5. As the event parameter, select `query`.
6. Set the period from which the aggregate will analyze the event to **last 30 days**.
7. Save the aggregate.
Configuration of the aggregate
## What's next
---
Once the aggregate is configured, it needs to be implemented as an element of your search engine. You can use [dynamic content](/docs/campaign/dynamiccontent/creating-dynamic-content) to display phrase suggestions automatically when the customer clicks on the search input and [Jinjava code](/developers/inserts/insert-usage#aggregates) to insert aggregate result as the dynamic list of phrases the customer searched for recently, updated in realtime.
If you decide to use Dynamic Content, you need to implement [Synerise tracking code](/developers/web/installation-and-configuration#creating-a-tracking-code) on your website.
If you want to implement the recent searches list via API, you can use our dedicated [API method](https://hub.synerise.com/api-reference/ai-search#tag/Search/operation/GetRecentSearches) to retreive customer's recently searched phrases instead of [creating an aggregate](/use-cases/recent-customer-search#create-an-aggregate).
## Check the use case set up on the Synerise Demo workspace
---
Check the [aggregate](https://app.synerise.com/analytics/aggregates/1494a1c5-19b0-348d-8015-39745db35027) 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 generates approximately 2 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).
## Read more
---
- [AI Search](/docs/ai-hub/ai-search)
- [AI Search statistics](/docs/ai-hub/ai-search/ai-search-statistics)
# 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)
# Export Customer Segmentation Data to Azure Blob Storage
Synerise allows you to collect data from any touchpoint with a customer. With advanced Synerise Analytics, you can create precise customer segments that you can use not only in Synerise, but also pass them to external tools. Using Synerise's seamless integration with Azure Blob Storage, you can transfer any data collected in Synerise and use it in other Microsoft tools.
In this use case, we will export a database of customers at risk of churn to Azure Blob Storage. To create a segmentation of customers at risk of churn, we will use the RFM analysis results from [this use case](/use-cases/rfm-analysis). This is just an example. You can export any other data types according to your needs, such as transactions, event data, metrics results, aggregates, expressions, reports, and much more.
## Prerequisites
---
- You must have an account on Azure AD.
- Create an RFM analysis thanks to which you will be able to define the segmentation of customers at risk of churn. You'll find a detailed process for creating the RFM analysis in [this use case](/use-cases/rfm-analysis).
The churn risk segmentation shown in this use case is just an example. You can create any other segmentation using your own rules according to your specific assumptions and business needs.
## Process
---
In this use case, you will go through the following steps:
- [Create a segmentation of customers](/use-cases/send-profiles-to-azure-blob-storage#create-a-segmentation-of-customers-at-risk-of-churn) at risk of churn.
- Create a workflow that sends selected customer profiles to Azure Blob Storage.
## Create a segmentation of customers at risk of churn
---
In this part of the process, create a segmentation of customers at risk of churn based on the RFM segmentation you created earlier.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segment.
3. Choose **Add condition** and find the RFM segmentation you created earlier.
4. Select the **Equal** operator and in the right field enter the name of the sub-segment that defines the customers at risk of churn. In this use case, it's `Churn risk`
5. Save the segment.
Segmentation settings
## Prepare a workflow
---
As the final part of the process, create a workflow which sends the customers' data to Azure Blob Storage every day.
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 (for example, every day at 6.00 A.M.).
The workflow will automatically launch at the scheduled time.
4. Confirm by clicking **Apply**.
The configuration of the Scheduled Run node
### Select customers to export
5. Add a **Get Profiles** node.
6. In the configuration of the node:
1. Select the segmentation you [created in the first part of the process](/use-cases/send-profiles-to-azure-blob-storage#create-a-segmentation-of-customers-at-risk-of-churn).
2. In the **Attributes** section, select the profile attributes which you want to export.
In the example, `email` and `newsletter_agreement` are selected.
3. Confirm by clicking **Apply**.
The configuration of the Get Profiles node
### Configure Send file to Azure Blob Storage node
1. Click **Azure Blob Storage > Send 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/azure-blob-storage/send-file-azure-blob-storage#create-a-connection).
- If you selected an existing connection, proceed with the integration settings.
1. In the **Container** field, enter the name of an existing container in your storage.
If this field is already filled out, it means that the URL used in the [connection](/docs/automation/integration/azure-blob-storage/send-file-azure-blob-storage#create-a-connection) settings contains the name of the container.
2. In the **Blob name** field, enter the name of the blob (file) you want to send to the storage.
If this field is already filled out, it means that the URL used in the [connection](/docs/automation/integration/azure-blob-storage/send-file-azure-blob-storage#create-a-connection) settings contains the name of the blob. In such case, the contents of the blob will be overwritten.
5. From the **File format** dropdown list, select the format in which the file will be sent to the storage.
6. Confirm by clicking **Apply**.
The configuration of the Send File node
### 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 each item created in this use case on our Synerise Demo workspace:
- [Segmentation](https://app.synerise.com/analytics-v2/segmentations/d0dc46f2-ac98-4264-a5ed-4627d85117ae)
- [Workflow](https://app.synerise.com/automations/automation-diagram/997d7492-37ea-4fcc-922b-57bf850f79ae)
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) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1).
## Read more
---
- [RFM analysis](/use-cases/rfm-analysis)
- [Send File](/docs/automation/integration/azure-blob-storage/send-file-azure-blob-storage)
- [Segmentations](/docs/analytics/segmentations)
- [Workflows](/docs/automation)
# Import customers to Synerise by file upload
Importing your customer database to Synerise is a great way to get started with your email marketing efforts, as it will allow you to immediately start building relationships with your customers.
In this use case, we will focus on how to use Automation Hub to easily import a ready-to-use data base from a CSV file without any transformation.
## Prerequisites
---
- Create a CSV file with your customer database. You can add a few basic columns: `firstName,lastName,email`. Prepare your file based on [this document](/docs/automation/actions/synerise-integrations/import-customers). You can also find the general requirements for the `.CSV` file format [here](/docs/assets/catalogs/creating-catalogs#requirements).
**Example CSV file might look like this:**
```csv
firstName,lastName,email,
Dwight,Addams,dwight.addams@test.com,
Martin,Smith,martin.smith@test.com,
Kurt,Doe,kurt.doe@test.com,
John,Smith,john.smith@website.com,
```
If you decide to import without a transformation diagram (without data transformation), it is very important to name the columns in the file appropriately, because they will later be connected with client's attributes. The column names should correspond with the API fields [described here](https://hub.synerise.com/api-reference/data-management#tag/Profile-management/operation/BatchAddOrUpdateClients). Any additional column outside this list in the API documentation will be treated as a custom client attribute.
If you are importing a newsletter database, apart from the email attribute, we suggest that you should also add columns with a marketing agreement called `agreements.email` with a value `1` or `0`.
## Prepare a workflow
---
The scenario for this use case involves a one-time import of `.csv` file with a customer database directly 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. Select the **Run once** option.
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 Import Profiles node
1. Choose **Synerise** node.
1. On the **Local File** node, click **THEN**.
2. From the list that opens, select **Synerise > Import Profiles**.
3. Optionally, in **Advanced settings**, you can change the [import mode](/docs/assets/imports/importing-clients#import-modes).
### Add the finishing node
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
Imported profile
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
**Result:** New imported profiles can be visible in **Behavioral Data Hub > Profiles**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [workflow configuration](https://app.synerise.com/automations/automation-diagram/9c4e1942-6751-45b7-b783-ee1389f59ab2) 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), [`client.add`](/docs/assets/events/event-reference/profiles#clientadd) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Behavioral Data Hub](/docs/crm)
# 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)
# Display Discount Information in Mobile App Using Screen View Campaign
Synerise [documents](/docs/assets/documents) are objects that allow users to build mobile applications or create single elements to display in the applications for example a simple information about ongoing discount season. A [screen view](/docs/campaign/screen-views) lets you display the content of documents in a mobile application. This way, you can create and deliver the content dedicated to defined customer groups and also group the documents and use those group in the further communication.
In this use case, you will display an image that contains information about discounts available for all customers. The image will be included in the body of a document, and the whole document will be published by means of a screen view.
## Prerequisites
---
- [Implement Synerise SDK in your mobile app](/developers/mobile-sdk).
- Upload an image with the information about discounts, you can do it in **Data Modeling Hub > Files**
- [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 a document](/use-cases/documents-promotion#create-a-document) with basic promotion targeted to everyone.
2. [Create a screen view](/use-cases/documents-promotion#create-a-screen-view) based on the document with the general promotion and target it to everyone.
## Create a document
---
As the first part of the process, create a document with general promotion targeted to the whole database.
1. Go to **Data Modeling Hub > Documents > Add document**.
2. Enter the name for your document.
2. In the **Audience** section, choose to whom the message 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. Optionally you can choose the **Group** to which you add your document. In this case we focus on single promotion.
4. 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).
5. 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:
Document configuration
7. Optionally, to check the preview of the document for the specific customer, use **Preview body**.
8. To save your changes, click **Apply**.
1. In the **Schedule** section, define the time when the document will be active.
- To activate a document immediately, choose **Run immediately** your campaign will be launched immediately after activation.
- To schedule the activation of the document at a specific date, select the **Scheduled** option and define the time range.
2. Click **Apply** to save your changes.
3. To activate immediately or at a scheduled date, click the **Activate** button.
Document configuration
## Create a screen view
---
In this part of the process, create screen views for the document created in the previous step.
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. Select the document you created in the [previous step](#create-a-document) by clicking the **Specified documents**.
4. From the dropdown list, select the document.
The configuration of the screen view
5. Confirm your choice by clicking **Add**.
4. Click **Apply** to save your changes.
6. Go to the **Schedule** section and click the **Change** button.
7. Set up when campaign will be active using option **Run immediately** or set up a specific time range using option **Scheduled**.
4. To save your changes, click **Apply**.
5. To run your screen views 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)
## Check the use case set up on the Synerise Demo workspace
---
In the Synerise Demo workspace, you can check:
- [Document](https://app.synerise.com/assets/documents/3e03fc3a-5875-4273-b552-407a6d653de7)
- [Screen view](https://app.synerise.com/campaigns/screen-views/screen-view/f4283005-966e-4510-82f0-1eab94db6652)
- [Workflow](https://app.synerise.com/automations/automation-diagram/48972f25-04ff-43c3-a06f-1e34c7089e06)
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
---
- [Documents](/docs/assets/documents)
- [Screen views](/docs/campaign/screen-views)
# Coupon for membership anniversary
The main reason why it is worth having a **loyalty program** is to retain customers by rewarding them for their repeat purchase behavior. Also, customers appreciate such programs because they can get access to rewards and special offers.
Setting up loyalty programs can help improve your brand recognition, increase growth and improve customer service.
It is also worth remembering special days for your club members, not only their birthday, but also **membership anniversary**, which can be a great opportunity to send them special rewards like coupons.
## Example of use - Retail industry
---
A customer from the footwear industry has had a customer club for several years and makes special offers and promotions available to members. They decided to show their appreciation for such clients by sending them an email on the anniversary of joining the club. Each email contained an individual rebate code.
Anniversary coupon
## Prerequisites
---
To implement this use case, you have to:
- [Configure your email account](/docs/campaign/e-mail/configuring-email-account).
- Import customer base with `email addres`. and `registration date`.
- Implement [tracking code](/docs/settings/tool/tracking_codes).
## Process
---
Prepare use case that will consist of 4 steps:
1. [Prepare a coupon pool](/use-cases/coupon_for_anniversary#prepare-a-coupon-pool).
2. [Prepare an email template](/use-cases/coupon_for_anniversary#prepare-an-email-template).
3. [Prepare workflow](/use-cases/coupon_for_anniversary#prepare-workflow).
## Prepare a coupon pool
---
In [this](/docs/assets/code-pools) article, you will find the rules and procedures needed to create and use voucher pool in Synerise.
On user registration anniversaries, it’s good to send each of them individual coupon codes with a discount. To do it you will have to import to Synerise coupons previously prepared in your ecommerce platform, which will apply the appropriate discount in the shopping cart.
1. To import such coupons, go to **Data Modeling Hub > Voucher Pools** and prepare a **Voucher pool**, to which you will add your coupons.
2. Add an obligatory **Pool name**, and set the Emission start and end dates.
3. When the pool is created, click **Import** and choose **CSV with vouchers**.
Prepare coupon pool
Remember that your csv should have only 1 column, without a name.
## Prepare an email template
---
To distribute coupon codes in an email, prepare a template - design banners, copy and add the ID of the coupon pool.
1. Go to **Experience Hub > Emails > Templates > Drag&drop builder** or **Code editor** to create an email template..
2. Click **Inserts** in the upper right corner, find **Pools** on the list of inserts, then choose the **Coupon pool** prepared in the previous step.
3. Copy and paste the Jinjava code of the pool in the place where the coupon code should be shown to the user. Instead of `{% voucher %}` voucher-hash `{% endvoucher %}`, a user will see a unique coupon code.
Prepare an email template
If your codes have the appropriate format, you can insert them as barcodes, details [here]( /docs/assets/code-pools/).
## Prepare workflow
---
To start sending your prepared email template you have to create a workflow, which in basic configuration may look like the one below. To do this, go to **Automation Hub > Workflow > New workflow**.
### Add the Audience as attribute
To start the journey for every user who has a anniversary on a given date, select the **Audience** node.
Add the trigger
1. Set the **Run trigger** to repeatable.
2. Select 1-day interval.
3. Select the **New audience** tab.
4. Click **Define conditions**.
5. Define three conditions, every has a registration date, the first one matches the current day, the second matches the current month, and the third one doesn't match the current year:
Prepare anniversary attribute
### Set up the anniversary email
When you finish setting up the anniversary attribute, you can set the **Send Email** node by selecting the appropriate email account, choosing the template that you prepared previously and adding the email subject and UTMs.
Email datail
### Prepare the final settings
1. **Add End nodes** where the workflow should finish for users.
2. 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**.
Prepare workflow
## Check the workflow set up on the Synerise Demo workspace
---
You can check the [workflow](https://app.synerise.com/automations/automation-diagram/8d237fd3-5772-414d-a738-199b7fcc7dff) 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:
[`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), [`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
---
- [Creating code pools](/docs/assets/code-pools)
- [Email templates](/docs/campaign/e-mail)
- [Import clients](/docs/automation/actions/synerise-integrations/import-customers#example-of-use)
- [Workflow](/docs/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)
# 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#tag/Events/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#tag/Events/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)
# 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)
# Recommendations with items in customer's favorite color
Color is one of those features that significantly affects the purchase decisions in the fashion industry, but should not limit the choice.
You can recommend items which are similar to the currently viewed by a customer, but you can add a little twist to that by elastically filtering the items in the recommendation based on the favorite color of your customer. For further details read the instruction in this use case.
## Prerequisites
---
- Enable the [similar recommendation model](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations).
- Supplement customer profiles with the favorite color 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 **Similar**.
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 `2`.
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 **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 item color attribute.
8. Click **Operator**.
9. From the dropdown menu, 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 favorite color.
The final configuration of the filters
11. At the bottom of the elastic filter pop-up, click **Apply**.
12. In the **Items** section, click **Apply**.
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**.
## 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)
- [Filters in recommendations](/docs/ai-hub/recommendations-v2/recommendation-filters)
- [Requirements for item feed](/docs/ai-hub/recommendations-v2/item-feed-requirements)
# First run in-app message
First-run in-app messages play a pivotal role in establishing a meaningful connection with customers from the outset of their interaction with a digital product or service. First-run in-app messages serve as a direct communication channel between the product and its users, allowing for personalized engagement. By conveying a brand's personality and values, these messages can create an immediate sense of connection, fostering a positive relationship between the user and the product.
Welcome messages can be considered as one of the examples of this kind of messages. A "Warm Welcome" message serves as the virtual handshake of the digital realm, extending a friendly greeting to users as they embark on their journey with a new app. This type of in-app message is crucial for setting the tone and establishing a positive initial interaction.
In this use case, we will create the first run in-app message that will be displayed to users who are logging into the mobile app for the first time. We will be using predefined in-app template. Created message will not only greet users warmly but also offer a unique voucher code, adding an extra touch to enhance their first purchase 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 first visit in the mobile application. In this use case, we use `app.firstVisit` event.
- Create [voucher pool](/docs/assets/code-pools) for users who are logging to the mobile application for the first time.
## 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, this segment 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 segment 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/fb5932ab-ae00-4302-948f-39c3aa72b542 the ID is `fb5932ab-ae00-4302-948f-39c3aa72b542`.
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 **Fullscreen** 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. In this use case, we will make changes to the graphic, header, description, and call to action button. We will also use inserts to personalize the displayed message.
1. In the **Background** section, adjust the background color and background image if needed.
2. In the **Image** section, leave the default image URL or change it to an image customized for your message (add the image to **Data Modeling Hub > Files** and then you can find there the URL to this image).
3. In the **Header** section, customize the header text, font size and color to your specifications.
Example of header used in this use case:
`Welcome {% customer firstname %}!`
4. In the **Description** section, customize the description text, font size and color to your specifications.
Example of the description used in this use case:
`To kick off your journey, here's an exclusive voucher code just for you: {% voucher assign=false %} fca2d8c1-afb0-4bb3-9198-4ac7d00c4233{% endvoucher %} Use this code at checkout for a special 20% discount on your first purchase! Ready to dive in? Explore our app now and redeem your voucher code.`
Where
is an insert that assigns a code from a pool to a customer (unless one is already assigned) and [retrieves that same code for this customer every time](/developers/inserts/insert-usage#retrieving-the-same-code-every-time). The value `pool-uuid` must be replaced with the ID of your voucher pool.
5. In the **CTA button** section, customize the button text, corner radius, color, background color, and URL to which a user is redirected according to your needs.
6. In the **Close button** section, select the position of the closing cross.
7. In the **Automatically Disappear** section, you can enable the **Automatically Disappear** switch and define a timeout for this in-app message in seconds, or leave this switch disabled by default.
8. You can also enable **Use deep links** option if you are using deep links as CTA links.
9. When the template is ready, in the upper right corner click **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 **Save**.
11. To continue the process of configuring the in-app campaign, click **Next**.
12. To save your content changes, click **Apply**.
In the screens below you can see a preview of the final in-app message configuration with and without contextual preview.
In-app preview without user contextIn-app preview with user context
### 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 **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**.
3. Define the **Delay display**, **Priority index**, **Frequency limit** and/or **Capping limit**.
In our case, we want to display the message once per user. To do this, we set the limit for displaying this in-app message to once per user.
4. Click **Apply**.
5. Optionally, you can define the UTM parameters and additional parameters for your in-app campaign.
6. Click **Activate**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [Voucher pool](https://app.synerise.com/assets/vouchers/pools/fca2d8c1-afb0-4bb3-9198-4ac7d00c4233/coupons) and [In-app message](https://app.synerise.com/communications/in-app/fb5932ab-ae00-4302-948f-39c3aa72b542) 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), [`voucherCode.assigned`](/docs/assets/events/event-reference/loyalty#vouchercodeassigned) (~1).
## Read more
---
- [In-app messages](/docs/campaign/in-app-messages)
- [Jinjava inserts](/developers/inserts)
- [Mobile campaigns](/docs/campaign/Mobile)
- [Using in-app template builder](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template)
# Extra loyalty points for buying a product from a specific brand
Loyalty programs have emerged as a crucial factor in determining the success and performance of companies across various industries. These programs provide a means for businesses to establish and nurture stronger connections and relationships with customers. By offering incentives and rewards to loyal customers, companies can effectively encourage repeat purchases and foster a sense of loyalty and affinity towards their brand.
This use case demonstrates a specific loyalty activity in which customers receive 100 loyalty points for each product bought from specific brand within a certain time period. This strategy effectively stimulates sales of the brand's products while fostering customer loyalty by encouraging additional purchases and the accumulation of loyalty points.
## Prerequisites
---
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CreateATransaction).
- Implement basic [loyalty program](/use-cases/loyalty-programs-basics) based on which you granted customers with 1 point for every 1 PLN spent.
## 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 awards 100 loyalty points for each product bought from a specific brand.
### Define the Profile Event trigger node
Configure the conditions that launch the workflow. As a trigger, we will use the `product.buy` event.
1. As the first node of the workflow, add **Profile Event**.
2. From **Choose event** dropdown menu, choose the `product.buy` event.
3. Click the **+ where** button and from the dropdown list, choose **brand**.
4. From the **Choose operator** dropdown, select **Equal**.
5. In the text field, type the name of the brand. In our case it will be `XYZ`.
6. Click the **+ where** button and from the dropdown list, choose **TIMESTAMP**.
7. From the **Choose operator** dropdown, choose **Custom (Date)**.
8. Click **Select date range**.
9. Set the time range in which your promotion is active. In this use case, it will be one week.
6. Confirm by clicking **Apply**.
Profile Event trigger node
### Configure the Generate Event node
In this part of the process, you will create a node which generates a `points.loyalty` event which adds extra loyalty points. This event is created in addition to the regular `points.loyalty` event. In result, the customer receives points for a purchase from specified brand twice:
- Points based on the [loyalty points schema](/use-cases/loyalty-programs-basics#prepare-the-points-schema) described as a part of prerequisites.
- Extra points through this workflow.
The body of the additional event will contain the `points` parameter calculated by multiplying the `$quantity` parameter from the `product.buy` event by the constant value of `100`.
1. As the second node of the workflow, add **Generate Event**.
2. In the **Event name** field, enter `points.loyalty`.
4. In the **Body** section, define the parameters of this event, and click **Apply**.
**Example content of **Body** section:**
The event body is an example. You can add more parameters or change the point calculation, perform any mathematical formula according to your business needs.
Generate Event node configuration
### Add the End node
1. On the **Generate Event** node, click the plus icon.
2. From the dropdown list, select **End**.
3. In the upper right corner, click **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 the [workflow](https://app.synerise.com/automations/automation-diagram/edbdd32f-34d7-4b1d-a7ba-8c0890ce687f) 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.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) (~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)
- [Jinjava inserts](/developers/inserts)
- [Loyalty programs basics](/use-cases/loyalty-programs-basics)
# Bestselling product recommendations
The psychological mechanism of social proof makes the choices of other people influence the decisions of an individual. It encourages customers to browse (and often buy) products that are popular. This use case describes implementation of bestselling products in the last 30 days.
## Prerequisites
---
- Implement a [tracking code](/developers/web/installation-and-configuration) into your website.
- [Track the transactions](/developers/web/transactions-sdk).
- Implement [OG tags](/developers/web/og-tags). Required tags:
- `product:retailer_part_no` which is the same as `` in the product feed,
- `og:category` which is the same as `` in the product feed.
- [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.
- Import at least a one week history of page.visit events or transactions. More instructions [here](/docs/automation/actions/synerise-integrations/import-events).
## Process
---
In this use case, you will go through the following steps:
1. [Preparing 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 **Top products** recommendation type.
Selected type and product feed of the recommendation
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 the **Static filters**, select the **availability** parameter and set it to **true**, 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**.
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. From the dropdown list, select **Sold items count in the last 30 days**.
11. Confirm the configuration by clicking **Apply**.
12. Optionally, define the boosting factors in the **Boosting** section, and settings in **Additional settings**.
12. Click **Save**.
## Create dynamic content
---
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#tag/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. 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**, define the circumstances for displaying the content.
Instructions how to do it are available [here](/docs/campaign/dynamiccontent/creating-dynamic-content/creating-dynamic-content).
6. Confirm by clicking **Apply**.
7. In the **UTM & URL parameters** section, click **Skip step**.
8. Activate the dynamic content.
**Result**: The recommendation frames are displayed on the website.
## What's next
---
You can also [show recommendations in emails](/use-cases/email-with-top-products) by inserting Jinjava code with AI recommendations in an email template.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [recommendations settings](https://app.synerise.com/ai-v2/recommendations/4KW2iNyhE5nY) and [dynamic content campaign](https://app.synerise.com/campaigns/create/37c5fadb-8628-47a4-ad8c-61a5e2b4a46b)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:
[`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/recommendation-statistics)
- [Top products](/docs/ai-hub/recommendations-v2/recommendation-types)
- [Using recommendations in dynamic content](/developers/inserts/recommendations-v2)
# Recommendations on an empty basket
Not every customer on your website converts. Some of them leave their basket empty after deleting products from it. You should remember to use every valuable place on your website to encourage customers to make a purchase and an empty basket is one of them. A empty shopping cart page is definitely a place with sales potential that usually remains unused.
**Why do customers leave behind an empty basket?**
- They added something to their shopping cart during a previous visit and they want to check it, but its content has already expired.
- They checked the contents of their basket, after which they decided to remove all products from it.
- They do not know what the online shopping process looks like or they just have clicked it by accident.
In all of these cases you can optimize the empty shopping cart page and help the customer find the products they need thanks to personalized recommendations.
Our algorithms implemented in the basket could help them make a choice and make a purchase. Recommendations that present personalized products based on previous purchases or recently viewed items can be more effective than simply leaving the space empty.
In this use case, we will present product recommendations on an empty basket page. There we will display a personalized offer where customers can find products selected for them. Those products are selected based on each customer’s behavioral history.
## Prerequisites
---
- [Implement a tracking code](/docs/settings/tool/tracking_codes).
- [Import product feed to Synerise](/developers/product-feed).
- [Track transaction events](/developers/web/event-tracking).
- Implement [OG Tags](/developers/web/og-tags) on 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 personalized recommendations.
## Process
---
In this use case, you will go through the following steps:
1. [Create AI recommendations](/use-cases/empty-basket#create-ai-recommendations) with personalized products.
2. [Create a dynamic content](/use-cases/empty-basket#create-a-dynamic-content) on the empty basket page.
## Create AI recommendations
---
In this part of the process, you will configure a personalized recommendation which will be later used in the dynamic content campaign.
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 **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 user 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). In our case, in the static filters, select availability equals true to show only available products
Filters
4. Confirm by clicking **Apply**.
8. Optionally, you can define the **Boosting** factors and settings in the **Additional settings** section.
9. In the right upper corner, click **Save**.
## Create a dynamic content
---
Create a dynamic content campaign, which will be displayed on an empty basket page.
1. Go to **Experience Hub > Dynamic content > Create new**.
2. Enter the name of the dynamic content.
1. Choose the **Insert Object** type.
2. As the audience, select **everyone**.
3. In the **Content** section, select **Simple message**, and set the CSS to **after** and add the value `.cart-empty`.
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.
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:
- Set **Triggers** 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 basket.
- 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 empty basket.
## 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/CjmCJ4X4RfRL),
- [Dynamic content campaign](https://app.synerise.com/campaigns/create/1595de2d-86b9-44be-b435-154908667c8a),
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
---
- [API Recommendations](https://hub.synerise.com/api-reference/ai-recommendations#tag/Recommendations)
- [Dynamic content campaigns](/docs/campaign/dynamiccontent)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Offer free shipping on bulky items based on purchase risk and basket margin
Bulky products, such as bicycles, fitness equipment, furniture, and appliances, can carry a separate delivery charge. Offer free shipping to selected customers when the basket margin can cover the delivery cost.
This scenario uses churn and category purchase propensity to select an audience for a free shipping offer. Jinjava calculates basket eligibility at render time, using the latest `cart.status` and product attributes from the feed.
The example uses a sporting goods retailer selling bicycles and bulky fitness equipment. An optional Lookalikes prediction extends the audience to profiles similar to previous buyers. You can also run an A/B test to assess the offer's effect on conversion and profitability.
## Prerequisites
---
- Implement website tracking and transaction tracking, including `product.buy` and `transaction.charge`. Installing the tracking code alone does not describe the transaction integration. See the prerequisites in [Send propensity-based customers to Facebook](/use-cases/send-propensity-to-facebook).
- Configure an item feed for Predictions. Include category data and make the category attribute filterable. Keep product identifiers consistent between the feed, purchase events, and basket events. See [Creating propensity predictions](/docs/ai-hub/predictions/propensity).
- Enable Classification and Propensity. Enable Lookalikes if you want to extend the audience. Check data requirements before calculating models; enabling a model does not ensure that every profile has enough data for a score. See [Introduction to Predictions](/docs/ai-hub/predictions/predictions-introduction) and [Enabling predictions](/docs/ai-hub/predictions/enabling-predictions).
- Send the complete `cart.status` after every basket change and send an empty basket after checkout. See [Tracking cart status](/developers/web/cart).
- Include price, margin, and the attributes that identify qualifying bulky products in the product feed. Define whether margin is a rate or an amount per unit. Use current quantities from `cart.status` and define delivery cost and customer delivery charge from your event data, feed, or delivery rules. The example uses fixed illustrative values. Use one currency and a consistent tax basis.
- Create a voucher pool with codes recognized by the store. Implement usage restrictions and redemption in the store, including what happens when a code has expired or has already been used. See [Voucher pools](/docs/assets/code-pools).
- Make the latest basket event available before rendering the offer. After a relevant basket change, update `cart.status` and render the offer again so Jinjava recalculates eligibility.
This scenario assumes that the events and product feed contain all data required for the calculation. Jinjava performs the calculation when the content is rendered. The Jinjava example below illustrates the calculation; adapt its fields, margin units, and delivery assumptions to your setup.
## Process
---
In this use case, you will go through the following steps:
1. [Define the scenario settings](#define-the-scenario-settings).
2. [Create the churn target and prediction](#create-the-churn-target-and-prediction).
3. [Create a propensity prediction for bulky categories](#create-a-propensity-prediction-for-bulky-categories).
4. [Use the latest prediction results to build the campaign audience](#use-the-latest-scores-to-build-the-campaign-audience).
5. [Optionally, extend the audience with Lookalikes](#optionally-extend-the-audience-with-lookalikes).
6. [Calculate basket eligibility in Jinjava](#calculate-basket-eligibility-in-jinjava).
7. [Display the free shipping code on the basket](#display-the-free-shipping-code-on-the-basket).
8. [Verify the scenario before activation](#verify-the-scenario).
## Define the scenario settings
---
Record these values before building the campaign. The time ranges below are examples. Adjust them to your customers' purchase patterns.
| Setting | Example or decision required |
| --- | --- |
| Bulky categories | Bicycles and the retailer's selected bulky fitness categories |
| Churn definition | A previous buyer with no transaction in the last 60 days |
| Churn forecast horizon | Select explicitly to match the retention question; this is separate from the 60-day inactivity definition |
| Churn recalculation | Every 7 days |
| Propensity audience | At least 3 sessions and no bulky-category purchase in the last 3 months |
| Propensity and optional lookalike recalculation | Every 10 days |
| Maximum score age | Set for each model, allowing for calculation time; exclude results older than this limit |
| Contribution buffer | The minimum amount that must remain after delivery; include other variable costs in the rule if your business requires it |
Choose the churn definition from actual purchase patterns. A 60-day gap can be normal for durable goods. One historical transaction establishes that a person is a previous buyer; it does not establish loyalty.
## Create the churn target and prediction
---
### Create the segmentations
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Name it `Previous buyers`.
3. Add a condition for a performed `transaction.charge` event and set its time range to **Lifetime**.
4. Save the segmentation.
5. Create another segmentation named `Previous buyers inactive for 60 days`.
6. Require membership in `Previous buyers`.
7. Add an **AND** condition: no `transaction.charge` in the **Last 60 days**.
8. Save it.
The second segmentation defines the state to predict. It is not itself a prediction. This follows the segmentation-to-expression pattern from [Predict churn](/use-cases/churn-prediction), with a different inactivity definition.
### Create the target expression
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Name it `Churn signal target`.
3. Select **Attribute** in **Expressions for**.
4. Select **Function > If**.
5. Use **Previous buyers inactive for 60 days** as the condition, `1` as the true result, and `0` as the false result.
6. Save the expression.
### Configure Classification
1. Go to **AI Hub > (AI Predictions) Models > New prediction**.
2. Select **Create from scratch > Classification** and name the model `Churn risk - previous buyers`.
3. Select **Previous buyers** as the audience and **Churn signal target** as the target expression.
4. Review the input events. Keep automatic selection unless the data requires a deliberate change.
5. In **Model configuration**, set the recalculation interval and explicitly select the forecast horizon.
6. Enable **Set up recurring prediction calculation** and select the **5-point scale**.
7. If configuring the event's score name, use `previous_buyers_churn`.
8. Apply the settings and select **Save & Calculate**.
Results use `snr.prediction.score`. Record the model ID for later filtering. Follow [Creating classification and regression predictions](/docs/ai-hub/predictions/custom) for the full configuration.
## Create a propensity prediction for bulky categories
---
The audience below captures repeat site visitors who have not recently bought from the selected categories. It does not establish that they are hesitant or that delivery is their barrier.
### Prepare the audience
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. Select **Profile**.
3. Name the aggregate `Sessions in the last 3 months`.
4. Select **Count**.
5. Select the `session.start` event, which is generated when a visitor starts a session.
6. Set the period to **Last 3 months**.
7. Save the aggregate.
8. Create a segmentation named `Repeat visitors without a recent bulky purchase`.
9. Require the session aggregate to be greater than or equal to `3`.
10. Add an **AND** condition: no `product.buy` matching the selected bulky categories in the **Last 3 months**. Match the category filter to the actual event values. Use the same category set in the prediction and basket eligibility rules.
11. Save the segmentation.
### Configure Propensity
1. Create a prediction using **Create from scratch > Propensity**.
2. Name it `Propensity to buy bulky items` and select the segmentation `Repeat visitors without a recent bulky purchase` as its audience.
3. In **Item feed**, select the configured feed and define an item filter for the bulky categories.
4. Review the matching items before saving the filter.
5. Enable recurring calculation, using the chosen interval, and keep the **5-point scale**.
6. Select **Save & Calculate** and record the model ID.
The output event is `snr.propensity.score`. A low result means a low predicted propensity to buy the selected products. See [Creating propensity predictions](/docs/ai-hub/predictions/propensity) and the comparable [attribute-based propensity use case](/use-cases/propensity-attribute).
## Use the latest scores to build the campaign audience
---
Use the most recent result for each model. A condition that matches any historical high or low score can retain a customer after their score changes.
### Create score aggregates
Create one aggregate for each prediction:
| Aggregate name | Event | Parameter | Event filter |
| --- | --- | --- | --- |
| `Latest churn label` | `snr.prediction.score` | `score_label` | `modelId` equals the churn model ID |
| `Latest bulky propensity label` | `snr.propensity.score` | `score_label` | `modelId` equals the propensity model ID |
For each aggregate:
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. Select **Profile** and the **Last** analysis.
3. Select the event, parameter, and event filter from the table.
4. Limit the relative period to the maximum score age defined for that model.
5. Save the aggregate.
Filter the aggregate by `modelId`, not by the desired label. Filtering for `high` before taking **Last** would return the latest high result, even if a newer low result exists.
The [SMS cost use case](/use-cases/decrease-sms-campaign-cost) shows the latest-score aggregate pattern. Use the event names above, which follow the model documentation.
### Create the audience segmentation
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Name it `Free shipping - risk audience`.
3. Add a condition: `Latest churn label` is `high` or `very high`.
4. Add an **OR** condition: `Latest bulky propensity label` is `very low`, `low`, or `medium`.
5. Save the segmentation.
Treat missing or expired results as no match for that condition. The other condition can still qualify the profile. Check the exact event values during verification; the documented five-point labels are `very low`, `low`, `medium`, `high`, and `very high`. See [Predictions glossary](/docs/predictions/predictions-concepts).
These scores select customers for the offer.
## Optionally, extend the audience with Lookalikes
---
Use Lookalikes to reach customers similar to previous bulky-item buyers. This is an audience extension, not another measure of churn risk.
1. Create a segmentation named `Previous bulky-item buyers` with a `product.buy` condition matching the selected categories. Set an explicit historical period suitable for your catalog and buying cycle.
2. Create a segmentation named `Recognized visitors active in the last 90 days`. Exclude `Previous bulky-item buyers` and the current `Free shipping - risk audience`.
3. Create a **Lookalikes** prediction. Select `Previous bulky-item buyers` as the source and `Recognized visitors active in the last 90 days` as the target.
4. Enable recurring calculation at the chosen interval and use the **5-point scale**.
5. Calculate the prediction and record its model ID.
6. Create an aggregate named `Latest bulky lookalike label` using **Last**, the `score_label` parameter of `snr.lookalike.score`, a filter for that model ID, and the chosen maximum score age.
7. Create a segmentation named `Free shipping - lookalike audience` for `high` or `very high` results. Reapply the exclusions of `Previous bulky-item buyers` and `Free shipping - risk audience` when selecting the campaign audience.
To include these profiles in the offer, create a segmentation named `Free shipping - campaign audience` with membership in `Free shipping - risk audience` **OR** `Free shipping - lookalike audience`. Use this combined audience in Dynamic content. Otherwise, use `Free shipping - risk audience` on its own.
Lookalike similarity supports reach extension. It does not supply a missing churn or purchase-risk signal. See [Creating lookalikes predictions](/docs/ai-hub/predictions/lookalikes).
## Calculate basket eligibility in Jinjava
---
Jinjava calculates eligibility at render time. A **Last** aggregate reads the product IDs from the latest `cart.status`. For each ID, the template retrieves the corresponding product from the feed and combines its attributes with the basket quantities. The example uses fixed delivery values; replace them with the appropriate values or rules for your setup.
### Prepare the latest basket data
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. Select **Profile**, name it `Latest basket products`, and select **Last**.
3. Select `cart.status` and its `products` parameter. In this example, each object contains the product ID in `sku` and its `quantity`.
4. Set the period to **Lifetime** and save the aggregate.
5. Send an empty basket after checkout so this aggregate does not retain the completed order.
6. Use the product IDs and quantities from the same `cart.status` event. If your existing aggregate returns only `itemIds`, obtain the matching quantities from the same event and adapt the loop below.
7. In the Jinjava template, read the aggregate, iterate over the IDs, and use `catalogitemv2` to retrieve each product's price, margin, and bulky-item attributes from the feed-backed catalog. See [Insert usage](/developers/inserts/insert-usage).
Take all inputs from the same, latest `cart.status` event. A feed price used in this calculation must represent the applicable selling price. If an event carries a basket-specific discount, account for it before calculating margin.
### Define the calculation
Use amounts in one currency and on the same tax basis. The example uses Synerise inserts, including the catalog-object insert `catalogitemv2`, the documented `do … append` syntax, and the `sum` filter. It collects line margins in a list and sums them after the loop. See [Jinjava tags](/developers/inserts/tag), [Jinjava filters](/developers/inserts/filter), and [Insert usage](/developers/inserts/insert-usage).
Check the Jinjava example
{# Illustrative values: adapt delivery rules and margin units to your store. #} {% set delivery_cost = 80 %} {% set customer_shipping_charge = 80 %} {% set required_contribution_buffer = 20 %} {% aggregate LAST-BASKET-PRODUCTS-AGGREGATE-ID %} {% set margins = [] %} {% set bulky_items = [] %} {% set invalid_items = [] %} {% for item in aggregate_result %} {% if item.sku is defined and item.quantity is defined %} {% set sku = item.sku %} {% catalogitemv2.CATALOG-NAME(sku) allowEmpty=True %} {% if catalog_result.price is defined and catalog_result.price != null and catalog_result.margin is defined and catalog_result.margin != null and catalog_result.bulky is defined and catalog_result.bulky != null %} {% set price = catalog_result.price|float(-1) %} {% set margin_rate = catalog_result.margin|float(-1) %} {% set quantity = item.quantity|float(-1) %} {% if price > 0 and quantity > 0 and margin_rate >= 0 and margin_rate <= 1 and (catalog_result.bulky == true or catalog_result.bulky == false) %} {% do margins.append(price * margin_rate * quantity) %} {% if catalog_result.bulky == true %} {% do bulky_items.append(sku) %} {% endif %} {% else %} {% do invalid_items.append(sku) %} {% endif %} {% else %} {% do invalid_items.append(sku) %} {% endif %} {% endcatalogitemv2 %} {% else %} {% do invalid_items.append('missing basket fields') %} {% endif %} {% endfor %} {% set basket_margin = margins|sum %} {% if invalid_items|length == 0 and bulky_items|length > 0 and customer_shipping_charge > 0 and basket_margin - delivery_cost >= required_contribution_buffer %} <p>Your free shipping code: {% voucher assign=false %} FREE-SHIPPING-POOL-UUID {% endvoucher %} </p> {% endif %} {% endaggregate %}
This example assumes a boolean `bulky` feed attribute, a numeric `price`, and a margin rate stored as a fraction. Replace the aggregate ID, catalog name, voucher pool ID, and attribute names. The `products` aggregate returns objects containing `sku` and `quantity`; the SKU is the key used to read the product feed.
The values `80`, `80`, and `20` are illustrative delivery cost, customer delivery charge, and remaining-margin buffer. Replace them with your rules or values from the events and feed. If margin is stored as a percentage, divide it by 100. If it is an amount per unit, multiply it by quantity without multiplying by price again. Adapt discount handling and included costs to your pricing model.
Supply validated numeric fields in the feed and event. The example expects a positive price and quantity, a margin rate between `0` and `1`, and a boolean `bulky`. A missing property produces no output by itself. Here, `is defined` checks whether the calculation has the required data; the example withholds the offer when data is missing or its checks fail. The `allowEmpty=True` option lets the template inspect a missing catalog item and withhold the offer. Adjust these example rules if your catalog includes free items or negative margins.
Check the template in Dynamic content Preview with your own aggregate and catalog. The example illustrates the calculation; it does not define your delivery policy.
For example, a basket worth 200 currency units with a 20% product margin contributes 40 before delivery. If delivery costs 80, the remaining contribution is -40. A 20% margin threshold alone would not reject this basket. All values in this example are illustrative.
Document the basis of the feed margin. If the feed price and margin already describe the applicable selling price, use them directly. If a basket discount changes that price, adjust the calculation using the event data; do not reuse the original percentage without checking its basis.
### Apply the rule throughout the basket flow
1. Send the complete `cart.status` after prices, quantities, or the delivery option change.
2. Render the content after the latest basket data is available to the aggregates.
3. In Jinjava, retrieve the products from the feed, calculate the contribution, and check the bulky-item and paid-delivery conditions.
4. Hide the outdated offer after a basket change and render the content again. Jinjava then recalculates the condition from the updated inputs.
5. Retrieve and display the voucher only inside the successful eligibility branch in the offer template.
6. Apply the store's voucher usage restrictions at checkout and record redemption for reporting.
The [voucher documentation](/docs/assets/code-pools) assigns usage logic to the integrated application. A condition in a message template controls display; it does not enforce the discount at checkout.
## Display the free shipping code on the basket
---
1. Go to **Experience Hub > Dynamic content > Create new** and choose **Insert Object**.
2. Name the campaign `Free shipping for bulky items`.
3. In **Audience**, select `Free shipping - risk audience`, or `Free shipping - campaign audience` if you added Lookalikes.
4. In **Content**, select **Simple message**, set the CSS selector and insertion position near the order summary, and create the offer template.
5. Include the Jinjava example in the template and replace its placeholders. Add your banner design around the content inside the successful eligibility branch.
6. Target the basket page and set the campaign schedule. If using **On landing**, also implement the basket-change refresh described above.
7. Save the campaign and verify the scenario before activation.
The calculation already includes the voucher insert. It retrieves a bound code for repeat display only when the basket meets the example conditions. Define the behavior for a redeemed or expired code according to your voucher policy. Use a separate pool in Preview because rendering voucher inserts can consume codes. See [Insert usage](/developers/inserts/insert-usage) and [Creating dynamic content](/docs/campaign/dynamiccontent/creating-dynamic-content/creating-dynamic-content).
## Verify the scenario
---
Use test profiles and the test voucher pool. Check both the displayed result and the store's response at checkout.
| Test | Expected result |
| --- | --- |
| Old high churn result followed by a current low result | Churn branch does not qualify the profile |
| No current score for either risk model | Risk audience does not qualify the profile |
| High lookalike result only | Profile qualifies only if the optional audience extension is enabled |
| Eligible profile, qualifying bulky item, paid delivery, sufficient contribution | Offer can display; the store validates the code |
| Eligible profile, basket with no qualifying bulky item | No offer |
| Shipping already free | No additional free shipping offer |
| Delivery cost exceeds available contribution | No offer |
| Missing cost or pricing data | No offer until a valid decision is available |
| Customer removes the bulky item after seeing the code | Updated render shows no offer; the store applies its configured code restrictions |
| Delivery option changes | Eligibility is recalculated |
| Code is redeemed or expired | Store applies the configured usage restrictions |
| Transaction completes | Empty `cart.status` is sent; order and redemption are recorded |
Confirm that the aggregate returns the expected basket objects and that feed fields have the specified types. After Preview and checkout checks pass, activate the campaign according to its schedule.
## Measure the impact with an A/B test
---
This step is optional. Use an A/B test if you want to assess whether the free shipping offer improves conversion and profitability.
1. In the campaign's **Content** section, choose **A/B tests**.
2. Create two variants with a fixed allocation, for example 50/50:
- **Control**: no free shipping code. Keep the basket unchanged and do not include the voucher insert.
- **Challenger**: the offer template with the Jinjava calculation and voucher insert. Show the code only when the basket meets the conditions.
3. Keep automatic allocation off during the comparison and use the same campaign audience and page targeting for both variants.
4. Confirm in Preview that **Control** shows no code and **Challenger** follows the basket conditions. Verify how both variants are recorded in campaign events before measuring results.
5. Define the reporting window and compare conversion rate, revenue per profile, and contribution after delivery costs between **Control** and **Challenger**.
Include all profiles assigned to each variant in the analysis, including those who do not purchase and those in **Challenger** whose baskets do not qualify. Comparing only voucher users against all **Control** profiles would compare different populations.
For profitability, use realized order contribution after delivery and other costs included in your accounting model. Include shipping revenue where charged, and handle returns and cancellations consistently. A revenue increase alone does not establish a profit increase.
Dynamic content variant allocation uses browser storage and lasts 30 days. Account for browser changes and reassignment when defining the test window. See [Creating dynamic content](/docs/campaign/dynamiccontent/creating-dynamic-content/creating-dynamic-content).
## Read more
---
- [Creating classification and regression predictions](/docs/ai-hub/predictions/custom)
- [Creating dynamic content](/docs/campaign/dynamiccontent/creating-dynamic-content/creating-dynamic-content)
- [Creating lookalikes predictions](/docs/ai-hub/predictions/lookalikes)
- [Creating propensity predictions](/docs/ai-hub/predictions/propensity)
- [Insert usage](/developers/inserts/insert-usage)
- [Jinjava filters](/developers/inserts/filter)
- [Jinjava tags](/developers/inserts/tag)
- [Tracking cart status](/developers/web/cart)
- [Voucher pools](/docs/assets/code-pools)
# Spin the Wheel promotion pop-up
Who doesn’t love winning, especially when the reward is guaranteed? This use case adds a playful moment of suspense to the shopping journey using a “Spin the Wheel” pop-up. It also helps you protect the perceived value of your discounts by requiring user interaction before any reward is revealed. As a result, we increase customer engagement, extend on-site interactions and make promotional experiences more memorable.
The experience starts with a bottom bar displayed on the website. Once the visitor clicks it, the spin to win pop-up appears and invites them to play. This approach ensures the campaign is user-initiated rather than interrupting the browsing session with an automatic pop-up.
Users spin the wheel to receive a discount code that can be used at checkout, allowing you to run a fully gamified experience without relying on a mobile app.
This use case is provided with a predefined template, so you can launch the campaign quickly. The layout and interaction logic are already prepared, and you only need to adjust the content, styling and provide valid discount codes.
Before implementing this use case in a production environment, please review local regulations related to promotional lotteries and games of chance. We recommend consulting your legal or compliance team to confirm all requirements. Any additional formalities, such as preparing terms and conditions or submitting the promotion to the relevant tax or regulatory authorities, remain the responsibility of the implementing company.
## Prerequisites
---
[Implement SDK to a website](/developers/web/installation-and-configuration)
## Create a dynamic content
---
Create a dynamic content campaign that will be displayed to all website visitors. We will use a predefined template for this communication, 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 **Insert object** type.
### Define audience
---
1. To select the recipients of the dynamic content, on the **Audience** tab, click **Define**.
2. Select **Everyone**.
3. Click **Apply**.
### Define content
---
In the next step, you will create the dynamic content 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 **Insert object templates**.
3. Select the **Spin the Wheel** 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 dynamic content.
Config panel
5. After customizing your dynamic content, save the template.
6. Set an appropriate CSS selector to define the placement of the banner that releases the pop-up. The correct selector depends on your website’s structure, so make sure to reference an element that ensures the bar is displayed in the intended position.
7. Click **Apply**.
### 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 campaign will be active.
3. Click **Apply**.
2. In the **Display Settings** section, click **Define**. If you want the banner to be displayed to all users continuously across the website upon landing, keep the default settings.
3. Click **Apply**.
4. Optionally, you can define the UTM parameters and additional parameters for your dynamic content campaign.
5. Click **Activate**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [dynamic content](https://app.synerise.com/campaigns/dynamic-content/preview/f732c41d-b02a-4530-bb86-0287485a0202) 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 2 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).
## Read more
---
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Introduction to dynamic content](/docs/campaign/dynamiccontent/introduction-to-dynamic-content)
- [Creating dynamic content](/docs/campaign/dynamiccontent/creating-dynamic-content)
- [CSS selector basics](/docs/campaign/dynamiccontent/creating-dynamic-content/css-selectors)
- [Testing dynamic content](/docs/campaign/dynamiccontent/testing-dynamic-content)
- [Dynamic content events](/docs/assets/events/event-reference/dynamic-content)
# In-app banner campaign
In the fast-paced world of mobile applications, effective communication with users is key to ensure engagement and satisfaction. Imagine a scenario in which you want to inform users through a mobile app about an exclusive 20% discount on the `electronics` category. To effectively deliver such promotional message, implement a two-step approach: launch an automation that sends push notifications and display visually appealing in-app messages within the mobile application.
The described use case is an omni-channel case - the user navigates through the website and receives both push notifications and in-app messages in the application.
The first step is to set up a workflow that sends a simple push notification to mobile app users who have visited items in the electronics category on the website. After a user clicks the push notification, the fullscreen banner is displayed in the application. The core of this use case revolves around the new, pre-defined in-app template that is ready-to-use. You can easily tailor the content of the banner, add dynamic inserts to personalize the message further.
## Prerequisites
---
- [Implement Synerise SDK in your mobile app](/developers/mobile-sdk).
- [Integrate JS SDK](/developers/web/installation-and-configuration).
- Implement mobile pushes in your mobile application: [iOS](/developers/mobile-sdk/configuring-push-notifications/ios), [Android](/developers/mobile-sdk/configuring-push-notifications/android).
- Implement customer identification [on the website](/developers/web/tracking-form-data) and [in your mobile application](/developers/mobile-sdk/user-identification-and-authorization).
## Process
---
In this use case, you will go through the following steps:
1. [Create mobile push](/use-cases/in-app-banner#create-mobile-push) with information about the promotion.
3. [Create an in-app banner campaign](/use-cases/in-app-banner#create-an-in-app-banner-campaign) based on the ready-to-use template.
2. [Create a workflow](/use-cases/in-app-banner#create-a-workflow) that sends a mobile push message to users who have visited items from the electronics category.
## Create mobile push
---
In this part of the process, you will create a mobile push template that contains information about the 20% discount for the electronics category and with the link that opens a mobile application.
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 mobile application
After a user clicks the link, the mobile application opens and an in-app message, which will be configured in the further part of the process, will be displayed
For more information on creating a simple mobile push, refer to the [Simple push](/docs/campaign/Mobile/creating-mobile-push) documentation.
Mobile push campaign settings
## Create an in-app banner campaign
---
In this part of the process, you will create an in-app banner campaign triggered by the [`push.click`](/docs/assets/events/event-reference/mobile-push#pushclick) event. The campaign will be displayed after users clicked the link in the mobile push message sent to them.
1. Go to **Experience Hub > In-app messages > Create new**
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 **Predefined templates** folder and choose **Fullscreen** 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 apperance fields in **Config** affect only the visual layer of the in-app message.
1. In the **Background** section, use the color picker to select the color of the background or enable background image and enter the link to this image (add the image to **Data Modeling Hub > Files** and then you can find there the URL to this image).
1. In the **Image** section, enable the image in your banner campaign and add the link to this image (add the image to **Data Modeling Hub > Files** and then you can find there the URL to this image).
1. In the **Header** section, enable header and add the text, font size and color of the header you want to display in the in-app message.
1. In the **Description** section, enable description and add the text, font size and color of the description you want to display in the in-app message.
12. In the **CTA button** section, enable the CTA and add the text, corner radius, color, background color and add the URL to which you want to redirect users afer clicking the button.
13. In the **Close button** section, enable this option and set up the close position.
14. In the **Automatically disappear** section, set up when the campaign banner will automatically disappear.
14. 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**.
15. To continue the process of configuring the in-app campaign, click **Next**.
16. To save your content changes, click **Apply**.
In-app campaign settings
### 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 the click in the mobile push campaign created in the [previous step](/use-cases/in-app-banner#create-a-workflow).
1. In the **Trigger events** section:
1. Click **Define**.
2. Select **Add event** and from the dropdown list, choose the `push.click` event.
2. Click the **+ where** button and as the parameter, choose `campaignTitle`. You can take its value from the name of the campaign visible on the list of all campaigns.
3. As the logical operator, select **Equal** and as the value add the campaign title of the mobile push campaign created in the previous step to analyze only clicks from this specific campaign.
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 **Change**.
2. Define the **Delay display** as **0** and **Priority index** as **1**.
The mobile application can display one in-app message at a time. If the conditions allow the triggering 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 for displaying after the first one is closed.
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 day.
3. Click **Apply**.
1. Optionally, you can define **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**.
## Create a workflow
---
In this step, prepare a workflow that sends the push message that opens a mobile application to customers who have visite the electronics category. The workflow has capping set once per day, so the workflow can be launch towards a user only once 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, we will configure conditions that launch the workflow. As a trigger, we will use the `page.visit` event in the `electronics` category.
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 `page.visit` event.
2. Click the **+ where** button, from the **Choose parameter** dropdown menu, choose **category**.
3. From the **Choose operator** dropdown, choose **String**, and then select **Equal (String)**.
4. In the next field, type `electronics` to analyze only visits to the items from the electronics category.
2. Confirm by clicking **Apply**.
Profile Event node configuration
### Configure the Send Mobile Push node
---
1. As the next node, add the **Send Mobile Push** node.
1. In the settings of the node, leave the template type at default (**Simple Push**).
2. From the **Template type** dropdown list, select the template you have prepared in the [previous step](/use-cases/in-app-banner#create-mobile-push).
6. Enable the **Action limit** toggle and set the limit to `1` per workflow.
3. If you want to add parameters to the [event generated by this message](/docs/assets/events/event-reference/mobile-push#pushsend), in the **Additional parameters**, click **Define**. If not, click **Skip step**.
You can read more about Additional parameters in the [Define additional parameters](/docs/campaign/Mobile/creating-mobile-push#define-additional-parameters) section.
2. Click **Apply**.
The send mobile push node configuration
### Prepare the final settings
---
1. After **Send Mobile Push**, add the **End** node.
3. Optionally, add titles to each node so the workflow will be more understandable to your colleagues.
9. To define capping, next to the workflow name, click **Set capping** and set it to `1 per 1 day`.
4. Activate the workflow by clicking **Save & Run**.
The workflow 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:
- [automation](https://app.synerise.com/automations/automation-diagram/7024931e-ccd6-47ca-9588-a35a300c6809),
- [in-app campaign with the banner](https://app.synerise.com/communications/in-app/a3dbe6da-524a-429c-8e11-40d6cc33b3c5).
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) (~1), [`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), [`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)
- [Mobile campaigns](/docs/campaign/Mobile)
- [Recommendations](/docs/ai-hub/recommendations-v2)
- [Recommendations inserts](/developers/inserts/recommendations-v2)
# Email Reminder with Abandoned Cart Products to Boost Conversions
The most common way that stores reduce abandoned carts is by setting up an automated email sequence. Thanks to the collected database with email addresses, you can easily reach customers and send them messages reminding them about unfinished purchases. The message contains products left by users in the cart, with the goal of “saving” abandoned carts and convicing the customer to make a purchase.
Email with abandoned cart
## Prerequisites
---
- Implement a [tracking code](/docs/settings/tool/tracking_codes).
- Import a product feed to Synerise. See these [instructions](/use-cases/import-product-feed-to-catalog).
- Implement [transaction events](/developers/web/transactions-sdk).
- Implement [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.
- Configure an [email account](/docs/campaign/e-mail/configuring-email-account).
- Implement [form data tracking](/developers/web/tracking-form-data).
## Process
---
In this use case, you will go through the following steps:
1. [Prepare an aggregate](/use-cases/save-abandoned-cart#prepare-an-aggregate).
2. [Prepare an email template](/use-cases/save-abandoned-cart#prepare-an-email-template).
3. [Prepare a workflow](/use-cases/save-abandoned-cart#prepare-a-workflow).
## Prepare an aggregate
---
Create an aggregate that returns the last **cart.status** event and returns the product parameter from the last 120 minutes. Thanks to this, it will be possible to use in the email data that are labeled as products.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Set **Analyze profiles by** to **Last**.
3. From the **Choose event** dropdown list, select the **cart.status** event.
4. As the event parameter select **products**.
Final settings
## Prepare an email template
---
In this part of the procedure, you create an email template that contains items from an abandoned cart.
1. Go to **Experience Hub > Email**.
2. On the left side of the screen, click **Templates**.
3. Select **Code editor**.
4. In the HTML section add the following Jinjava code that contains the items from the abandoned cart.
Click to see the Jinjava code with items from abandoned cart
<!-- Opening the tag that retrieves the value from the aggregate prepared in the Prepare an aggregate section in the article--> {% aggregate XXXXXXXXXXX %} for loop below: <!-- In the section {% for r in aggregate_result %} 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 aggregate_result %} next item: <!-- {{ r.brand }} {{ r.category }} {{ r.sku }} - parameters taken from the cart.status event - the sku is key. The use of brand and category is optional--> {{ r.brand }} {{ r.category }} {{ r.sku }} <!-- {% catalog.Snrs-produktu-ogTag(r.sku).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.sku).og:image %} {% catalog.Snrs-produktu-ogTag(r.sku).og:title %} {% catalog.Snrs-produktu-ogTag(r.sku).product:price:amount %}{% catalog.Snrs-produktu-ogTag(r.sku).product:price:currency %} {% catalog.Snrs-produktu-ogTag(r.sku).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.
5. Use CSS to style the email according to your preferences.
6. Click **Save this template > Save as**.
7. Enter the name of the template and select the folder in which the template will be saved.
## Prepare a workflow
---
To start sending emails with items from an abandoned cart to customers, prepare a workflow. Optionally, you can add additional nodes, depending on your business needs.
The diagram contains the following nodes:
1. **Profile Event** - the workflow is triggered by the event of adding an item to the cart.
2. **Delay** - before the workflow continues it waits 24 hours.
3. **Profile Filter** - the workflow rejects all customers who made a transaction in the last 24 hours.
4. **Send Email** - the workflow sends the email with items from an abandoned cart to the customers who didn't finish the purchase.
5. Two **End** nodes:
- one for the **not matched** path - customers who made the purchase in the last 24 hours end the workflow there.
- one at the end of the diagram - after the email is sent to customers.
The diagram of the workflow
1. Go to **Automation > Workflows > New worklfow**.
2. Enter the name of the worklfow.
3. As the first node, add the **Profile Event**. In the settings of the node, select the **productAddToCart** event.
Configuration of the Profile Event node
2. As the second node, add **Delay**. In the configuration of the node, set delay to 24 hours.
Configuration of the Delay node
3. As the third node, add **Profile Filter**. In the settings of the node:
1. Select **transaction.charge** event.
2. On the top of the pop-up, click the green **matching** word.
**Result**: The word changes to **not matching**.
2. Set the date range to the last 1440 minutes.
{{< important >}} Use 1440 minutes instead of 1 day – smaller granulation is recommended as in this case 1 day would take the time from current hour till the midnight, so such analysis will not take into consideration all necessary users.
{{< /important >}}
3. Confirm by clicking **Apply**.
4. Click the plus button on the **Profile Filter** node.
5. Select **Send Email**.
**Result**: The **Matched** path leads to the **Send Email** node.
6. Click the plus button on the **Profile Filter** node.
7. Select the **End** node.
**Result**: The **Not matched** path leads to the **End** node.
Configuration of the Profile Filter node
4. Click the **Send Email** node. In the settings of the 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 in the [Prepare an email template section](/use-cases/save-abandoned-cart#prepare-an-email-template), add the subject of the email and UTM parameters.
3. In the **UTM & URL parameters** section, define the UTM parameters for the email.
Send Configuration of the Send Email node
5. After the **Send Email** node, add the **End** node.
5. Configure the final settings:
- Define capping - 1 for 1 day.
- Optionally, add titles to each node so the workflow will be more understandable to your colleagues.
- To save it as a draft, click **Save it** or activate by clicking **Save & Run**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of all steps directly in the Synerise Demo workspace:
- [Aggregate](https://app.synerise.com/analytics/aggregates/5aeb4fcd-d679-3c56-8369-a52f63e0b46c)
- [Workflow](https://app.synerise.com/automations/automation-diagram/bd183f9c-e4b7-4b4f-b5a5-ec869c007b94)
If you don't have access to the Synerise Demo workspace, please leave your contact details in this [form](https://demo.synerise.com/request) and our representative will contact you shortly.
## Generated events
This use case generates approximately 9 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), [`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)
- [Creating aggregates](/docs/crm/aggregates/creating-profile-aggregates)
- [Email templates](/docs/campaign/e-mail/creating-email-templates)
- [Event Cart status](/developers/web/event-tracking#declarative-tracking-custom-events)
- [Importing product feed to catalog](/use-cases/import-product-feed-to-catalog)
- [Jinjava inserts](/developers/inserts/insert-usage)
# Anniversary of the transaction
Happy customers are loyal customers. Satisfied customers are those who become advocates for your business and help you grow it by sharing their positive experiences with others. To perpetuate positive customer experiences, you need to make them feel appreciated and noticed. For example, you can use transaction history to identify individuals with a transaction anniversary on the current day and reward them with a discount code delivered in the form of a mobile push message.
This use case describes the process of creating a workflow that will send a mobile push with a promo code to a segment of customers who have a transaction anniversary on the current day.
## Prerequisites
---
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#tag/Events).
- 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 [voucher pool](/docs/assets/code-pools).
## Process
---
1. [Create an aggregate](/use-cases/transaction_anniversary#prepare-an-aggregate) that returns the timestamp of the customer's first transaction.
3. [Create a mobile push template](/use-cases/transaction_anniversary#create-mobile-push-template)
2. [Create a workflow](/use-cases/transaction_anniversary#create-a-workflow) that sends a mobile push with a discount code for the customers who made their first transaction exactly one year ago.
## Prepare an aggregate
---
Build an aggregate that returns the timestamp of the customer's first transaction.
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 **transaction.charge** event.
5. As the event parameter, select **TIMESTAMP**.
6. Set the period from which the aggregate will analyze the event to **Lifetime**.
7. Save the aggregate.
Configuration of the aggregate
## Create mobile push template
---
1. Go to **Experience Hub > Mobile Push > Templates**.
2. You can use the template from the folder or create your own one using the mobile push code editor.
To use the template, click **New Template**.
3. Choose what type of message you want to create. In our case it's **Simple Push**.
4. Choose how you want to create a mobile push message. In this use case, we will use **Visual Builder**.
5. Create your mobile push message according to your business needs.
For more information on creating a simple mobile push, visit our [User Guide](/docs/campaign/Mobile/creating-mobile-push).
To add a voucher code in the form of the barcode, add the following insert:
Mobile push template example
## Create a workflow
---
In this part of the process, create a workflow that will manage mobile push notifications with a promo code for customers with an anniversary of transaction. The mobile notifications will be sent once a day to the segment of customers whose transaction anniversary falls on the current day.
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 configuration of the node:
1. Select **New audience** and **Define conditions**.
2. From **Choose event** dropdown menu, select the aggregate created in the [previous step](/use-cases/transaction_anniversary#prepare-an-aggregate).
3. From the **Choose operator** dropdown menu, select **Date > Current date > Matches current day**.
4. From **Choose filter** dropdown menu, select the [aggreagate](/use-cases/transaction_anniversary#prepare-an-aggregate).
5. From the **Choose operator** dropdown menu, select **Date > Current date > Matches current month**.
6. From **Choose filter** dropdown menu, select the [aggreagate](/use-cases/transaction_anniversary#prepare-an-aggregate).
7. From the **Choose operator** dropdown menu, select **Date > Current date > Matches current year**.
8. In the condition **Matches current year** define the attribute Contacts **not matching**.
9. Confirm your audience settings by clicking **Apply**.
10. Confirm by clicking **Apply**.
4. As the next node, add **Send Mobile Push**. 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. Set a workflow capping where each customer can run a workflow once every 12 months. In the configuration of the **Capping**:
1. Define **Limit** as `1`.
2. Define the **Time** to `12 month`.
3. Confirm by clicking **Apply**.
7. To run the workflow, click **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 from this use case in our Synerise Demo workspace:
- [Aggregate](https://app.synerise.com/analytics/aggregates/378f75ac-c7a3-3658-bf56-174facc48587)
- [Voucher pool](https://app.synerise.com/assets/vouchers/pools/0b0c1720-e9b3-4185-ae04-0df0e16a989a/coupons)
- [Workflow](https://app.synerise.com/automations/automation-diagram/bb591c14-3f83-4769-bd82-0e1c16cd423b)
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:
[`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), [`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/introduction-to-aggregates)
- [Jinjava inserts](/developers/inserts)
- [Segmentation](/docs/analytics/segmentations)
- [Mobile push](/docs/campaign/Mobile/creating-mobile-push)
- [Workflow](/docs/automation/creating-automation)
- [Voucher pools](/docs/assets/code-pools)
# 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)
# 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)
# 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)
# Send offline transactions to Facebook
You can enrich events collected in Facebook Pixel with any event gathered in Synerise. Based on Facebook Conversion API, Synerise enables sending all event parameters or only its chosen parameters. In this use case, we will send offline transactions to Facebook using the dedicated integration node in Automation Hub.
## Prerequisites
---
- [Create a Pixel in Facebook](https://developers.facebook.com/docs/facebook-pixel).
- [Generate an access token in Facebook](https://developers.facebook.com/docs/marketing-api/conversions-api/get-started/#access-token).
- [Implement offline transactions events](https://hub.synerise.com/api-reference/profile-management#operation/CreateATransaction).
## Create a workflow
---
In order to send offline transactions using Automation Hub, create a workflow that is triggered by a purchase in the point of sales. Through the Facebook Integration node, Synerise sends this event to Facebook.
### Add the Profile Event trigger
1. In the Synerise app, go to **Automation Hub > Workflows > New workflow**.
2. On the dashboard, click the plus button.
3. From the dropdown list, select **Profile Event**.
4. Double-click the **Profile Event** node.
5. On the pop-up, from the **Choose event** list, select the transaction event. If you're not sure of the event's label in your system, search for `transaction.charge`.
6. Click the **+ where** button.
7. From the **Choose parameter** dropdown list, select **$source**.
8. From the **Choose operator** dropdown list, select **Equal**.
9. In the text field, enter `POS`.
10. Confirm by clicking **Apply**.
Configuration of the Profile Event trigger
### Configure Facebook Integration node
1. On the **Profile Event** node, click the plus icon.
2. From the dropdown list, select **Facebook**.
3. From the dropdown list, select **Send Offline Transactions**.
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-offline-transactions-facebook#create-a-connection).
Configuration of the Facebook Integration node
### Create a connection
Use an access token which allows you to send a request.
1. At the bottom of the **Select connection** dropdown list, click **Add connection**.
2. In the **Access token** field, enter the app access token.
You can read more about access tokens in [Facebook documentation](https://developers.facebook.com/docs/marketing-api/conversions-api/get-started/#access-token).
3. Click **Next**.
4. In the **Connection name** field, enter the name for the access token you generated.
5. Click **Apply**.
**Result**: A connection is created and selected.
### Define the integration settings
1. In the **Graph API version** field, enter the currently used API version in Facebook.
You can find information about the currently used API version in the Facebook documentation.
2. In the **Meta Pixel ID** field, enter the identifier of the Pixel you use in Facebook.
You can find information about how to find ID of the Pixel in the Facebook documentation.
3. From the **Identifier type** dropdown list, select the identifier of customer - an email address of phone number.
Offline transactions will be matched with customers based on this identifier.
4. In the **Identifier source** field, enter the Automation insert (Jinjava tag) that corresponds to the identifier you selected as the **Identifier type**.
Read the article about the [Automation inserts](/developers/inserts/automation).
5. In the **Currency code** field, enter the ISO currency code of the transactions, for example, `USD`, `EUR`, `GPB`, `AUD`, `PLN`, and so on.
6. Confirm by clicking **Apply**.
### Add the End node
12. On the **Outgoing webhook** node, click the plus button.
13. From the dropdown list, select **End**.
14. Save and activate the automation by clicking **Save&Run**.
The final structure of the workflow
15. Go to your Facebook Ad account, select **Facebook Manager > Events Manager** to see the events. After the offline transaction, the `automation` event is visible on the customer's card with 200 status. That means that the transaction has successfully been sent to Facebook.
A webhook response with the OK status (200) on a customer's profile
## 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/5a304073-4d44-448a-a4b3-812054f4a423) 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:
[`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) (~1), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), `facebook.sendOfflineTransactions` (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Facebook integration](/docs/automation/integration/facebook)
# Send alerts to Microsoft Teams and email alerts about unsent and failed emails
Effective communication is crucial for maintaining strong relationships with customers and ensuring seamless business operations.
In scenarios in which message delivery issues occur, such as unsent and failed messages, these disruptions can impact customer satisfaction and operational efficiency.
This use case focuses on implementing a comprehensive monitoring and alert system for unsent and failed messages.
By using Synerise's Automation Hub, businesses can distribute detailed daily reports and set up real-time alerts to notify channel members in Microsoft Teams and send email alerts when message delivery issues occur.
This proactive approach helps maintain communication reliability and enhances customer satisfaction. In our case we will start this automation daily to check the number of `message.notSent` events and the list of possible errors. The message alert will be sent only if the number of unsent messages will be higher or equal to `1`.
This case specifically describes creating reports based on the `message.notSent` event, which is generated when the process of sending an email fails.
However, it can be easily adapted by incorporating additional events that are generated when delivery issues occur in different communication channels. For instance, events like `push.notSent` or `webpush.notSent` can be included to ensure a broader scope of monitoring.
## Prerequisites
---
Create a workflow from a channel in Teams by following steps below:
1. Go to Power Automate to create [a workflow from a channel in Teams](https://support.microsoft.com/en-us/office/creating-a-workflow-from-a-channel-in-teams-242eb8f2-f328-45be-b81f-9817b51a5f0e). Save workflow to generate incoming webhook URL.
2. Edit the created workflow by filling out the **TeamId** and **ChannelId** fields. These values will be suggested. If not:
- To get the value of **TeamId**, go to the MS Teams application and retrieve a link to the team. **TeamId** is the part of generated URL groupId=XXXX.
- To get the value of **ChannelId**, go to the MS Teams application and retrieve a link to the channel. **ChannelId** is a part of generated URL channel/XXXXXXXX.
3. Save the changes in the workflow.
4. If you want to send an interactive message (such message can contain links, simple surveys, sections), prepare it in [Adaptive Card Designer](https://adaptivecards.microsoft.com/designer).
## Process
---
In this use case, you will go through the following steps:
1. [Create a metric which counts the occurrences of `message.notSent` events](/use-cases/teams-alerts#create-a-metric).
3. [Create a report](/use-cases/teams-alerts#create-a-report).
2. [Create an email template](/use-cases/teams-alerts#create-an-email-template) that contains description of error parameters.
2. [Create a workflow](/use-cases/teams-alerts#create-a-workflow) which sends an email alert.
2. [Create a workflow](/use-cases/teams-alerts#create-a-workflow-sending-teams-alert) which sends the message to the Microsoft Teams channel.
## Create a metric
---
In this part of the process, we will create a metric whose result will be later sent in the Microsoft Teams message. This specific metric will count the number of unsent email messages.
1. In Synerise, go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As the metric type, choose **Simple metric**.
3. From the **Type** dropdown, choose **Event**.
4. As an aggregator, choose **Count**.
3. From the **Choose event** dropdown list, select `message.notSent`.
4. Set the time range to **Yesterday**.
The configuration of the metric
## Create a report
---
In this part of the process, we will create a report whose results will be later sent in the Microsoft Teams message.
1. Go to **Decision Hub > Reports > New report**.
2. Enter a meaningful name of the report.
3. From the **Choose metric** dropdown list, select [a metric created in "Create a metric" part of the process](#create-a-metric).
4. From the **Range** dropdown list, select the number. This number should be linked to the average number of campaigns sent daily and may therefore be smaller or larger depending on the business. In this case it will be **TOP 20**.
5. In the **Dimension** section, from the dropdown list, select **Event > Parameters**. From the list, select the following parameters:
- campaignName
- info
- extra
- exception
- id
- diagramId
- You can find descriptions of these parameters in the [documentation](/docs/assets/events/event-reference/email#messagenotsent) for the `message.notSent` event.
- If needed, you can add more parameters, reduce its number, or modify them to suit your specific business requirements.
8. Choose **Show null values**.
6. Using the date picker in the lower-right corner, set the time range to **Yesterday**.
9. Save the report.
The configuration of the report
## Create an email template
---
You can use a [ready-made template](https://app.synerise.com/campaigns/email/content-manager/template/161215) (available on the Synerise Demo workspace) that inserts the data you want to send in a table format.
1. On the right panel, click the **Config** tab.
2. Fill out **Title** and **Subtitle** to personalize the header and subtitle in the template.
3. Define **Maximum report table rows number**.
4. In **Report id**, enter the ID of the report you created within ["Create a report"](#create-a-report).
You can retrieve the report ID by going to **Decision Hub > Reports**. On the list of reports, find the report you created in the previous part of the process. To the right side of the report author, expand the context menu and at the bottom of the list, copy the ID.
5. In the **General Settings** section:
- From the **Synerise environment** dropdown, select the cloud where your workspace is hosted.
- From the **Campaign type** dropdown, select **email**.
4. Click **Save as**.
5. On the pop-up, you can change the name and select the folder where the template will be saved.
The configuration of the email template
## Create a workflow
---
In this part of the process, you will create a workflow that sends a message with the report results through email once a day. The message alert will be sent only if the number of unsent messages will be higher than `1`.
1. In Synerise, 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 **all time**.
2. Choose the **Everyday** option.
3. Choose the timezone and hour (in our case, it's 6.00 A.M.)
3. Confirm by clicking **Apply**.
The configuration of the Scheduled Run node
### Choose Get Analytics Report Node
---
1. Choose **Get Analytics Report**.
2. From the dropdown list, select the [report created in "Create a report" part of the process](#create-a-report).
3. Set report records limit.
4. Click **Apply**.
The configuration of the Get Analytics Report Node
### Define the Metric Filter node
---
In the **Metric Filter** node, you will select [the metric prepared in "Create a metric" part of the process](#create-a-metric). The continuation of the workflow will depend on the result of the metric. If the metric result is equal to or more than 1, an alert will be sent.
1. Add **Metric Filter**.
2. In **Define condition**, choose the [metric created in the previous step](#create-a-metric).
3. As the condition, by using the mathematical operators, set the metric result as equal or more than `1`.
4. Click **Apply**.
The configuration of the Metric Filter node
## Define the Email Alert Node
---
1. Add the **Email Alert** node to the **matched** path. 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 add at least one email address of a workspace user to whom the message will be sent.
3. Confirm the selection by clicking **Add**.
3. Confirm by clicking **Apply**.
## Add the finishing node
---
1. Add the **End** node:
- To the **Not matched** path,
- After the **Email Alert** node.
2. In the upper right corner, click **Save & Run**.
Workflow configuration
## Create a workflow sending Teams alert
---
In this part of the process, you will create a workflow that sends a message to the Microsoft Teams channel once a day. The workflow will look similar to one created [previously](#create-a-workflow) but instead of the Email Alert node, we use the **Send Channel Message** node. Its settings are described below.
## Send channel message
---
In this step, you will configure the settings of the outgoing integration that sends the alert message to Microsoft Teams channel.
1. Add the **Send Channel message** node.
3. In the configuration of the node:
- If you already 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/teams-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.
1. In the **Type of message** field, choose **Interactive message (JSON)**.
2. Below, in **JSON body**, add the content of the message which will be sent to the Microsoft Teams channel.
In the code below, remember to replace a few things:
- `set mentions`: Replace email addresses with emails of workspace users who are supposed to be mentioned on the Teams channel when a new report is available.
- `set reportId`: Set this to the ID of the report created in ["Create a report"](#create-a-report).
- `set env`: Replace this with the environment your workspace is hosted.
- `set campaignType`: Replace this with the type of campaign, in our case: email.
Remember, that the rest of the code and the adaptive card are designed to match the parameters of the event described earlier. The results of this report will reflect those parameters. If you want to show fewer, additional, or different parameters, you will need to modify the rest of the code accordingly.
3. Confirm by clicking **Apply**.
Configuration of the workflow that sends alert messages based on the metric results to the Teams channel
## Add the finishing node
---
5. Add the **End** node after **Send channel message** and to the **not matched** path.
6. In the upper right corner, click **Save & Run**.
Workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
Directly in our Synerise Demo workspace, you can check the configuration of:
- [metric](https://app.synerise.com/analytics/metrics/901e1213-9c04-4f31-b1d1-226531b95a46)
- [report](https://app.synerise.com/analytics/reports/f3370785-f309-4b6f-b47f-bb10de377708)
- [workflow sending email alert](https://app.synerise.com/automations/workflows/automation-diagram/828b4892-e681-4d95-b250-e4f127e11565)
- [workflow sending teams alert](https://app.synerise.com/automations/workflows/automation-diagram/44b674e7-4d81-4af6-87e2-31640e50877a)
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) (~2), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~6), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~2), [`message.send`](/docs/assets/events/event-reference/email#messagesend) (~1), [`MSteams.sendChannelMessage`](/docs/assets/events/event-reference/integration#msteamssendchannelmessage) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Metrics](/docs/analytics/metrics)
- [Reports](/docs/analytics/reports)
# Personalized menu
The navigation menu serves as a roadmap for category discovery, allowing customers to explore important site areas. However, sometimes, if the menu is not personalized, it can highlight items that are not interesting for to them. Optimizing and reorganizing the menu items based on a customer's previous visits and preferences not only eases the website navigation but also can reduce the time it takes to reach the desired categories and drive conversions more effectively.
This use case describes an example of menu personalization for a sports company's website. When the customer clicks the hamburger menu and selects a list of all sports, the list of categories is displayed in an alphabetical order. Above the list, a recommendation with six personalized categories (based on visits and interactions) is added to facilitate navigation and promote the most frequently viewed categories.
## Prerequisites
---
- A [tracking code](/developers/web/installation-and-configuration#creating-a-tracking-code) implemented in the source of your website.
- Implement [OG Tags](/developers/web/og-tags) on your website.
- Create [items feed](/docs/ai-hub/recommendations-v2/item-feed-requirements).
- Activate basic menu with all product categories on your website.
- Enable [the Attribute recommendation model](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations).
Attribute recommendation settings
## Process
---
In this use case, you will go through the following steps:
1. [Prepare metadata catalog](/use-cases/personalized-menu#prepare-metadata-of-categories).
2. [Import metadata of categories to a catalog](/use-cases/personalized-menu#import-metadata-of-categories-to-a-catalog).
3. Create [attribute recommendation campaign](/use-cases/personalized-menu#create-recommendation-campaign).
## Prepare metadata of categories
---
1. Go to **Data Modeling Hub > Catalogs**.
2. Create a new catalog with meaningful name, for example `Metadata catalog`. It will be necessary during the import process.
3. Prepare a file (CSV, JSON Lines or XML Google Merchant format) with all product categories available in your menu on the website. Include 4 parameters: `itemId`, `title`, `link` and `imageLink`. You can add more additional parameters if you want.
`itemId` values must correspond with the same values of the `category` attribute in your general product feed. In metadata catalog, all values must start with lower case letter.
## Import metadata of categories to a catalog
---
Create the workflow that imports the metadata of categories into the Synerise catalog.
1. Go to **Automation Hub > Workflows > New workflow**.
3. Enter the name of the workflow.
4. As the trigger node, add **Scheduled Run**.
5. In the configuration of the node:
1. In the **Run trigger** dropdown, leave the default option **One time**.
2. Choose option **Immediately**.
3. Confirm by clicking **Apply**.
4. Add the **Local File** node.
7. In the configuration of the node, add your file prepared in previous step.
8. Add the **Import to Catalog** node.
9. In the configuration of the node:
1. Select [the catalog created in previous step](/use-cases/personalized-menu#prepare-metadata-of-categories) to which the data will be imported.
2. As the primary key, enter the name of the file column which contains the unique identifiers of the items (in this case: `itemId`).
3. Confirm by clicking **Apply**.
4. Add the **End** node.
The workflow configuration
## Create recommendation campaign
---
Create an attribute recommendation for the `0` level category. Such recommendation will return personalized categories for customers based on their 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 **Attribute**.
3. As the **Metada catalog**, choose the catalog created in [this step](/use-cases/personalized-menu#import-metadata-of-categories-to-a-catalog) that contains additional information about categories.
4. Click **Apply**.
Attribute recommendation - Type&Source settings
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 **Item attribute** dropdown, choose **category**. Remember, that this attribute must have the same values as itemId in the metadata catalog.
8. Additionally, if you want to, you can use [additional filters](/docs/ai-hub/recommendations-v2/recommendation-filters) to make this recommendations more personalized.
9. In the **Items** section, click **Apply**.
10. In **Boosting**, you can enable [boosting](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-the-boosting-factors).
11. In **Additional settings**, optionally you can add metrics or filters to increase the chances of conversion and to put your recommendations in a favorable order.
12. Save the recommendation by clicking **Save**.
Attributes recommendations - final settings
## What's next
---
We recommend to implement this recommendation campaign on your website through [API](https://hub.synerise.com/api-reference/ai-recommendations#tag/Recommendations/operation/GetRecommendationsByCampaignV2).
Example of API response
However, as an alternative option you can display the recommended categories to your customers 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 configuration](https://app.synerise.com/ai-v2/recommendations/iTt1yuoP0l6B), and [workflow](https://app.synerise.com/automations/workflows/automation-diagram/4de44dca-a712-4a89-a518-45597207e8ee) 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:
[`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), [`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
---
- [Catalogs](/docs/assets/catalogs/introduction-to-catalogs)
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Jinjava inserts](/developers/inserts)
- [Recommendations](/docs/ai-hub/recommendations-v2)
- [Recommendation filters](/docs/ai-hub/recommendations-v2/recommendation-filters)
# Email with Tailored Brand Recommendations Based on Customer Preferences
An email is a great way to present a tailored offer to your customers. You can prepare a recommendation of items which match the preferences of each customer and distribute this offer by using emails.
This use case describes how to create such a recommendation and contains instructions on preparing an email template that contains the recommendation.
## Prerequisites
---
- Implement a [tracking code](/developers/web/installation-and-configuration).
- Import a product feed to Synerise.
- Implement OG tags, required: `product:retailer_part_no` (which is the same as `` in the product feed).
- [Configure an item feed for recommendations](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations) - initiate the personalized model training.
## Process
---
In this use case, you will go through the following steps:
1. [Create AI recommendation](/use-cases/personalized-email-with-brands#create-ai-recommendation).
2. [Prepare an email template](/use-cases/personalized-email-with-brands#prepare-an-email-template).
## Create AI recommendation
---
In this part of the process, you create a recommendation that will display items of a different brand per slot. The selection of items will be adjusted to the preferences of an individual customer.
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**.
1. From the **Items feed** dropdown list, select a product feed for which the model training is completed.
You can learn more about the statuses of the model training [here](/docs/settings/configuration/ai-engine-configuration/model-status).
2. Select the **Personalized** recommendation type.
Configuraion of the catalog and recommendation type section
3. Confirm by clicking **Apply**.
7. In the **Items** section, click **Define**.
1. Click **Add slot**.
2. Click the slot you added. Optionally, you can rename it.
3. 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).
4. In **Static filters**, set the following parameters:
- `availability` to `true` - it shows only available products,
- `brand` to a brand of your choice, for example, `brand equals Acme`.
Configuraion of the filters
5. Click **Add slot** and repeat steps b-d. In step d, select different brands.
Final configuraion of the items section
6. Confirm by clicking **Apply**.
6. 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)
7. Save the recommendation by clicking the **Save** button in the upper right corner.
## Prepare an email template
---
In this part of the process, you create an email template that contains a Jinjava code that contains the recommendation you created in the previous step. Before you start reating a template, obtain the ID of the recommendation you created in the previous part of the process (in the URL of the recommendation).
1. Go to **Experience Hub > Email**.
2. On the right side, click **Templates**.
3. Select the **Code editor**.
4. Enter the name of the template.
4. In the HTML section, paste the following Jinjava code.
{% recommendations3 campaignId=insert_recommendation_ID %}
{% for slot_products in slots_products3 %}
{% for item in slot_products.items %}
{{ item.itemId }}
{% endfor %}
{% endfor %}
{% endrecommendations3 %}
5. Replace `insert_recommendation_ID` with the ID of your recommendation. You can find the ID in the URL of the recommendation.
6. Adjust the content and design of your message using CSS.
8. Click **Save this template > Save as**.
9. Select the template folder in which the template will be saved.
10. Confirm by clicking **Apply**.
## What's next
---
You can use such template in an email campaign which you can send manually or you can prepare a workflow in **Automation Hub** and use it as a part of your business scenario.
## Generated events
This use case generates approximately 8 events per profile that completes the flow:
[`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~3), [`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.view`](/docs/assets/events/event-reference/recommendations#recommendationview) (~1), [`recommendation.click`](/docs/assets/events/event-reference/recommendations#recommendationclick) (~1).
## Read more
---
- [Email campaigns](/docs/campaign/e-mail)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# 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)
# 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#tag/Events/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)
# Promotion with limited number of uses per user
Promotions with a limited number of uses per user have a unique appeal in the marketing field because of their ability to create a sense of exclusivity and urgency. This exclusivity factor is a powerful tool for effectively engaging customers and has numerous benefits. When customers are aware that an offer is only available a limited number of times, they tend to act quickly. This urgency can significantly increase conversion rates and drive sales.
This use case describes a scenario in which a special promotion is created for members of a loyalty program. The product included in the promotion is coffee, which each loyalty program member can get for free 5 extra coffees.
## Prerequisites
---
- POS must be integrated with Synerise promotion engine to calculate the promotion limits per user directly in the offline store.
- Apply [the Process basket method](https://hub.synerise.com/api-reference/loyalty-and-engagement#tag/Promotions%3A%20basket%20%26%20POS%20integration/operation/processSale_POST) which sends information to Synerise about the transaction such as basket value and transaction items made at the checkout to Synerise (both in online and offline stores). This way, we can determine whether the transaction qualifies for being included in this specific promotion.
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CreateATransaction).
- Implement promotions in your [mobile application](/developers/mobile-sdk/loyalty), website or through [API](https://hub.synerise.com/api-reference/authorization#tag/Authorization/operation/profileLogin).
This use case only works when Synerise is the main source of promotion calculation.
## Process
---
In this use case, you will go through the following steps:
1. [Prepare a segmentation](/use-cases/promotion-limit-per-user/#prepare-a-segmentation) of customers who are members of the loyalty program.
2. [Create a promotion](/use-cases/promotion-limit-per-user#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 a boolean value: **Is true**.
The conditions used in the segmentation 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
---
In this part of the process, create a promotion for specific products (coffee) with usage limits (maximum 5) per user.
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 ["Prepare a segmentation"](/use-cases/promotion-limit-per-user#prepare-a-segmentation).
4. In the **Content** section, define the name, description, and an image of the promotion. Confirm the settings by clicking **Apply**.
5. In **Type & limits** section:
1. As **Discount type**, choose **Exact price**.
2. In the **Value** field, enter the amount of discount - in our case - `0` because the coffee is for free.
5. Apply changes.
Configuration of the promotion
6. In the **Schedule** section, define the distribution period.
7. In the **Stores** section, select stores where the profiles can redeem the promotion.
8. In the **Items** section, select the catalog and specific items to be included.
Configuration of the promotion
8. To apply all changes and run the promotion, click **Publish**.
As the next step, you can create a [document](/docs/assets/documents) within Synerise that includes this promotion, so that it becomes visible, for example, in the mobile application. Thanks to this, you can enhance the promotion's reach and effectiveness, potentially increasing customer engagement and sales.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [promotion configuration](https://app.synerise.com/campaigns/promotions/7e83d2b5-c852-465d-b173-2651a730c54d) 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
---
- [Promotions](/docs/ai-hub/promotions)
- [Segmentations](/docs/analytics/segmentations)
# Step discount promotion
Elevate your customers engagement with step discounts, aligning savings with their journey, while strengthening their connection to your brand. Enable them to access higher discounts with each transaction, incentivizing loyalty and fostering more interactions. Transform their shopping experience into a journey towards greater value, connecting them with offers that resonate.
This use case describes how to create a step discount promotion for one product. The customer will receive a discount of 5, 10 and 15% respectively on the first, second and third purchase of the same product. The promotion will work only for loyalty program members (customers logged into the mobile app).
## Prerequisites
---
- Implement promotions in your [mobile application](/developers/mobile-sdk/loyalty), website or through [API](https://hub.synerise.com/api-reference/authorization#tag/Authorization/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).
## Process
---
In this use case, you will go through the following steps:
1. [Prepare a segmentation](#prepare-a-segmentation) of customers who are members of the loyalty program.
2. [Create a promotion](#create-a-promotion) with step discount for one product.
## 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 **Add condition** 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.
## Create a promotion
---
Create a step discount promotion aimed at loyalty club members for one specific product. The promotion gives a 5, 10 and 15% discount for the item, the discount grows with every transaction.
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, select the [segmentation created in the previous step](#prepare-a-segmentation).
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 params.
2. Confirm the settings by clicking **Apply**.
Content configuration
6. In the **Type and limits** section:
1. Leave **General** in the **Type section**.
2. Enter a **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. Leave **Single** for the promotion logic.
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 **Steps**.
7. Assign **Transaction number** for each **Discount value**.
Configuration of discount thresholds for each purchase
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 yout 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 **Selected items**.
3. Click **Select items** and select the product you want the step discount to apply to.
Items configuration
10. Optionally select **stores** where the profiles can redeem the promotion.
9. To apply configuration and run the promotion, click **Publish**.
## Check the use case set up on the Synerise Demo workspace
---
You can also check the configuration of the [segmentation](https://app.synerise.com/analytics-v2/segmentations/614f5ac1-8bdb-41ec-8d9d-8ad2d6cd65f2) and [promotion settings](https://app.synerise.com/campaigns/promotions/97531b2e-0440-4bf0-806b-52ab594d9c06) 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:
[`client.activatePromotion`](/docs/assets/events/event-reference/loyalty#clientactivatepromotion) (~3), [`transaction.charge`](/docs/assets/events/event-reference/items#transactioncharge) (~3), [`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~3).
## Read more
---
- [Catalogs](/docs/assets/catalogs/introduction-to-catalogs)
- [Promotions](/docs/ai-hub/promotions)
- [Segmentation](/docs/analytics/segmentations)
# 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)
# Campaign with registration for offline events
In this case study, we explore the successful implementation of an offline-to-online event registration system, enhancing the overall experience for attendees.
Leveraging dynamic content, promotions, and coupons, this solution revolutionized the way people sign up, confirm reservations, and attend specific events.
The integration of real-time analytics allows for comprehensive monitoring of all events through an intuitive dashboard.
Using Dynamic Content, a special campaign appears, showcasing current events that users can conveniently sign up for by entering their email address and phone number.
Agreeing to the terms and conditions, attendees can swiftly submit their registration.
This seamless process ensures a hassle-free experience, driving higher engagement and participation.
Our solution helps organizers to effortlessly manage their events. The platform allows for real-time event creation, enabling organizers to add new events efficiently.
Additionally, event managers can easily set the maximum capacity for each event. When the number of registered participants exceeds the set limit, registration is automatically closed, and information about that will be displayed.
To facilitate easy event management, we utilized promotional features. Event details, including event type, description, graphics, and additional information, are defined within a promotion.
This information is automatically imported into the Dynamic Content campaign, using our API, streamlining the process. Moreover, seat management is facilitated through the use of coupon pools.
Each event is associated with a specific coupon pool, allowing organizers to allocate a fixed number of coupons. Upon registration confirmation, the coupon is assigned to attendee.
In this use case we will describe how to manage the whole event registration process, using the power of Dynamic Content, promotions, and coupons.
## Prerequisites
---
- [Implement a tracking code](/docs/settings/tool/tracking_codes).
- [Configure an email account](/docs/campaign/e-mail/configuring-email-account).
- [Create an email template](/docs/campaign/e-mail) with the registration confirmation.
## Process
---
In this use case, you will go through the following steps:
1. [Create a voucher pool](/use-cases/offline-events#create-a-voucher-pool) necessary for seat management.
2. [Create promotion](/use-cases/offline-events#create-a-promotion) with additional information.
3. [Create a dynamic content](/use-cases/offline-events#create-a-dynamic-content) which displays the promotion on the website .
5. [Create a workflow](/use-cases/offline-events#create-an-automation) which sends your customers an email with confirmation after registration for a specific event.
## Create a voucher pool
---
Seat management for an event is facilitated through the use of voucher pools. Each event is associated with a specific voucher pool, allowing organizers to allocate a fixed number of coupons. Upon registration confirmation, attendees receive a coupon.
In this use case, every pool is connected with one event and the number of coupon codes reflects the number of seats available for the event. You can add as many events as you want.
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 event.
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.
4. Add codes to the voucher pool by clicking **Add record** button.
- One code represents one seat for the event.
- Add a number of coupons equal to the expected number of seats for this event.
- As coupon codes, we recommend to use ordinal numbers.
In [this](/docs/assets/code-pools) article, you will find the rules and procedures needed to create and use voucher pool in Synerise.
Voucher pool with coupons
## Create a promotion
---
In this step, prepare a promotion which lets you display each event with additional information. Each event is treated as a single promotion. You can add as many events as you want. Promotions will be displayed in a dynamic content campaign.
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, description, and image of the promotion.
2. Prepare a JSON code that includes basic information about the event. Check the example code below. This date is later used in the dynamic content campaign. You can add different data to the given event.
This data is later displayed in the dynamic content campaign. You can include different data than in the example, depending on your integration.
3. Confirm the settings by clicking **Apply**.
5. Fill out the **Type and limits** section according to your business needs.
6. In the **Schedule** section, define the promotion distribution period according to your business needs.
11. To run the promotion, click **Publish**.
12. To create the second promotion, repeat all the steps.
Promotion
## Create a dynamic content
---
Create a dynamic content campaign. This dynamic content will be displayed on your site with information about the promotion, link to the form, and information about the lack of seats if all of them are taken. This dynamic content also generates the `experience.subscribe` event, which is generated after signing up to an event and assigning the code from the voucher pool to the specific user.
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 your campaign.
4. In the **Content** tab, click **Create Message**.
5. In the code editor, create a dynamic content campaign based on your preferences and your own CSS styles. Below you will find technical elements of the campaign which you should add to the code to make sure that the mechanism of assigning codes and checking the amount of them in the pool works correctly.
In the dynamic content campaign, you must use the API to fetch promotions for the website: request the list of promotions, receive JSON data, and based on it, render the dynamic content campaign with a specific promotion. To implement this, please refer to [our documentation](https://hub.synerise.com/api-reference/loyalty-and-engagement), where you will find a complete description of this method.
Below you will find the instruction for developers, which describes how to assign the code from the voucher pool created in the previous step to the specific user.
Click to see instruction for developers
To assign a voucher to a person who signs up through a form, you need to use this endpoint. The API call includes the user's UUID. If the user does not already have a voucher from a specific pool, it will be assigned to them. However, if the user already has a voucher assigned from that pool, the API will return the existing voucher without assigning a new one. If the pool is already filled (all vouchers are assigned), you receive a response with status 416, indicating that the pool is empty, expired, not found, or the user's profile is not found. At this point, you need to handle the error and display the information to the user.
Below you will find instructions for developers on how to - in case of lack of coupons in the pool - display information in the dynamic content that signing in to this event is currently not possible.
Click to see instruction for developers
To implement the dynamic content that informs when there are no coupons available in the pool, you can use the following endpoint. You pass the poolUuid to check, and in the response, you get information about the number of coupons available that can be assigned (`activeCount`) and the the number of coupons already assigned (`assignedCount`). Based on this information, you can inform users about seat availability.
Rememeber to also add to your campaign - code - that after signing in to an offline event, generates the event in our case the name of this event is: `experience.subscribe`. To do it check the [basic method for tracking events](/developers/web/methods-reference#basic-method-for-tracking-events). You will find there information how to add custom events.
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 based on your business needs.
6. Confirm by clicking **Apply**.
7. In the **UTM & URL parameters** section, click **Skip step**.
8. Activate the dynamic content.
## Create an automation
---
In this step, create a workflow which sends your customers an email with confirmation after registration for a specific event.
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 conditions that launch the workflow. As a trigger, we will use the `experience.subscribe` event, which is generated after registration.
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 `experience.subscribe` event.
2. Confirm by clicking **Apply**.
### Configure settings for email
At this stage, you will send an email with confirmation for users who fill out the form and register for a specific event.
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 in the prerequisites.
3. You can define **UTM & URL parameters**.
4. Confirm by clicking **Apply**.
You can optionally enrich your email template with data related to the specific event - eg. event name, start date, place etc. To do so, use [Jinjava code](/developers/inserts/automation#event-parameters) inserts and correlate it with parameters from the `experience.subscribe` event. Read more about the [basic method for tracking events](/developers/web/methods-reference#basic-method-for-tracking-events). You will find there information ow to send custom events.
### Add the finishing node
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
Workflow settings
## What’s next
---
In the basic version, this use case focuses on allowing users to sign up for an event. However, it can be extended with additional mechanisms to enhance user experience and functionality.
- One such extension is the **"Unsubscribe" mechanism**, which enables users to cancel their registration and reassign their spot to another participant.
- Another extension is the **"Waiting List" feature**, where users can automatically join a waiting list if the event's capacity is exceeded. When a spot becomes available, individuals from the waiting list will receive a reminder and have the opportunity to register for the event.
- To further improve user engagement, the system can implement **"Reminders" for participants**, notifying them a certain number of days before the event. This ensures participants don't miss the event and can make necessary preparations.
- Moreover, after the event concludes, the system can send out **"Surveys"** to gather feedback and assess participant satisfaction. These surveys can help organizers make improvements for future events based on the received evaluations.
In addition to the mentioned extensions, there are many other potential enhancements that can be incorporated into this use case to cater to specific requirements and deliver a more comprehensive and user-friendly event management solution.
### Dynamic Dashboard
---
Additionally, to measure the effectiveness of the campaigns and track the results, Synerise provided a comprehensive dashboard. It might be treated as an inspiration for a further analysis. This dashboard offered valuable analytics, including:
**First part** - dynamic, with the dynamic key based on the eventHash for a specific event.
- Report with the details of the event (name, start and end date, place)
- Report with a final guest list for a specific event
- Metric with the total number of users subsribed for an event
**Second part** - common for all events. You can adjust the date/time range for the whole dashboard.
- Report with all events - presented from most popular based on number of subscriptions
- Total (and unique) number of users registered
Those analytics are inspirational and can be used as a base for creating your very own dashboard to summarize the campaign 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 worksp,ace](https://demo.synerise.com/request):
- [Voucher pool](https://app.synerise.com/assets/vouchers/pools/abb319ba-ff84-48bd-b93f-146fe3b59f22/coupons)
- [Promotion](https://app.synerise.com/campaigns/promotions/a777d94b-9388-48d6-aeed-0935f4a5f3ea)
- [Dynamic content campaign](https://app.synerise.com/campaigns/create/6d784bb3-9dd3-4ab5-bff7-e655c56cb00c)
- [Workflow](https://app.synerise.com/automations/automation-diagram/1083d90d-631e-47d0-9e63-173122877a27)
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:
[`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), `experience.subscribe` (~1), [`voucherCode.assigned`](/docs/assets/events/event-reference/loyalty#vouchercodeassigned) (~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).
## Read more
---
- [Automation Hub](/docs/automation)
- [Automation Jinjava inserts](/developers/inserts/automation)
- [Dashboards](/docs/analytics/analytics-dashboard)
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Email templates](/docs/campaign/e-mail/creating-email-templates)
- [Voucher pools](/docs/assets/code-pools)
# 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)
# Email Recommendations Based on Customer's Recent Browsing History
Predefined HTML blocks for email templates can help businesses create professional and visually appealing emails without having to start from scratch. These blocks combine the advantages of two builders - drag & drop, thanks to which you can easily adjust the appearance of the email to your needs, customize with your brand colors, fonts, and images, and at the same time enrich emails with dynamic elements such as recommended products. The configuration of dynamic elements is easy as it only involves selecting appropriate object (such as analysis or recommendation) responsible for the the logic of choosing products. Ultimately, this can drive conversions, boost sales, and enhance customer loyalty.
This use case describes the process of creating a personalized recommendation of items which are similar to those seen recently by the customer. Later this recommendation is sent through an email to customers who did not make any transaction in the last 30 days. Showing products similar to those they recently viewed might encourage undecided customers to make a purchase.
This use case provides you with an instruction how to use a ready-made html block that can be used 1:1 in a business scenario.
## 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).
- [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#tag/Events/operation/CreateATransaction).
- 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 ID of the last visited product, it will be used in the template configuration.
2. [Prepare an AI recommendation](#prepare-an-ai-recommendation), it will be used in the template configuration.
4. [Prepare an email template](#prepare-an-email-template) with the predefined HTML block.
3. [Create a workflow](#create-a-workflow).
## Create an aggregate
---
In this part of the process, create an aggregate that returns the ID of the last product a customer had visited. The recently viewed product itself will not display in the template, but 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 **Last**.
4. From the **Choose event** dropdown list, select the **Visited page** event.
5. As the event parameter, select **product:retailer_part_no**.
6. Click the **+ where** button.
7. From the **Choose parameter** dropdown list, select the **product:retailer_part_no** 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 7 days**. Confirm your choice with the **Apply** button.
7. Click **Save**.
Configuration of the aggregate returing the ID of the last seen product
## Prepare an AI recommendation
---
In this part of the process, you will configure a similar items recommendation which will be later used in the email template. You can use a different recommendation type according to your business needs.
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 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 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, create an email template. You can use a predefined template or create your own template from scratch. In this case, we will use a predefined template. You will also use a specific HTML block which will let you configure the section with context recommendations in an easy way. In the configuration, we will use the [aggregate](#create-an-aggregate) and [recommendation](#prepare-an-ai-recommendation) created in the previous steps.
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.
### Add the HTML block
---
1. From the **Content** section, select **HTML block**. Drag and drop the block to the chosen place in your template.
2. Click the **Configure** button.
3. Choose the **Predefined blocks** folder where you will find the list of all predefined templates. In this case, choose the **Context recommendation 2**.
You can edit the template in two ways, by editing the code of the template in the **HTML** tab 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 with default values. You can keep them or change them to fit your business needs.
1. In the **Recommended products** section:
1. From the **Recommendation campaign 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. From the **Agregate ID with context product** dropdown 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 section below, you have the option to customize email width, number of products, title, price and sale price font color of the product, gap height (height between information about the product and CTA button), background and font color of the button as well as its border radius and text.
Html block configuration
3. After you make changes to the template, you can check the preview.
1. On the upper left side, click the **Preview Contexts** button.
2. Enter the ID of a customer.
3. Click **Apply**.
Html block preview
4. If the block is ready, click **Next** on the upper right side to proceed, or click the arrow next, and from the dropdown select **Save as**. If you want to save the block, 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**.
### Save the email template
---
1. 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**.
2. 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 the workflow which sends emails with recommendations of products similar to those last seen by a customer. The workflow is triggered when the customer finishes their session on the site. The email will be sent maximum once a month to customers who didn’t make a purchase in the 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 the 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 the **Choose event** dropdown menu, choose the **session.end** event.
2. Confirm by clicking **Apply**.
### Define the delay
Add the Delay node to define the lag between the `session.end` event and sending an email with a product recommendation to a customer. In this example it is 1 hour.
1. Add the **Delay** node, in the configuration of the node:
1. In the **Delay** field, enter `1`.
2. From the **Unit** dropdown, choose **Hour**.
3. Confirm by clicking **Apply**.
### Define the Profile Filter node
As the next step, add the **Profile Filter** node, which checks if the customer made a transaction in the last 30 days. If the customer has not made a transaction, we will send them an email with recommendations, and if they have, then the workflow ends.
1. Add the **Profile Filter** node.
2. From the **Choose filter** dropdown list, select the **transaction.charge** event.
4. Using the date picker in the lower-right corner, set the time range to **Custom> Last 30 days**. Confirm your choice with the **Apply** button.
5. Click **Apply**.
### Configure the Send Email node
1. To the **Not matched** path, 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 prepared 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 optionally assign [parameters](/docs/campaign/e-mail/creating-email-campaigns#adding-custom-parameters), which will be added to every event generated by this communication.
2. Click **Apply**.
### Add the finishing nodes and set capping
1. Add the **End** nodes after **Send Email** 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 **Apply**.
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 each step directly in our Synerise Demo workspace:
- [Aggregate](https://app.synerise.com/analytics/aggregates/1162c599-338f-32f7-ba20-b1bb64fcaed0)
- [AI Recommendation](https://app.synerise.com/ai-v2/recommendations/pcJ44bk6rXz2)
- [Template](https://app.synerise.com/campaigns/create/56bf912a-53fc-4785-afd9-fa127c44dd9a)
- [Workflow](https://app.synerise.com/automations/automation-diagram/2dd2c994-cc88-42b2-95d9-a1c82ff0ee3b)
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:
[`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), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~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 email templates](/docs/campaign/e-mail/creating-email-templates)
- [Html blocks](/docs/campaign/e-mail/creating-email-templates/creating-custom-html-block-basic-builder)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Exclude product categories from rewarding loyalty points
The ability to take a flexible approach to loyalty program management is undoubtedly an advantage, which allows you to both better meet the needs of your customers and execute a range of customized campaigns that enable the execution of individual business scenarios. Synerise offers a number of features to help you achieve your specific goals.
Based on the basic loyalty program settings described in detail in this [use case](/use-cases/loyalty-programs-basics), a number of additional scenarios can be created to meet your current business needs. An example of such a scenario might be the need to exclude certain product categories from loyalty point accrual for a particular campaign.
This use case describes the process of creating a workflow that helps exclude certain product categories from loyalty point accrual. This workflow describes a scenario in which we will give loyalty points for every category except Beverages and cancelled products. Such a workflow can be created for a specific campaign that takes place within a certain timeframe.
This use case presents one of the ways to exclude product categories from accruing loyalty points. You can find an alternative solution in [this use case](/use-cases/product-category-exclusion-in-points-scheme). Your choice of one of the scenarios will depend on the implementation of your loyalty program. You can always customize any solution to meet your specific business needs.
## Prerequisites
---
Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CreateATransaction).
## 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 that excludes specific product categories from rewarding loyalty points
---
Create a workflow that excludes certain product categories from accruing loyalty points during the customer purchase process.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Profile Event trigger node
---
The workflow will be triggered by a purchase. In the settings of the trigger, define the product categories that you want to exclude from rewarding loyalty points.
1. As a trigger, choose **Profile Event**.
2. Choose the `product.buy` event.
3. Click **+ where** and as the parameter, select `category`.
4. From the **Choose operator** dropdown list, select **Not equal (String)**.
5. Enter the names of the categories you want to exclude from loyalty point accrual.
6. Click **+ where** and as the parameter, select `cancel`.
7. From the **Choose operator** dropdown list, select **Is false (Boolean)**.
The `cancel` parameter used in this use case refers to products that were previously selected by the customer, but were canceled for some reason during the purchase process. You can use any other nomenclature for this type of action while implementing transaction events.
8. Click **Apply**.
Configuration of the Profile Event node
### Define the Generate Event node
---
At this stage, an event will be generated with information about the number of points accrued.
1. As the second node of the workflow, add **Generate Event**.
2. In the **Event name** field, enter the name of the event that will be generated on the customer's profile. In this case, it is `points.loyalty`. This event cause counting the points for customers.
4. In the **Body** section, define the parameters of this event, and click **Apply**.
**Example content of **Body** section:**
In the Jinjava code presented above, we multiply the quantity (`$quantity`) of bought products by 50.
The event body is an example. You can add more parameters or change the point calculation formula according to your business needs.
Configuration of the Generate Event node
### Prepare the final settings
---
1. Add the **End** node.
2. Launch the workflow 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 the [workflow in the Synerise Demo workspace](https://app.synerise.com/automations/automation-diagram/b2dc5475-ba2c-4fae-b525-7f5a321db91f).
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:
[`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) (~2), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~2), [`points.loyalty`](/docs/assets/events/event-reference/loyalty#pointsloyalty) (~2).
## Read more
---
- [Automation Hub](/docs/automation)
Check our loyalty use cases [here](/use-cases/?ordering=DESC&sortBy=publishDate&filters=tags%3D%3D%22loyalty%22)
# 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#tag/Events/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), [`brickwork.generated`](/docs/assets/events/event-reference/brickworks#brickworkgenerated) (~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)
# 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#tag/Events/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)
# 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)
# 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)
# In-app message with a reminder about a promo code
In-app messages are another efficient way to reach your customers in the mobile app. By providing targeted and relevant messages to users who are actively using your app, in-app messages can assist you in retaining their attention. They can be used, for example, to remind your customers they have a promo code they can use for their cart.
This use case describes the process of creating a reminder that a customer received a promo code and sending it through an in-app message. In this case, we assume that the promo code was sent by an email and the customer hasn't redeemed it yet.
In this use case we provide you with a ready-made campaign code that can be used 1:1 in a 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#tag/Events/operation/CreateATransaction).
Transactions that were made using a promo code must have an additional parameter that will store the code content. In this case, `coupon`.
- [Send an email campaign](/docs/campaign/e-mail/creating-email-campaigns) with a promo code to customers.
It can be any channel, in this use case we assume that the voucher was sent by an email. [Learn more about Experience Hub in Synerise](/docs/campaign).
Optionally, you can implement [coupons](/docs/assets/code-pools) which you can import and add to your email template as an [insert](/developers/inserts/insert-usage#code-pools).
## Create an in-app message
---
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 received an email with a promo code and didn't redeem it in the last 30 days.
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 `message.send` event.
2. Click the **+ and where** button and select `id` as the parameter.
4. As an operator, choose **Equal** and enter the ID of the email campaign that was sent to customers as a part of [prerequisites](#prerequisites).
6. Click **and then...**.
**Result**: A dropdown menu and an input field appear below.
7. From the dropdown, select `transaction.charge` event.
8. Click the **+ and where** button and select a parameter assosciated with promo codes. In this case, `coupon`.
10. As an operator, choose **Regular expression** and in the text field, enter `.`.
11. Change **Performed** to **Not performed**.
12. Click **Add condition**, and from the dropdown list, select the `message.send` event.
2. Click the **+ and where** button and select `id` as the parameter.
4. As an operator, choose **Equal** and enter the ID of the email campaign that was sent to customers as a part of [prerequisites](#prerequisites).
This way the audience will exclude customers who made the transactions using the promo codes. To include purchases from a specific campaign with codes, you can use a fixed prefix or suffix for every promo code.
6. In the calendar in the right bottom of the page, define the period from which the segmentation will return the customers. In this case, last 30 days.
7. Click **Apply**.
In app campaign configuration
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.
1. In the **Content** section, click **Define**.
2. Click **Create Message** and select **Code Editor** to create the code for your in-app message.
3. Style the message according to your design assumptions by using the HTML, CSS, and JS sections.
Below you can find an example of the code that you can use to create in-app message.
HTML
<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> <p class="in-app__upper--text">We've sent you an email with the promo code.</strong></p> </div> <div class="in-app__lower"> <p class="in-app__lower--text changeDate">20% discount!</p> <p class="in-app__lower--text--second">You haven't used it yet,</br>maybe you can redeem it now?</p> </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 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" ); } }); })();
4. 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 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 **+ and where** button and select `mobile`.
4. As the logical operator, select **Is true**.
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** 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 massage to the customer a maximum of 1 time in period of 7 days.
You can additionaly 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 [In-app message configuration](https://app.synerise.com/communications/in-app/502bf3a3-827a-4c93-828d-1f8d58ffc25a) 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 4 events per profile that completes the flow:
[`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), `inapp.custom` (~1).
## Read more
---
- [Email campaigns](/docs/campaign/e-mail)
- [In-app messages](/docs/campaign/in-app-messages)
- [Jinjava inserts](/developers/inserts)
# 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)
# 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)
# Recommending complementary products to recently bought
You can use AI to offer customers a personalized shopping experience by suggesting relevant, complementary products that they might like. You can send those recommendations, based on cross-sell algorithms that select complementary products based on those recently bought, in your email marketing campaigns.
This use case describes how to prepare an automated workflow that sends an email with cross-sell recommendations. This use case uses an aggregate and AI cross-sell recommendations inserts in targeted customer communication. The workflow is triggered with `product.buy` event, and sends an email after a specific time period.
## Prerequisites
---
- [Configure AI engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations).
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CreateATransaction).
- [Create an email 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-aggreagate).
2. [Prepare AI recommendations](#prepare-ai-recommendations).
3. [Prepare an email template](#prepare-an-email-template).
4. [Create a workflow](#create-a-workflow).
## Create an aggreagate
---
In this step, create an aggregate that returns the SKU of the product a customer bought in the last 30 days. You will later use it as an insert in an email.
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**.
6. From the **Choose event** dropdown list, select the `product.buy` event.
7. From the **Choose parameter** dropdown list, select `$sku` parameter.
8. In the calendar in the right bottom of the page define the period from which the aggregate will return products from the event.
1. In this case, in the **Relative date range** section, click **Custom**, type 30 and from the the dropdown list, select **Days**.
2. Click **Apply**.
9. In the right upper corner, click **Save**.
10. Copy the aggregate ID from its URL to use in [Jinjava later](#prepare-an-email-template).
Configuration of the aggregate with last bought products
Cross-sell recommendations which you will add to the email template have to have the context of the product based on which the items in the recommendations can be selected. It is provided by the SKU retrieved from the `product.buy` event in the aggregate.
## Prepare AI recommendations
---
In this part of the process, you will configure a cross-sell recommendation which will be later used in the email template.
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 user 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 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 in [Jinjava later](#prepare-an-email-template).
## Prepare an email template
---
In this part of the process, you will create an email template with a Jinjava code that contains the IDs of the [aggregate](#create-an-aggreagate) and the [recommendation](#prepare-ai-recommendations) you created in the previous steps.
1. Go to **Experience Hub > Email > Templates**.
1. To create a new template, click **Create new**.
2. To create a template out of an existing template, click **From template**.
2. Select the template.
3. Select the wizard:
1. **Drag&drop** builder - Create email templates with ready-made components.
2. **Code editor** - Create email templates in CSS and HTML.
4. To add the dynamic part to the email template (last bought product and AI recommendations), you use Jinjava and add your own CSS. Below you can find an example Jijnava code.
Check the Jinjava code
<!-- Opening the tag that retrieves the value from the aggregate prepared in step 1--> {% aggregate 6b009acf-d86a-3ac6-b299-cb3c5d64c04f %} <!-- Assign an aggregate value to skuValue --> {% set skuValue = aggregate_result[0] %} <!-- Referencing with the help of variable to the snrs-product-ogTag directory built by default from OG tags. The variable names depend on the name of the OG tags on your page --> <div class="wrapper-card"> <h2 style="text-align:center">Product Card</h2> <div class="card"> <img src="{% catalog.Snrs-produktu-ogTag(skuValue).og:image %}" alt="Product image" style="width:100%"> <h1>{% catalog.Snrs-produktu-ogTag(skuValue).product:brand %}</h1> <p class="price">$ {% catalog.Snrs-produktu-ogTag(skuValue).product:price:amount %}</p> <p>{% catalog.Snrs-produktu-ogTag(skuValue).og:title %}</p> <p><button>Add to Cart</button></p> </div> </div> <!-- Adding the skuValue variable to the array for which we will retrieve cross-sell products --> {% set itemContext = [] %} {% do itemContext.append(skuValue) %} <!-- Downloading the cross-sell campaign for the product in the table --> {% recommendations3 campaignId=tFwEUKvZLj4d itemsIds=itemContext %} <!-- Iterating loop through the received products --> {% for item in recommended_products3 %} <!-- Listing the attributes assigned to the product in the feed --> <div class="wrapper-card" style="width:25%;float:left"> <h2 style="text-align:center">Product Card</h2> <div class="card"> <img src="{{ item.imageLink }}" alt="Product image" style="width:100%"> <h1>{{ item.brand }}</h1> <p class="price">$ {{ item.priceValue }}</p> <p>{{ item.title }}</p> <p><button>Add to Cart</button></p> </div> </div> {% endfor %} {% endrecommendations3 %} <!-- Closing of the tag that gets the value from the aggregate prepared in point 1 --> {% endaggregate %}
You will find more about email templates in [this article](/docs/campaign/e-mail/creating-email-templates).
## Create a workflow
---
To start sending emails with the recommendation to customers prepare a workflow, which in basic configuration may look like the one below.
1. 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. As the second node, add **Delay**. In the configuration of the node, set the period according to your business needs.
5. As the next node, add the **Send Email** node.
6. 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:
3. Enter the subject of the email which will be visible in the customer’s inbox.
4. Select the email template created in [the previous step](#prepare-an-email-template).
5. Optionally, you can add UTM and URL parameters.
7. Confirm by clicking **Apply**.
8. Add the **End** node to finish the workflow.
9. Optionally, you can set up the capping for this workflow based on your business needs.
10. Click **Save & Run**.
Workflow configuration
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of use case in Synerise Demo workspace:
- [Aggregate](https://app.synerise.com/analytics/aggregates/6b009acf-d86a-3ac6-b299-cb3c5d64c04f)
- [Email template](https://app.synerise.com/campaigns/email/content-manager/template/153786)
- [Recommendation](https://app.synerise.com/ai-v2/recommendations/tFwEUKvZLj4d)
- [Workflow](https://app.synerise.com/automations/workflows/automation-diagram/be21803b-2ad4-4c96-b1a2-d5d9cad0e644)
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) (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~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)
- [Jinjava inserts](/developers/inserts)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Email with abandoned cart and recommendations
Save abandoned carts with the help of dynamic email recommendations powered by AI. When a customer doesn't complete a purchase, send an email with the product left behind in the cart, complete with suggested accessories chosen by AI.
In this way you can not only encourage customers to finish the purchase but also to buy more products that are connected to his choice (for example accessories). It can help you to increase the number of products bought by your customers.
## Example of use - Retail industry
**Challenge**
A client from the retail industry decided to create AB tests of the abandoned carts. One group received a standard email containing products recently added to the basket, the second group received an email in which, in addition to abandoned products, was also products recommended for a specific customer.
**Results**
- 25% CTOR for email with recommendations (A),
- 18,8% CTOR for email without recommendations (B).

## How to do it
---
1. First of all prepare the right aggregate. Read more about creating [recommendations](/docs/ai-hub/recommendations-v2)).
Then, implement it in your email campaign.
- If you send to Synerise event "cart status", prepare the **Last** type of aggregate and select event cart.status and then the products parameter. In this way you will get products that the customer had previously in the basket.
- If you do not send such an event, you can use event "add to cart". In this case, select the **Last Multi** type of aggregate by selecting the unique events option and indicate how many events you are interested in, for example 10. Then select the event add_to_cart and the parameter by which you will aggregate - in this case SKU.
To view the details of the indicated product in the email, refer to the catalog from the OG tags.
More details you can find [here.](/developers/inserts/insert-usage)
2. Using Inserts, add personalized recommendations to your email campaign.
3. Send your email campaign with abandoned carts and dynamic recommendations to your database.
Learn how to create an [email campaign.](/docs/campaign/dynamiccontent)
## 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), [`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).
# Export customer's predicted LTV and loyalty status to Google Cloud Storage
Make use of the built-in Google Cloud Storage integration in Automation Hub and export prediction results of lifetime value (LTV) and customer's loyalty status to your external resources for further analysis.
This use case combines three Synerise hubs:
- Decision Hub - to create analyses required for the prediction configuration, including an expression to calculate the total transaction value over the last 90 days, a segmentation based on website visits in the past 30 days to use it for a prediction, segmentation of customers who participate in a loyalty program, and later on an aggregate that retrieves the prediction result.
- Predictions (from AI Hub) - to create a prediction that forecasts the transaction value in the next 90 days for the customers who visited your website in the last 30 days, and assess the probability of this transaction value.
- Automation Hub - to create a workflow in which you will re-select the segmentation with visits in the last 30 days, select the aggregate with prediction results and the segmentation of customers who are in the loyalty program to export to your Google Cloud Storage.
## Prerequisites
---
- [Enable the Custom prediction model](/docs/ai-hub/predictions/enabling-predictions#enabling-regression-and-classification-predictions).
- Make sure you meet all [prerequisites](/docs/automation/integration/google-cloud-storage/send-file-to-gcp#prerequisites) to integrate Synerise with Google Cloud Storage.
- Create a segmentation of customers who are members of the company's loyalty program.
The conditions used in the segmentation will vary depending on your loyalty program logic (for example, you may use custom attributes related to loyalty program).
## Process
---
In this use case, you will go through the following steps:
1. [Create prediction target](/use-cases/send-ltv-to-gcs#create-prediction-target) based on an aggregate and expression.
2. [Create the segmentation](/use-cases/send-ltv-to-gcs#create-a-segmentation) for whom the prediction will be made (users who have visited the website in the past 30 days).
3. [Create the prediction](/use-cases/send-ltv-to-gcs#create-the-prediction) to predict the transaction value in the next 90 days and determine its likelihood.
4. [Create an aggregate](/use-cases/send-ltv-to-gcs#create-an-aggregate) that retrieves the prediction results.
3. [Create a workflow](/use-cases/send-ltv-to-gcs#create-a-workflow) that will send results of the prediction and loyalty program status of selected customers.
## Create prediction target
---
In the first part of the process, create an expression that calculates the total value of purchases. This expression will also serve as data input to forecast the total purchase value for the next 90 days.
In order to create such expression, you have to start with creating aggregate whose results will be retrieved in the expression. This is because only expressions can be used as prediction goals in the prediction 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. Set the **Analyze profiles by** option to **Sum**.
4. Click **Choose event**.
5. From the dropdown list, select **transaction.charge**.
Events may have different labels among workspaces, but you can always find them by their action name (in this step, it's **transaction.charge**).
6. As the parameter of the event, select **$totalAmount**.
5. Using the date picker in the lower-right corner, set the time range to **Relative time range > Custom > last 90 days**.
6. Save the aggregate.
The formula of the aggregate
After saving the aggregate, proceed to creating an expression.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression.
3. Set the **Expression** to **Attribute**. Predictions work only with attribute expressions.
4. On the canvas, click **Select**.
5. From the dropdown list, select **Profile**.
6. Click the **unnamed** input that appeared on the canvas.
7. From the **Choose attribute** dropdown list, select the aggregate you have created before.
8. Click **Save**.
The formula of the expression
## Create a segmentation
---
In this part of the process, create a group of customers for whom the prediction will be made.
The conditions of the segmentation can be very complex. It usually makes sense to analyze customers with some activities observed, so in this use case, the segmentation contains customers who have at least one page visit during the last 30 days.
1. Go to **Decision Hub > Segmentation > New segmentation**.
2. Enter the name of the segmentation.
3. Create a segmentation of customers who visited your website in the last 30 days.
You can find the instructions on creating segmentations in the ["Creating segmentations"](/docs/analytics/segmentations/creating-segmentations) article.
4. Click **Save**.
Segmentation
## Create the prediction
---
In this part of the process, create a prediction for a selected group of customers. The prediction result will be available on the profile cards of these customers as a [`snr.prediction.score` event](/docs/ai-hub/predictions/custom#understanding-prediction-events). This event will contain the forecast result of the expression created in ["Create prediction target"](#create-prediction-target) and probability of receiving such result expressed in 5-point scale.
1. Go to **(AI Predictions) Models > New prediction**.
2. On the pop-up, select **Create from scratch**, and then select **Regression**.
### Select the audience
In this section, select the group of customers you created in [this part](#create-a-segmentation) of the process.
1. In the **Audience** section, click **Define**.
2. Click **Choose segmentation**.
3. Select the group of customers you created in [Create a segmentation](#create-a-segmentation) part of the process.
4. Click **Apply**.
### Select the target
1. In the **What would you like to predict?** section, click **Define**.
2. Click **Select expression**.
3. From the dropdown list, select the expression you created in the [Create prediction target](#create-prediction-target) part of the process.
### Select events
[Events](/docs/assets/events/introduction-to-events) are customer activities on the website (visits to a website, adding a product to a shopping cart, and so on) and also your activities towards customers (such as sending messages to them). Select the events that the system will use as input to make a prediction. By default, the list already contains the events recommended for the prediction you are creating. The contents of the list is defined while enabling [Custom predictions](/docs/ai-hub/predictions/enabling-predictions#enabling-regression-and-classification-predictions).
1. Leave the **Auto-select events** option toggle on.
### Schedule recalculation and result settings
In this section, define the frequency of recalculating the prediction and settings of the event that is generated for customers for whom the prediction is made.
1. In the **Prediction time window** section, from the **How many days in advance do you want to make a prediction?** dropdown list, select **90 days** as the number of days in advance.
The time must correspond to the time range selected earlier in the prediction target.
2. In the **Calculation frequency** section, leave the settings at default (**One-time calculation**). As a result, the prediction is run only one time.
3. In the **Prediction start** section, leave the settings at default (**Immediately**). As a result, the prediction is calculated immediately after saving.
4. In the **How would you like to display results?** section, leave the settings at default (**5-point scale**).
5. In the **Define the value of the score name parameter** section, in the **Name** field, enter the user friendly name of predictions scores. The score name parameter is shown in the `snr.prediction.score` event. In our case it is `Lifetime value`.
6. Click **Apply**.
7. Complete the prediction by clicking **Save&Calculate**.
**Result**: The calculation begins. After it completes, an event named [`snr.prediction.score`](/docs/ai-hub/predictions/custom#understanding-prediction-events) is saved to the customer profiles selected in the segmentation. The event will be available in the platform, for instance in Decision Hub, Behavioral Data Hub, and Automation Hub.
The prediction
## Create an aggregate
---
In this part of the process, create an aggregate that returns the prediction score.
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.prediction.score` event.
6. As the event parameter, select **score_label**.
7. Click **+where** and choose **modelId**.
To find the model ID, simply navigate to the prediction in the Synerise application. The ID is the part of the URL that comes after /prediction/, for example: **deoojrhqdkpp** in the URL `https://app.synerise.com/ai-v2/predictions/deoojrhqdkpp`. Copy this ID and use it in your code where needed.
8. As the operator choose **equal** and as the value add the ID of the prediction creadted [before](#create-the-prediction).
7. Set the period from which the aggregate will analyze the results to **Lifetime**.
12. **Save** the aggregate.
The aggregate
## Create a workflow
---
As the final part of the process, create a workflow which sends the customers' data to Google Cloud Storage.
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 (**one time**).
2. Choose option **Immediately**.
4. Confirm by clicking **Apply**.
The configuration of the Scheduled Run node
### Select customers to export
5. Add a **Get Profiles** node.
6. In the configuration of the node:
1. Select the segmentation you [created in the first part of the process](#create-a-segmentation).
2. In the **Attributes** section, select **name** **lastname** and **email**. You can also add more attributes based on your business needs.
The configuration of the Get Profiles node
7. In the **Aggregate Values** section, select the [aggregate which retrieves the prediction result](#create-an-aggregate).
8. In the **Belonging to segmentation** section, add the segmentation of loyalty members created as the part of the [prerequisites](#prerequisites).
3. Confirm by clicking **Apply**.
The configuration of the Get Profiles node
### Configure Send File node
1. Add **Google Cloud Storage > Send 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/send-file-to-gcp#create-a-connection).
- 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) to which you will send a file with data.
3. In the **Path to directory** field, enter the path to which the file will be saved in the bucket.
4. In the **File name** field, enter the name of the file you want to send to 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 in which the file will be saved in the storage.
6. Confirm by clicking **Apply**.
The configuration of the Send File node
In this case, we use the Google Cloud Storage export node. However, Synerise offers various built-in integrations for data exports, including Amazon, Facebook, and others. Additionally, by using Outgoing Integration, you can send data as a request to any external tool, providing flexibility and extensive possibilities for data distribution.
### 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 each item created in this use case on our Synerise Demo workspace:
- [Aggregate - prediction target](https://app.synerise.com/analytics/aggregates/84991085-f72c-3684-a1eb-57fc643830a8)
- [Expression](https://app.synerise.com/analytics/expressions/ee582e83-0667-4580-b509-1ad1cd4aaad0)
- [Segmentation](https://app.synerise.com/analytics-v2/segmentations/11295db2-80c2-464e-b9be-61fa8e78b98b)
- [Prediction](https://app.synerise.com/ai-v2/predictions/ylhrexxshcak)
- [Aggregate](https://app.synerise.com/analytics-v2/aggregates/fe0e4e86-a1bc-392e-9ff9-1ecb48b508dc) which retrieves the prediction results
- [Workflow](https://app.synerise.com/automations/workflows/automation-diagram/d4259a0a-5488-4b4a-92d9-ba65ee376c4e)
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:
[`snr.prediction.score`](/docs/assets/events/event-reference/predictions#snrpredictionscore) (~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), `googleCloudStorage.sendFile` (~1).
## Read more
---
- [Send File](/docs/automation/integration/google-cloud-storage/send-file-to-gcp)
- [Segmentations](/docs/analytics/segmentations)
- [Workflows](/docs/automation)
- [Prediction - Quick Start](/docs/ai-hub/predictions/custom)
# Mobile push with abandoned cart notification
The effectiveness of abandoned cart scenarios in mobile push notifications lies in their ability to significantly boost conversion rates by reminding customers about items they have shown interest in but have not yet purchased. This strategy leverages the power of timely, personalized communication to encourage users to complete their transactions, often incorporating incentives like discounts or free shipping to further entice the customer back to their cart.
In this use case, we will outline the steps to create an abandoned cart scenario specifically for mobile push notifications. The scenario begins when a customer adds items to their shopping cart but exits the app without completing the purchase. After a predetermined period of inactivity, the system triggers a push notification that is sent to the customer's mobile device.
Example mobile push with an abandoned cart items
## Prerequisites
---
- Add [product Feed](/developers/product-feed).
- Create [product catalog](/docs/assets/catalogs).
- 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), [Android](/developers/mobile-sdk/configuring-push-notifications/android).
- Implement the [transaction events](/developers/web/transactions-sdk) using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#tag/Events/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](/use-cases/abandoned-cart-mobile-push#create-an-aggregate).
2. [Create mobile push notification](/use-cases/abandoned-cart-mobile-push#create-mobile-push-template).
4. [Create a workflow](/use-cases/abandoned-cart-mobile-push#create-a-workflow).
## 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 mobile push notification.
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`](/docs/assets/events/event-reference/items#cartstatus) 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 mobile push template
---
1. Go to **Experience Hub > Mobile Push > Templates**.
2. You can use the template from the folder or create your own one using the mobile push code editor.
To use the template, click **New Template**.
3. Choose what type of message you want to create. In our case it's **Simple Push**.
4. Choose how you want to create mobile push message. In this use case we will use **Visual Builder**.
5. Create your mobile push message according to your business needs.
For more information on creating a mobile push, visit our [User Guide](/docs/campaign/Mobile/creating-mobile-push-templates).
Below you can find exemplary jinjava codes for the fields Message, URL and Image.
- In the **Message section**, we add the product title
- In the **URL section** given link to the product page.
- In the **Image section** added URL to the image, which is in the catalog.
**Message section**
You left {%aggregate 17d214c4-5644-33b1-b0c6-9fab96b26b3e %}
{% set id = aggregate_result[0].sku %}
{%catalogitemv2.store-1(id) %}
{%set itemObject=catalog_result%}
{{itemObject.name}}
{%endcatalogitemv2%}
{%endaggregate%} in your basket!
**URL section**
{%aggregate 17d214c4-5644-33b1-b0c6-9fab96b26b3e%}{% set id = aggregate_result[0].sku %}{%catalogitemv2.store-1(id) %}{%set itemObject=catalog_result%}{{itemObject.productUrl}}{%endcatalogitemv2%}{%endaggregate%}
**Image section**
{%aggregate 17d214c4-5644-33b1-b0c6-9fab96b26b3e%}{% set id = aggregate_result[0].sku %}{%catalogitemv2.store-1(id) %}{%set itemObject=catalog_result%}{{itemObject.image}}{%endcatalogitemv2%}{%endaggregate%}
**Usage:**
1. Replace aggregate ID with the ID you’d like to use.
2. In `{% set id = aggregate_result[0].sku %}` replace `sku` with the name of the catalog’s attribute that holds sku.
3. In `{%catalogitemv2.store-1(id) %}` replace `store-1` with the name of your item catalog.
4. In `{{itemObject.link}}`, `{{itemObject.name}}`, `{{itemObject.imageLink}}` make sure to put a correct name of an attribute which holds product’s **link**, **name** or **imageLink**.
To properly display icons on iOS, you need to pay attention to whether the **Mutable-Content** option is enabled.
Disabling this option will result in the icon not displaying on mobile push.
Mobile push template configuration
## Create a workflow
---
The workflow will be triggered by the [`product.AddToCart`](/docs/assets/events/event-reference/items#productaddtocart) event. The delay is defined up to 1 day. If a customer does not make a transaction within one day, we will send a push notification 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**.
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 `1`.
2. From the dropdown list, choose **Day**.
2. Click **Apply**.
Configuration of the Delay node
### 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`](/docs/assets/events/event-reference/items#transactioncharge) event.
2. Change **matching** to **not matching**.
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 filter conditions.
2. Click **Apply**.
### Define the Send Mobile Push node
---
1. Add the **Send Mobile Push** node to the **Matched** path.
2. In the settings of the node, choose the type of the mobile push and the template you have prepared [in the previous steps](/use-cases/abandoned-cart-mobile-push#create-mobile-push-template).
Configuration of the Send Mobile Push node
## Add the finishing node
---
1. Add the **End** node to the **Send Mobile Push** node and **Not Matched** path from the **Profile Filter** node.
2. In the upper right corner, click **Save & Run**.
Final view 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/17d214c4-5644-33b1-b0c6-9fab96b26b3e)
- [Mobile push template](https://app.synerise.com/campaigns/mobile-push/content-manager/template/129344)
- [Workflow](https://app.synerise.com/automations/automation-diagram/691feacc-8158-4986-abd1-2b12aabee328)
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.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).
## Read more
---
- [Automation Hub](/docs/automation)
- [Creating aggregates](/docs/crm/aggregates/creating-profile-aggregates)
- [Jinjava inserts](/developers/inserts/insert-usage)
- [Mobile notifications](/docs/campaign/Mobile/mobile_campaign)
# 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).
# A/B tests in emails
**A/B tests** in emails are used in the assessment of possible changes in the communication. The test allows you to easily and quickly evaluate which version is more targeted at the customer and has a higher impact on conversions. This allows you to easily **optimize communication with various customer segments**, especially since different groups may react in different ways to the same content.
In an A/B test you set up two or more variations of one email and send each to a specific percentage of your total recipients. Half of the test group is sent Version A, and the other half gets Version B. It doesn't have to be exactly 50-50, however. In Synerise **you can set up the customer allocation on your own**. The result, measured by opens and clicks, determines the best version.
Send test versions of the email to any number of selected users in order to evaluate the sales hypothesis. Using email A/B testing, you’ll also discover what actually works on your prospects and how to address them!
Example email A/B test
## Example of use - Retail industry
A client prepared an automation that allowed them to test the sending of 2 email templates to a part of their database. After a specified time (in this case after 24 hours), the other group not included in the test received the version with the higher CTR. The aim of the communication was to check how users reacted to the mailing, and to use this knowledge for other users not participating in the test (by sending them the template to which the test participants responded better).
## 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).
- [Import profile database](/docs/automation/actions/synerise-integrations/import-customers).
## Process
---
1. [Create the email templates](/use-cases/ab-test-mailing#create-the-email-templates).
2. [Prepare a metric](/use-cases/ab-test-mailing#prepare-a-metric)
3. [Create new workflow](/use-cases/ab-test-mailing#create-new-workflow).
## Create the email templates
---
Create the email templates you want to test in **Experience Hub -> Email** > , and save them using the **Save as a template** option.
## Prepare a metric
---
The next node we have to set up is the **Metric Filter** node. Add it to the third path for the group C. The value of the CTR indicator determines the winning version of the template. The formula of the metric must subtract the CTR of the template sent to group A from the CTR of the template sent to group B. If the result of the metric is greater than 0, it means that template A had higher CTR and wins. If the metric result is below 0, it means the CTR of the version B is higher.
1. Go to **Decision Hub > Metrics > New metric**.
2. Select the **Formula metric**.
The formula of the metric
3. Enter the unique names you will use for the **Send Email** nodes in the workflow you will create in further steps (for example SendTemplate).
4. **For the first bracket**, use the name of the node with template A, **for the second bracket** use the name of the node with template B.
- For the **newsletter.click** event, select **campaignTitle** parameter.
- For the **message.send** event, select **CampaignName** parameter.
The first bracket counting the CTR of template A The further part of the first bracket counting the CTR of template A
5. Click the second bracket, using the name of the **Send Email** node appropriate for group B and save the prepared metric and return to the automation.
## Create new workflow
---
1. Go to **Automation Hub > Workflow** and click the **New workflow** button.
2. Add your **Audience** - you can choose a segment of people with consent for email communication or you can select the **New audience** option and define your conditions for this specific automation (for example, if in addition to the fact that users have email consents enabled, they should have additional attributes/tags and so on).
3. **Add ABx Test node** to divide your audience into test groups.
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, 3 groups are created.
- **Group A**: 20% of the database
- **Group B**: 20% of the database
- **Group C**: the remaining 60% of the database
Screenshot presenting ABx Test node
4. From the **ABx Test** node, you have to add three different paths - for group A, group B and C.
1. The first path for **group A** must be connected to the **Send Email** node.
1. Double-click the **Send Email** node.
2. The **Sender details** are filled in by default, if you want to send your message from different email account, click **Change**.
3. In the **Content** section, enter the subject of the email (it will display in the inbox) and select the template.
4. Enter the name of the node (for example `SendTemplate A`).
This is required step and the name must be unique.
5. Optionally, you can fill in the UTM parameters.
6. After the **Send Email** node, add the **End** node.
Screenshot presenting Send Email node
2. In the second path for **group B**:
1. Double-click the **Send Email** node.
2. The **Sender details** are filled in by default, if you want to send your message from different email account, click **Change**.
3. In the **Content** section, enter the subject of the email (it will display in the inbox) and select the template.
4. Enter the name of the node (for example `SendTemplate B`).
This is required step and the name must be unique.
5. Optionally, you can fill in the UTM parameters.
6. After the **Send Email** node, add the **End** node.
3. In our case, **group C** is the largest group (60%) to which the winning template will be sent.
1. First, add the **Delay** node.
2. Make sure that the users have time to react to the emails sent to groups A and B in the test and that the appropriate amount of data is collected for the metric, so the winner can be determined.
3. The time unit depends on the customer, in our case it was **24 hours**.
Delay node
5. In the **Metric Filter** node, we can already define the metric prepared by us (we select it from the dropdown list) and it is necessary to add the condition that it should meet.We established that for the created metric, if it is greater than 0, template A won, if less than 0, then template B.
What if the CTR is equal and we get 0? To avoid surprises, we agreed with the customer that if CTRs are identical, then template A is sent. In the node, we set the metric to be equal to or greater than 0.
Metric Filter node
6. From the node prepared you can make two paths - if our metric meets the condition that we assumed or does not meet it.
1. Choosing a **matched path**, add the **Send Email** node and insert our template from **Metric Filter** node.
2. Add the **End** node.
The metric counts the difference between CTR A and CTR B, if it matches the result greater than or equal to 0, it means that our template A had a higher CTR and won.
7. Similarly, if our metric does not meet the condition assumed in the node, it means that the CTR of version B had to be greater, so we add the **Send Email** node with template B, and then add the **End** node.
8. Add **End** nodes where the workflow should finish for users.
9. Define **capping** (here 1 for 1 day).
10. Optionally, **add titles** for the rest of the nodes so the workflow will be more understandable to your colleagues.
11. **Name** the workflow.
12. To save it as a draft, click **Save it** or activate by clicking **Save & Run**.
The final automation
## Check the use case set up on the Synerise Demo workspace
---
Check the prepared [metric](https://app.synerise.com/analytics/metrics/d034567c-3616-4fb2-82b0-8fa4f89fb6d0) and [workflow](https://app.synerise.com/automations/automation-diagram/c5bb660f-5eeb-4dc4-b577-ae1a926a1d54) 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 8 events per profile that completes the flow:
[`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.abTestVariantAssigned`](/docs/assets/events/event-reference/automation#automationabtestvariantassigned) (~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
---
- [ABx Test node](/docs/automation/conditions/abx-split-node)
- [Automation Hub](/docs/automation)
- [Audience node](/docs/automation/triggers/audience-node)
- [Metrics](/docs/analytics/metrics)
- [Metric Filter node](/docs/automation/conditions/metric-filter-node)
# 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/authorization#tag/Authorization/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)
# Tracking in-store loyalty program registrations via QR codes for a store competition
Running competitions between physical stores is a proven way to motivate staff and increase loyalty program sign-ups. By assigning each store a unique QR code that links to the registration page, you can track exactly which store drove each new membership.
This use case describes how to set up end-to-end tracking and reporting of in-store loyalty program registrations in Synerise. Each physical store distributes a unique QR code containing a registration URL with a store identifier (for example, `https://www.example.com/create-account?store_ABC`). When a customer scans the code and completes the full registration process — e.g. submitting the form, confirming the account, and opting in to the newsletter — the registration is attributed to that store.
Synerise collects the relevant events, builds a segmentation of fully qualified registrations, and generates a monthly report broken down by store. This use case covers the full process up to the point where the report is ready — how you choose to distribute the results (for example, via email, SharePoint, or another external tool) depends on your specific business needs.
Based on the report, the business can reward the stores with the highest number of complete registrations in a given period.
All event names, attributes, and business rules described in this use case are specific to this implementation and serve as an example. For other projects, different naming conventions, conditions, or constraints may apply — for example, which store identifier is used, which marketing agreements are required, or what the time window between registration and confirmation should be.
## Prerequisites
---
- Implement a [tracking code](/docs/settings/tool/tracking_codes) on your website.
- Have an integrated registration form on the website so that when a customer completes the form, a `form.submit` event is generated on their profile. This event must contain at least the following parameters:
- `uri` — the full URL of the registration page (including the store identifier in the query string),
- `formType` — the type of form, for example with the value `registration`.
- Have a mechanism for tracking account confirmation. In this example, the `profile.updated` event is generated with the `activation` parameter set to `true` when a customer confirms their account.
- Have a mechanism for tracking newsletter agreement activation. In this example, the `marketingAgreement.turnOn` event is generated when a customer enables the newsletter agreement.
- Have a custom profile attribute (in this example, `subscriptionDate`) that stores the date when the customer opted in to the newsletter, in date format (`yyyy-mm-dd`). This attribute is not available by default — it must be implemented separately, for example by sending it from an external system or by creating a workflow that reacts to the `marketingAgreement.turnOn` event and saves the current date to this attribute on the customer's profile.
- Generate unique registration URLs per store with a consistent identifier pattern in the query string (for example, `?store_ABC`, `?store_XYZ`).
- Create [API keys](/docs/settings/tool/api#adding-api-keys) with appropriate permissions for report retrieval.
## Process
---
In this use case, you will go through the following steps:
1. [Create an event aggregate that returns the last registration form URI](#create-an-event-aggregate-for-registration-uri).
2. [Create a profile aggregate for account confirmation with store origin](#create-a-profile-aggregate-for-account-confirmation).
3. [Create a segmentation of fully qualified registrations](#create-a-segmentation-of-qualified-registrations).
4. [Create a report with monthly registration counts per store](#create-a-report-with-registration-counts-per-store).
## Create an event aggregate for registration URI
---
This aggregate returns the last URI from the `form.submit` event where the form type is `registration`. It will be used later in the profile aggregate and segmentation to check whether the registration originated from a store link.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Event**.
3. Enter a name for the aggregate, for example `Last URI from registration form submit`.
4. Set **Analyze events by** to **Last**.
5. From the **Choose event** dropdown list, select the `form.submit` event.
6. As the event parameter, select **uri**.
7. Click the **+ where** button.
8. From the **Choose parameter** dropdown list, select the **formType** parameter.
9. From the **Choose operator** dropdown, choose **Equal**.
10. In the next field, enter `registration`.
11. Set the time range to **Lifetime**.
12. Save the aggregate.
Configuration of the event aggregate returning the last registration form URI
## Create a profile aggregate for account confirmation
---
This aggregate returns the last timestamp of the `profile.updated` event where the account was confirmed (`activation` = `true`) and where the registration originated from a store link (the event aggregate from the previous step contains the store identifier). It will be used in the segmentation to verify the chronological order of events.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter a name for the aggregate, for example `Account confirmation timestamp after in-store registration`.
4. Set **Analyze profiles by** to **Last**.
5. From the **Choose event** dropdown list, select the `profile.updated` event.
6. As the event parameter, select **TIMESTAMP**.
7. Click the **+ where** button.
8. From the **Choose parameter** dropdown list, select the **activation** parameter.
9. From the **Choose operator** dropdown, choose **Equal**.
10. In the next field, enter `true`.
11. Click the **+ where** button.
12. From the **Choose parameter** dropdown list, select the event aggregate created in the [previous step](#create-an-event-aggregate-for-registration-uri).
13. From the **Choose operator** dropdown, choose **Contain**.
14. In the next field, enter the store identifier prefix, for example `store_`.
15. Set the time range to **Last month** (or adjust according to the reporting period).
16. Save the aggregate.
Configuration of the profile aggregate for account confirmation with store origin
## Create a segmentation of qualified registrations
---
In this part of the process, create a segmentation that identifies customers who completed a full loyalty program registration through a store link. A customer qualifies if they performed all of the following actions within 7 days, in any order:
- Submitted the registration form (`form.submit`) from a URL containing the store identifier.
- Confirmed their account (`profile.updated` with `activation` = `true`).
- Enabled the newsletter agreement (`marketingAgreement.turnOn`).
The segmentation consists of two segments connected by an **OR** operator. The reason for splitting the segmentation into two segments is that there are two distinct groups of customers who qualify:
- **Segment A** — customers who registered through the store QR code, confirmed their account, **and** opted in to the newsletter — all within 7 days. These are entirely new customers who completed the full process during the competition period.
- **Segment B** — customers who registered through the store QR code and confirmed their account within 7 days, but **already had the newsletter agreement from before** (for example, they subscribed via the website footer months ago). These customers did not need to opt in again — they only needed to register and confirm.
To track when the newsletter agreement was originally given, this implementation uses a custom profile attribute (in this example, `subscriptionDate`) that stores the date of the newsletter opt-in in date format (`yyyy-mm-dd`). It must be set up beforehand (see [Prerequisites](#prerequisites)).
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation, for example `Fully qualified in-store loyalty registrations`.
### Configure Segment A
---
Segment A captures customers who completed all three actions (form submission, account confirmation, newsletter opt-in) within 7 days. Because the events can happen in different orders (for example, newsletter agreement before or after account confirmation), you define two condition groups connected by **OR** to cover both orderings.
**First condition group:**
3. Click **Add condition**.
4. From the dropdown list, select the `form.submit` event.
5. Click the **+ where** button and select the **uri** parameter.
6. From the **Choose operator** dropdown, choose **Contain** and enter the registration page URL, for example `www.example.com/create-account`.
7. Click the **+ where** button and select the **uri** parameter again.
8. From the **Choose operator** dropdown, choose **Contain** and enter the store identifier prefix, for example `store_`.
9. Below the first condition, in the **and then...** section, click **Add condition**.
10. From the dropdown list, select the `profile.updated` event.
11. Click the **+ where** button and select the **activation** parameter.
12. From the **Choose operator** dropdown, choose **Equal** and enter `true`.
13. Click the **+ where** button and select the event aggregate created [earlier](#create-an-event-aggregate-for-registration-uri).
14. From the **Choose operator** dropdown, choose **Contain** and enter the store identifier prefix, for example `store_`.
15. Click the **+ where** button and select the **TIMESTAMP** parameter.
16. From the **Choose operator** dropdown, choose **Custom** and set the date range to the reporting period (for example, `1 Feb 2026, 00:00` to `28 Feb 2026, 23:59`).
The custom date range on the TIMESTAMP parameter should be adjusted each month to match the reporting period, or the segmentation should be configured to use a dynamic time range.
17. In the **and then...** section, click **Add condition**.
18. From the dropdown list, select the `marketingAgreement.turnOn` event.
19. Click the **+ where** button and select the **TIMESTAMP** parameter.
20. From the **Choose operator** dropdown, choose **Custom** and set the same date range as above.
21. Set the completion window to **Completed within 7 Days**.
22. Set the time range to **Lifetime**.
Configuration of the first condition group in Segment A
**Second condition group:**
23. Click **Add condition**.
23. Click **Or** to add an alternative condition group.
24. Configure the same three events (`form.submit`, `marketingAgreement.turnOn`, `profile.updated`) but in a different order to account for customers who enabled the newsletter agreement before confirming their account.
25. Apply the same filters, time ranges, and the 7-day completion window.
Configuration of the second condition group in Segment A
### Configure Segment B
---
Segment B captures customers who registered through the store QR code and confirmed their account within 7 days, but already had the newsletter agreement from before the registration. This segment consists of two parts connected by an **AND** operator.
**Part 1 — Performed action:**
This part verifies that the customer submitted the registration form from a store link and confirmed their account within 7 days during the reporting period. Unlike Segment A, there is no `marketingAgreement.turnOn` event here — the newsletter opt-in happened earlier.
26. Click **Add segment** to create Segment B.
27. Click **Add condition**.
28. From the dropdown list, select the `form.submit` event.
29. Click the **+ where** button and select the **uri** parameter.
30. From the **Choose operator** dropdown, choose **Contain** and enter the registration page URL, for example `www.example.com/create-account`.
31. Click the **+ where** button and select the **uri** parameter again.
32. From the **Choose operator** dropdown, choose **Contain** and enter the store identifier prefix, for example `store_`.
33. Below the first condition, in the **and then...** section, click **Add condition**.
34. From the dropdown list, select the `profile.updated` event.
35. Click the **+ where** button and select the **activation** parameter.
36. From the **Choose operator** dropdown, choose **Equal** and enter `true`.
37. Click the **+ where** button and select the event aggregate created [earlier](#create-an-event-aggregate-for-registration-uri).
38. From the **Choose operator** dropdown, choose **Contain** and enter the store identifier prefix, for example `store_`.
39. Click the **+ where** button and select the **TIMESTAMP** parameter.
40. From the **Choose operator** dropdown, choose **Custom** and set the date range to the reporting period (for example, `1 Mar 2026, 00:00` to `31 Mar 2026, 23:59`).
41. Set the completion window to **Completed within 7 Days**.
42. Set the time range to **Lifetime**.
**Part 2 — Has property (chronological check):**
This part verifies that the customer's newsletter opt-in date (`subscriptionDate` attribute) is earlier than the account confirmation timestamp. This means the customer had already subscribed to the newsletter before completing the in-store registration.
43. Below the performed action block, click **Add condition** and select **Has property**.
44. Select the `subscriptionDate` attribute (a custom attribute storing the date when the customer opted in to the newsletter).
45. From the **Choose operator** dropdown, choose **Less than**.
46. As the value, select the profile aggregate for account confirmation created in [the earlier step](#create-a-profile-aggregate-for-account-confirmation).
Configuration of Segment B with registration from store and pre-existing newsletter agreement
### Finalize the segmentation
---
1. Connect Segment A and Segment B using the **OR** operator (visible in the top-right corner of the conditions panel). A customer qualifies if they match **either** Segment A (all three actions within 7 days) **or** Segment B (registration + confirmation within 7 days, with a pre-existing newsletter agreement).
2. Save the segmentation.
## Create a report with registration counts per store
---
In this part of the process, create a report that returns the number of qualified registrations broken down by store and month. Before creating the report itself, you need to prepare several supporting analyses. The full list of elements to create in this section is:
1. **Metric** — counts profiles matching the segmentation of qualified registrations.
2. **Aggregate: Newsletter agreement timestamp after in-store registration** — returns the last `marketingAgreement.turnOn` timestamp for store-originated registrations.
3. **Aggregate: Account confirmation timestamp after in-store registration** — returns the last `profile.updated` timestamp for confirmed accounts from store-originated registrations.
4. **Expression: `TIMESTAMP`** — returns the earlier available timestamp (newsletter agreement or account confirmation) using `IfNull`.
5. **Aggregate: `Last_store`** — returns the last store identifier from `form.submit`, filtered by store origin and timestamp.
6. **Expression: `Data`** — extracts the registration date (year-month) from the timestamp for grouping by month.
7. **Expression: `Data_Store`** — combines the registration date with the store identifier into a single dimension.
8. **Report** — uses the metric and the three dimensions above.
### Create a metric for counting qualified registrations
---
This metric counts all profiles that belong to the segmentation created in the [previous step](#create-a-segmentation-of-qualified-registrations). It will be used as the base metric for the report.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric, for example `Count of in-store loyalty registrations`.
3. As the metric kind, select **Simple metric**.
4. As **Type**, select **Profile**.
5. As **Aggregator**, select **Count**.
6. Click the filter icon to add a profile filter.
8. From the **Choose filter** dropdown, select the segmentation created in the [previous step](#create-a-segmentation-of-qualified-registrations).
9. From the **Choose operator** dropdown, choose **Is true (Boolean)**.
10. Confirm by clicking **Apply**.
11. Save the metric.
Configuration of the metric counting profiles from the qualified registrations segmentation
### Create an aggregate for newsletter agreement timestamp after in-store registration
---
This aggregate returns the last timestamp of the `marketingAgreement.turnOn` event for customers whose registration originated from a store link. It will be used in the expressions that serve as report dimensions.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter a name for the aggregate, for example `Newsletter agreement timestamp after in-store registration`.
4. Set **Analyze profiles by** to **Last**.
5. From the **Choose event** dropdown list, select the `marketingAgreement.turnOn` event.
6. As the event parameter, select **TIMESTAMP**.
7. Click the **+ where** button.
8. From the **Choose parameter** dropdown list, select the event aggregate created in the [first step](#create-an-event-aggregate-for-registration-uri) (last URI from registration form submit).
9. From the **Choose operator** dropdown, choose **Contain (String)**.
10. In the next field, enter the store identifier prefix, for example `store_`.
11. Set the time range to **Last 1 months before 1 months** (this ensures the aggregate covers the previous month's data for reporting purposes).
12. Save the aggregate.
Configuration of the aggregate for newsletter agreement timestamp after in-store registration
### Create an aggregate for account confirmation timestamp after in-store registration
---
This aggregate returns the last timestamp of the `profile.updated` event where the account was confirmed and the registration originated from a store link. It will be used as the fallback value in the `TIMESTAMP` expression — for customers who already had the newsletter agreement before the registration and therefore did not trigger the `marketingAgreement.turnOn` event during the process.
This aggregate uses the same event and conditions as the [profile aggregate for account confirmation](#create-a-profile-aggregate-for-account-confirmation) created earlier in the process, but its time range is set to **Last 1 months** to align with the monthly reporting cycle. You can reuse the same aggregate if the time range matches, or create a separate one for reporting purposes.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter a name for the aggregate, for example `Account confirmation timestamp after in-store registration`.
4. Set **Analyze profiles by** to **Last**.
5. From the **Choose event** dropdown list, select the `profile.updated` event.
6. As the event parameter, select **TIMESTAMP**.
7. Click the **+ where** button.
8. From the **Choose parameter** dropdown list, select the **activation** parameter.
9. From the **Choose operator** dropdown, choose **Equal**.
10. In the next field, enter `true`.
11. Click the **+ where** button.
12. From the **Choose parameter** dropdown list, select the event aggregate created in the [first step](#create-an-event-aggregate-for-registration-uri) (last URI from registration form submit).
13. From the **Choose operator** dropdown, choose **Contain**.
14. In the next field, enter the store identifier prefix, for example `store_`.
15. Set the time range to **Last 1 months**.
16. Save the aggregate.
Configuration of the aggregate for account confirmation timestamp after in-store registration
### Create the TIMESTAMP expression
---
This expression returns the earliest available timestamp from the registration process — either the newsletter agreement timestamp or the account confirmation timestamp. It uses the `IfNull` function: if the newsletter agreement timestamp is available, it is returned; otherwise, the account confirmation timestamp is used as a fallback. This expression will be referenced in the `Last_store` aggregate (to ensure the form submission occurred before the confirmation) and serves as a building block for other report dimensions.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression: `TIMESTAMP`.
3. Set **Expressions for** to **Attribute**.
4. Build the formula using the following structure:
- **IfNull** - newsletter agreement timestamp aggregate, account confirmation timestamp aggregate
- The first argument is the aggregate for the newsletter agreement timestamp after in-store registration (created in the [previous step](#create-an-aggregate-for-newsletter-agreement-timestamp-after-in-store-registration)).
- The second argument (fallback) is the profile aggregate for account confirmation created [earlier](#create-a-profile-aggregate-for-account-confirmation).
5. Save the expression.
Configuration of the TIMESTAMP expression
### Create the Last_store aggregate
---
This aggregate returns the last store identifier extracted from the `form.submit` event. It filters for registrations that came from a store link and whose timestamp is earlier than the registration confirmation timestamp (using the `TIMESTAMP` expression). It will be used directly as a report dimension and also within the `Data_Store` expression.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
3. Enter a name for the aggregate: `Last_store`.
4. Set **Analyze profiles by** to **Last**.
5. From the **Choose event** dropdown list, select the `form.submit` event.
6. As the event parameter, select the parameter that contains the store identifier extracted from the URI (for example, `fd:lastStore_`).
7. Click the **+ where** button and select the **uri** parameter.
8. From the **Choose operator** dropdown, choose **Contain (String)** and enter the registration page URL, for example `www.example.com/create-account`.
9. Click the **+ where** button and select the **uri** parameter again.
10. From the **Choose operator** dropdown, choose **Contain (String)** and enter the store identifier prefix, for example `store_`.
11. Click the **+ where** button and select the **TIMESTAMP** parameter.
12. From the **Choose operator** dropdown, choose **Less than (Date)**.
13. As the value, select the `TIMESTAMP` expression created in the [previous step](#create-the-timestamp-expression).
14. Set the time range to **Lifetime**.
15. Save the aggregate.
Configuration of the Last_store aggregate
### Create the Data expression
---
This expression returns the registration date (used as a report dimension to group results by month). It uses the `Regexp` and `IfNull` functions to extract the date from one of two aggregates: the newsletter agreement timestamp or the account confirmation timestamp — whichever is available first.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression: `Data`.
3. Set **Expressions for** to **Attribute**.
4. Build the formula using the following structure:
- **Regexp** ( **IfNull** ( `[newsletter agreement timestamp aggregate]` , `[account confirmation timestamp aggregate]` ) , `......` )
- The first argument of `IfNull` is the aggregate for the newsletter agreement timestamp after in-store registration (created in the step above).
- The second argument (fallback) is the profile aggregate for account confirmation created [earlier](#create-a-profile-aggregate-for-account-confirmation).
- The `Regexp` pattern (`......`) extracts the date portion (for example, year-month) from the timestamp.
5. Save the expression.
Configuration of the Data expression
### Create the Data_Store expression
---
This expression combines the registration date with the store identifier into a single dimension. It uses the `Concat` function to join the date (extracted via `Regexp` and `IfNull`, same logic as in `Data`) with a separator (`_`) and the `Last_store` aggregate.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression: `Data_Store`.
3. Set **Expressions for** to **Attribute**.
4. Build the formula using the following structure:
- **Concat** ( **Regexp** ( **IfNull** ( `[newsletter agreement timestamp aggregate]` , `[account confirmation timestamp aggregate]` ) , `......` ) , **Concat** ( `_` , `Last_store` ) )
- The inner `Regexp(IfNull(...))` portion is the same logic as in the `Data` expression — it extracts the date from the first available timestamp.
- The outer `Concat` appends an underscore and the store identifier from the `Last_store` aggregate.
5. Save the expression.
Configuration of the Data_Store expression
### Configure the report
---
Now that all the required analyses are ready, create the report.
1. Go to **Decision Hub > Reports > New report**.
2. Enter the name of the report, for example `Monthly in-store loyalty registrations by store`.
3. Click **Choose metric** and from the dropdown list, select the metric created [above](#create-a-metric-for-counting-qualified-registrations).
4. From the **Range** dropdown list, select **Top 1000**.
5. In the **Dimension** section, add the following dimensions:
- `Data_Store` — the expression combining date and store identifier.
- `Data` — the expression returning the registration date.
- `Last_store` — the aggregate returning the store identifier.
6. Set the **Format** to `19 000,7` for all dimensions.
7. Enable the **Show null values** toggle.
8. Set the time range to **Lifetime**.
9. Save the report.
Configuration of the report with metric and three dimensions
**Result:** The report returns a table with the month of registration, the store name, and the number of customers who completed a full registration from that store.
To ensure the report always returns data for the previous month without manual adjustments, set all aggregates used in the segmentation and report dimensions to a relative time range such as **Last month** or **Last 1 months before 1 months**. This way, the segmentation and report will automatically shift to the correct period each month, and the only element that may still require a manual update is the custom TIMESTAMP range inside the segmentation conditions (if used).
## What's next
---
Once the report is configured and saved, you can distribute the results in a way that best fits your business needs. Some common options include:
- **Email** — use a workflow with the [Send Email](/docs/campaign/e-mail) node to deliver the report results directly to the relevant stakeholders on a scheduled basis.
- **External systems (e.g. Microsoft SharePoint, Google Sheets)** — use a workflow with [Outgoing Integration](/docs/automation/integration/outgoing-webhook) nodes to authenticate with the external API, generate the report via the Synerise API, transform the data using Jinjava, and upload it to the target location.
- **Dashboards** — add the report to an [analytical dashboard](/docs/analytics/analytics-dashboard) for convenient, real-time access within Synerise.
- **CSV export** — [export the report to a CSV file](/docs/analytics/reports/exporting-reports-to-file) manually or automate the process via a workflow.
In each case, you can automate the delivery by creating a workflow triggered on a schedule (for example, on the first day of each month) that generates the report and sends or uploads the data to the desired destination.
## 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:
- [Event aggregate – Last URI from registration form submit](https://app.synerise.com/analytics-v2/aggregates/e72afcda-7fd2-34e1-8799-3103e084ca6b)
- [Profile aggregate – Account confirmation timestamp after in-store registration](https://app.synerise.com/analytics-v2/aggregates/650cc8a7-705f-3ee8-bb63-ca38d4b57ef1)
- [Aggregate – Newsletter agreement timestamp after in-store registration](https://app.synerise.com/analytics-v2/aggregates/e30e3df1-4fd3-3bdd-8a56-6f30255839c3)
- [Expression – TIMESTAMP](https://app.synerise.com/analytics/expressions/e669fe4a-a3f2-48b9-ba2f-1af01055a2b8)
- [Aggregate – Last_store](https://app.synerise.com/analytics-v2/aggregates/a69e3775-b29f-3554-8b3b-bff1af9ba3f8)
- [Expression – Data](https://app.synerise.com/analytics/expressions/689ceb85-4396-419e-8dfa-07601d90fe41)
- [Expression – Data_Store](https://app.synerise.com/analytics/expressions/85c84329-06db-41c4-8009-a6f95d80ef0f)
- [Metric – Count of in-store loyalty registrations](https://app.synerise.com/analytics/metrics/b155b6a7-9635-4068-9cb9-1252e51a9e15)
- [Segmentation – Fully qualified in-store loyalty registrations](https://app.synerise.com/analytics-v2/segmentations/f461624f-4a3f-49a8-b1d3-9ce6ac2439cc)
- [Report – Monthly in-store loyalty registrations by store](https://app.synerise.com/analytics/reports/73e49afa-29dd-4f3a-b02b-307abe871e7f)
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/creating-profile-aggregates)
- [Segmentations](/docs/analytics/segmentations/creating-segmentations)
- [Reports](/docs/analytics/reports/creating-reports)
- [Exporting reports to a file](/docs/analytics/reports/exporting-reports-to-file)
- [Metrics](/docs/analytics/metrics/creating-simple-metrics)
- [Expressions](/docs/crm/expressions/creating-expressions)
- [Dashboards](/docs/analytics/analytics-dashboard)
- [Outgoing Integration](/docs/automation/integration/outgoing-webhook)
- [Creating workflows](/docs/automation/creating-automation)
# 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)
# Return External Source error details to content with a Response Transformer
An invalid latitude causes the weather API in this example to return an error instead of temperature data. Capturing that response makes its error details available to a Brickworks response transformer.
In this use case, you will extend the [weather example](/use-cases/brickworks-prepare-current-temperature-data) to return a temperature for valid coordinates and an error message for invalid coordinates. A content consumer can use the resulting error flag to distinguish these two outcomes.
This option handles an external source that responds with an error. It does not handle connection failures such as timeouts or DNS errors, and this article does not describe recovery from those failures.
## Prerequisites
---
- Complete [Prepare current temperature data for content with Brickworks](/use-cases/brickworks-prepare-current-temperature-data), including the external request and context configuration.
- Keep the existing Open Meteo Connection external source available for reuse.
- Have [permissions](/docs/settings/identity-access-management/permissions/data-management-permissions#work-with-brickworks) to create an additional schema and configure its External Data field and response transformer.
## Process
---
In this use case, you will go through the following steps:
1. [Create a separate schema for error handling](#create-a-separate-schema-for-error-handling) that reuses the weather external source.
2. [Enable error details on its External Data field](#enable-error-details-on-the-external-data-field).
3. [Create the error-handling transformer](#create-the-error-handling-transformer) with successful-response and error-response branches.
4. [Preview successful and failed responses](#preview-successful-and-failed-responses) before activating the transformer.
## Create a separate schema for error handling
---
Use a separate schema for this example so that its output can be tested independently from the original schema. Reuse the external source without changing its request configuration.
1. Go to **Data Modeling Hub > Schemas > New schema**.
2. Set **Display name** to `Current Temperature (Error Handling)`
3. Set the schema type to **Singleton**.
4. Add an **External Data** field with the display name `Open Meteo Connection`
5. Set the field's API name to `openMeteoConnection`, which the transformer below references.
6. Select the existing `Open Meteo Connection` external source.
## Enable error details on the External Data field
---
1. Open the configuration of `openMeteoConnection` in the new schema.
2. Enable **Return error details when the source responds with an error**.
3. Save the schema.
A successful call returns the weather payload with `current` and `current_units`, without a `response.status` key. The transformer below uses this difference to select a branch.
External source field configuration
## Create the error-handling transformer
---
For the invalid latitude example, the field returns an object that contains an HTTP status and the provider's error body. The relevant excerpt is:
```json
{
"response.status": 400,
"response.body": {
"reason": "Latitude must be in range of -90 to 90°. Given: 200.0.",
"error": true
}
}
```
The keys `response.status` and `response.body` contain literal dots. The transformer accesses them with bracket notation, such as `weather["response.status"]`
The transformer returns `error: false` with the temperature after a successful request. For the documented error response, it returns `error: true`, a placeholder temperature, and an error message.
1. In the schema editor, open **Response transformers**.
2. Select **Edit > Add transformer**.
3. Name the transformer `Error Handling`
4. Enter the following script:
{
var weather = generated.openMeteoConnection;
if (weather["response.status"]) {
var body = weather["response.body"] || {};
return {
temperature: "N/A",
error: true,
errorMessage: body.reason || "Unknown error"
};
}
return {
temperature: weather.current.temperature_2m + weather.current_units.temperature_2m,
error: false
};
}
5. Click **Save** or **Save and close**.
Error handling transformer script
The script is specific to the response shapes above. It does not handle every possible missing or malformed payload. Its `Unknown error` fallback covers a missing or empty `reason` in the selected error branch; it is not a fallback for timeouts or failed record generation.
## Preview successful and failed responses
---
1. Open the record preview:
1. Set the context.
2. Select `Error Handling` on the **Transforming response** tab.
Use the inactive transformer for these checks before you change the active configuration.
### Check valid coordinates
---
1. Use the [record preview](/docs/assets/brickworks/quick-start/creating-a-record#previewing-records) to check the results.
1. Set the context in **Additional parameters** to `lat` to `50` and `lng` to `20`.
2. On the **Transforming response** tab, select the `Error Handling` transformer.
2. Generate the preview.
3. Check that `error` is `false` and that `temperature` combines the value and unit returned by the weather provider.
For the sample weather response, the preview returns:
```json
{
"temperature": "23.6°C",
"error": false
}
```
The temperature can differ in a new request.
### Check invalid coordinatesf
---
1. Use the [record preview](/docs/assets/brickworks/quick-start/creating-a-record#previewing-records) to check the results.
1. Set the context in **Additional parameters** to `lat` to `200` and keep `lng` at `20`
2. On the **Transforming response** tab, select the `Error Handling` transformer.
2. Generate the preview.
3. Check that `error` is `true`, `temperature` is `N/A`, and `errorMessage` contains the provider's reason.
For the sample error response, the preview returns:
```json
{
"temperature": "N/A",
"error": true,
"errorMessage": "Latitude must be in range of -90 to 90°. Given: 200.0."
}
```
Once the preview results are confirmed, select `Error Handling` as the active transformer for this schema, click **Apply**, and save the schema when ready to use the output.
Preview record
## What's next
---
For another external source, define which provider responses represent each business outcome, then map them to the fields expected by the consumer. Adapt and test the condition and error-body handling for that source instead of reusing the weather-specific script unchanged.
## Read more
---
- [Brickworks](/docs/assets/brickworks)
- [Response transformers](/docs/assets/brickworks/response-transformers)
# Time-window event aggregates
*"How much revenue did this email drive? Did the push notification lead to a purchase? Which campaign gets credit for the sale?"* - the usual answer comes in one of two forms, and each has a drawback. You can build the metric logic and formulas by hand, but joining a click to a later purchase this way relies on approximations — proxies for the link between the two events — so the result is never fully accurate. Alternatively, you can export the raw events and wait for the BI or analytics team to join clicks to purchases for you, which arrives days later as a static spreadsheet that cannot be refreshed. A third option avoids both drawbacks: a single metric that returns the number directly.
The difference from the hand-built approach is not the number of metrics involved — it is how the link between the two events is made. A time-window event aggregate tracks a triggering event (for example, a `newsletter.click`) within a defined rolling window. When this aggregate is attached as a condition to a metric built on a base event (for example, each `transaction.charge`), it checks, for every occurrence of the base event, whether the triggering event happened first, within that window. The link between the action and the outcome is established at the event level — not approximated — without hand-built formulas and without an export to refresh. Because it runs on first-party events rather than tracking pixels, the result is not affected by cookie consent or cross-device behavior.
This builds on a familiar idea: a standard Last aggregate returns a profile's most recent value within a date range. An event aggregate applies the same Last logic at the event level — it evaluates each occurrence of the base event and looks at what happened before it — so the defined window only sets how far back it checks for the triggering event.
The key characteristic of this aggregate: it returns nothing on its own. It is a condition attached to a base event. You are not asking *"what did each customer do"* — you are asking *"of all these purchases, which ones followed the triggering action within the window."* This applies to any scenario where one action causes a later outcome inside a known time horizon: email, push, in-app, recommendations, or in-store visits.
This use case shows how to build that metric, step by step, using email attribution as the example.
## Example - Email attribution
---
**Business question:** *"How many transactions can we credit to the newsletter, and to which campaign specifically?"*
**Why this matters:** Open Rate and CTR tell you that people engaged with the email. They do not tell you that anyone bought anything. Without connecting the click to the transaction, email's contribution to revenue stays an assumption rather than a measured number. This use case provides the number, and it holds up against cookie consent, ad-blockers, and cross-device behavior, because it runs on first-party events rather than tracking pixels.
The three levels below are not three separate metrics. They are one metric, extended step by step. On its own it returns a single number (Level 1). Add a dimension and that same number splits into a table, one row per campaign (Level 2). Expose its parameter as a dynamic key and a user can enter any campaign and read its result on a dashboard (Level 3). The attribution logic stays identical at every level; what changes is only the dimension or parameter added on top. The [Process](#process) section builds it.
### Level 1 - Total
*"How much did the newsletter drive overall?"*
One number: the count of transactions that happened within 24h of any newsletter click.
**What decisions you can make based on the metric result:**
- Defend or challenge the email channel's revenue contribution in a business review.
- Track the trend over time — is email-driven revenue growing or declining?
- Set the baseline before testing a new send strategy.
### Level 2 - Per campaign
*"Which campaign gets the credit?"*
The same logic, broken out into a table — one row per campaign, showing how many post-click transactions each one drove. In this variant, the metric is used inside a report, with the campaign ID set as a dimension. The metric returns the attributed transaction count; the report is what breaks it into one row per campaign.
**What the report shows:** a table of `campaignId` (or `campaignName`) | transactions attributed.
**What decisions you can make based on the metric result:**
- Stop crediting campaigns with high open rates that drive clicks but no purchases.
- Identify the subject lines or offers that convert, not just engage.
- Reallocate send budget toward campaigns with proven downstream revenue.
### Level 3 - Self-serve
*"Let marketers check any campaign themselves."*
The same metric, exposed as a dashboard field where a user enters a campaign ID and instantly sees that campaign's attributed transactions. It uses last-click logic, so a purchase is credited only to the most recent newsletter click before it (if a customer clicks campaign X and then campaign Y, only Y receives the sale).
**What decisions you can make based on the metric result:**
- Hand campaign owners a self-service answer instead of a request to the analytics team.
- Wire the dashboard directly to email communications so the campaign context is passed automatically.
- Standardize how the whole team measures email-driven revenue.
## Prerequisites
---
The [Process](#process) below builds the total and per-campaign version step by step. All logic is configured inside Synerise using analytics features. No SQL, API, or external attribution tool is required. The same steps apply to other triggering actions — only the events and the window change. For more examples, see [Other applications](#other-applications).
- Both events must be tracked — the triggering event (for example, the `newsletter.click`) and the outcome event (for example, `transaction.charge`).
- For a breakdown, the identifying parameter must be on the event - e.g. `newsletter.click` must carry a campaign id if you want results split by campaign.
- Decide the attribution window up front (24h / 48h / 72h). This is a business decision, not a technical default — see the note in the [Process](#process) section.
- The events you want to analyze must already exist in the workspace. For building the aggregate and the metric, see [Creating event aggregates](/docs/crm/aggregates/creating-event-aggregates) and [Creating simple metrics](https://hub.synerise.com/docs/analytics/metrics/creating-simple-metrics/).
Understand the model - the aggregate alone returns nothing. It only produces results once attached as a condition to a base event inside a metric.
- For the self-serve dashboard: the dynamic key must be named exactly (lowercase, for example `id`) so the predefined parameter passing from communications works. See [Creating dashboards](https://hub.synerise.com/docs/analytics/analytics-dashboard/creating-dashboards/).
## Process
---
In this use case, you will go through the following steps:
1. Create an **event aggregate**.
1. Analyze events by **Last – Time Window** type.
2. Select the `newsletter.click` event to aggregate by chosen function.
3. As the event parameter, select **TIMESTAMP**,
4. Set the **Time window** to 24 hours.
Configuration of the event aggregate
The aggregate returns nothing on its own; this is expected, because it acts as a condition.
2. Create a **simple metric**.
1. Set the **Type** to **Event** and the **Aggregator** to **Count**.
2. Select the `transaction.charge` event.
3. As the event parameter, select the aggregate created in the previous step.
4. Add a condition that the event aggregate **Is not null**.
Configuration of the metric with the aggregate used as a condition
3. Optionally, go deeper:
- **Per campaign** — add a second event aggregate that returns the campaign ID, and use it as a dimension in a report.
- **Self-serve** — set the aggregate's parameter as a dynamic key (/docs/analytics/i_events-parameter-value#how-to-create-a-dynamic-key) (regex value `.` matches all when the field is left blank, and a specific value when filled), then add a matching profile filter on the metric so Synerise treats it as dynamic.
**Attribution Choices - read this before you rely on the number.**
- **Window length is a tradeoff.** Too short and you under-credit the channel (slow buyers fall outside the window); too long and you over-credit it (purchases that would have happened anyway get attributed). Choose the window deliberately, per purchase cycle.
- **This is last-click, single-touch attribution.** Earlier clicks receive no credit. This fits the question *"which campaign closed the sale"*; it is not the right model for *"which campaign started the journey."* Confirm which question you are answering.
## What's Next
---
After building the metric, you can:
- Tune the window to match the real purchase cycle for each channel.
- Break down the result by campaign using a report dimension.
- Make it self-serve with [a dynamic-key dashboard](/docs/analytics/analytics-dashboard/creating-dashboards#dynamic-data-in-dashboards) wired to your communications, so the campaign context is passed automatically.
- Pin to a dashboard and set alerts when attributed revenue drops.
- Reuse the same three steps for push, in-app, recommendations, and in-store scenarios.
## Other applications
---
The same setup — a triggering event, a time window, and a base event — answers other questions. These are applications of the same pattern, not pre-built reports. Only the events and the window change.
| Triggering action | Outcome (base event) | Question it answers |
| --- | --- | --- |
| Push click / push delivered | `transaction.charge` | How much revenue followed a push within 24–48h? |
| In-app banner or message view | `transaction.charge` | Did the in-app campaign convert, or was it only seen? |
| Recommendation click | `product.buy` | Did the recommendation lead to an actual purchase, not just a click? |
| Abandoned-cart reminder sent | `transaction.charge` | What share of reminded carts were recovered in the window? |
| App open | `transaction.charge` | Do app sessions convert to a purchase within the day? |
The window length is the lever: match it to the realistic decision cycle for that action.
## Read more
---
- [Event aggregates](/docs/crm/aggregates/creating-event-aggregates)
- [Metrics](/docs/analytics/metrics)
- [Reports](/docs/analytics/reports)
- [Creating reports](/docs/analytics/reports/creating-reports)
- [Dashboards](/docs/analytics/analytics-dashboard)
# Promote Customer's Favorite Brand in Personalized Recommendations
If you know what the customer's favorite brand is (for example, from a poll), you can adjust the recommendations to include that brand more often.
This can be done by using **recommendation boosting** to promote items from that brand. 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 article explains how to build a filter that matches the item's brand (item attribute) with the customer's favorite brand (customer profile attribute). You can use the mechanism for different attributes that you collect in customer's profiles, such as size, favorite color, favorite style, and so on.
## 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 customer profile must include an attribute that denotes the customer's favorite brand.
In this example, the attribute is called `favoriteBrand`.
## 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 matches the `favoriteBrand` attribute in the customer's profile.
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. Click the value type icon () a few times until it changes to the customer value icon ().
7. From the **Select value** drop-down list, select **favoriteBrand**.
8. Click **Apply**.
9. 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 the customer's favorite brand
### 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.
## 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)
# Adform integration
Adform integration empowers businesses to extend their reach and connect with specific segments and similar audiences, capitalizing on Adform's extensive partner network. By seamlessly sending user segments from Synerise to Adform, you can reach not only users within your predefined segments but also individuals who share striking similarities with them. This can be a valuable tool for increasing advertising effectiveness, brand awareness, driving traffic to your website and boosting sales.
In this use case, you will create dynamic content that assigns the adFormID attribute to customers and a workflow that sends segments of customers to Adform.
## Prerequisites
---
- Have an Adform account.
- Create API keys according to [this](/docs/settings/tool/api#adding-api-keys) instruction, and add appropriate permissions. Screenshot below shows all the required permissions:
Permissions required for this use case
## Process
---
In this use case, you will go through the following steps:
1. [Match ID Cookie on Web](#match-id-cookie-on-web), create Dynamic Content assigning AdformID value to site customers.
2. [Match ID Cookie on Mobile](#match-id-cookie-on-mobile), send a custom event assigning AdformID value to mobile customers.
3. [Save Adform ID as an attribute](#save-adform-id-as-an-attribute).
4. [Create a workflow to sends a group of customers to Adform](#create-a-workflow-to-share-segmentation).
## Match ID Cookie on Web
---
In this part of the process, you match the Adform ID with your customer's profile in Synerise.
In the browser, Adform issues an ID in a cookie named `uid` from the `adform.co.uk` domain. This cookie is unique within your browser and resets itself in the following cases:
- Clearing cookies in the browser
- Expiration of a cookie (60 days)
- Mechanisms on the website that enforce the right of users to be forgotten (clearing cookies)
This value is not returned by calling `document.cookie`.
Since one customer can use multiple devices, it is necessary to store multiple Adform IDs per a customer in Synerise. The Adform ID is stored in the `adFormID` attribute, which will take values separated by `|` (the unique Adform ID collected from the browser or application), for example:
`"adFormID": "2122903280729231000|2122903280729231001"`
You can prepare a dynamic content with the code that matches the Adform ID with the UUID from Synerise by adding a value to the `adFormID` attribute. It is important that the value is added, not overwritten.
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**, you can leave **Everyone** or specify to whom the attribute should be assigned according to your business needs.
5. In the **Content** section, click **Define**.
6. Leave **Simple message** as default.
7. In **CSS selector**:
1. Select **After (in div)**
2. In the field, enter `.snrs-modal-wrapper`
8. In the **Create your template** tab, click **Create message**.
1. Click **+ New template** in the upper rght corner.
2. Leave the **HTML** and **CSS** tabs blank, and in the **JavaScript** tab paste the following script:
(function () {
function loadScript(src, callback) {
let script = document.createElement('script');
script.src = src;
script.onload = function () {
return callback(window.Adform);
};
document.head.append(script);
}
function checkAdform(instance) {
if (!instance || !instance._uid) {
console.log('no uid')
} else {
var oldUid = "{% if 'adFormID' in customer|string %}{{ customer['adFormID'] }}{% else %}brak{% endif %}";
if (oldUid === 'brak' || oldUid.indexOf(instance._uid) === -1) {
SR.event.trackCustomEvent('adformid.save', {
newId: instance._uid.toString(),
});
console.log('adform uid sent -> ' + instance._uid);
}
}
}
loadScript('https://track.adform.net/serving/cookie/?adfaction=getjs;adfcookname=uid', checkAdform)
})();
3. To continue the process of configuring the dynamic content campaign, click **Next**.
9. Click **Apply**.
10. In the **Schedule** section, click **Define**.
1. As the **Display time** choose **Display immediately**.
2. Click **Apply**.
2. In the **Display Settings** section, click **Define**.
1. Specify circumstances for dynamic content to be displayed and Advanced options, according to your business needs.
2. Click **Apply**.
3. Optionally, you can define the UTM parameters and additional parameters for your dynamic content campaign.
4. Click **Activate**.
**Result:** `adformid.save` event is generated, it will contain the `adFormID` parameter with the ID value.
## Match ID Cookie on Mobile
---
The cookie matching is based on the Adveritising ID, which is a fixed ID for a given device issued by Google.
Currently, Advertising ID is not collected through our SDK. You must implement such tracking in the application. You can do this by sending a custom event.
The event is recommended to be sent once per customer.
The custom event available on the activity list on the customer’s profile:
The output of custom event sent from mobile
## Save Adform ID as an attribute
---
In this part of the process you will create a workflow that is triggered by the `adformid.save` event and adds the ID it contains to the current value of the client attribute.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### 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 **adformid.save** event.
2. Click the **+ where** button, from the **Choose parameter** dropdown menu, choose **newId**.
3. From the **Choose operator** dropdown, choose **Regular expression**.
4. In the next field, type the `.`, which means that all values are considered (except for `null`).
2. Click **Apply**.
The configuration of the Profile Event node
### Define the Update Profile node
---
1. Add the **Update Profile** node. In the configuration of the node:
1. From the first dropdown list, select **adFormID**.
2. From the next dropdown list, select **Change**.
3. In the field enter the following formula:
{% set currentValue = customer['adFormID'] %}{% set newVal = event.params.newId|string %}{% set currentValues = currentValue|split('|') %}{% do currentValues.append(newVal) %}{% set finalValues = [] %}{% if currentValue|length > 255 %}{% for x in currentValues %}{% if loop.index0 > 0 %}{% do finalValues.append(x) %}{% endif %}{% endfor %}{% else %}{% if newVal in currentValue %}{% catalog.kill(it) %}{% else %}{% set finalValues = currentValues %}{% endif %}{% endif %}{{ finalValues|join('|') }}
The insert above checks:
- If the customer doesn't have the `adformID` assigned, the attribute is assigned to them.
- If the customer has the `adformID` assigned, the length of the ID is checked. If it exceeds 255 characters, old ID is deleted and new is added. If it doesn't, new ID is added.
2. Click **Apply**.
The configuration of the Update Profile node
### Add the finishing node
---
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
**Results**:
The workflow configurationUpdated attribute in the customer's profile
## Create a workflow to share segmentation
---
In this part of the process, you will prepare a workflow which sends a group of customers based on the adFormId to Adform. You will define the filters in the Audience node to include customers with assigned adFormId according to your business needs.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### 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, specify whether you want the workflow to run cyclically or on a one-time basis.
4. In the **Define audience** section, choose **New audience**.
1. Click **Define conditions**.
2. From the **Choose filter** dropdown list, select the **adFormId** attribute.
5. From the **Choose operator** dropdown, choose **Is true**.
6. Optionally, you can add other filters to define the audience according to your business needs.
6. Click **Apply**
You can optionally add the Profile Filter node as the next step in your workflow. This node allows you to divide your segment into subgroups.
The workflow with optional Profile Filter node
### Configure the Outgoing Integration node
---
You will use the Outgoing Integration node to upload segments from Synerise to Adform.
1. Add **Outgoing Integration**. In the configuration of the node:
1. In the upper right corner, choose **Custom**.
3. As the Webhook connection type, choose **API key**.
4. Click **Select connection**, select the API key you created as a part of [prerequisites](#prerequisites).
5. If the connection you want to use is in the list, select it and proceed. If the connection list is empty or you don’t see a connection, follow [this](/docs/automation/integration/outgoing-webhook#define-the-connection) instruction.
2. Name the webhook.
2. Select the **POST method**.
3. In the **Endpoint** field, enter the endpoint to which you will send the segment.
To obtain the endpoint, contact us at `synerise.com/support`. When contacting, provide: the link to the automation responsible for submitting the segment and the DMP ID, which you can find in your Adform panel.
4. Leave the **content-type** at the default value: `application / json`.
5. In the body of the request, paste the code below. The OwnerID value must be a combination of your workspace name and the name of the segmentation that it will be exported with to Adform, for example, SyneriseDemo_female where SyneriseDemo is the name of the workspace and female is the name of the segmentation
{% set ids = customer['adFormID']|split('|') %}
[
{% for x in ids %}
{"adformID2": "{{ x }}" ,
"OwnerID": "SyneriseDemo_female"
}
{% if loop.index != ids | count %},{% endif %}
{% endfor %}
The configuration of the Outgoing Integration node
7. Click **Apply**.
### 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 check the configuration of each step from this use case in our Synerise Demo workspace:
- [Dynamic Content](https://app.synerise.com/campaigns/create/d7413af5-3e74-414d-8ff1-13d1b6bb5cb2)
- [Workflow to save Adform ID as an attribute](https://app.synerise.com/automations/automation-diagram/ad437660-a793-44f2-bc58-90c5cebe633e)
- [Workflow to share segmentation](https://app.synerise.com/automations/automation-diagram/5982f11b-00b8-49ac-8cbd-d9df8d8e72b1)
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:
[`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), `adformid.save` (~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), [`profile.updated`](/docs/assets/events/event-reference/profiles#profileupdated) (~1), [`webhook.response`](/docs/assets/events/event-reference/integration#webhookresponse-and-custom-webhook-response-names) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Integration](/docs/automation/integration)
- [Segmentation](/docs/analytics/segmentations)
# 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)
# Back in stock campaign
There are many reasons why products go out-of-stock. As an example, it can be caused by a sudden trend or seasonal demands. As a result, customers can get a bit frustrated as they cannot buy the product they want at the time they need it. Leaving customers with this feeling in this situation is a very bad idea, as it can trigger them to move on to a competitor in hopes of finding a substitute for the product they were unable to buy in your store. At that point it not only causes you to lose sales, but also makes a long-term impact on customer satisfaction that was caused by the frustrating experience.
If you don't want to lose your customers, it's important to properly manage the out-of-stock situation and turn it into a positive customer interaction. One of the most effective actions in this regard is to allow the customer to sign up for a product availability notification list, so that when the product is back in stock, the customer receives an email notification about it. This simple action helps recover potentially lost revenue while keeping customers engaged with your brand.
This use case describes an example of a back in stock campaign that you can implement in your business. The scenario described involves sending email communications to customers with products that they were previously interested in and signed up for notifications about those products, and which are now back in stock.
## Prerequisites
---
- Send an event when a customer signs up for a product availability notification. Such an event should contain the ID of the product that the customer signed up for in order to be notified when the product is back in stock. This event will appear on the profile of the customer who signed up for such notification. You can send this event using the [API](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CustomEvent) or [JS SDK](/developers/web/tracking-form-data/tracking-form-data-sdk#calling-the-sdk-directly).
In this use case, this event is named `form.submit`. We will use the nomenclature of this event in the subsequent steps of this use case. The name of the implemented event used in this case is just an example and depends on your implementation.
You can use the [dynamic content](/docs/campaign/dynamiccontent) to display a sign-up form for product availability notifications on the card of unavailable product and send an event to Synerise when the form is filled out using the [JS SDK](/developers/web/tracking-form-data/tracking-form-data-sdk#calling-the-sdk-directly) method.
- [Create an email template](/docs/campaign/e-mail/creating-email-templates) to be used in the back in stock campaign.
You can find an example of Jinjava code that you may use in your mailing in the [configuration of the Send Email node](/use-cases/back-in-stock#configure-the-send-email-node).
- [Configure email account](/docs/campaign/e-mail/configuring-email-account).
- [Create item catalog](/use-cases/import-product-feed-to-catalog) containing information about product availability.
## Process
---
1. [Create a product.backInStock event](/use-cases/back-in-stock#create-a-productbackinstock-event)
2. [Create an aggregate with products for which the customer has signed up for notifications ](/use-cases/back-in-stock#create-an-aggregate-with-products-for-which-the-customer-has-signed-up-for-notifications)
3. [Create an aggregate collecting SKUs of products already received by the customer that are back in stock](/use-cases/back-in-stock#create-an-aggregate-collecting-skus-of-products-already-received-by-the-customer-that-are-back-in-stock)
4. [Create a workflow](/use-cases/back-in-stock#create-a-workflow)
## Create a product.backInStock event
---
In this part of the process, add the **product.backInStock** event, which will later be generated in the workflow that checks whether the product is back in stock. In addition, this event must include the parameter **sku**, which contains the SKUs of all restocked products the customer signed up for.
1. Go to **Data Modeling Hub > Events > Add event**.
3. In the **Name** field, enter `product.backInStock`.
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 the **Data Modeling Hub** and **Decision 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 `sku`.
11. In the **Property name** field, enter a human-readable label 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 with products for which the customer has signed up for notifications
---
The aggregate created will later be used in workflow to check which products have returned to stock.
The event action name and the parameter name used in this use case are only demonstrative and may be different depending on the event implementation.
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 `100`.
5. From the **Choose event** dropdown list, select the **form.submit** event.
6. As the event parameter, select **sku**.
7. Click **+ where** button.
8. From the **Choose parameter** dropdown list, select the **form type** parameter.
9. From the **Choose operator** dropdown list, select **Equal**.
10. Enter the name of the form. In our case it's `back in stock alert`.
11. Set the period from which the aggregate will analyze the results to the last **30 days**.
12. Save the aggregate.
Configuration of the aggregate
## Create an aggregate collecting SKUs of products already received by the customer that are back in stock
---
This aggregate will be used later in the process to exclude products already sent to customers when sending the next notification email.
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 `100`.
5. From the **Choose event** dropdown list, select the **product.backInStock** event.
6. As the event parameter, select **sku**.
7. Set the period from which the aggregate will analyze results to the last **30 days**.
8. Save the aggregate.
Configuration of the aggregate
## Create a workflow
---
Create a workflow that will check daily whether the products that customers have signed up for notifications have returned to stock. If so, the prepared workflow will send an email to the customer with the relevant information.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Configure the trigger
---
In this part of the process, select the segmentation for which you will run this campaign. In our case, these are those customers who have signed up for product availability notifications in the last 30 days and agreed to receive messages through the email channel.
1. Start the workflow with the **Audience** node. In the configuration of the node:
1. Set the **Run trigger** option to **repeatable**.
2. Set the interval at which you want to run the workflow.
3. Select the time zone.
4. Select the **New audience** tab.
5. Click **Define conditions**.
6. From the **Choose filter** dropdown list, select the **form.submit** event.
7. Click **+ where** button.
8. From the **Choose parameter** dropdown list, select the **form type** parameter.
9. From the **Choose operator** dropdown list, select **Equal**.
10. Enter the name of the form. In our case it's `back in stock alert`.
11. Define the time period for the **last 30 days**.
12. From the **Choose filter** drop-down list, select the **newsletter_agreement** parameter.
13. From the **Choose parameter** drop-down list, select the **Equal** operator and specify the condition as **enabled**.
14. Confirm by clicking **Apply**.
Configuration of the Audience node
### Configure the Generate Event node
---
Before sending the email to the customer, an event must be generated on the customer's profile, which will be defined in this step. The event must contain the SKUs of restocked products (these are the products that will be sent to the customer in the email).
The system will verify the restocking based on the availability parameter in the item catalog which was created as part of the prerequisites.
Additionally, the [products for which notifications have already been sent to the customer previously](/use-cases/back-in-stock#create-an-aggregate-collecting-skus-of-products-already-received-by-the-customer-that-are-back-in-stock) are excluded.
1. Add the **Generate event** node.
In the configuration of the node:
1. Enter the **Event name**. In our case, we are using `product.backInStock` event.
2. In the **Body** section, use the following Jinjava and modify it to your needs:
Jinjava inserted in **Generate event** body must have all empty spaces deleted.
{
"sku":"
{% set signedProducts = [] %}
{% set receivedProducts = [] %}
{% set finalSku = [] %}
{% aggregate LAST-SKU-SIGNED %} {# aggregate collecting product sku #}
{% for sku in aggregate_result|reverse %} {# saving sku from aggregate to signedProducts variable #}
{% do signedProducts.append(sku) %}
{% endfor %}
{% endaggregate %}
{% aggregate LAST-SKU-RECEIVED %} {# aggregate collecting product sku sended to user #}
{% for sku in aggregate_result|reverse %} {# saving sku from aggregate to receivedProducts variable #}
{% do receivedProducts.append(sku) %}
{% endfor %}
{% endaggregate %}
{% for sku in signedProducts %}
{% catalogvar.catalog(sku).availability %}
{% if catalog_result == 'in stock' %} {# condition to check if products are availability#}
{% if sku in receivedProducts|join(',') %} {# condition that adds a comma to items #}
{% else %}
{% do finalSku.append(sku) %}
{% endif%}
{% endif %}
{% endcatalogvar %}
{% endfor %}
{% set counter = 0 %}
{% for sku in finalSku %} {# listing the final sku in the sku parameter #}
{% set counter = counter + 1 %}
{{sku}}
{% if counter < finalSku|length%},{% endif %}{%endfor%}"
}
As a result is a `product.backInStock` event which in the `sku` parameter contains the SKUS of products that are back in stock. The list of the products will be sent in the email, separated by commas. If the event is empty, it means that none of the products have met the back in stock conditions.
An example of a generated event:
An example of a generated product.backInStock event
### Configure the Event Filter node
---
The workflow waits for the event generation from the previous step and sends the email based on it.
1. Add the **Event Filter** node. In the configuration of the node:
1. Check event **for period of time**.
2. Define the time range to **1 minute**.
3. From the **Choose event** dropdown list, select the **product.backInStock** event.
4. As the event parameter, select **sku**.
5. From the **Choose operator** dropdown list, select **Regular expression**.
6. As the value, enter `.+`
The `.+` value means any number of characters. We add this value to exclude from the communication customers for whom an empty SKU parameter was generated in the previous event. It happens when none of the products the customer signed up for were returned to stock.
7. Confirm by clicking **Apply**.
2. For the **not matched** path, select the **End** node.
3. For the matched path, select the **Send Email** node.
### Configure the Send Email node
---
At this stage, an email is sent to customers, which contains the products returned in the event from the previous step.
1. In the email configuration, select the template you previously prepared for the back in stock campaign.
In the template, you can retrieve event data from the **Event Filter** node.
You can learn more how to reuse event parameters [here](/developers/inserts/automation).
The following code is an example of how to do it:
Example Jinjava code
In addition, you can retrieve, for example, images or other parameters from your [catalog](/developers/inserts/insert-usage#extracting-values-from-catalogs).
2. Confirm by clicking **Apply**.
### Add final setting 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:
- [Create an aggregate with products for which the customer has signed up for notifications ](https://app.synerise.com/analytics/aggregates/b4173b56-cf83-3ce8-90c8-f35f36a91368)
- [Create an aggregate collecting sku's of products already received by the customer that are back in stock](https://app.synerise.com/analytics/aggregates/e55cae5e-2d48-3e29-a2a2-5122913e4e96)
- [Create a workflow](https://app.synerise.com/automations/automation-diagram/14d5a2dc-3cc9-4fcf-97fc-d0d328004484)
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:
[`form.submit`](/docs/assets/events/event-reference/web-and-app#formsubmit) (~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), `product.backInStock` (~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)
- [Product feed](/developers/product-feed)
- [Reusing event context from preceding nodes](/developers/inserts/automation)
- [Segmentation](/docs/analytics/segmentations)
# Dynamic Content Scratch Card
Interactive dynamic content formats can increase engagement and make promotional communication less intrusive. A scratch card mechanic adds a simple game-like interaction — users reveal an offer themselves, which often increases attention and memorability compared to static banners.
In this use case, you’ll create a predefined dynamic content scratch card template displayed to users who visit a specific product category (for example, the Women category). After scratching the card, users reveal a promotion code that gives them 25% off products from that collection.
The scratch card can be revealed with a finger or cursor, making the experience more interactive while still serving a clear promotional purpose.
The template is predefined, so no coding is required — configuration happens through the template form and campaign settings.
## Prerequisites
---
- Create [item feed](/docs/ai-hub/recommendations-v2/item-feed-requirements)
- 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. In our case category should contain WOMEN.
Filter configuration for category
Name and save the filter by clicking Save filter.
## Process
---
In this use case, you will go through the following steps:
1. [Create a promotion](/use-cases/dc-scratch#create-a-promotion) with discount for specific category.
2. [Create a dynamic content campaign](/use-cases/dc-scratch#create-a-dynamic-content-campaign) with a scratch card.
## Create a promotion
---
Create a promotion for a specific product category with a discount rate (for example, 25%).
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 `25`.
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.
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.
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**.
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). In our case, women category.
Type and limits configuration
9. To apply configuration and run the promotion, click **Publish**.
## Create a dynamic content campaign
---
In this part of the process, you will create a dynamic content campaign with a scratch card, presented after the user visits the category **Women**.
1. Go to **Experience Hub > Dynamic Content > Create new**
2. Enter a meaningful name for the campaign.
3. Choose the **web layer** type of 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 **Scratch card**.
**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 change them to fit your business needs.
Dynamic content configuration
1. In the **Content** section:
1. Fill out **Main Title**, **Subtitle**, **Scratch Surface Text**, and **Button Text** with specific description displayed on the scratch card.
2. Add also your personalized copy for **Copied Confirmation Text** and **Footer Text** where you can add info for example about the validation date.
2. In the **Prize** section:
1. In the **Discount Value** field, enter the value of the prize.
2. In **Prize Text**, add the copy which will be displayed as the description for the prize amount.
3. In **Promo Code**, enter the discount code displayed, created in the ["Create a promotion" part of the process](#create-a-promotion).
2. In the **Settings** section:
1. Set up the **Scratch Threshold** (in percentage) - what percentage of the card's surface does the customer need to scratch off to see its value.
2. Set up the **Brush Size** - in pixels.
5. In the **Colors** section, define your color scheme.
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.
### Schedule the message and configure display settings
---
As the final part of the process, you need to set the schedule.
1. In the **Schedule** section, click **Define** and set the time when the campaign will be active.
3. Click **Apply**.
2. In the **Display Settings** section, click **Define**. If you want the countdown bar to be displayed to all users continuously across the website upon landing, keep the default settings.
3. Click **Apply**.
### Set up the display settings
1. In the **Display settings** section, define the circumstances the dynamic content will be shown:
- **Always on landing**.
- **On a specific URL** which indicates a product page (for example, if a URL contains product).
4. Optionally, you can define the UTM parameters and additional parameters for your dynamic content campaign.
5. Click **Activate**.
## 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:
- [promotion configuration](https://app.synerise.com/campaigns/promotions/9d67af84-ab72-4b3b-ad07-e349af9d1382),
- [Dynamic content](https://app.synerise.com/campaigns/dynamic-content/create/d5193acb-db56-45f8-b8e7-2b95ddd6da5d)
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)
- [Promotions](/docs/ai-hub/promotions)
# Carousel with recently viewed products
---
Contextualized recommendations tailored to customer interests help to influence purchasing decisions. To create a recommendation, it is worth using recently viewed products, which will provide a good context for them.
In this way you can display not only last seen products to remind customers about them, but also show similar products to make sure that even if they will not buy last seen products they can be interested in similar categories.
## Example of use – Home appliances industry
One of our clients decided to personalize the offer on their home page by placing a carousel with recently viewed products on it. To make the offer more attractive for each of the products in the carousel, they additionally recommended a dozen or so similar products using AI algorithms.

**Results**
- CTR **11.5%**
- AB tests (division 50/50), where in group A general personalized recommendations were displayed, and in group B recently viewed with similar recommended products.
**Group B showed an 11% better conversion than group A**
## Requirements
---
- Synerise Tracker
- Imported correct product feed
- OG tags implemented (required: product: retailer_part_no consistent with the product ID in the feed)
- Trained Similar Recommendations Model
## How to do it
1. Prepare the aggregate with recently viewed products.
2. Prepare an AI campaign with a similar model. The campaign should return from 4 to about 20 products. You can use any filters you want.
3. Prepare dynamic content for the carousel, where you add the aggregate and based on it you will call a similar campaign to each of the products from the aggregate and save the result into separate tables. Then, place all products in the carousel, remembering that when the user scrolls through recently viewed products, the right side should immediately display products recommended from a similar campaign named for the currently displayed last seen product.
Using Jinjava, call the IDs of products recently viewed from the aggregate and create a carousel on the left side of the screen.
{% set productsSKU = [] %}
{% aggregate aggregate_hash %}
{% for p in aggregate_result %}
{% do productsSKU.append(p) %}
// HERE CAROUSEL ON THE LEFT SIDE
{% endfor %}
{% endaggregate %}
Iterate over the board with recently viewed products, trigger a similar campaign for each of them and create a carousel on the right.
{% for productSKU in productsSKU %}
{% set exampleProd = [] %}
{% set exampleProdUpdt = exampleProd.append(productSKU) %}
{% recommendations2 campaignId=campaign_hash products=exampleProd %}
{% for p in recommended_products2 %}
// HERE CAROUSEL ON THE RIGHT SIDE
{% endfor %} {% endrecommendations2 %} {% endfor %}
## Generated events
This use case generates approximately 7 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) (~3), [`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 [Aggregates](/docs/crm/aggregates)
- Read more about [Jinjava inserts](/developers/inserts/insert-usage) (aggregates and recommendations)
- Read more about [Loops in Jinjava](/developers/inserts/tag)
- Read more about [Product feed preparation](/developers/product-feed)
# Update the value of discounts in communication
If you offer your customers a discount with a fixed value in response to their actions, you can use an expression as a variable in the templates of your messages (email, SMS, mobile push, web push) and other types of communication (dynamic content on websites) to display the discount value.
The main advantage of this solution is quick modification of the value of discount - when you modify the expression, its result is automatically updated in all templates the expression is used.
## Prerequisites
---
Implement [tracking code](/developers/web/installation-and-configuration#creating-a-tracking-code) on your website.
## Process
---
1. Create an [expression](/use-cases/update-dynamic-discount-value#use-the-expression-insert-in-templates).
2. Use the [expression insert](/use-cases/update-dynamic-discount-value#use-the-expression-insert-in-templates) in templates.
3. [Modify the expression](/use-cases/update-dynamic-discount-value#modify-the-expression).
## Create an expression
---
In this part of the process, you create an expression with a discount value, which will be used as a variable in the template of the message further in the process.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression.
3. Leave the **Expression for** option at default (**Attribute**).
4. Build the formula of the expression.
1. Click **Select**.
2. From the dropdown list, select **Constant**.
3. Click the field that appeared on the dashboard.
4. Enter the value of discount.
5. Click **Save**.
Formula of the expression
## Use the expression insert in templates
---
In this part of the process, you use the expression as a variable in the message template.
1. Go to **Experience Hub** and select the type of message.
2. Go to the code editor.
3. On the upper right side of the screen, click **+ Inserts**.
Selecting the expression on the list of inserts
4. From the dropdown list, select **Expressions**.
5. Find the expression you created in the first part of the process.
6. Click the name of the expression.
7. Copy the Jinjava code of the expression.
8. Paste it in the template.
9. Style the template according to your preferences.
Preview of the template that contains the expression variable
## Modify the expression
---
If you need to change the value of the discount, edit the expression you created in the beginning of the process. As a result, the expression will return the new value in all templates in which the expression is used as a variable.
To edit the expression:
1. Go to **Behavioral Data Hub > Expressions**.
2. Find the expression on the list.
3. Click the expression.
4. Make the changes to the formula of the expression.
5. Click **Publish**.
## Check the use case set up on the Synerise Demo workspace
---
In the Synerise Demo workspace, you can check the configuration of:
- the [expression](https://app.synerise.com/analytics/expressions/9caa08a3-2428-4eaa-81da-8ce86facd5f2)
- the [email template](https://app.synerise.com/campaigns/create/c562dfbc-d6bf-4331-9df4-4a9e2e34c67f)
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)
- [Inserts](/developers/inserts/insert-usage#expressions)
# 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/authorization#tag/Authorization/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)
# Promotions for customers with high propensity to purchase
As customer expectations grow, they expect personalized experiences and customized content, promotions, and recommendations to help them find what they are looking for quickly and easily. This challenge can be met by using algorithms that can predict customer behavior using propensity scores. Such insight into customers' future actions allows you to deliver hyper-personalized messages at the right time for the right users.
This use case describes how to create a promotion for customers who have the highest propensity to buy products from the wireless headphones category.
## Prerequisites
---
- Implement promotions in your [mobile application](/developers/mobile-sdk/loyalty) or website, [API](https://hub.synerise.com/api-reference/authorization#tag/Authorization/operation/profileLogin).
- [Import your product feed to catalog](/use-cases/import-product-feed-to-catalog).
- [Enable the Propensity prediction type](/docs/ai-hub/predictions/enabling-predictions#enabling-propensity-and-best-fit-predictions).
- The `category` attribute must be added to [filterable attributes](/docs/ai-hub/ai-search/define-attributes#filterable-attributes).
## 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. [Create a prediction](/use-cases/propensity_based_promotion#create-a-prediction) to find customers with the highest propensity to buy wireless headsets.
2. [Prepare a segmentation](/use-cases/propensity_based_promotion#prepare-a-segmentation) of customers who have the highest propensity to buy wireless headsets.
3. [Create a filter in the product catalog](/use-cases/propensity_based_promotion#create-a-filter-in-the-product-catalog) with wireless headphones that will be used in the promotion.
4. [Create a promotion](/use-cases/propensity_based_promotion#create-a-promotion) for the customers with the highest propensity.
## Create a prediction
---
1. Go to **(AI Predictions) Models > New prediction** and select **Propensity** as the prediction type.
2. Define the prediction name.
3. 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 category for which you want to calculate the prediction. This is done by creating a filter that matches the 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 attribute** dropdown list, select the `category` attribute.
You can use the search field.
6. From the dropdown list that appears, select the **Equal** operator.
**Result**: The **Select category** button and **Level range** field appear.
7. Click **Select category** and select the desired product category - `headphones>wireless headphones`.
You can use the search field.
8. In the **Level range** field, enter `0`.
Enter `0` for wireless headphones or `1` for the entire headphone category.
The filter matches wireless headphone category
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**.
After the calculation, 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.
## Prepare a segmentation
---
In this part of the process based on the `snr.propensity.score` event, create a segmentation of customers with the highest propensity score.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of segmentation.
3. From the **Choose filter** dropdown list, select the `snr.propensity.score` event.
4. From the **Choose parameter** dropdown list, select **modelId**.
5. From the dropdown list that appears, select the **Equal** operator.
6. Enter the ID of the propensity model that was created in [this part of the process](/use-cases/propensity-product#creating-the-prediction).
7. Click **Add condition**.
8. From the **Choose parameter** dropdown list, select **score_label**.
9. From the dropdown list, select the **Equal** operator.
10. Enter the **Very high** score.
If you selected a 2-point scale in the settings of the prediction, enter `High` instead of `Very high`.
11. Click **Save**.
An example of a segmentation of customers with the highest propensity score
The conditions used in the segmentation will vary depending on your business needs (for example, the score level may be different).
## Create a filter in the product catalog
---
In this part of the process, create a filter with wireless headphones in the catalog with the product feed you will use as a source in the promotion.
1. Go to **Data Modeling Hub>Catalogs**.
2. Select product feed.
3. On the upper right, click **> Define.**
4. Click **Choose filter**.
5. Choose **Category>equal>**`wireless headphones`.
6. To save the filter, click **Save filter**.
7. Enter the name of the filter.
8. To only save the filter, click **Save**.
9. To save the filter and filter out promotions on the list, click **Save and Apply**.
**Result**: The filter is available in the folder
## Create a promotion
---
In this part of the process, create a promotion for the group of customers with the highest propensity to purchase. These customers will be entitled to a 15% discount on the wireless headphones.
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/propensity_based_promotion#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** section:
1. As the **Type**, choose **General**.
2. Select the **Single** tab.
3. In the **Limit per profile** section, enter `1`.
4. From the **Discount type** dropdown list, choose **Percentage**.
5. From the **Discount mode** dropdown list, choose **Static**.
6. In the **Value** field, enter `15`.
7. Leave the rest of the settings in this section at default.
The configuration of the Type and limits section
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:
1. In the **Source catalog** field, select an item catalog from which the items will be discounted.
2. Select **Filtered items**.
3. From **Select filter** dropdown list, select the filter that includes the wireless headphone product group you created [earlier in the catalog](/use-cases/propensity_based_promotion#create-a-filter-in-the-product-catalog).
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 configuration of each step from this use case in our Synerise Demo workspace:
- [Propensity prediction](https://app.synerise.com/ai-v2/predictions/propensity/pngsuydybpkq),
- [Segmentation](https://app.synerise.com/analytics-v2/segmentations/15226481-541f-4ad0-8293-cc508a223d08),
- [Promotions](https://app.synerise.com/campaigns/promotions/c71bdcfc-8573-4f44-884c-f84e01bd7f13).
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:
[`snr.propensity.score`](/docs/assets/events/event-reference/predictions#snrpropensityscore) (~1), [`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)
# Voucher assignment based on average basket value
Most marketers know that vouchers in line with your customers' shopping habits are one of the best ways to turn a visit into a sale. Sending an email with a relevant discount coupon to customers who have not purchased in a while will be great to re-engage them. You can personalise the communication and drive extra revenue for your business by grouping your customers by their average order value and offering them a better-tailored offer. Directing vouchers to the right audience at the right time will be more effective than sending irrelevant offers to all your customers. In this use case, you will create an automation that sends an email communication with a dedicated voucher code to a specific segment of customers with two or more transactions, depending on their average order value (AOV). The workflow is triggered when customers's session on the site ends, and will only continue for those customers who meet all the conditions defined in the segmentation and have not made any purchase in the last 30 days.
## Prerequisites
---
- [Implement a tracking code](/docs/settings/tool/tracking_codes).
- [Configure email account](/docs/campaign/e-mail/configuring-email-account).
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CreateATransaction).
- Create two different [voucher pools](/docs/assets/code-pools). One will be used for customers whose AOV less than 200 PL and one for those with AOV greater than or equal to 200 PLN.
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate for calculating AOV](#create-an-aggregate-for-calculating-aov).
2. [Create an aggregate for counting transactions](#create-an-aggregate-for-counting-transactions).
3. [Create a segmentation](#create-a-segmentation) based on the aggregates to set an audience for use in communication.
4. [Create an expression](#create-an-expression) that will be used in an e-mail template to check which segment the customer is in.
6. [Create an email template](#create-an-email-template) with jinjava code that inserts a voucher code depending on the customer's segment.
6. [Create a workflow](#create-a-workflow) that will send emails with vouchers to a specific segment of customers.
## Create an aggregate for calculating AOV
---
In this part of the process, create an aggregate that returns AOV from `transaction.charge` 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 **Average**.
4. From the **Choose event** dropdown list, select the `transaction.charge` event.
5. As the event parameter, select **$totalAmount**.
6. Define the period which the aggregate will analyze. In this use case, it is **Lifetime**.
7. Save the aggregate.
Configuration of the AOV aggregate
## Create an aggregate for counting transactions
---
In this part of the process, create an aggregate that returns number of transactions.
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 `transaction.charge` event.
6. Define the period which the aggregate will analyze. In this use case, it is **Lifetime**.
7. Save the aggregate.
Configuration of the aggregate returning the number of transactions
## Create a segmentation
---
In this part of the process, create a segmentation that contains two customer target groups who made at least two transactions. First for customers with AOV less than 200 PLN and second for customers with AOV equal or greater than 200 PLN.
The names of the segments will be used as variables later, so enter them as exactly as instructed.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of segmentation.
3. Rename **Segment A** to `AOV < 200 PLN`
4. From the **Add condition** dropdown list, select the [aggregate for AOV](#create-an-aggregate-for-calculating-aov) you created in the previous step.
5. As the operator, choose **Less than** for number.
6. In the text field, enter `200`
7. From the **Add condition** dropdown list, select the [aggregate for counting transactions](#create-an-aggregate-for-counting-transactions) you created in the previous step.
8. As the operator, choose **More or equal to** for number.
9. In the text field, enter `2`
Configuration of the segmentation for AOV less than 200 PLN
10. Click **Add segment** next to the first one. Name the new segment `AOV >= 200 PLN`
4. From the **Add condition** dropdown list, select the [aggregate for AOV](#create-an-aggregate-for-calculating-aov) you created in the previous step.
5. As the operator, choose **More or equal to** for number.
6. In the text field, enter `200`
7. From the **Add condition** dropdown list, select the [aggregate for counting transactions](#create-an-aggregate-for-counting-transactions) you created in the previous step.
8. As an operator, choose **More or equal to** for number.
9. In the text field, enter `2`
10. Save the segmentation.
Configuration of the segmentation for AOV more or equal to 200 PLN
## Create an expression
---
In this part of the process, create an expression which will be used to return the customer's segment in the [segmentation created in the previous step](#create-a-segmentation). It will be used later in the email template and will allow us to target vouchers appropriately - to the right group of 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**.
4. Click the **unnamed** node.
5. From the **Choose attribute** dropdown list, select the [segmentaion created in the previous step](#create-a-segmentation).
5. Save the expression.
Configuration of the expression
## Create an email template
---
In this part of the process, create an email template with a Jinjava code which uses the results from the expression created in the [previous part of the process](#create-an-expression) to check the customer's segment and assign a voucher code from the corresponding pool.
1. Go to **Experience Hub > Email**.
2. On the left pane, click **Templates**.
3. Select the wizard:
- **Drag&drop builder** - use ready-made components to build an email template.
- **Code editor** - use HTML, CSS and JS to build an email template from scratch.
4. Build a template.
5. Add the Jinjava code presented below.
This code includes a context of the node from the [workflow](/developers/inserts/automation#context) you will create in the next part of the process. Thanks to this context, the latest results of the expression will be used in the email template to select the voucher pool corresponding to the customer's segment.
You can change the text of the messages in the code according to you business needs.
1. Replace the UUID after `expressionvar` with the ID of the expression you created earlier.
2. Replace the UUID in the first `voucher` tag with the ID of the voucher pool with vouchers for customers whose AOV is less than 200 PLN.
3. Replace the UUID in the second `voucher` tag with the ID of the voucher pool with vouchers for customers whose AOV is 200 PLN or more
Check the Jinjava code
{% expressionvar 2bf51517-ae79-4bfb-bd37-153408c80bf5 %} {% set state = expression_result %} {% if state == 'AOV < 200 PLN' %} Buy discounted products from the online shop with an extra 10% discount! You can find your personal code below <p> {% voucher assign=false %} f017803f-4d5c-4192-aa3a-f845822490cb {% endvoucher %} {% elif state == 'AOV >= 200 PLN' %} Buy new collection products from the online shop with a 20% discount! You can find your personal code below. <p> {% voucher assign=false %} 8464b593-478c-412a-9dfb-0aab59f8ff5e {% endvoucher %} {% endif %} {% endexpressionvar %}
6. Save the template.
## Create a workflow
---
In this part of the process, you will create the workflow which sends emails with vouchers to a specific segment of customers, triggered when they finish their session on the site. The voucher will be sent maximum once a month, to customers who didn't make a purchase in the last 30 days.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
3. 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 **Apply**.
Configuration of Workflow capping
### Add the Profile Event node
1. Click **Add trigger**.
4. From the dropdown list, select **Profile Event**.
5. Click the node.
6. From the **Choose event** dropdown list, select `session.end`.
7. Confirm by clicking **Apply**.
### Add the Delay node
Add the Delay node to define the lag between the `session.end` event and sending an email with voucher to specific segment of customers. In this example it is 1 hour.
1. Click **MATCHED**.
2. From the dropdown list, select **Delay** node.
3. Click the node.
4. Set **Time of delay** to 1 hour.
5. Confirm by clicking **Apply**.
### Add the Profile Filter node
1. Click **THEN**.
2. From the dropdown list, select **Profile Filter** node.
3. Click the node.
4. From the **Choose filter** dropdown list, select the [expression created in the previous step](#create-an-expression).
5. From the **Choose operator** dropdown list, select **Is true**.
5. Add another condition by clicking the **Choose filter** dropdown list and selecting the `transaction.charge` event.
6. Click **Profiles matching funnel** and change it to **Profiles not matching funnel**.
7. Click the calendar icon in the right lower corner to change the date range.
1. In the **Relative date range** section, select **Custom**.
2. Set to **Last 30 days**.
3. Confirm by clicking **Apply**.
8. Confirm by clicking **Apply**.
9. At the **NOT MATCHED** path, add the **End** node.
Configuration of the Profile Filter node
### Add the Send Email node
1. Click **THEN**.
2. From the dropdown list, select **Send Email** node.
3. In the **Sender details** section, choose the email account from which the email is sent.
4. 4. In the **Content** section:
5. Select the [template that you prepared in the previous step](#create-an-email-template).
6. Add the subject of the email.
3. You can define the UTM parameters in the **UTM & URL parameters** section.
4. In the **Additional parameters** section, optionally describe the campaign with [additional parameters](/docs/campaign/e-mail/creating-email-campaigns#adding-custom-parameters).
4. Confirm by clicking **Apply**.
5. Click **THEN**.
6. From the dropdown list, select **End** node.
7. Click **Save & Run**.
Automation
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of:
- [Voucher pool for customers with AOV less than 200 PLN](https://app.synerise.com/assets/vouchers/pools/f017803f-4d5c-4192-aa3a-f845822490cb/coupons)
- [Voucher pool for customers with AOV more than or equal to 200 PLN](https://app.synerise.com/assets/vouchers/pools/8464b593-478c-412a-9dfb-0aab59f8ff5e/coupons)
- [Aggregate for AOV](https://app.synerise.com/analytics/aggregates/7a866b05-137b-3237-ad36-041cdf14553a)
- [Aggregate for counting transactions](https://app.synerise.com/analytics/aggregates/1b01b454-3e3f-3837-8ba1-feb4bf117ce6)
- [Segmentation](https://app.synerise.com/analytics-v2/segmentations/039f798d-2bdc-4979-a7e4-e56a81d93ae4)
- [Expression](https://app.synerise.com/analytics/expressions/2bf51517-ae79-4bfb-bd37-153408c80bf5)
- [Automation](https://app.synerise.com/automations/automation-diagram/8fe22258-0ef2-42f0-bbf4-afe79f76abe8)
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 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), [`voucherCode.assigned`](/docs/assets/events/event-reference/loyalty#vouchercodeassigned) (~1).
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Automation Hub](/docs/automation)
- [Email campaigns](/docs/campaign/e-mail)
- [Expressions](/docs/crm/expressions)
- [Jinjava inserts](/developers/inserts)
- [Segmentation](/docs/analytics/segmentations)
- [Voucher pools](/docs/assets/code-pools)
# 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#tag/Uploader/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)
# Visually Similar Product Recommendations with Brand Promotion
Visually similar product recommendations enhance the browsing journey by helping users discover items that match their preferences in color, style, or category. These suggestions are especially powerful on product pages, where shoppers are already engaged with a specific item. By surfacing lookalike alternatives, brands can reduce drop-off and create a smoother path to conversion.
In this use case, the product page features two dedicated recommendation slots. One displays products visually similar in color and category to the viewed item. The second highlights visually similar products from a specific promoted brand. This setup balances personalization with promotional goals, driving both user satisfaction and brand visibility.
## Prerequisites
---
- Prepare an item feed according to the requirements in [Item feed requirements](/docs/ai-hub/recommendations-v2/item-feed-requirements), include the brand attribute in the feed. Optionally, add product attributes that further describe item features — such as color, style, sleeve length. These attributes will allow for even more accurate matching and filtering of recommended products, based on a wider range of parameters.
- Import the [item feed to a catalog](/docs/ai-hub/recommendations-v2/item-feed-requirements) or if you use Google Merchant Feed, then you can pull the feed from the URL during AI Engine configuration.
- [Configure AI engine](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations) and enable the Visual Similarity model.
## Create visual recommendations
---
In this part of the process, you will configure a visually similar recommendations which will be added to the website.
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 **Visual similarity** 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 user in first from two slots.
3. Define [Static filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#static-filters). Click **Define filter** and choose **Visual builder**.
1. Click **Select value** and from the list of attributes choose `color`.
2. From the **Operator** dropdown list, select **Equals**.
6. Click on the icon and select **Context**.
7. As the value, choose `color`, to be sure that the color of recommended products will be the same as the color of the currently viewed item.
8. Click **and where** and from the list of attributes choose **availability** and set it to **is defined**, so the recommendations will show only available items.
9. Click **and where** and from the list of attributes choose `category`.
5. From the **Operator** dropdown list, select **Equals**.
6. Click on the icon and select **Context**.
7. As the value, choose `category`, and set up its value to **root catalog** to be sure that the category of recommended products will be the same as the category of the currently viewed product.
8. Select value how you want to select your category level - in our case **Whole category**.
9. Click **Apply**.
Static filters
**Result**: A recommendation will show items similar in color to the viewed one; if a product in a particular color is not available, no recommendations will be shown in the first slot.
4. Define [Elastic filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#elastic-filters). Click **Define filter** and choose **Visual builder**.
1. Click **Select value** and from the list of attributes choose one of the available additional parameters of the products created as the part of [prerequisites](#prerequisites).
5. From the **Operator** dropdown list, select **Equals**.
6. Click on the icon and select **Context**.
7. As the value, choose the same parameter, to be sure that the specific parameter of recommended products has the same parameter as the viewed item.
8. Add as many additional parameters as you want.
9. Confirm by clicking **Apply**.
Dynamic filters example
**Result**: In this way, the first recommendation slot will be enriched with additional corresponding attributes and will feature products that possess the same specific details. If no products with a significant number of matching attributes are identified, it will revert to presenting visually similar products in the matching color and category established in the static filters.
7. To add the next slot, click **+** symbol .
1. Define the minimum and maximum number of items that will be recommended to the user in the second from two slots.
3. Define [Static filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#static-filters). Click **Define filter** and choose **Visual builder**.
1. Click **Select value** and from the list of attributes choose `brand`.
5. From the **Operator** dropdown list, select **Equals**.
7. As the value, choose the name of the brand you want to present and promote in this set of recommendations, in our case it will be: `XXX`.
8. Click **and where** and from the list of attributes choose **availability** and set it to **is defined**, so the recommendations will show only available items.
9. Click **and where** and from the list of attributes choose `category`.
5. From the **Operator** dropdown list, select **Equals**.
6. Click on the icon and select **Context**.
7. As the value, choose `category` and as the value set up **root category**, to be sure that the color of recommended products will be from the same category as the currently viewed product.
8. Select how you want to select your category level - in our case **Whole category**.
9. Click **Apply**.
**Result**: A recommendation will show items from specified brand and the category of the currently viewed item. If there are no products available from the specific brand and category, no recommendations will be shown in the slot.
4. Define [Elastic filters](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#elastic-filters). Click **Define filter** and choose **Visual builder**.
1. Click **Select value** and from the list of attributes choose one of the available additional parameters of the products created as the part of [prerequisites](#prerequisites).
2. From the **Operator** dropdown list, select **Equals**.
6. Click on the icon and select **Context**.
7. As the value, choose the same parameter, to be sure that the the parameter value will be the same for the recommended items and the item currently viewed.
8. Add as many additional parameters as you want.
9. Click **Apply**.
4. Confirm by clicking **Apply**.
**Result**: In this way, the second recommendation slot will be enhanced with additional matching attributes and will display products that share the same detailed parameters. However, if no products with such a high number of matching attributes are found, it will default to showing visually similar products in the same brand and category, as defined in the static filters.
8. In the **Slots and items ordering** section, define how you want to arrange the order of slots and items in the recommendation frame.
8. Optionally, you can define the **Boosting** factors.
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**.
## What's next
---
You now have ready-to-use product recommendations split into two distinct sets. These can be easily implemented on your product page to enhance the browsing experience and increase conversions in your store.
You can also use them in other areas of your customer journey—such as email campaigns, mobile push notifications, or personalized homepage sections—to drive further engagement.
To learn more about it, check the [Distributing recommendations](/docs/ai-hub/recommendations-v2/distributing-recommendations) article.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of [AI Recommendations](https://app.synerise.com/ai-v2/recommendations/yQsFpTzamWvS) 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:
[`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
---
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Back in stock push notification campaign
Product unavailability can stem from various factors like sudden trends or seasonal demands, leading to customer frustration when they're unable to purchase desired items promptly.
Effectively managing these out-of-stock situations is important. Offering customers the option to subscribe to product availability notifications is a proactive strategy. By enabling customers to receive mobile push alerts when items are restocked, you can mitigate revenue loss.
This use case presents a mobile push notification campaign for back-in-stock updates. By sending timely notifications to interested customers, it enhances their shopping experience and fosters brand loyalty. The example involves notifying customers who previously expressed interest in specific products and signed up for notifications when those products are back in stock.
## Prerequisites
---
- Send an event when a customer signs up for a product availability notification. Such an event must contain the ID of the product that the customer signed up for in order to be notified when the product is back in stock. This event will appear on the profile of the customer who signed up for such notification. You can send this event using the [API](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CustomEvent) or [JS SDK](/developers/web/tracking-form-data/tracking-form-data-sdk#calling-the-sdk-directly).
In this use case, we will use the [`form.submit` event](/docs/assets/events/event-reference/web-and-app#formsubmit).
You can use the [dynamic content](/docs/campaign/dynamiccontent) to display a sign-up form for product availability notifications on the card of unavailable product and send an event to Synerise when the form is filled out using the [JS SDK](/developers/web/tracking-form-data/tracking-form-data-sdk#calling-the-sdk-directly) method.
- [Create item catalog](/use-cases/import-product-feed-to-catalog) containing information about product availability.
- 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#tag/Events/operation/CreateATransaction).
## Proces
---
1. [Create a product.backInStock event](/use-cases/back-in-stock-mobile-push#create-a-productbackinstock-event)
2. [Create an aggregate that returns products for which the customer has signed up for notifications ](/use-cases/back-in-stock-mobile-push#create-an-aggregate-with-products-for-which-the-customer-has-signed-up-for-notifications)
3. [Create an aggregate that returns SKUs of products about which the customer got information that are back in stock](/use-cases/back-in-stock-mobile-push#create-an-aggregate-collecting-skus-of-products-already-received-by-the-customer-that-are-back-in-stock)
4. [Create a mobile push template](/use-cases/back-in-stock-mobile-push#create-a-mobile-push-template) with the back in stock campaign.
4. [Create a workflow](/use-cases/back-in-stock-mobile-push#create-a-workflow)
## Create a product.backInStock event
---
In this part of the process, add the definition of the **product.backInStock** event, which will later be generated in the workflow that checks whether the product is back in stock. In addition, this event must include the **sku** parameter, which contains the SKUs of all restocked products the customer signed up for.
1. Go to **Data Modeling Hub > Events > Add event**.
3. In the **Name** field, enter `product.backInStock`.
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 the **Data Modeling Hub** and **Decision 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 `sku`.
11. In the **Property name** field, enter a human-readable label 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 with products for which the customer has signed up for notifications
---
The aggregate created will later be used in workflow to check which products have returned to stock.
The event action name and the parameter name used in this use case are only demonstrative and may be different depending on the event implementation.
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 `100`.
5. From the **Choose event** dropdown list, select the **form.submit** event.
6. As the event parameter, select **sku**.
7. Click **+ where** button.
8. From the **Choose parameter** dropdown list, select the **formType** parameter.
9. From the **Choose operator** dropdown list, select **Equal**.
10. Enter the name of the form. In our case it's `back_in_stock_alert`.
11. Set the period from which the aggregate will analyze the results to the last **30 days**.
12. Save the aggregate.
Configuration of the aggregate
## Create an aggregate collecting SKUs of products already received by the customer that are back in stock
---
This aggregate will be used later in the process to exclude products already sent to customers when sending the next notification.
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 `100`.
5. From the **Choose event** dropdown list, select the **product.backInStock** event.
6. As the event parameter, select **sku**.
7. Set the period from which the aggregate will analyze results to the last **30 days**.
8. Save the aggregate.
Configuration of the aggregate
## Create a mobile push template
---
Prepare a mobile push with information about restocking products.
1. Go to **Experience Hub > Mobile Push > Templates**.
2. You can use the ready-to-use template and edit it in the mobile ush visual builder. Click **New Template > Simple Push**.
2. Create your mobile push in the visual editor.
3. You can use Jinja to retrieve from the template a list of products that have been restored to the assortment from the **Event Filter** block, which has not yet been defined because it will be done in subsequent steps.
You can learn more how to reuse event parameters [here](/developers/inserts/automation).
The following code is an example of how to do it:
Great news, the product:
{%set eventParams = event.params%}
{%set sku = eventParams.sku|split(',')|last%}
{%catalogitemv2.items-demo(sku)%}
{%set itemObject=catalog_result%}
{{itemObject.title}}
{%endcatalogitemv2%}
you were waiting for is back in stock!
4. In the **URL** box, add the following code, which will redirect the customer to the page of the specific product after clicking the notification:
5. Personalize other settings in the templates like style for your business needs.
6. **Save** the changes.
Example of mobile push notification
## Create a workflow
---
Create a workflow that will check daily whether the products that customers have signed up for notifications have returned to stock. If so, the prepared workflow will send a push notification to the customer with the relevant information.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Configure the trigger
---
In this part of the process, select the segmentation for which you will run this campaign. In our case, these are those customers who have signed up for product availability notifications in the last 30 days and agreed to receive messages through the mobile application.
1. Start the workflow with the **Audience** node. In the configuration of the node:
1. Set the **Run trigger** option to **repeatable**.
2. Set the interval at which you want to run the workflow.
3. Select the time zone.
4. Select the **New audience** tab.
5. Click **Define conditions**.
6. From the **Choose filter** dropdown list, select the **form.submit** event.
7. Click **+ where** button.
8. From the **Choose parameter** dropdown list, select the **formType** parameter.
9. From the **Choose operator** dropdown list, select **Equal**.
10. Enter the name of the form. In our case it's `back_in_stock_alert`.
11. Define the time period for the **last 30 days**.
12. From the **Choose filter** drop-down list, select the `profile.receive_push_messages`. This attribute containing the marketing consent status for push notifications.
13. From the **Choose parameter** drop-down list, select the **Equal** operator and specify the condition as **true**.
14. Click **Choose filter** and from the drop-down list, select the `snrs_has_mobile_push_devices`. It includes information on whether the customer has an active FCM token or not. For more information, please visit [this material](/docs/campaign/Mobile/mobile_campaign#conditions-for-sending-and-displaying-mobile-notifications).
13. From the **Choose parameter** drop-down list, select the **Equal** operator and specify the condition as **true**.
14. Confirm by clicking **Apply**.
Configuration of the Audience node
### Configure the Generate event node
---
Before sending the push notification to the customer, an event must be generated on the customer's profile, which will be defined in this step. The event must contain the SKUs of restocked products (these are the products that will be sent to the customer in the notification).
The system will verify the restocking based on the availability parameter in the item catalog which was created as part of the prerequisites.
Additionally, the [products for which notifications have already been sent to the customer previously](/use-cases/back-in-stock#create-an-aggregate-collecting-skus-of-products-already-received-by-the-customer-that-are-back-in-stock) are excluded.
1. Add the **Generate event** node.
In the configuration of the node:
1. Enter the **Event name**. In our case, we are using `product.backInStock` event.
2. In the **Body** section, use the following Jinjava and modify it to your needs:
Jinjava inserted in **Generate event** body must have all empty spaces deleted.
{
"sku": "{% set signedProducts=[] %}{% set receivedProducts=[] %}{% set finalSku=[] %}{% aggregate b4173b56-cf83-3ce8-90c8-f35f36a91368 %}{% for sku in aggregate_result|reverse %}{% do signedProducts.append(sku) %}{% endfor %}{% endaggregate %}{% aggregate e55cae5e-2d48-3e29-a2a2-5122913e4e96 %}{% for sku in aggregate_result|reverse %}{% do receivedProducts.append(sku) %}{% endfor %}{% endaggregate %}{% for sku in signedProducts %}{% catalogvar.items-demo(sku).availability %}{% if catalog_result=='in stock' %}{% if sku in receivedProducts|join(',') %}{% else %}{% do finalSku.append(sku) %}{% endif%}{% endif %}{% endcatalogvar %}{% endfor %}{% set counter=0 %}{% for sku in finalSku %}{% set counter=counter + 1 %}{{sku}}{% if counter < finalSku|length%},{% endif %}{%endfor%}"
}
As a result, a `product.backInStock` event is generated. The `sku` parameter contains the SKUS of products that are back in stock. The list of the products will be sent in the notification, separated by commas. If the event is empty, it means that none of the products have met the back in stock conditions.
An example of a generated event:
An example of a generated product.backInStock event
### Configure the Event filter node
---
The workflow waits for the event generation from the previous step and sends the push notification based on it.
1. Add the **Event filter** node. In the configuration of the node:
1. Check event **for period of time**.
2. Define the time range to **1 minute**.
3. From the **Choose event** dropdown list, select the **product.backInStock** event.
4. As the event parameter, select **sku**.
5. From the **Choose operator** dropdown list, select **Regular expression**.
6. As the value, enter `.+`
The `.+` value means any number of characters. We add this value to exclude from the communication customers for whom an empty SKU parameter was generated in the previous event. It happens when none of the products the customer signed up for were returned to stock.
7. Confirm by clicking **Apply**.
2. For the **not matched** path, select the **End** node.
3. For the matched path, select the **Send Mobile Push** node.
### Configure the Send mobile push node
---
At this stage, a mobile push is sent to customers, which contains the products returned in the event from the previous step.
1. In the node configuration, select the template you previously prepared for the back in stock campaign.
2. Confirm by clicking **Apply**.
### Add final setting 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:
- [Aggregate that returns products for which the customer has signed up for notifications ](https://app.synerise.com/analytics/aggregates/b4173b56-cf83-3ce8-90c8-f35f36a91368)
- [Aggregate that returns SKUs of products about which customer has received information that they are back in stock](https://app.synerise.com/analytics/aggregates/e55cae5e-2d48-3e29-a2a2-5122913e4e96)
- [Mobile push template](https://app.synerise.com/campaigns/mobile-push/content-manager/template/130038)
- [Workflow](https://app.synerise.com/automations/automation-diagram/223e895e-1327-41cc-8f3a-8fd193f1ab52)
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:
[`form.submit`](/docs/assets/events/event-reference/web-and-app#formsubmit) (~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), `product.backInStock` (~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)
- [Catalogs](/docs/assets/catalogs/introduction-to-catalogs)
- [Email campaigns](/docs/campaign/e-mail)
- [Product feed](/developers/product-feed)
- [Reusing event context from preceding nodes](/developers/inserts/automation)
- [Segmentation](/docs/analytics/segmentations)
# Recommend bestselling items in a WhatsApp message
You can use WhatsApp to send personalized messages to potential customers who have viewed a product page and have high propenisty to buy, motivating them even more to return and purchase popular or beststelling products. Increase customer engagement and drive sales with communication that ensures customers receive customized and relevant messages with enticing incentives and exclusive deals.
In this use case, you will create a workflow that sends a message on WhatsApp with the bestselling products. This workflow will be triggered by a visit to a page, however, the message will be sent only to customers with a high propensity to buy and who visited the product page and haven't made a purchase just to encourage them to come back and make a 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 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#tag/Events/operation/CreateATransaction).
- [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 recommendation desribed in [this use case](/use-cases/recommendations-bestsellers#prepare-ai-recommendation).
- Create a Propensity prediction described in [this use case](/use-cases/propensity-brand).
## Process
---
In this use case, you will go through the following steps:
1. [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 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.
The example message used in this use case:
`*{{1}}* *{{2}} PLN* One of our best-sellers and an ABSOLUTE favorite among our customers! Hurry up because we only have a few units left.`
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 template message creation in the Meta portal:
An example of body section configuration in the 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 the Meta platform
## Create a workflow to send message to customers on WhatsApp
---
The workflow will be triggered by the `Visited page` event for customers with high propenisty to buy. 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 encouraging customers to come back and buy a bestselling product.
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 **Visited page** 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 with high propenisty to buy 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.
2. Change **matching** to **not matching**.
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 will not take into consideration all necessary users.
4. From the **Choose filter** dropdown, select the `snr.propenisty.score` event.
5. Click **+ where**.
6. As the event parameter, select `score_label`.
7. As the logical operator, select **Equal**.
8. In the text field, enter `high`.
9. As the date range, select **Lifetime**.
2. Click **Apply**.
Configuration of the Profile Filter node
### 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 recommendation 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 | `{% set products = [] %}{% recommendations3 campaignId=VrEXZm00A7CK %}{% for p in recommended_products3 %}{% do products.append(p) %}{% endfor %}{% endrecommendations3 %}{{ products[0].title }}` | The value of this insert is used as the value of `{{1}}`, so the name of recommended product can be displayed in the message. |
| body | `{{ products[0].price }}` | The value of this insert is used as the value of `{{2}} PLN`, to show the price of the item. |
| button | `{{ products[0].title\|replace('https://yourshop.com', '') }}` | 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 | `{{ products[0].image_link }}` | The value of this insert is used to return 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**.
Configuration of the Workflow
## Check the use case set up on the Synerise Demo workspace
---
You can check the [recommendation](https://app.synerise.com/ai-v2/recommendations/4KW2iNyhE5nY) and [workflow](https://app.synerise.com/automations/automation-diagram/a958fb74-1280-4176-9041-22a8f43b463a) 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 8 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) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~1), [`whatsapp.sendTemplateMessage`](/docs/assets/events/event-reference/integration#whatsappsendtemplatemessage) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Jinjava inserts](/developers/inserts)
- [Predictions](/docs/ai-hub/predictions)
- [Recommendations](/docs/ai-hub/recommendations-v2)
- [WhatsApp Send Template Message node](/docs/automation/integration/whats-app/send-template-message)
# 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#tag/Events/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.
# Web push with survey
This scenario involves creating a web push notification with a simple survey shown to customers right after completing a purchase. The survey asks for a simple **YES** or **NO** response. Depending on the choice made and the cumulative responses for each option, customers will be navigated to a page that will feature a tailored message, crafted through Dynamic Content based on the survey outcomes. When customers click on a button on this page, it will record an event on their profile, which can be leveraged for analyzing performance and enhancing future customer targeting.
The detailed logic behind the web push created in this use case:
1. **Survey Question:** "Would you recommend our products/services to friends or family?"
2. **User Response Options:**
- YES
- NO
3. **Outcome based on User Response and Overall Survey Results:**
**NO Response:**
- Redirects a user to a webpage with dynamic content.
- Encourages users with negative experiences to contact customer service.
Aims to gather feedback for improving the customer experience.
**YES Response:**
- Redirects a user to a webpage with dynamic content.
- Displays either:
- Survey results if the percentage of YES responses is higher than x% (in our case it's 80%).
- A message thanking them for recommending the company's products/services to friends and family.
This setup ensures a tailored response based on the user's feedback and overall survey trends.
This is only an exemplary scenario. You can customize the logic and content according to your specific business needs and goals.
## Prerequisites
---
- [Configure web push notifications](/docs/campaign/Webpush/configuring-web-push)
- [Implement SDK to a website](/developers/web/installation-and-configuration)
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CreateATransaction).
## Process
---
1. [Create a web push template](/use-cases/web-push-survey#create-a-web-push-template).
2. [Create a workflow](/use-cases/web-push-survey#create-a-workflow) to send a webpush.
3. [Create metrics](/use-cases/web-push-survey#create-metrics) counting the number of responses of each available option (different buttons).
3. [Create Dynamic Content campaign](/use-cases/web-push-survey#create-dynamic-content-campaign).
## Create a web push template
---
1. Go to **Experience Hub > Web Push**.
2. Click Template icon.
3. In the upper right corner, click the **New template** button.
4. Enter the name of the web push template.
6. In the **Title** field, enter the headline of the notification. It's recommended to not exceed 50 characters, however, the displayed number of characters depends on the browser.
6. In the **Message** field, enter the main text of the notification.
**Recommended**: Up to 100 characters. If the message is too long, the rest of it is replaced with ellipsis (`...`).
7. In the **Destination URL** field, enter the address to which a customer is redirected after clicking the notification.
8. In the **Icon URL (optional)** field, you can enter the URL of the icon you uploaded previously to the **Files** section in the **Data Modeling Hub**.
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.
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. In the **Button text** field, enter the text that will appear on the button.
2. In the **Button URL** field, enter the address to which a customer is redirected after clicking the button.
3. To add the second action button, click **Add button** and follow steps a-b.
12. For saving the template in a folder of your choice, click **Save as** button and select the desired folder.
In this scenario, we have two buttons labeled "YES" and "NO." Each button corresponds to a specific URL link:
- Clicking the "YES" button will redirect to: `https://demoshop.synerise.com/survey?answer=yes`
- Clicking the "NO" button will redirect to: `https://demoshop.synerise.com/survey?answer=no`
These links will be employed later in the Dynamic Content (DC) configuration when choosing where to display the DC.
### Preview the template
---
1. To check the preview of the template for a particular customer or a product, click the Preview context button on the upper left side.
2. Enter the ID of a customer.
3. Click **Apply**.
**Result:** You see the preview of the template for the particular customer.
4. To test the notification template in your browser, click **Show notification** on the upper right side.
**Result:** You get a browser request to receive notifications.
5. Agree to receive notifications.
**Result:** A web push notification is displayed.
## Create a workflow
---
The workflow will be triggered by the [`transaction.charge` event](/docs/assets/events/event-reference/items#transactioncharge). The delay is set to 10 minutes, after this time customer will receive a web push.
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 **transaction.charge** event.
2. Click **Apply**.
### Configure the Delay node
---
1. Add the **Delay** node. In the node settings:
1. In the **Delay** field, type `10`.
2. From the **Unit** dropdown list, choose **Minute**.
2. Click **Apply**.
### Configure the Send Web Push node
---
1. Add the **Send Web Push** node. In the node settings:
1. In the **Content** section, from the **Webpush template** dropdown, select [the template you created in the previous step](/use-cases/web-push-survey#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**.
### Add the finishing node
---
1. Add the **End** node to the **Send Web Push** node.
2. In the upper right corner, click **Save & Run**.
The workflow configuration
## Create metrics
---
In this step, create two metrics - one for each button - to count the number of responses for each button option. The results of these metrics will be used in the next part of the process to determine the logic for the content displayed in the Dynamic Content.
### Create a metric for the first button (YES)
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 `webpush.click`.
6. Click **+ Where** button.
**Result**: The **Choose parameter** button appears.
7. From the **Choose parameter** dropdown list, choose `actionButton`.
8. From the **Choose operator** dropdown list, select **Equal (String)**.
9. In the text field, type `1` (meaning the first button).
10. Click **+ Where** button.
**Result**: The **Choose parameter** button appears.
11. From the **Choose parameter** dropdown list, choose `diagramId`.
12. From the **Choose operator** dropdown list, select **Equal (String)**.
13. In the text field, type the ID of the diagram that you created earlier in the process.
Diagram ID is another word for Workflow ID. To find your Workflow ID, you need to navigate to **Automation Hub > Workflows**. Then find the workflow whose ID you need and click on the three dots located on the right side of it. After clicking the three dots, move to the section that displays the ID and click on it. This action will copy the ID for you.
14. Using the date picker in the lower-right corner, set the time range to **Lifetime**. Confirm your choice with the **Apply** button.
15. Click **Save**.
Configuration of the the first metric
### Create a metric for the second button (NO)
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 `webpush.click`.
6. Click **+ Where** button.
**Result**: The **Choose parameter** button appears.
7. From the **Choose parameter** dropdown list, choose `actionButton`.
8. From the **Choose operator** dropdown list, select **Equal (String)**.
9. In the text field, type `2` (meaning the second button).
10. Click **+ Where** button.
**Result**: The **Choose parameter** button appears.
11. From the **Choose parameter** dropdown list, choose `diagramId`.
12. From the **Choose operator** dropdown list, select **Equal (String)**.
13. In the text field, type the ID of the diagram that you created earlier in the process.
Diagram ID is another word for Workflow ID. To find your Workflow ID, you need to navigate to **Automation Hub > Workflows**. Then find the workflow whose ID you need and click on the three dots located on the right side of it. After clicking the three dots, move to the section that displays the ID and click on it. This action will copy the ID for you.
14. Using the date picker in the lower-right corner, set the time range to **Lifetime**. Confirm your choice with the **Apply** button.
15. Click **Save**.
Configuration of the the second metric
## Create dynamic content campaign
---
Set up a single dynamic content campaign to showcase relevant content based on the button chosen and the number of responses received for each option. Three different copies are utilized for distinct scenarios:
Scenario 1: **NO** response
Scenario 2: **YES** response with a rate of over 80% - in this scenario we will also display the exact percentage of customers that responded this way.
Scenario 3: **YES** response with a rate lower than 80%
In this case, we're using a predefined template and customizing it according to our communication requirements. The logic determining the dynamic content change for each scenario will be outlined in the Jinjava code within the dynamic content template.
1. Go to **Experience Hub > Dynamic content > Create new**.
2. Enter the name of the dynamic content.
3. Choose the **Web layer** type.
4. As the audience, select **Everyone**.
### 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**.
8. Select the template that you can further tailor to your communication needs.
**Result**: You are redirected to the template builder.
9. Customize the template layout according to your needs.
10. Add a **HTML** block to display specific content to customers upon clicking a web push button. In this block, you will configure the content logic. Below is a sample Jinjava used to cover the three scenarios mentioned in the description of this part of the process.
Check Jinjava example
(function() { const urlYES = 'https://demoshop.synerise.com/survey?answer=yes'; const urlNO = 'https://demoshop.synerise.com/survey?answer=no'; let currentUrl = window.location.href; let title = document.querySelector('.survey_title') let paragraph = document.querySelector('.survey_paragraph') if(currentUrl.includes(urlYES)){ title.innerText = `Thank You for Your Recommendation! 🌟` paragraph.innerHTML = `
{%- set metricYESValue = '{%- metrics -%} 3308b4d2-7624-42f8-9929-024b564c0ea4 {%- endmetrics -%}' -%}
{%- set metricNOValue = '{%- metrics -%} b173efa8-b172-4073-aa4c-f87d6ef16185 {%- endmetrics -%}' -%}
{%- if (metricYESValue|int / (metricYESValue|int + metricNOValue|int) * 100) >= 80 -%}
Your trust means the world to us! Over {{(metricYESValue|int / (metricYESValue|int + metricNOValue|int) * 100)|int}}%
of the respondents expressed their willingness to recommend our products to their friends and family.
This overwhelming support speaks volumes about the satisfaction and trust our customers place in us.
Thank you for choosing us and for being a part of our community!
{%- else -%}
Your trust means the world to us!
We're thrilled to hear that you would recommend our products/services to your friends and family.
It's our constant endeavor to provide you with the best quality and service,
and your positive feedback reinforces our commitment to excellence.
{%- endif -%}
` } else { title.innerText = `We Value Your Feedback! 🤝` paragraph.innerText = `We're sorry to hear that you wouldn't recommend our products/services.
Your feedback is crucial to us in improving and providing you with a better experience.
If you have a moment, we would love to hear more about your concerns.
Please share your thoughts with us, and let's work together to make things right.
Thank you for your honesty and for being a valued customer.
` } })()
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**.
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. Set the conditions for when the dynamic content should appear. 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** and only on specific pages we've chosen, linked to each button. You can also choose which type of device displays the dynamic content. Additionally, we'll use the **Stop display** feature to make sure the dynamic content is shown to a user just once.
4. Click **Apply**.
5. Optionally, you can define the UTM parameters for your dynamic content campaign.
6. Click **Activate**.
## Generated events
This use case generates approximately 12 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), [`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).
## 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:
- [Web push template](https://app.synerise.com/campaigns/webpush/content-manager/template/126315)
- [Workflow](https://app.synerise.com/automations/automation-diagram/318e3be4-4fde-46a9-9605-84156b7fda7b)
- [Metric 1](https://app.synerise.com/analytics/metrics/3308b4d2-7624-42f8-9929-024b564c0ea4)
- [Metric 2](https://app.synerise.com/analytics/metrics/b173efa8-b172-4073-aa4c-f87d6ef16185)
- [Dynamic content campaign](https://app.synerise.com/campaigns/dynamic-content/create/dcd98d37-1133-495e-826b-a4f93c2e9c42)
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.
# Web push with last visited product
You can use web push notifications to remind customers of their last viewed products, helping them pick up where they left off and complete their purchase journey. Personalized push notifications can increase customer engagement, retention, and ultimately, sales. Reach your customers in a non-intrusive way and provide a seamless shopping experience that keeps your brand top of mind.
In this use case, you will create a workflow sending a personalized web push with product recently viewed by customer.
## Prerequisites
---
- [Implement a tracking code](/docs/settings/tool/tracking_codes).
- [Implement OG tags](/developers/web/og-tags). Make sure that items include an image so webpush can render.
- [Configure web push notifications](/docs/campaign/Webpush/configuring-web-push).
## Process
---
In this use case, you will go through the following steps:
1. [Create aggregates](#create-aggregates) returning the tile, image and link of the last visited product.
2. [Create a web push template](#create-a-web-push-template) with aggregate inserts.
3. [Create a workflow](#create-a-workflow) to send customers a webpush.
## Create aggregates
---
In this part of the process, create three aggregates that return title, image, and link of the last product customer had visited.
### Aggregate returning the title of the last visited product
---
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 **Visited page** event.
5. As the event parameter, select **og:title**
6. Click the **+ where** button.
7. From the **Choose parameter** drop-down list, select the **product:retailer_part_no** parameter.
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 **Custom > Last 12 hours**. Confirm your choice with the **Apply** button.
7. Click **Save**.
Configuration of the aggregate returing the title of the last seen product
### Aggregate returning the image of the last visited product
---
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 **Visited page** event.
5. As the event parameter, select **og:image**
6. Click the **+ where** button.
7. From the **Choose parameter** drop-down list, select the **product:retailer_part_no** parameter.
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 **Custom > Last 12 hours**. Confirm your choice with the **Apply** button.
7. Click **Save**.
Configuration of the aggregate returing the image of the last seen product
### Aggregate returning the link of the last visited product
---
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 **Visited page** event.
5. As the event parameter, select **og:url**
6. Click the **+ where** button.
7. From the **Choose parameter** drop-down list, select the **product:retailer_part_no** parameter.
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 **Custom > Last 12 hours**. Confirm your choice with the **Apply** button.
7. Click **Save**.
Configuration of the aggregate returing the link of the last seen product
## Create a web push template
---
In this part of the process, you will create a web push template with [aggregate inserts you created in the previous part of the process](#create-aggregates).
1. Go to **Experience Hub > Web Push > Templates > Create new**.
2. Click **Drag&drop builder**.
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 copy you want to appear in the web push. In our case it will be an insert with [aggregate returing the product title, created in the previous step](#aggregate-returning-the-title-of-the-last-visited-product). Enter the following code:
Aggregate IDs are used as examples for the purpose of this use case.
6. In the **URL** field, define the link you want to display in the web push. In our case it will be an insert with [aggregate returing the product link, created in the previous step](#aggregate-returning-the-link-of-the-last-visited-product). Enter the following code:
7. In the **Icon** field, define the image you want to display in the web push. In our case it will be an insert with [aggregate returing the product image, created in the previous step](#aggregate-returning-the-image-of-the-last-visited-product). Enter the following code:
8. Optionally, you can define an image in the **Image** field.
Web push template configuration
## Create a workflow
---
The workflow will be triggered by the `session.end` event. The delay is set to 2 hours, after this time customer will receive a web push with the last seen product.
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 **session.end** event.
2. Click **Apply**.
### Configure the Delay node
---
1. Add the **Delay** node. In the node settings:
1. In the **Delay** field, type `2`.
2. From the **Unit** dropdown list, choose **Hour**.
2. Click **Apply**.
### Configure the Send Web Push node
---
1. Add the **Send Web Push** node. In the node settings:
1. In the **Content** section, from the **Webpush template** dropdown, select [the template you created in the previous step](#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**.
### Add the finishing node
---
1. Add the **End** node to the **Send Web Push** 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:
- [Aggregate returning the name of the last visited product](https://app.synerise.com/analytics/aggregates/ae5d9077-d723-3649-8233-08fab406ec53)
- [Aggregate returning an image of the last visited product](https://app.synerise.com/analytics/aggregates/71293b39-ea01-310c-b887-3cb91b6645e3)
- [Aggregate returning a link of the last visited product](https://app.synerise.com/analytics/aggregates/87eba5f7-40ab-3b24-98df-ae2ac6263474)
- [Workflow](https://app.synerise.com/automations/automation-diagram/8e027e43-2ac7-4e50-be0d-b4b6c4c5f469)
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:
[`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) (~2), [`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).
## Read more
---
- [Automation Hub](/docs/automation)
- [Jinjava inserts](/developers/inserts)
- [Web push](/docs/campaign/Webpush)
# Recommend Top-Rated Products on Category Pages Based on Customer Reviews
Customer reviews play a great role in the customer journey. You can use them for your advantage with recommendations. If properly used, they can significantly increase the conversion rate and revenue. This is because customers are more likely to use the services of a company which presents an offer that best suits their needs and preferences, and they pay as much attention to good online reviews.
## Prerequisites
---
- [Import your item feed to AI engine](/docs/ai-hub/recommendations-v2/item-feed-requirements). In the item feed you need to provide a custom attribute storing the average rating of an item.
- Implement [Synerise tracking code](/developers/web/installation-and-configuration#creating-a-tracking-code) on your website.
- Implement [OG Tags](/developers/web/og-tags) on your website.
- Enable the personalized recommendation type in [AI Engine Configuration](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations).
## 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 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 brands that will be recommended to the user.
In our example, it is from 10 (minimum) to 15 (maximum).
12. Click **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).
13. From the dropdown list, choose **Visual Builder**.
14. Click **Select attribute**.
15. From the dropdown list, choose an attribute that contains average item rating.
16. Click **Operator**.
17. From the dropdown list, choose **More than**.
18. In the text input enter the value. In our case, it is `4` (items whose minimum average rating is 4).
19. On the bottom of the elastic filter pop-up, click **Apply**.
20. Click **Apply**.
21. In **Boosting** section, you can enable [boosting](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-the-boosting-factors).
22. In **Additional settings**, optionally you can exclude already bought products and set a metric to sort by.
23. Save the recommendation by clicking **Save**.
## What's next
---
You can display the recommendation on a category 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 [recommendation insert](/developers/inserts/recommendations-v2).
Optionally, you can apply an [additional filter](/developers/inserts/recommendations-v2#open-graph-meta-tags-in-filters) to the insert in order to always display products that are from the same category as your customer currently browses.
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 also check the [AI recommendation configuration](https://app.synerise.com/ai-v2/recommendations/dGZaKdmzVads) 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)
- [Dynamic content inserts](/developers/inserts/dynamic-content)
- [Recommendation campaigns](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign)
# 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)
# Boosting item selection with best fit predictions
Best Fit prediction model returns the best item attribute value for the each customer in the analyzed group. It can be either color, brand, category or any other attribute value you would like to recommend.
In this use case, the goal is to reach customers with a personalized newsletter featuring products from their "Favorite Brand," based on predictions made by Synerise's AI. By leveraging the Best Fit model, products presented in the email campaign can be customized to match the preferences of individual customers and display products from their favorite brand to make it more personalized.
By offering personalized content to each customer, focusing on products from the brand most likely to resonate with their preferences, you can increase engagement and conversion rates.
## Prerequisites
---
- [Create item catalog](/docs/ai-hub/recommendations-v2/item-feed-requirements) that contain `brand` attribute.
- [Enable the best fit predictions](/docs/ai-hub/predictions/enabling-predictions). It usually takes several hours to initialize Predictions and perform necessary calculations.
- The attributes that you want to use for best fit predictions must be configured as [filterable attributes](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-propensity#selecting-filters).
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CreateATransaction) to track customer transaction-related interactions.
## Process
---
1. [Create a segmentation](/use-cases/bestfit-brand#create-a-segmentation) of people who made minimum 1 purchase during last year to be sure that we generate brand prediction for users based on their previous choices.
1. [Create a best fit prediction](/use-cases/bestfit-brand#create-a-best-fit-prediction) to return the brand which a customer is most likely to purchase from.
3. [Create an aggregate](/use-cases/bestfit-brand#create-an-aggregate) that retrieves the result of the prediction.
4. [Create AI recommendations](/use-cases/bestfit-brand#create-ai-recommendations) with personalized products from specific brand.
2. [Create an email campaign](/use-cases/bestfit-brand#create-an-email-campaign) template with AI recommendations.
## Create a segmentation
---
In this part of the process, we will create a group of customers who have made transaction during last year. This group will be the selected as the subject of prediction analysis in further part of the process.
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 a best fit prediction
---
In this part of the process, you will create a prediction that analyzes the group of customers you created in the previous part of the process. The prediction will predict which brand each customer in your selected group is most likely to buy from. The prediction results will be available on the profile card of each customer from the segmentation in the form of a `snr.bestfit.score` event. The `attribute` parameter will contain the name of the brand.
1. Go to **AI Hub > (AI Predictions) Models > New prediction**.
2. On the pop-up select one **Create from scratch**, and then select **Best Fit**.
### Go to Audience section
---
1. In the **Audience** section, click **Define**.
2. Click **Choose segmentation** and select the [segmentation](/use-cases/bestfit-brand#create-a-segmentation) created in the previous step.
3. Confirm by clicking **Apply**.
**Result**: The result of this prediction will be saved on the activity list on the profile of each customer from the segmentation as the **snr.bestfit.score** event.
Segmentation configuration
### Select items
---
1. In the **Item selection** section, click **Define**.
2. Click **Choose item feed**.
3. From the list of available catalogs, select the item feed which you created as a part of [prerequisites](/use-cases/bestfit-brand#prerequisites).
4. From the **Choose item attribute** dropdown list, select **brand**.
5. Optionally, from the **Define item filter** dropdown list, you can define the filters to include the item or items that you want to include in the analysis.
3. Click **Apply**.
### Launch the Prediction
---
1. If you want to leave the settings as default, the prediction is ready to calculate.
2. If you want to change the settings, in the **Settings** section, click **Change**.
3. To schedule a recurring calculation:
1. Select the **Set up recurring prediction calculation** checkbox.
2. In the input field, enter the number of days between calculations.
4. To change the start date of the prediction, in the **Settings** section, click **Change**.
1. Select the **Scheduled** checkbox.
2. In the **Select start date and time** field, specify the date and time for launching the calculation of the prediction.
5. Click **Apply**.
**Results** will be saved in the form of an event: **snr.bestfit.score.**
## Create an aggregate
---
Create an aggregate which will return the latest value from the `topValue` parameter of the **snr.bestfit.score** event. 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.
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 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](/use-cases/bestfit-brand#create-an-aggregate).
11. At the bottom of the elastic filter pop-up, click **Apply**.
12. In the **Items** section, click **Apply**.
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 an email campaign
---
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. Go to **Experience Hub > Emails > Templates > Drag&drop builder** or **Code editor** to create an email template..
2. 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).
4. Save the template.
Prepare an email template
Use the template in an [email campaign](/docs/campaign/e-mail/creating-email-campaigns) which you can send to the group of customers created [at the beginning of the process](/use-cases/bestfit-brand#create-a-segmentation) to encourage them to make another purchase from their favorite brand.
## Check the use case set up on the Synerise Demo workspace
---
You can also check on our demo account the:
- [segmentation](https://app.synerise.com/analytics-v2/segmentations/c39f2834-3f44-4f1d-96d8-0ed6fb272221),
- [aggregate](https://app.synerise.com/analytics/aggregates/673eb2b8-8869-329c-b6d4-b79e3a0f99bf),
- [prediction](https://app.synerise.com/ai-v2/predictions/best-fit-propensity/orbypencokue),
- [AI recommendations](https://app.synerise.com/ai-v2/recommendations/eb5qO10yrfXe).
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.
## Check our latest Case Study
---
Check our [Case Study](https://pulse.synerise.com/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 7 events per profile that completes the flow:
[`snr.bestfit.score`](/docs/assets/events/event-reference/predictions#snrbestfitscore) (~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)
# Birthday email with coupon
It is very important to improve customer loyalty with special **birthday coupons**. On your customer’s special day you can send them a code and at the same time reward yourself with a good chance of more sales for your online business.
Your customers will definitely have a positive reaction when you help to celebrate the occasion and having a gift in the form of discount will make them more likely to spend. If you add automatic birthday emails into your loyalty program it will enable you to build a **more engaged and loyal** customer base.
## Example of use - Retail industry
A customer from the fashion industry had a loyalty club where users shared their date of birth. Based on this information, the company could prepare a birthday email. As a medium, they used email. Customers received an individual discount coupon on their birthday for **20% off** on any product, valid for 14 days. The coupon was valid in both offline and online stores.
Email with a birthday coupon
**Results**
- OR 12,16%
- CTR 18,43%
## Prerequisites
---
- Implement [Synerise tracker](/developers/web/installation-and-configuration#creating-a-tracking-code) on your website.
- [Email account configuration](/docs/campaign/e-mail/configuring-email-account).
- Import of customer base with birthdate in format YYYY-MM-DD.
- Import of [code pools](/docs/assets/code-pools).
## Process
---
To prepare such a scenario, you have to follow 4 important steps.
1. [Import user base](/use-cases/birthday-coupon#import-user-base).
2. [Prepare coupon pool](/use-cases/birthday-coupon#prepare-coupon-pool).
3. [Prepare an email template](/use-cases/birthday-coupon#prepare-an-email-template).
4. [Prepare workflow](/use-cases/birthday-coupon#prepare-workflow).
## Import user base
---
To be able to send a message to users on their birthday, you have to store information about their birthdate. You can prepare a one-time **csv import**, which in basic format may contain only 2 columns:
1. email address.
2. date of birthday.
To prepare this use case, birthdates must be in the YYYY-MM-DD format.
Explanation
Import the prepared file to Synerise as import Clients according to the manual found here. Also you can update users via API, or send it from forms. No matter which method you use, you have to map those fields as Synerise default attributes: email and birthDate.
## Prepare coupon pool
---
On a user’s birthday, you can send each of them an individual coupon code with a discount. To do it, you will have to import to Synerise coupons previously prepared in your ecommerce platform, which will apply the appropriate discount in the shopping cart.
1. To import such coupons, go to Vouchers and prepare a **Voucher pool**, to which you will add your coupons.
2. Add an obligatory **Pool name**, and set the Emission start and end dates.
3. When the pool is created, click **Import** and choose **CSV with vouchers**.
Prepare coupon pool
Remember that your csv should have only 1 column, without a name.
## Prepare an email template
---
To distribute coupon codes in an email, prepare a template.
1. Go to **Experience Hub > Emails > Templates > Drag&drop builder** or **Code editor** to create email template.
2. Click **Inserts** in the upper right corner, find Pools on the list of inserts, then choose the **Coupon pool** prepared in the previous step.
3. Copy and paste it in the place where the coupon code should be shown to the user. Instead of **{% voucher %} voucher-hash {% endvoucher %}**, user will see his individual coupon code.
Prepare email template
If your codes have the appropriate format, you can insert them as barcodes, details [here](/developers/inserts/insert-usage#barcodes).
## Prepare workflow
---
To start sending your prepared email template you have to create a workflow, which in basic configuration may look like the one below. To do this, go to **Automation Hub > Workflows > New workflow**.
Prepare a workflow
### Add the Audience node
To start the workflow for every user who has a birthday on a given date, select the **Audience** node. Set the **Run trigger** option to **repeatable** with 1-day interval.
Audience trigger
### Set up the birthday attribute
Your audience in this trigger has to be customers who have a birthday on this day. During segment creation choose the birthdate attribute, select date format and indicate that value in this attribute has to match the current day and month.
Birthdate attribute
### Set up the birthday email
When you finish setting up the birthday attribute, you can set the **Send Email** node by selecting the appropriate email account, choosing the template that you prepared previously and adding the email subject and UTMs.
Email datail
### Prepare the final settings
1. **Add End nodes** where the workflow should finish for users.
2. 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**.
Set capping 1 for 1 year to avoid a situation in which the customers change their date of birth to get an additional discount twice or more.
## Check the use case set up on the Synerise Demo workspace
---
Check the [workflow settings](https://app.synerise.com/automations/automation-diagram/51b318f7-e9dc-477e-9a95-a7b99ee5a2d0) 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:
[`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), [`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
---
- [Creating code pools](/docs/assets/code-pools)
- [Email templates](/docs/campaign/e-mail)
- [Import clients](/docs/automation/actions/synerise-integrations/import-customers)
- [Inserting coupons](/developers/inserts/insert-usage#code-pools)
- [Updating users via API](https://hub.synerise.com/api-reference/profile-management#tag/Profile-management/operation/BatchAddOrUpdateClients )
- [Workflow](/docs/automation)
# 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)
# Transform and download your segmentation list with your own JavaScript
If you manage a large number of segmentations, having their metadata in one exportable file makes it easier to compare and analyze them as a whole.
This use case describes how to build an automated workflow that retrieves the list of your segmentations from the Synerise API, converts the JSON response into flat rows with the **Run Code** node, and saves the result as a file you can download and open in a spreadsheet application. This gives you a self-service way to filter, sort, and analyze your segmentations — for example, to identify segmentations that haven't been used in a long time, or to audit which segmentations were created by which author — without needing to query the API manually.
The same pattern (retrieving a list from a Synerise API endpoint, reshaping it with **Run Code**, and exporting it as a file) can be reused for other list-type endpoints, such as automations, message templates, or recommendation configurations.
## Prerequisites
---
- You must have segmentations created in **Decision Hub > Segmentation**.
- You must have a [workspace API key](/docs/settings/tool/api) with the `ANALYTICS_BACKEND_SEGMENTATIONS_LIST_READ` permission, used to authorize the request to the [Segmentations - List](https://hub.synerise.com/api-reference/analytics-suite#tag/Analytics:-Segmentations/operation/analytics2-segmentations-list) endpoint.
- You must be assigned a [user role](/docs/settings/identity-access-management/permissions) with the **Data export > Save file** - **Read**, **Edit**, and **Execute** [permissions](/docs/settings/identity-access-management/permissions#permissions), required to configure and run the **Save File** node.
- Basic knowledge of JavaScript, required to configure the [**Run Code** node](/docs/automation/operation/run-code-node).
## Prepare a workflow
---
Create a workflow which retrieves your list of segmentations from the Synerise API, transforms the response into rows, and exports it as a downloadable file.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Trigger the workflow on a schedule
As the first part of the process, define when the workflow runs, so the segmentation list is refreshed automatically without you having to launch the process manually.
1. As the trigger node, add **Scheduled Run**.
2. In the configuration of the node select the **Repeat runs** tab, where the workflow runs on a recurring basis. **Repeat runs** is the recommended option if you want the segmentation export to refresh automatically at regular intervals, for example once a day.
1. From the **Timezone** dropdown list, select the time zone consistent with the timezone selected for your workspace.
2. Define the frequency of the workflow — for example, once a day at a fixed time — according to how often you want the segmentation list refreshed.
3. Confirm by clicking **Apply**.
The configuration of the Schedule Run node
### Retrieve the list of segmentations from the Synerise API
In this part of the process, you configure an HTTP request that retrieves the current list of your segmentations from the Synerise API.
1. Add the **[HTTPS - Get File](/docs/automation/integration/http-integrations/http-get-file)** node and configure the connection with an API key that has the `ANALYTICS_BACKEND_SEGMENTATIONS_LIST_READ` permission.
2. Set the **Method** to **GET**, the **URL** to `https://api.synerise.com/analytics/profiles/segmentations`, and the **File format** to **JSON**.
The [Segmentations - List](https://hub.synerise.com/api-reference/analytics-suite#tag/Analytics:-Segmentations/operation/analytics2-segmentations-list) endpoint accepts parameters you can append to the URL to narrow down the returned set of segmentations, for example: `page` and `limit` (pagination), `search` (search by name), `sortBy` (sorting, for example `name:asc` or `author:desc`), `directoryId` (segmentations from a specific directory), and `ids` (a comma-separated list of specific segmentation IDs).
The configuration of the HTTPS - Get File node
### Transform the raw API response into individual rows
The API response has the structure `{ "meta": {...}, "data": [...] }`. This entire object arrives at the **Run Code** node as a single row, and the a function in the node reaches into the `data` field and returns an array of objects with the selected fields. Returning an array of objects means each element becomes a separate output row, which is how a single API response turns into a full set of rows ready to be saved as a file.
1. Click **THEN** and add the **Run Code** node.
2. In the **JavaScript source code** field, enter the following function:
```javascript
(row) => {
const items = row.data ?? [];
return items.map((item) => ({
id: item.id,
name: item.name,
author: item.author?.id ?? null,
updatedAt: item.updatedAt,
createdAt: item.createdAt,
usedAt: item.usedAt,
}));
}
```
3. Under **Test execution**, in the **Sample file** field, upload a sample JSON file with the same structure as the API response (for example, a response exported earlier from the same endpoint), to preview how your code reads the data.
4. Click **Preview sample data** to check the structure, then click **Execute test** to run the function against the sample and confirm the output contains the expected fields.
5. Confirm by clicking **Apply**.
The configuration of the Run Code node
### Export the transformed data to a downloadable file
As the final part of the process, save the rows produced by the **Run Code** node as a file you can download.
1. Click **THEN** and add the **Save File** node.
2. In the configuration of the node:
1. In the **File name** field, enter the name of the exported file (up to 128 characters).
2. Optionally, from the **File name suffix** dropdown list, select **Date** to add the current date to the file name.
3. Optionally, in the **File expiration** field, define how long the exported file will be available for download. The minimum value is 30 minutes; if left empty, the default expiration period is 7 days.
3. Confirm by clicking **Apply**.
The configuration of the Save File node
### Add the finishing node
1. Add the **End** node and connect it to the **Save File** node.
2. In the upper-right corner, click **Save & Run**.
**Result**: The file is available for download, both as JSON and as CSV, from **Data Modeling Hub > Export**, or from the **Transformation logs** tab in the workflow view.
The workflow configuration
## What's next
---
The combination of an HTTPS - Get File node pointed at a Synerise API list endpoint and a Run Code node that flattens the response can be reused for other data you'd like to export as a file, such as lists of automations, message templates, or recommendation configurations — as long as a corresponding "list" endpoint is available in the [API Reference](https://hub.synerise.com/api-reference/).
If the client needs the file to be delivered automatically to an external system instead of being downloaded manually, the **Save File** node can be replaced with a **Send File** node for [SFTP](/docs/automation/integration/sftp-integrations/sftp-send-file), [HTTPS](/docs/automation/integration/http-integrations/http-send-file), [Amazon S3](/docs/automation/integration/amazon-s3-bucket/send-file-amazon-s3-bucket), [Azure Blob Storage](/docs/automation/integration/azure-blob-storage/send-file-azure-blob-storage), or [Google Cloud Storage](/docs/automation/integration/google-cloud-storage/send-file-to-gcp).
## Read more
---
- ["End" node](/docs/automation/flow-control/end-node)
- ["Get File" node (HTTP)](/docs/automation/integration/http-integrations/http-get-file)
- ["Run Code" node](/docs/automation/operation/run-code-node)
- ["Save File" node](/docs/automation/actions/synerise-integrations/save-file)
- ["Scheduled Run" node](/docs/automation/triggers/scheduled-run)
- [Segmentations - List (API Reference)](https://hub.synerise.com/api-reference/analytics-suite#tag/Analytics:-Segmentations/operation/analytics2-segmentations-list)
# 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)
# Prepare current temperature data for content with Brickworks
Weather APIs return more data than a content template needs. A Brickworks response transformer combines the temperature and its unit into one field that a content consumer can use.
In this use case, you will connect Open-Meteo as an external source, create a Singleton schema with an External Data field, and transform the response into a temperature value such as `23.6°C`
## Prerequisites
---
- Access to **Data Modeling Hub**, with [permission](/docs/settings/identity-access-management/permissions/data-management-permissions#work-with-brickworks) to create the required connection, external source, schema, and response transformer.
- A weather API endpoint that returns the current temperature and its unit. This example uses [Open-Meteo](https://open-meteo.com/).
- Latitude and longitude values to pass when generating the record. This example uses `lat: 50` and `lng: 20`
## Process
---
In this use case, you will go through the following steps:
1. [Create an external source](#create-an-external-source) that retrieves weather data.
2. [Create a schema with an External Data field](#create-a-schema-with-an-external-data-field) that uses this source.
3. [Create a response transformer](#create-a-response-transformer) that combines the temperature and unit.
4. [Preview the transformed response](#preview-the-transformed-response) result before activating the transformer.
## Create an external source
---
In this part of the process, you will define where Brickworks fetches weather data from. The external source defines the request to the weather provider. It can be reused by the error-handling example described in the [follow-up use case](/use-cases/brickworks-handle-weather-api-error-responses).
1. Go to **Data Modeling Hub > External sources > New external source**.
2. Name the source `Open Meteo Connection`
3. Select or [create](/docs/assets/brickworks/creating-external-source#procedure) the connection required by the external source.
4. From the **Method** dropdown list, select the **GET** request method.
5. In **URL**, provide the Open-Meteo forecast endpoint with the coordinates passed from the generation context:
`https://api.open-meteo.com/v1/forecast?current=temperature_2m,[OTHER_CURRENT_PARAMETERS]&latitude={{ context.lat }}&longitude={{ context.lng }}`
1. Replace [OTHER_CURRENT_PARAMETERS] with the list of current parameters you need. The response shown in this use case was generated with a query that requested `temperature_2m`, `relative_humidity_2m`, `apparent_temperature`, `is_day`, `precipitation`, `rain`, `weather_code`, `cloud_cover`, `wind_speed_10m`, `wind_direction_10m`, and `wind_gusts_10m`. The full query string is [to be completed / TBC].
Configure the request method, endpoint, and parameters for your weather API. Pass the latitude and longitude from the generation context to the request.
6. In **TTL**, set the response cache TTL to match your data freshness requirements. Cached responses can be reused until the TTL expires. A shorter TTL returns more current weather, a longer TTL reduces the number of calls to the API. The maximum is 1800 seconds.
6. Save the external source.
External source configuration for the weather provider
## Create a schema with an External Data field
---
Create a singleton schema that makes the external response available to the transformer.
1. Go to **Data Modeling Hub > Schemas > New schema**.
2. Set **Display name** to `Current Temperature`
3. Set the schema type to **Singleton**.
4. Add an **External Data** field with the display name `Open Meteo Connection`
5. Set the field's API name to `openMeteoConnection`, which the transformer below references.
6. Select the external source [created in the previous step](#create-an-external-source).
7. Save the schema. This example includes the following values inside the external response. This is an excerpt, not the full generated object:
## Create a response transformer
---
When you make a request to generate an object from the schema, the external resource returns more data than necessary to show the temperature. The temperature is also split into two objects - one for the number and one for the unit:
```json
{
"current": {
"temperature_2m": 23.6
},
"current_units": {
"temperature_2m": "°C"
}
}
```
The transformer accesses this response through `generated.openMeteoConnection`
To remove the unnecessary data and turn the temperature into a single string that is returned as the field value, create a data transformer:
1. In the schema editor, open **Response transformers**.
2. Select **Edit > Add transformer**.
3. Enter `Extract temperature data` as the name.
4. Add a description, such as `Combines the temperature value and unit into one field`
5. Enter the transformation script.
This script returns a new object that contains only the `temperature` field. It does not preserve other generated fields.
Transformer editor with the script
## Preview the transformed response
---
Test the transformer before selecting it as the active transformer for the schema.
1. Open the record preview for this schema.
2. Set the coordinates for the example: latitude `50`, longitude `20`
3. On the **Transforming response** tab, select `Extract temperature data`
4. Generate the preview and inspect the response. For the sample weather response shown earlier, the transformed result is:
{
"temperature": "23.6°C"
}
Record preview with the temperature
5. After checking the preview, select the transformer as the active one on the schema's **Response transformers** tab.
6. Click **Apply**.
7. Save the schema when ready to use this output.
## Limitations
---
- The transformer runs on the top-level record requested for generation. Transformers on nested records are not processed automatically.
- Only one transformer can be active for a schema, although other transformers can be selected in preview.
- This example expects a successful weather response. It does not handle a missing response or an error returned by the provider.
## What's next
---
Extend the example to [handle weather API error responses](/use-cases/brickworks-handle-weather-api-error-responses). The companion article uses the same external source and returns different results for valid and invalid coordinates.
## Read more
---
- [Brickworks](/docs/assets/brickworks)
- [Response transformers](/docs/assets/brickworks/response-transformers)
# 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#tag/Events/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)
# 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)
# 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#tag/Events/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)
# Calculate the percentage of unique transactions
An accurate analysis of the transaction is a must for businesses. By using the Synerise Decision Hub, you can calculate the number of transactions for a specific period. To make sure you receive a reliable result, use an aggregator which lets you exclude duplicated transactions in case some occur in your workspace, for example due to duplicate data from an external source used in an import.
Additionally, you may calculate the ratio of the unique transactions to all transactions to find out the scale of duplicated transactions in your workspace.
This use case describes a process of creating metrics on the basis of the `transaction.charge` event and the `$orderId` event parameter. One of them counts only the number of all unique transactions with the use of the Count Distinct aggregator. The other calculates the percentage of unique transactions through a mathematical formula.
## Prerequisites
---
Implement transaction events either through [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CreateATransaction).
## Process
---
1. [Create a metric that calculates the number of unique transactions](/use-cases/calculate-unique-transactions#calculate-the-number-of-unique-transactions).
2. [Create a metric that calculates the ratio of unique transactions to all transactions](/use-cases/calculate-unique-transactions#calculate-the-percentage-of-unique-transactions).
## Calculate the number of unique transactions
---
Create a metric on the basis of the `transaction.charge` event to count the unique occurrences of the event with an `$orderId` parameter.
This analysis uses a `transaction.charge` event, which is generated after a purchase as a summary of an order (as opposed to `product.buy` which is generated separately for each item from a specific order). The names of the events may be different in your workspace.
1. Go to **Decision Hub > Metrics > New metric**.
2. Leave the metric kind at default (**Simple**).
3. Leave the type at default (**Event**).
4. As the aggregator, select **Count Distinct**.
5. From th **Choose event** dropdown list, select **transaction.charge**.
6. As the event parameter, select **$orderId**.
7. In the lower right corner, select the data range for which you want to analyze the data.
8. Save the metric.
**Result**:
The configuration of the metric
## Calculate the percentage of unique transactions
---
Create a metric with a mathematical formula which calculates the ratio of unique transactions to all transactions in your workspace.
1. Go to **Decision Hub > Metrics > New metric**.
2. As the metric kind, select **Formula metric**.
3. On the dashboard, click **Select**.
4. From the dropdown list, select **Event**.
5. Click the **unnamed** node.
6. From the **Choose event** dropdown list, select **transaction.charge**.
7. As the aggregator, select **Count Distinct**.
8. In the lower right corner, set the date range to **Lifetime**.
9. Click the button.
10. From the dropdown list, select **Event**.
11. Click the **unnamed** node.
12. From the **Choose event** dropdown list, select **transaction.charge**.
13. Leave the aggregator type at default (**Count**).
14. In the lower right corner, set the date range to **Lifetime**.
15. Click the button.
16. From the dropdown list, select **Number**.
17. Replace `0` with `100`.
18. Change the mathematical operators:
1. Between the nodes with events, change the plus sign to the division sign.
2. Between the transaction.charge node and `100`, change the plus sign to the multiplication sign.
19. Save the metric.
**Result**:
The configuration of the 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 a convenient and readable form.
Additionally, you may use one of the metrics in an alert system that notifies you when the metric result deviates from the norm. To create such an alert, you can use Automation Hub, create a workflow and include a [Metric Filter](/docs/automation/conditions/metric-filter-node) node. If the metric results exceeds a specific number, you can send an email alert, SMS alert, or a message to a third party tool by using [Outgoing Integration](/docs/automation/integration/outgoing-webhook).
You can get inspired by one of our [use cases which presents a workflow that sends a message to a Slack channel with the metric results](/use-cases/slack-integration).
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of both metrics on our Synerise Demo workspace:
- [The number of unique transactions](https://app.synerise.com/analytics/metrics/1c56a0aa-0331-47c7-8d5f-f56bbb32d1e9)
- [Ratio of unique transactions to all transactions](https://app.synerise.com/analytics/metrics/09ddb511-83f3-4d1e-a423-0d234fab9286)
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
---
- [Metrics](/docs/analytics/metrics)
- [Metric use cases](/use-cases/?ordering=DESC&sortBy=publishDate&filters=tags%3D%3D"metrics")
# Personalized prices for loyalty club members
---
Adjusting product prices for customers with a loyalty card affects customer engagement and attachment to the brand.
Loyalty programs provide not only motivation for customers to make a purchase but also help you to create meaningful connections. To **boost your member engagement**, you can use special discount policies.
This is an effective way to create a unique customer experience. **Special prices only for members** can be a great value to your clients, proving that you want to provide better service to them. On the other side, your lower prices will seem more appealing and encourage your customers to make a purchase.
## Example of use - Retail industry
**Challenge**
A customer from the jewelry industry has a group of clients who belong to a loyalty club. For these users, product prices in the recommendation boxes **should be reduced by 10%. **
The value of products is the same for everyone until a specific user logs in to the client panel as a loyalty club member. When the system recognizes him, then the discount is added, and relevant information is sent to Synerise.
After the customer visits the site, he will see recommended products with a better price, with a special discount for him. In addition, such products are marked with a special mini logo so that the customer is aware that this is not a standard discount, but a discount for club members.

## Requirements
---
1. Basic elements of AI integration:
- Synerise Tracker
- Product feed, filled with appropriate custom attributes
- Transactional events
- OG tags
2. Additionally:
- information in the product feed about the price after the discount, saved as a custom parameter, or providing a special rule by which we will calculate the price
- information sent to dataLayer or a cookie with information about being a loyalty club member
## How to do it
---
1. Prepare AI campaign. Select the type of recommendation, for example personalized recommendations.
2. In the next step, you should modify the dynamic content campaign so that it will download information from dataLayer or cookies and modify the prices of products.
To prepare the mechanism, both product prices should be downloaded **using jinjava**. This is necessary because downloading data from the feed is only possible when the user enters the website, and at this time we do not yet have information whether a given discount should be granted. It's best to keep both prices hidden in CSS. We check the information in Data Layer / cookies in JS and based on it we discover the price accordingly.
Sample code below:
- **HTML:**
Here the appropriate price variant is discovered.
## 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 [dynamic content](/docs/campaign/dynamiccontent)
- Read more about [recommendation types](/docs/ai-hub/recommendations-v2)
# 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)
# Personalized recommendations in a mobile app
Every customer wants to feel special and wants to be able to get their needs met without effort. That's why personalization is so useful, which makes the shopping process for each user simpler and more enjoyable. Using mobile applications, companies can create various types of recommendations, helping to personalize the product offer to each user.
In this use case, you will learn how to create a personalized recommendation frame in a mobile app. Based on the product browsing history, the recommendations will display items that match customer's preferences.
## Prerequisites
---
- [Implement Synerise SDK in your mobile application](/developers/mobile-sdk).
- Implement [product.view event in your mobile application](/developers/mobile-sdk/event-tracking#product-viewed) and [transactions](https://hub.synerise.com/api-reference/data-management#tag/Events).
- [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. [Preparing recommendations](/use-cases/personalized-recommendations-in-mobile-app#prepare-recommendations).
2. [Preparing a document with recommendations](/use-cases/personalized-recommendations-in-mobile-app#prepare-a-document-with-recommendations).
## Prepare recommendations
---
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. In **Static filters**, set the following parameter:
- `availability` to `true` - it shows only available products.
Configuraion of the filters
4. Confirm by clicking **Apply**.
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 the **Save** button in the upper right corner.
## Prepare a document with recommendations
---
1. Go to **Data Modeling Hub > Documents > Add document**.
2. Define name and description.
3. From the **Type** dropdown menu, choose the type of document.
4. Define **Content (JSON)** section.
**Example**:
Where `XXX` is the value that needs to be replaced with the ID of the recommendation created in [this step](/use-cases/personalized-recommendations-in-mobile-app#prepare-recommendations)
5. Save the document by clicking the **Apply** button in the bottom right corner.
## What’s next
---
Recommendations in the mobile app can be displayed in a number of ways, such as referring to the document by using the content widget in [iOS](/developers/mobile-sdk/displaying-recommendations/content-widget/ios) or [Android](/developers/mobile-sdk/displaying-recommendations/content-widget/android).
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of use case in Synerise Demo workspace:
- [Recommendation configuration](https://app.synerise.com/ai-v2/recommendations/uq5juAkds44q)
- [Document](https://app.synerise.com/assets/documents/94081f9b-ee19-42c2-bf8a-4c25542e0854)
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 documents](/docs/assets/documents)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# 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#tag/Promotions%3A%20activation%20%26%20redemption/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%3A%20activation%20%26%20redemption/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)
# Remove profiles from Custom Audience in Facebook
You can use Synerise to manage your Custom Audience in Facebook and update it by adding or removing users based on all the data collected in Synerise, like customer activity and attributes. Removing profiles from audiences can be useful when we want to remove a club member when they unsubscribe, or we have an audience which abandoned shopping cart, and we want to remove from it customers who have made a purchase.
In this use case, you will use the native Facebook integration in Automation Hub to remove users from Facebook Audience after they withheld newsletter consent.
## 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`.
- Have a [Custom Audience in Facebook](https://developers.facebook.com/docs/marketing-api/reference/custom-audience/) from which you would want to remove users, who withheld newsletter consent. Save the ID of the Custom Audience.
## Create a workflow
---
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 `newsletter.unsubscribe` event, so each resignation from subscription will start a workflow.
1. On the dashboard, click the **Add trigger** icon.
3. From the dropdown list, select **Profile Event**.
**Results**: The **Profile Event** node is added to the dashboard.
4. Click the node.
**Result**: A pop-up appears.
5. Click **Choose event** and from the dropdown list, select `newsletter.unsubscribe` event.
6. Confirm by clicking **Apply**.
Profile Event node configuration
### Define the Remove Profiles from Facebook Audience node
In this part of the process, you will configure the node which removes users from Facebook Audience.
1. As the second node of the workflow, add **Remove Profiles from Facebook Audience**.
2. Click the node.
3. Click **Select connection** and from the dropdown list, select the earlier established connection.
If you haven’t established a connection yet, see [Create a connection](/docs/automation/integration/facebook/send-custom-audience#create-a-connection).
4. In the **Graph API version** field, enter the currently used version of Facebook API.
5. From the **Identifier type** dropdown list, as the identifier, select **Email**.
6. In the **Identifier source**, enter the following Jinjava tag: `{{ client.email }}`
7. In the **Custom Audience ID** field, enter the ID of the Custom Audience.
8. Confirm by clicking **Apply**.
Remove profiles from Facebook Audience node configuration
9. Add the **End** node and save your worfklow.
Workflow configuration
**Result:** From now on, users who unsubscribe from the newsletter, will be automatically removed from the audience selected in the **Remove profiles from Facebook Audience** node.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [workflow configuration](https://app.synerise.com/automations/automation-diagram/714ee926-ca4e-4113-a752-3d0f220def7e) 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:
[`newsletter.unsubscribe`](/docs/assets/events/event-reference/email#newsletterunsubscribe) (~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), `facebook.removeFromCustomAudience` (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Facebook Integration](/docs/automation/integration/facebook)
# Loyalty programs basics
There are a lot of ways to encourage existing customers to continue being returning customers, but one of the best and most effective ways to do this is via creating a customer loyalty program. Its most important advantages are increasing Customer Lifetime Value, boosting loyalty, and avoiding churn.
Examples of activities that can be taken into account in the loyalty program are:
- Product page view,
- Product category page view,
- Adding a product to the basket,
- Product purchase,
- Purchase above a certain price,
- Purchase a product from a specific category,
- Newsletter subscription,
- After-sales survey submission,
- Events from ticketing system (customer care),
- Events connected with the external partnerships.
Without any coding, based on Synerise possibilities we can manage to develop rules for calculating points for such activities.
In this use case, we will present a **basic schema for building loyalty program**, which is the necessary first step you have to make in the beginning if you wish to calculate points for purchased products.
We will describe the basic rules, based on which:
- we granted customers with 1 point for every 1 PLN spent,
- we count the points separately for every product in one transaction,
- we multiply the number of points by number of products bought, if the customer has bought more than one item of specific product,
- we round down the number of points (for example, for spending 80,60 PLN, the customer gets 80 points),
- we count the point balance for every customer.
Those rules are the fundamental elements which might be treated as the basic loyalty program as a whole. We use basic conditions, awarding 1 point for every 1 PLN spent, but you can adjust those settings to your business needs. It is worth mentioning that, based on these elements, you can add more rules, exclusions, and requirements, to make your program more complex. For example, you can multiply the number of points awarded for specific products or product categories or opt out of awarding points for them at all. In this use case, we focus on the mechanism of earning points, but Synerise also provides functionalities for [spending points](/loyalty/lesson-4/type-of-promotion).
## 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.
## Prerequisites
---
Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CreateATransaction).
Additionally, you can also collect a [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 joins, resigns, or re-joins).
## Process
---
The process of creating the basic loyalty program described in this use case is divided into two main stages:
1. **Prepare the points schema** -
this part of the process consists of the following:
1. [Create an aggregate](/use-cases/loyalty-programs-basics#create-an-aggregate-which-counts-number-of-productbuy-events-in-a-single-transaction) which counts number of product.buy events in a single transaction
2. [Create an expression](/use-cases/loyalty-programs-basics#create-an-expression) which contains the aggregate from step 1.
3. [Create an expression](/use-cases/loyalty-programs-basics#create-an-expression-that-counts-money-spent-for-a-single-productbuy-event) that counts amount of money spent on the products for a single product.buy event
4. [Create an aggregate](/use-cases/loyalty-programs-basics#create-an-aggregate-counting-money-spent-on-the-products-within-a-single-transaction) which counts the amount of money spent on the products within a single transaction.
5. [Create an expression](/use-cases/loyalty-programs-basics#create-an-expression-which-adds-points-for-money-spent) which calculates how many points a transaction is worth and rounds them down.
6. Contact Synerise support to implement the `points.loyalty` event which saves the result of the point calculation as an event in a customer's profile. A parameter in the event is then used for creating an aggregate.
2. **Count the points balance** -
this part of the process consists of the following procedures:
1. [Create an aggregate](/use-cases/loyalty-programs-basics#create-an-aggregate-counting-the-number-of-points) which counts the number of points gained by customer.
2. [Create an expression](/use-cases/loyalty-programs-basics#create-an-expression-which-returns-the-number-of-points-gained-by-customer) which returns the value of the aggregate with the number of points.
## Prepare the points schema
In this part of the process, you will create the basic schema of counting points in a loyalty program, in which you grant customer with 1 point for every 1 PLN spent. This includes rounding points down when the amount includes hundredths. For example, for 80,60 PLN the customer gets 80 points.
### Create an aggregate which counts number of product.buy events in a single transaction
---
In this part, you create an aggregate which counts number of product events in every processed transaction. It is used for checking integrity of the process.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the name of the aggregate
4. Set **Analyze profiles by** to **Count**.
4. In the formula of the aggregate:
1. Click **Select**.
2. From the **Select property** dropdown list, pick **Event** attribute.
3. Click **Choose event** and enter `product.buy`.
3. From the **Choose parameter** dropdown list, select `$orderId`.
5. From the **Choose operator** dropdown list, pick **Equal (String)**.
6. Click the icon next to the Equal operator twice to get
7. In the first box, add `orderId` and in the second add any value (in our case it might be `1`).
8. Define the period from which the aggregate will return products from the event as Lifetime.
9. Click **Save**.
Aggregate which counts number of product.buy events in a single transaction
### Create an expression
---
In this step, you create an expression which contains the aggregate from the previous part of the process. It will be used for workspace configuration by Synerise CSI team.
1. Go to **Behavioral Data Hub > Expression > New expression**.
2. Enter the name of the expression.
3. As a type of expression, select **Attribute**.
4. Click the **Select** button and select **Profile**.
7. To configure the settings, click **Unnamed**.
8. Click the **Choose attribute** button and select the aggregate created in the previous step.
9. Click **Publish**.
Expression settings
### Create an expression that counts money spent for a single productbuy event
---
In this part, you create an expression which counts amount of money spent on all products within a single transaction. This is also a place where you can exclude products from points calculation.
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 **product.buy** event.
3. Click the **Select** button and select **Event attribute**.
4. Choose parameter **$quantity** from the list.
5. Click the **+** button and select **Event attribute**.
4. Choose parameter **$finalUnitPrice** from the list.
9. Change the mathematical operator between these two parameters to multiplication.
10. Click **Save**.
Expression counting money spent on every product within transaction
### Create an aggregate counting money spent on the products within a single transaction
---
In this part, you create an aggregate which counts amount of money spent on all products within a single transaction. This is also a place where you can exclude products from points calculation.
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 `product.buy` event.
5. As the event parameter, choose the [expression](/use-cases/loyalty-programs-basics#create-an-expression-that-counts-money-spent-for-a-single-productbuy-event) created in the previous step.
6. Click the **+ where** and as the parameter select the `$orderId`.
ID of the transaction is necessary for Synerise Team to be able to charge points after every transaction separately.
7. As the operator select **Equal**.
8. Click the icon next to the **Equal** operator two times, to find dynamic key icon.
9. In the first box add `orderId` and in the second add any value (in our case it might be `1`).
10. Define the period from which the aggregate will return products from the event as **Lifetime**.
11. Click **Save**.
Aggregate counting money spent on every product within transaction
### Create an expression which adds points for money spent
---
In this part, you create an expression which adds 1 point for every 1 PLN spent and additionally rounds down to full units (for example, for spending 80,60 PLN, the customer gets 80 points). This expression is also used by Synerise CSI team for workspace loyalty configuration.
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. Click the **Select** button and select **Function**.
4. From the dropdown list, select **Floor**.
This function rounds down the results of expressions (for example 4.99 will be rounded down to 4).
5. Click the **Select** button.
6. From the dropdown list, select **Profile**.
6. Click **Unnamed** to display the settings.
7. Click the **Choose attribute** button and select the [aggregate created in the previous step](/use-cases/loyalty-programs-basics#create-an-aggregate-counting-money-spent-on-the-products-within-a-single-transaction).
7. Click **+** button and select **Constant**.
8. As the value of the **Constant**, add `1`
This way, you define that for every 1 PLN spent, the customer will get 1 point.
9. Change the mathematical operator between these two parameters to multiplication.
10. Click **Save**.
Expression which adds 1 point for every 1 PLN spent and additionally use the round down mechanism
### Contact Synerise to enable loyalty points
---
Once you prepare all the above analytics, contact the Synerise [Support Team](https://synerise.com/support) to configure the materialization of loyalty points. You need to send links or IDs of both created expressions and let our Support Team launch your loyalty program. 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).
## Count the points balance
---
In this part of the process, you will create analytics which counts the points balance for each customer. It is important to have that information in one place so it can be used in further communication with customers.
### Create an aggregate counting the number of points
---
In this step, you create an aggregate which counts the number of points 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. Define the date filter as **Lifetime**.
7. Click **Save**.
Aggregate counting the number of points
### Create an expression which returns the number of points gained by customer
---
In this part, you create an expression which counts the number of points for a specific customer.
The expression in this is a simple example whose only purpose is to show the result of an aggregate. Unlike an aggregate, for the purpose of a loyalty program you can make it more advanced by adding mathematical operations, conditions, and exclusions based on your business needs. For example, you can add points collected from other campaigns, take into account [expired and spent points](https://pulse.synerise.com/loyalty-points-balance-management-with-synerise/) and [transfer of the points](/use-cases/loyalty-points-transfer-with-push) between customers. Remember that regardless of how many elements you have implemented in your loyalty program and how extensive it should be, you can include all the necessary elements directly in this expression.
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. Click the **Select** button and select **Profile**.
4. Click **Unnamed** to display the settings.
7. Click the **Choose attribute** button and select the [aggregate created earlier](/use-cases/loyalty-programs-basics#create-an-aggregate-counting-the-number-of-points).
10. Click **Save**.
Expression which counts the points balance for every customer
## What's next
---
You can use the created [expression](/use-cases/loyalty-programs-basics#create-an-expression-which-returns-the-number-of-points-gained-by-customer) with the points balance as an [insert](/developers/inserts) and use it on the website, display it in personalized dynamic content campaigns, send it in a push message, SMS, or email campaign with the information about current points balance.
Also, you can use it as a part of the dedicated promotions for users with a specific number of points and take into account the number of points gained by a customer in the conditions of promotions displayed, for example, in your mobile application.
The expression is also available as a profile attribute, so you can use it in analytics, for example to create a segmentation of customers depending on their collected points, and then use that segmentation as a workflow audience.
In this article, we described the fundamental requirements for a basic loyalty program, but we encourage you to develop it and make it more personalized and adjusted to your business needs. Here are a few examples to help you in adding more complex elements and options to your loyalty program:
- Learn how to manage the [expired and burned points](https://pulse.synerise.com/loyalty-points-balance-management-with-synerise/).
- Learn how to [add points for custom events](/use-cases/adding-points-for-custom-event).
- Learn how to [transfer the points between customers](/use-cases/loyalty-points-transfer-with-push).
- Learn how to create [promotion for joining loyalty program](/use-cases/discount-promotion-for-first-transaction).
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of all described analytics directly in Synerise Demo workspace:
1. Preparation of points schema:
- [Aggregate](https://app.synerise.com/analytics/aggregates/3999696a-0bc2-38a6-90b8-1edfb501f4ef) which counts number of product.buy events in a single transaction.
- [Expression](https://app.synerise.com/analytics/expressions/e68f934c-143d-4bbc-92b4-fa342bf5526e) which contains the aggregate from step 1.
- [Expression](https://app.synerise.com/analytics/expressions/8e1ea568-2a13-44fd-8e76-967a8356dbdf) that counts amount of money spent on the products for a single product.buy event.
- [Aggregate](https://app.synerise.com/analytics/aggregates/6c316763-b3ef-3427-90ed-e1934b6207fd) which counts the amount of money spent on the products within a single transaction.
- [Expression](https://app.synerise.com/analytics/expressions/5b4644ae-c1c9-4bb8-90a5-6a19b7aa60f5) which calculate how many points a transaction is worth and rounds them down.
2. Counting the point balance:
- [Aggregate](https://app.synerise.com/analytics/aggregates/90878ebe-d993-37d1-b1b6-06cc1d7a2015) which counts the total number of points gained by a customer.
- [Expression](https://app.synerise.com/analytics/expressions/702c634e-b142-4dfb-8d10-dd7873eaf5d6) which return the value of the aggregate with the number of points.
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), [`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~2), [`points.loyalty`](/docs/assets/events/event-reference/loyalty#pointsloyalty) (~1).
## 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)
# 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#tag/Events/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)
# Predict propensity to buy items with an attribute
You can use the Predictions feature to calculate the probability of customers buying items with a particular attribute value, such as color or size. The results can be used for better targeting of your marketing efforts.
In this use case example, an additional condition is added - the items must be available at the time of calculation.
Propensity to buy items with the color attribute set to "red". Only available items are included in the calculation.
## Prerequisites
---
- [Enable the Propensity model](/docs/ai-hub/predictions/enabling-predictions#enabling-propensity-and-best-fit-predictions).
- The item feed must contain the attribute you want to use for the prediction 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 item attribute
In this section, you define the items for which you want to calculate the prediction. This is done by creating an item filter that matches only the items with an attribute of your choosing.
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 an attribute.
You can use the search field.
Custom attributes have an `attribute` prefix in the selector.
6. From the drop-down list that appears, select the **Equal** operator.
7. From the list of available values that appears, select a value.
You can use the search field.
You can only choose attribute values which already exist in the item feed.
8. Click **Add condition**.
9. From the **Select attribute** drop-down list, select the **availability** attribute.
10. From the drop-down list that appears, select the **Equal** operator.
11. From the list of available values, select `true`.
The filter matches items with an attribute value (attributes.exampleAttribute = "example value") and the items must be available
12. Click **Save**.
13. 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/rgsoxyozowvg) 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)
# Dynamic content with recommendation carousel
Similar item recommendations are a powerful tool for online retailers that suggests products to customers that are similar to those they are currently browsing or have purchased in the past. These recommendations are useful as they can help customers discover new products that they might not otherwise find, and they can also help sellers increase sales by promoting products that customers are more likely to be interested in.
This use case describes the implementation of dynamic content (DC) with recommendations of similar items on a website. 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](/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.
## Process
---
In this use case, you will go through the following steps:
1. [Prepare AI recommendations](/use-cases/dynamic-content-recommendation-carousel#prepare-ai-recommendations).
2. [Create dynamic content](/use-cases/dynamic-content-recommendation-carousel#create-dynamic-content-campaign) with similar item recommendations using the predefined dynamic content web layer template.
## Prepare AI recommendations
---
In this part of the process, you will configure a similar items recommendation which 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 and settings in the **Additional settings** section.
9. In the right upper corner, click **Save**.
## Create dynamic content campaign
---
Create a dynamic content campaign with recommendations of similar items using a predefined dynamic content web layer template. This dynamic content will be displayed as a pop-up on your site for the customers who have added products to their shopping cart.
1. Go to **Experience Hub > Dynamic content > Create new**.
2. Enter the name of the dynamic content.
3. Choose the **Web layer** type.
4. As the audience, select **Everyone**.
### 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. 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-recommendation-carousel#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`
- `imageLink` -> `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**.
**Result**: This is an example of how the pop-up with the predefined template may look like on the website:
Example of dynamic content with carousel on a website
## 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:
- [AI Recommendation](https://app.synerise.com/ai-v2/recommendations/FvK977G7W8LM)
- [Dynamic content](https://app.synerise.com/campaigns/create/c1aff499-c68f-463e-94ba-bb3cd0c43294)
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)
- [Dynamic content template builder](/docs/campaign/dynamiccontent/creating-dynamic-content-templates/dynamic-content-template-builder)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# 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#tag/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)
# Creating event parameters out of event expressions
In the realm of marketing automation, Synerise stands out as a platform that empowers users with advanced capabilities, allowing for dynamic and efficient campaign management. One notable feature that enhances the flexibility of Synerise is its support for **multi-parameter expressions.** This functionality becomes particularly valuable in scenarios where obtaining multiple pieces of information from a single aggregate operation is crucial.
Consider a use case in which a marketing campaign revolves around a price drop strategy. The challenge in this use case is combining both the SKU (Stock Keeping Unit) and corresponding price from a [`page.visit` event](/docs/assets/events/event-reference/web-and-app#pagevisit) within a single analysis in Synerise. Synerise [aggregates](/docs/crm/aggregates) let you produce results concerning one particular parameter at a time. This means that obtaining a combination of SKU and price information would require creating two separate aggregates - one for SKU and another for price. However, using expressions enables you to analyze more than one parameter of a selected event. You can then use the result of this expression as a special parameter of that event in other types of analyses. This approach simplifies the implementation of a price drop strategy.
In this use case, we will create an event expression that combines SKU of a product and its price into one string from a page visit event. Later on, we will create an aggregate that returns SKUs and prices of 10 last visited products and the aggregate will reuse the event expression created in the first part of the process.
## Prerequisites
---
- Implement [tracking code](/developers/web/installation-and-configuration#creating-a-tracking-code) on your website with [OG:tags](/developers/web/og-tags).
- Implement [product feed](/developers/product-feed).
- Implement [product catalog](/docs/assets/catalogs).
- [Implement transaction events](/developers/web/transactions-sdk).
- [Implement tracking cart status](/developers/web/cart).
## Process
---
In this use case, you will go through the following steps:
1. [Prepare an expression](/use-cases/multi-params-expression#prepare-an-expression) that retrieves the values of `product:retailer_part_no` and `product:price` parameters from a page visit event and joins them by separating it with semicolon (`;`).
2. [Prepare an aggregate](/use-cases/multi-params-expression#prepare-an-aggregate) that returns SKUs of 10 last visited items with their prices.
### Prepare an expression
---
In this part of the process, create an expression that will retrieve values of the SKU (Stock Keeping Unit) and the corresponding price from a `page.visit` event and join them in one string which is separated by semicolon (`;`).
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 **page.visit** event.
4. In the **Formula definition** section of the page, click **Select**.
**Result**: A dropdown list appears.
6. From the dropdown list, select **Function**, and form the list select **Concat**. This function joins two or more strings together and returns the joint string as the result.
5. Click the first **Select** element that appeared. From the dropdown list, select **Function**, and form the list select **Concat**.
5. Click the left **Select** element. From the dropdown list, select **Event attribute**.
9. Open the settings of the event attribute by clicking the **unnamed** expression element that appeared.
10. From the **Choose parameter** dropdown, select `product:retailer_part_no`.
15. Click the middle **Select** element, from the dropdown list select **Constant** and set its value to `;`.
16. Click the right **Select** element, and from the dropdown list, select **Event attribute**.
9. Open the settings of the event attribute by clicking the **unnamed** expression element that appeared.
10. From the **Choose parameter** dropdown, select `product:price`.
10. From the **Choose parameter** dropdown, select `product:price`.
Configuration of the expression.
16. Save the expression.
### Prepare an aggregate
---
In this part of the process, create an aggregate that returns SKUs and prices of 10 last visited items. In this aggregate, the expression from the previous part of the process will be used.
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 as the size, set `10`.
4. Click **Choose event** and from the dropdown list, select **page.visit**.
5. From the **Choose parameter** dropdown list, select the [expression created in the previous step](/use-cases/multi-params-expression#prepare-an-expression).
5. Click **+ where**.
6. From the **Choose parameter** dropdown list, select **product:retailer_part_no**
7. From the **Choose operator** dropdown list, as the value, select **Is true (Boolean)**.
8. Set the analyzed period to **Lifetime**.
Configuration of the aggregate
9. Click **Save**.
**Result**:
Configuration of the aggregate
## What's next
---
As a next step, you can use this solution in many use cases in which you can simplify multiple operations by creating an event expression and use it in the parts of the process where it is necessary. This will make the process of gathering data easier. A one example in which you can use this solution to make it easier might be [price drop](/use-cases/price-drop-alert).
## Check the use case set up on the Synerise Demo workspace
---
Check the prepared [expression](https://app.synerise.com/analytics/expressions/a9434d9b-f465-45b0-851c-a81586e52e7a) and [aggregate](https://app.synerise.com/analytics/aggregates/f53dfb1a-71ea-34b1-ac47-8a8081f367dd) 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 does not generate any events.
## Read more
---
- [Aggregates](/docs/crm/aggregates)
- [Expressions](/docs/crm/expressions)
- [Functions in expressions](/docs/crm/expressions/functions-in-expressions)
# Abandoned cart with a control group and A/B tests
Measuring the effectiveness of campaigns is crucial to evaluate their success and determine if they met their objectives. An important component of this measurement is the use of a control group, which allows for better analysis of campaign activities. By comparing the effects of campaigns targeted at the target group with those aimed at the control group (which doesn't receive any special campaigns), it becomes easier to assess the campaign's impact.
A/B testing is a valuable technique that complements the control group approach and helps optimize campaign results. It involves testing different versions of a campaign to determine which one resonates best with the target audience.
This use case presents a detailed scenario of an abandoned shopping cart. The scenario consists of two workflows, each with its own logic explained in the corresponding steps of the process.
Here is a high-level overview of the process:
- The process starts with adding a product to the shopping cart.
- The process includes control and target groups.
- Depending on which group customers are assigned to, they follow different workflow paths.
- Customers in the target group receive email communication about the abandoned shopping cart, while customers in the control group don't receive any additional communication. Instead, we generate an event for the control group as a simulation for sending an email. This event is later used to analyze the effectiveness of communication targeted at the target audience.
- A/B test are used to find the most effective approach that resonates with customers from the target group.
- To ensure consistent email messaging, each customer is assigned an **email_group** attribute before receiving the first email. This attribute identifies the type of email the user should receive.
- After sending the respective email or simulating it (for the control group), the automation checks if customers in both groups made a purchase within 25 hours of abandoning their cart.
- If a transaction occurs, an event is generated with the main information about the transaction. Otherwise, a follow-up email is sent to customers.
The detailed logic of each workflow along with the required analytics will be presented in the corresponding process steps.
## Prerequisites
---
- [Implement a tracking code](/docs/settings/tool/tracking_codes) 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#tag/Events/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. This event must to be sent to Synerise after every change in the cart status.
- Collect [product.addToCart events](/docs/assets/events/event-definitions).
- [Create a control group dispatcher](/use-cases/control-group-dispatcher).
See a short explanation of how the dispatcher works
The dispatcher is essentially a piece of software that intelligently manages content distribution. It uses the DC template, which is like sets of rules, to determine which content to display to different users.
Behind the scenes, this dispatcher employs JavaScript. JavaScript code within the template dynamically updates the webpage based on predefined user allocations. This means that when someone visits the webpage, the dispatcher instantly decides which version of content they should see, whether it's 'A' or 'B,' according to the rules set in the DC template.
Moreover, it attaches a special 'data-test-snrs' attribute to each user's experience. This attribute acts as a marker, helping us later identify which version of content each user was exposed to. This kind of tracking is valuable for understanding how different messages perform and for tailoring future interactions based on users' previous experiences.
- Create email templates that will be use in the abandoned cart communication.
- [Create an email account](/docs/campaign/e-mail/configuring-email-account) which you will use to send emails.
## Process
---
In this use case, you will go through the following steps:
1. [Create an aggregate](/use-cases/abandoned-cart-scenario#create-an-aggregate-that-returns-the-number-of-products-in-a-cart) that returns the last total quantity of items the shopping cart for each customer.
2. [Create the first workflow](/use-cases/abandoned-cart-scenario#create-the-first-workflow) which outlines the logic of an abandoned cart scenario involving the sending of emails to a target group and a control group.
3. [Create an aggregate](/use-cases/abandoned-cart-scenario#create-an-aggregate-that-returns-the-timestamp-of-the-first-message-sent-from-an-abandoned-cart-campaign) that returns the timestamp of the first message sent from an abandoned cart campaign.
4. [Create an aggregate](/use-cases/abandoned-cart-scenario#create-an-aggregate-that-returns-the-order-id-of-the-first-transaction-that-took-place-after-the-first-email-from-abandoned-cart-campaign-was-sent) that returns the order ID of the first transaction that took place after the first email from abandoned cart campaign was sent.
5. [Create a second workflow](/use-cases/abandoned-cart-scenario#create-the-second-workflow) designed to identify transactions within the abandoned cart scenario.
## 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 the first workflow
---
This workflow outlines the logic of an abandoned cart scenario involving the sending of emails to a target group and a control group. The paths for both groups are very similar, with the only difference being that in the control group, an email isn't sent. Instead, sending the email is simulated by generating a special event.
To understand the more detailed logic behind the first workflow, let's break it down into several parts:
1. **Trigger:** The workflow is initiated when a customer adds a product to the cart.
2. **Path Division:** In this step, we divide the path for customers assigned to the target group from those in the control group. We use a filter to determine the group assignment, resulting in two paths: one for the **control group** and one for the **target group**. Both paths further divide into two more paths based on whether the customer is entering the workflow for the first time.
3. **Target Group Path:** This path applies to customers assigned to the target group and is divided into two sub-paths: one for customers entering the workflow for the first time and another for subsequent entries.
1. **First-time entry:** For customers entering the workflow for the first time, an A/B test is conducted to assign them to either group A or group B. At this stage, each customer in the target group receives an **email_group** attribute to determine the type of emails they will receive.
After assigning the email group, we check for three conditions:
- The customer has products in their basket,
- The customer has not completed a transaction in the past 60 minutes,
- The customer has given consent for email communication.
If all conditions are met, customers will receive an email specific to their email group. If not, the process ends. After sending the email, a **campaign.event** event is generated, triggering the second workflow.
2. **Reentry:** For customers who reenter the workflow, we first check which email group they were previously assigned to in order to provide them with a consistent email communication targeted to their group. After that, we check the same conditions mentioned in the first-entry path, and if all conditions are met, customers will receive an email with the abandoned cart communication.
4. **Control Group Path:** This path applies to customers assigned to the control group and is divided into two sub-paths: one for customers entering the workflow for the first time and another for subsequent entries.
1. **First-time entry:** Customers entering the workflow for the first time receive the **email_group** attribute with a value that will identify their assignment to the control group.
After assigning the email group, we check for three conditions:
- The customer has products in their basket,
- The customer has not completed a transaction in the past 60 minutes,
- The customer has given consent for email communication.
If all conditions are met, we generate an event for the control group as a simulation for sending an email. If not, the process ends. After generating an event with the email send simulation, we generate a **campaign.event** event, which will be used as a trigger for the second workflow.
2. **Reentry:** For customers who reenter the workflow, we repeat all the steps described in the first-time entry, excluding the attribute assignment step (considering that customers are already assigned with the attribute when they enter the workflow for the first time).
In further steps, we will describe each part of this process in detail.
The final view of the workflow
### Define the workflow trigger
---
At this stage, you should configure the conditions that trigger the workflow. In our case, the worflow is initiated when a customer adds a product to the cart and we use the `product.addToCart` event as a trigger.
1. As the first node of the workflow, add **Profile Event**.
2. From the **Choose event** dropdown menu, choose the `product.addToCart` event.
3. Confirm by clicking **Apply**.
### Create a path division
---
In this part of the process, we will divide the path for customers assigned to the control group from the customers assigned to the target group. To do so, we use the **Profile Filter** node to check whether a customer was assigned to the **control group**.
After checking the profile filter, the process splits into two paths: for customers who meet the filter condition (are assigned to the **control group**), and for customers who do not meet these conditions, which means that they are assigned to the **target group**.
1. Add the **Profile Filter** node. In the node settings:
1. Click **Choose filter** and select the **test-snrs** attribute form the drop-down list.
2. From the **Choose operator** drop-down, choose **Equal(String)**.
3. In the text field type `B`.
2. Click **Apply**.
Profile Filter node configuration
The next step will cover the part of the process for the target group.
### Target group path
This part of the process covers the path of the **target group**. In the following screenshot, we have highlighted this section. This path is further divided into two sub-paths: one for customers entering the workflow for the first time and another for customers re-entering the workflow.
The division between these sub-paths is checking if customers have been assigned to any email group. Customers entering the workflow for the first time don't have the email group attribute assigned yet, so they follow the **not matched** path of the filter (and the assignment of the attribute occurs in their path). Customers re-entering the workflow have already been assigned to an email group, so they follow the **matched** path of the filter.
Target group path
### Check if customers are assigned to an email group
---
This filter is used to check whether the **email_group** attribute has been assigned to a customer profile.
1. Add the **Profile Filter** node to the **Not matched** path from the profile filter defined in ["Define the workflow trigger"](/use-cases/abandoned-cart-scenario#create-a-path-division). In the node settings:
1. Click **Choose filter** and select the **email_group** attribute form the drop-down list.
2. From the **Choose operator** drop-down, choose **Is true (Boolean)**.
2. Click **Apply**.
Profile Filter node configuration
At this point, the path is divided into two sub-paths:
1. For customers who are not yet assigned to an email group:
- These are customers who enter the workflow for the first time.
- They will follow the **not matched** path.
2. For customers who are already assigned to an email group:
- These are customers who re-enter the workflow.
- They will follow the **matched** path.
### Customers from the target group who are entering the workflow for the first time
---
This part of the process covers the path for customers entering the workflow for the first time. It's shown in the screenshot below.
AB test path
The first step of this path is creating an A/B test to check which type of communication gets better reaction from the customers.
#### Define the A/B test
---
In this step, we set up an A/B test for the **not matched** path from the filter that checked the email group assignment. Customers will be assigned to **Group A** or **Group B**.
When configuring the node, keep the allocation equal or change the proportion according to your business needs.
The view of the ABx Test node configuration
#### Assign an email_group attribute to customers profiles
---
Depending on which group a customer is assigned to, we will add an **email_group** attribute with a value of **A** or **B** to their profile.
The **ABx Test** node is divided into two paths: for **Group A** and **Group B**. For customers assigned to **Group A**, we will add an attribute with the value **A**, and for customers assigned to **Group B**, we will add an attribute with the value **B**.
1. For the path for **Group A** and **Group B** add the **Update Profile** node.
2. In the **Click to select** drop-down list, select the **email_group** attribute. If it doesn't exist, click **Add** and create it.
3. From the drop-down list on the right, select the **Change** option.
4. As the value:
1. In the path for **Group A**, enter `A`
2. In the path for **Group B**, enter `B`
The view of the Update Profile node for group A
#### Define the Delay node for customers from each group
---
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
#### Check if the customer meets all the requirements before sending an email message
---
Before sending an email message, we will check if the customer meets all requirements:
- The customer has products in the basket,
- The customer has not completed a transaction in the past 60 minutes,
- The customer has given consent for email communication.
1. Add the **Profile Filter** node to both **Delay** nodes. In the node settings:
1. Click **Choose filter** and select the [aggregate](/use-cases/abandoned-cart-scenario#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 **transaction.charge** event.
4. Change the funnel type from **profiles matching** to **profiles not matching**.
5. To select a specific time range, click the calendar icon. In our case, it will be **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
If a customer does not meet these conditions, the workflow ends for them at this stage. Otherwise, the email message is sent.
#### Send an email message to a customer
---
In this step, select email templates (prepared earlier in the prerequisites) that will be sent to customers.
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. **Optional**: In the **Additional parameters** section, describe campaigns with [additional parameters](/docs/campaign/e-mail/creating-email-campaigns#adding-custom-parameters).
6. Click **Apply**.
#### Generate an event that will trigger the second workflow
---
In this part of the process, we will generate a custom event that will act as a trigger for the second workflow. This event's action is **campaign.event** and it includes the following details:
- Campaign name,
- Test group to which the customer was assigned,
- Event type.
1. Add the **Generate Event** node to previous **Send Email** nodes.
2. In the **Event name** field, enter the name of the event that will be generated on the customer's profile. In this case, it is `campaign.event`.
4. In the **Body** section, define the parameters of this event:
1. Include a `campaign` parameter with the campaign name.
2. Include a `trigger` parameter with the value set to `trigger`
3. Include the `group` parameter:
1. For group A, set it to `A`
2. For group B, set it to `B`
**Example content of **Body** section for Group A:**
{{< highlight json >}}
{
"campaign": "abandoned cart - mail",
"group": "A",
"type": "trigger"
}
{{< /highlight >}}
{{% note %}}
The event body is an example. You can use a different campaign name and add more properties, if needed.
{{% /note %}}
Configuration of the Generate Event node for Group A
Add the **End** node to complete the path associated with the A/B test (with the path dedicated to the customers entering the workflow for the first time).
In the next steps, we will address the second part of the path related to the target group - the path intended for customers who have reentered the workflow.
### Customers from the target group that reenter the workflow
---
In this part of the process, we will go through the path designed for customers re-entering the workflow. The described part of the workflow is shown in the screenshot below.
Path for the customers from the target group who re-enter the workflow
At the start of this path, we check the assigned email group of the customer to determine the type of email to be sent. This ensures that we send an email specifically tailored to the email group the customer was assigned to upon their initial entry into the workflow.
To do this, we will first check if the customer is assigned to the **A** email group.
#### Check if the customer is assigned to the A email group
---
This step checks if the returning customer was assigned to email group **A**.
1. Add the **Profile Filter** node to the **Matched** path from the [filter](/use-cases/abandoned-cart-scenario#create-a-path-division) that checks the customer assignment to any email group. In the node settings:
1. Click **Choose filter** and select the **email_group** attribute from the dropdown list.
2. From the **Choose operator** drop-down, select **Equal (String)**.
3. In the empty field, type `A`
2. Click **Apply**.
Profile Filter node configuration
If the customer has not been assigned to email group **A**, we then check whether they are assigned to email group **B**.
#### Check if the customer is assigned to the B email group
---
The configuration of this node is the same as described in the previous step, except that this time we are checking the assignment to group B.
1. At the **not matched** path of the node that checks assignment to group A, add a **Profile Filter** node. In the node settings:
1. Click **Choose filter** and select the **email_group** attribute from the dropdown list.
2. From the **Choose operator** drop-down, choose **Equal (String)**.
3. In the empty field, type `B`
2. Click **Apply**.
After creating both filters to check the assignment for email group A and B, there are two paths. One is for customers assigned to group A, and the other is for those assigned to group B. The steps following both paths will be the same, with the only difference being the mailing they will receive, as it is specific to their assigned email group. Additionally, the value of the group parameter in the trigger event generated at the end of the workflow will store the group to which the customer is assigned.
For customers who have not been assigned to any group, the workflow ends after the filter checks the profiles for assignment to group B.
#### Define the Delay node for customers from each group
---
This node creates an hour's delay before moving to the next condition of the workflow.
1. Add the **Delay** node to both **Profile Filter** nodes. 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
#### Check if customers meet all the requirements before sending an email message
---
Before sending the email, we will check if the customer meets all the conditions, which are the same conditions described [earlier in the process](/use-cases/abandoned-cart-scenario#check-if-the-customer-meets-all-the-requirements-before-sending-an-email-message). To simplify the configuration of the Profile Filters with these conditions, you can duplicate a previously created node and add it to both **Delay** nodes.
For customers who do not meet the defined conditions, the workflow comes to an end. However, for those who do meet all conditions, the next step in the process is to send them an email.
#### Send an email message to a customer
---
In this part of the process, we will send an email to customers in both email groups. You need to create two **Send Email** nodes and use the dedicated template for each email group that you have already prepared in the prerequisites.
The configuration of these nodes remain the same as described in [this part of the process](/use-cases/abandoned-cart-scenario#send-an-email-message-to-a-customer). To simplify the configuration of these nodes, you can duplicate a previously created node and add it to both paths.
#### Generate an event that will trigger the second workflow
---
In this part of the process, we will generate a custom event that will act as a trigger for the second workflow. The configuration of this event remain the same as described in [this part of the process](/use-cases/abandoned-cart-scenario#generate-an-event-that-will-trigger-the-second-workflow). To simplify the configuration of these node, you can duplicate a previously created node and add it to both paths.
Add the **End** node to end the path associated with customers from the target group who reenter the workflow.
That wraps up the workflow section related to customers from the target group. Next, we'll delve into the second part of the workflow, which focuses on the control group path.
### Control group path
---
In this part of the process, we will focus on the path from the workflow that is dedicated to the **control group**. In the following screenshot, we have highlighted this section. This path is also further divided into two sub-paths: one for customers entering the workflow for the first time and another for customers reentering the workflow.
The division between these sub-paths is determined by a filter that checks if customers have been assigned the email group **D**. Customers entering the workflow for the first time do not have the email group attribute assigned yet, so they follow the **not matched** path of the filter (and the assignment of the attribute occurs in their path). On the other hand, customers reentering the workflow have already been assigned an email group, so they follow the **matched** path of the filter.
Control group path
### Check if customers are assigned to email group D
---
This filter checks if the **email_group** attribute with the value `D` is assigned to a customer profile.
1. Add the **Profile Filter** node to the **Matched** path from the profile filter defined in [this part](/use-cases/abandoned-cart-scenario#create-a-path-division) of the process. In the node settings:
1. Click **Choose filter** and select the **email_group** attribute form the dropdown list.
2. From the **Choose operator** drop-down, choose **Equal (String)**.
3. In the empty field, type `D`
2. Click **Apply**.
Profile Filter node configuration
At this point, the path is divided into two sub-paths:
1. For customers who are not yet assigned to the email group **D**:
- These are customers who enter the workflow for the first time.
- They will be redirected to the **not matched** path.
2. For customers who are already assigned to the email group **D**:
- These are customers that reenter the workflow.
- They will be redirected to the **matched** path.
### Customers from the control group who are entering the workflow for the first time
---
In this part of the process, we will go through the path designed for customers entering the workflow for the first time. The described part of the workflow is shown in the screenshot below.
Path for the customers from the control group that enter the workflow for the first time
#### Assign an email_group attribute to customers profiles
---
In this step we will assign customers from the control group who enter the workflow for the first time to email group **D**.
1. For the **Not Matched** path for the filter that checks the assignment to email group **D**, add the **Update Profile** node.
2. In the **Click to select** dropdown list, add the **email_group** attribute.
3. From the dropdown list on the right, select the **Change** option.
4. In the empty field, type `D`
Profile Filter node configuration
#### 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 to both **Profile Filter** nodes. In the node settings:
1. In the **Delay** field, type `1`.
2. From the dropdown list, choose **Hour**.
2. Click **Apply**.
#### Check if customers meet all the requirements before sending an email message
---
Before sending the email, we will check if the customer meets all the conditions, which are the same conditions as described [earlier in the process](/use-cases/abandoned-cart-scenario#check-if-the-customer-meets-all-the-requirements-before-sending-an-email-message). To simplify the configuration of the Profile Filters with these conditions, you can duplicate a previously created node and add it to both **Delay** nodes.
For customers who do not meet the conditions, the workflow comes to an end. However, for those who meet all conditions, the next step in the process is to generate an event as a simulation for sending an email.
#### Generate an event to simulate sending an email
---
In this part of the process, we generate a **campaign.event** event with parameters that indicate that this is a simulation of an email dispatch. This event is created for the purpose of further analysis of the effectiveness of the overall implemented actions.
1. Add **Generate Event** to previous **Send Email** nodes.
2. In the **Event name** field, enter the name of the event that will be generated on the customer's profile. In this case, it is `campaign.event`.
4. In the **Body** section, define the parameters of this event, and click **Apply**.
**Example content of **Body** section for Group D:**
{
"campaign": "abandoned cart - mail",
"group": "D - Control group",
"type": "simulation of sending an e-mail"
}
#### Make sure that the event has been generated
---
This filter serves as a security measure to ensure that the **campaign.event** 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 **campaign.event** event.
4. As the event parameter, select **type**.
5. From the **Choose operator** dropdown list, select **Equal (String)**.
6. As the value, enter `simulation of sending an e-mail`. The provided value must be the same as the one defined in the event body.
2. Confirm by clicking **Apply**.
Event Filter node configuration
#### Generate an event that will trigger the second workflow
---
In this part of the process, we will generate the **campaign.event** event, which will act as a trigger for the second workflow. The structure of the event body is similar to the previously created events for target group customers, with the only difference in the value of the **group** parameter, which is always specific to the featured group.
1. Add the **Generate Event** node to previous **Send Email** nodes.
2. In the **Event name** field, enter the name of the event that will be generated on the customer's profile. In this case, it is `campaign.event`.
4. In the **Body** section, define the parameters of this event:
1. Include a `campaign` parameter with the campaign name.
2. Include a `trigger` parameter with the value set to `trigger`
3. Include the `group` parameter with the value set to `D - Control group`
**Example content of **Body** section for Group D:**
Add the **End** node to complete the path related to the customers from the control group that enter the workflow for the first time.
In the next steps, we will address the second part of the path related to the control group - the path intended for customers who have reentered the workflow.
### Customers from the control group who re-enter the workflow
---
In this part of the process, we will go through the path designed for customers reentering the workflow. The described part of the workflow is shown in the screenshot below.
Path for the customers from the control group that reenter the workflow
Customers following this path have already been assigned an email group. Their process begins with a 1 hour delay. After the Delay node, the remaining steps for these customers are identical to those described for [customers from the control group who enter the workflow for the first time](/use-cases/abandoned-cart-scenario#customers-from-the-control-group-who-are-entering-the-workflow-for-the-first-time). Therefore, you need to repeat all those steps in the same order:
- [Check if customers meet all the requirements before sending an email message](/use-cases/abandoned-cart-scenario#check-if-customers-meet-all-the-requirements-before-sending-an-email-message-1)
- [Generate an event to simulate sending an email](/use-cases/abandoned-cart-scenario#generate-an-event-to-simulate-sending-an-email)
- [Make sure that the event has been generated](/use-cases/abandoned-cart-scenario#make-sure-that-the-event-has-been-generated)
- [Generate an event that will trigger the second workflow](/use-cases/abandoned-cart-scenario#generate-an-event-that-will-trigger-the-second-workflow-2)
Once this path is completed, add an **End** node to conclude the path associated with the customers from the control group that reenter the workflow.
That wraps up the creation of the first workflow.
## Create an aggregate that returns the timestamp of the first message sent from an abandoned cart campaign
---
This aggregate returns the timestamp of the first message sent from an abandoned cart campaign described in the first 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 **First**.
5. From the **Choose event** dropdown list, select the `message.send` event.
6. As the event parameter, select **TIMESTAMP**.
7. Click the **+ where** button and from the dropdown list, choose **campaignName**.
8. From the **Choose operator** dropdown, select **Contain (String)**.
9. In the text field, type the name of the abandoned cart campaign you used in the first workflow. In our case it's `Abandoned cart`.
10. Set the period from which the aggregate will analyze the results to **Last 1455 minutes** (this is 24 hours with a spare of 15 minutes).
11. Save the aggregate.
Configuration of the aggregate
## Create an aggregate that returns the order ID of the first transaction that took place after the first email from abandoned cart campaign was sent
---
The ID of this aggregate will be used as an insert in the event generated in the second 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 **First**.
5. From the **Choose event** dropdown list, select the `transaction.charge` event.
6. As the event parameter, select **$orderId**.
7. Click the **+ where** button and from the dropdown list, choose **TIMESTAMP**.
8. From the **Choose operator** dropdown, select **More than (Date)**.
9. Click (Choose value icon).
10. From the **Choose value** dropdown list, select the aggregate you created in the [previous step](/use-cases/abandoned-cart-scenario#create-an-aggregate-that-returns-the-timestamp-of-the-first-message-sent-from-an-abandoned-cart-campaign) of the process.
11. Set the period from which the aggregate will analyze the results to **Last 1455 minutes**.
12. Save the aggregate.
Configuration of the aggregate
## Create the second workflow
---
The purpose of the second workflow is to identify the transactions that occurred in the abandoned cart scenario. This helps us in future analyses to measure the quantity and value of transactions that occurred after the customer received the abandoned cart message. By doing this, we can assess the effectiveness of the performed actions.
Let's dive into the detailed logic of the second workflow:
- At the end of each email group's path (A, B, and D) in the first workflow, we generated a **campaign.event** event. This event serves as a trigger for the second workflow. Therefore, the second workflow now consists of three triggers, each dedicated to customers from a specific email group. By utilizing the parameters of each event, we create separate audiences for customers belonging to each email group.
- The subsequent steps in the workflow are very similar for all three email groups. We will describe the process simultaneously, highlighting any differences that occur in certain steps.
- After defining the triggers and creating audiences for each email group, we check (using the Profile Filter) if a customer has made a transaction within the last 25 hours. At this point, the path for customers from each email group splits into two: those who made a transaction and those who didn't.
- **Customers who made a transaction:** For customers who completed a transaction, we generate a **campaign.event** event. This event has a similar structure to the previously generated events, but has a different `type` value. It also includes additional information about the order ID from the transaction the customer made during the abandoned cart process. This order ID allows us to identify the value of transactions made during the abandoned cart process, enabling the creation of useful metrics for campaign analysis.
- **Customers who didn't make a transaction:** For customers in email groups A and B (target groups) who didn't make a transaction but have consented to email communication, we send a follow-up email. For customers in email group D (control group), we generate a simulated event indicating that an email was sent.
- Finally, we merge all the created paths to conclude the process.
The final view of the workflow
### Define the workflow triggers
---
At this part of the process, configure three triggers of the workflow. Those triggers will be activated each hour for customers from each email group for whom a **campaign.event** event trigger was generated in the first workflow.
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 hour.
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 **Choose filter** dropdown menu, choose the `campaign.event` event.
2. From the **Choose parameter** dropdown list, select **type**.
3. From the **Choose operator** dropdown list, select **Equal (String)**.
4. In the right field, enter the value of the **type** parameter that was generated in the event. In our case, we type `trigger`.
5. From the **Choose parameter** dropdown list, select **campaign**.
6. From the **Choose operator** dropdown list, select **Equal (String)**.
7. In the right field, enter the value of the **campaign** parameter that was generated in the event. In our case, we type `abandoned cart - mail`.
8. From the **Choose parameter** dropdown list, select **group**.
9. From the **Choose operator** dropdown list, select **Equal (String)**.
10. In the right field, enter the names of the groups for each email group you are creating the trigger for:
1. For group A, enter `A`
2. For group B, enter `B`
3. For group D, enter `D - control group`
11. Define the time range from which you want to analyze this event. In our case, it's **Last 60 minutes before 24 hours**.
Configuration of the Audience node for group A
### Check whether customers from each group have made a transaction in the last 25 hours
---
1. Add the **Profile Filter** node to the trigger from each group.
2. From the **Choose filter** dropdown list, select the **transaction.charge** event.
3. Set the period from which you want to analyze this event. In our case, we use **Last 1500 minutes**.
4. Apply all changes.
After this **Profile Filter** path for customers from each email group splits into two: those who made a transaction and those who didn't.
### Path for customers that made a transaction
---
When a customer completes a transaction after abandoning their cart, we generate a **campaign.event** event. This event contains information about the customer's **order ID** from the transaction. The order ID helps us identify the value of transactions made during the abandoned cart process, which is important for creating useful metrics for campaign analysis.
The customers from different groups are differentiated by the value of the **group** parameter in the **campaign.event** event.
1. To the **Matched** path from the [profile filter](/use-cases/abandoned-cart-scenario#check-whether-customers-from-each-group-have-made-a-transaction-in-the-last-25-hours) for all email groups add the **Generate event** node.
2. In the **Event name** field, enter the name of the event that will be generated in the customer's profile. In this case, it's `campaign.event`.
4. In the **Body** section, define the parameters of this event and click **Apply**.
In the `orderID` section, place an [aggregate ID that returns the order ID of the first transaction](/use-cases/abandoned-cart-scenario#create-an-aggregate-that-returns-the-order-id-of-the-first-transaction-that-took-place-after-the-first-email-from-abandoned-cart-campaign-was-sent) created earlier in the process. AYou should also change the group value for the corresponding groups.
**Example content of "Body" section for Group A:**
5. Confirm by clicking **Apply**.
Configuration of the Generate Event node for group A
This node will be then connected with the **Merge Paths** node that combines seperate path into one.
### Path for customers who have not completed the transaction
---
Customers belonging to email groups A and B (target groups) who have not completed a transaction but have given consent for email communication receive a follow-up email. On the other hand, for customers in email group D (control group), we generate a simulated event to indicate that an email was sent.
#### Check whether customers have given consent for email communication
---
1. To the **Not Matched** path from the [Profile Filter node which checks if the customer made a transaction](/use-cases/abandoned-cart-scenario#check-whether-customers-from-each-group-have-made-a-transaction-in-the-last-25-hours), for all email groups add the **Profile Filter** node.
1. Click **Choose filter** and select **newsletter_agreement** attribute form the dropdown list.
2. From the **Choose operator** drop-down, choose **Equal(String)**.
3. In the text field, type `enabled`.
2. Click **Apply**.
For customers who have not provided consent, the workflow comes to an end. However, for customers from email groups A and B (target group) who meet the conditions of this filter, we proceed to the next step and send them a follow-up email. For customers from email group D (control group), we generate a simulated event to indicate that an email was sent.
#### Send a follow-up email for customers from email group A and B
---
1. To the **Matched** path from the [profile filter](/use-cases/abandoned-cart-scenario#check-whether-customers-have-given-consent-for-email-communication), 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 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 campaigns with [additional parameters](/docs/campaign/e-mail/creating-email-campaigns#adding-custom-parameters).
6. Click **Apply**.
This node will be then connected with the **Merge Paths** node that combines seperate path into one.
#### Generate an event to simulate sending a follow-up email
---
1. Add the **Generate Event** node to the **Matched** path from the [profile filter](/use-cases/abandoned-cart-scenario#check-whether-customers-have-given-consent-for-email-communication) checking email communication consent.
2. In the **Event name** field, enter the name of the event that will be generated on the customer's profile. In this case, it is `campaign.event`.
4. In the **Body** section, define the parameters of this event, and click **Apply**.
**Example content of "Body" section for Group D:**
{
"campaign": "abandoned cart - mail",
"group": "D - Control group",
"type": "simulation of sending an e-mail follow up"
}
Configuration of the simulation event for group D
Merge all the final nodes from each email group path into a single path using the **Merge Paths** node and add an **End** node to complete the process.
## What's next
---
Once both workflows are launched, you will obtain valuable information that can be utilized to measure the campaign's performance. This data can be collected and analyzed through a dashboard, which will present the achieved results in a breakdown for each group (control and target). Through the dashboard, you can assess the overall performance of your campaign, evaluate the results of the AB test conducted for the target group, and determine the number and value of transactions that occurred during the abandoned cart process.
## Generated events
This use case generates approximately 26 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) (~2), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~11), [`automation.abTestVariantAssigned`](/docs/assets/events/event-reference/automation#automationabtestvariantassigned) (~1), [`profile.updated`](/docs/assets/events/event-reference/profiles#profileupdated) (~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), `campaign.event` (~2), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~2), [`transaction.charge`](/docs/assets/events/event-reference/items#transactioncharge) (~1), [`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~2).
## 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/0d351702-fb43-356e-a90a-c405fa0a388c) that returns the sku of products in the shopping cart for each customer
- [First workflow](https://app.synerise.com/automations/automation-diagram/1fcb7219-dbb3-4fc3-b51e-37ae8b738c20)
- [An aggregate](https://app.synerise.com/analytics/aggregates/d49c2395-e7af-3cbe-83eb-5e69f4377c75) that returns the timestamp of the first message sent from an abandoned cart campaign
- [An aggregate](https://app.synerise.com/analytics/aggregates/4c1a5eff-edae-33e9-89c2-191bb460ef46) that returns the order ID of the first transaction that took place after the first email from abandoned cart campaign was sent
- [Second workflow](https://app.synerise.com/automations/automation-diagram/862cf91e-5e99-4fc4-86b1-cfe76a235e83)
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.
# 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)
# Saving and recovering product configuration
Businesses offering made-to-order personalized products have very specific customer journeys. Instead of selling ready-made items from stock, they allow shoppers to configure products step by step, choosing dimensions, colors, finishes or other attributes tailored to their individual needs. This model is especially common in industries such as home & decor, automotive, jewelery or custom apparel.
While product configurators unlock powerful personalization, they also introduce a challenge. Configuring a custom product often requires time, consideration or even consultation, especially since personalized items are usually non-returnable and come with higher price points. As a result, many customers pause the process or abandon the configuration before completing the purchase.
In this use case, you’ll create a complete scenario for saving and recovering abandoned configurations. By allowing users to send a configuration link to their email via a simple form, you can trigger a follow-up communication flow that reminds them about their unfinished product. If the purchase is not completed, the scenario can end with an incentive such as a voucher to encourage conversion.
Additionally, by collecting configuration attributes, you can use Synerise’s AI to recommend similar products from the same category with comparable features, helping customers make a final decision and increasing the chances of recovery.
## Prerequisites
---
- [Implement SDK to a website](/developers/web/installation-and-configuration).
- [Configure an email account](/docs/campaign/e-mail/configuring-email-account).
- [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 a custom event for saving configuration details, which will be available in the customer profile.
In this example, the event is called `configuration.saved`.
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).
- Optionally, you can create a [voucher pool](/docs/assets/code-pools).
## Process
---
In this use case, you will go through the following steps:
1. [Create a dynamic content template](/use-cases/saving-configuration#create-a-dynamic-content-template) which displays the saving configuration form on the website.
2. [Create an aggregate](/use-cases/saving-configuration#create-an-aggregate) returning configuration details.
3. [Create an AI recommendation](/use-cases/saving-configuration#create-an-ai-recommendation) returning similar items.
4. [Create an email template](/use-cases/saving-configuration#create-an-email-template) with the link to saved configuration details and similar product recommendations.
5. [Create a workflow](/use-cases/saving-configuration#create-a-workflow) which sends your customers an email with saved configuration details after submitting the form.
## Create a dynamic content template
---
Create a dynamic content template that displays a button on your website leading to a form. The form should include a direct link to the saved configuration and additional fields for the customer’s name and email address. After providing consent, the user receives a link to their configuration via email. This dynamic content will generate the `configuration.saved` event on the customer's profile which stores the selected configuration attributes, such as color, size, and other chosen options, as parameters. You can use a [ready-made template](https://app.synerise.com/campaigns/dynamic-content/content-manager/template/247451) available on the Synerise Demo workspace.
1. Go to **Experience Hub > Dynamic content > Create new**.
2. Enter the name of the dynamic content.
3. Choose **Insert Object** type.
4. As the audience, select **everyone**.
5. In the **Content** section, select **Simple message**, and specify the CSS selector where you want to insert your campaign.
6. In the **Content** tab, click **Create Message**.
7. In the code editor, create a dynamic content based on your preferences and your own CSS styles. The JavaScript should track the configuration options selected at each step and save them as parameters within the `configuration.saved` event.
8. Save the template.
9. In the **Schedule** section, select the date when the dynamic content is activated.
10. In **Display settings**, configure the settings based on your business needs.
11. Confirm by clicking **Apply**.
12. Optionally, you can define the UTM parameters in the **UTM & URL parameters** section. Otherwise, click **Skip step**.
13. Activate the dynamic content.
Configuration of the dynamic content template
## Create an aggregate
---
Create an aggregate which returns the product data from the saved configuration and which will be later used in the email template.
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 **Last**.
5. From the **Choose event** dropdown list, select the `configuration.saved` event.
6. As the event parameter, select `configuration_data`.
7. Define the period which the aggregate will analyze. Confirm your choice with the **Apply** button.
8. Click **Save**.
Configuration of the aggregate returing the product data from the saved configuration
## Create an AI recommendation
---
In this part of the process, you will configure a similar items recommendation which will be later used in the email template.
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 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 and settings in the **Additional settings** section.
9. In the right upper corner, click **Save**.
## Create an email template
---
You can use a [ready-made template with an HTML block](https://app.synerise.com/campaigns/email/content-manager/template/249686) (available on the Synerise Demo workspace). Copy it and edit according to your needs. In the configuration, we will use the [aggregate](#create-an-aggregate) and [AI recommendation](#create-an-ai-recommendation) created in the previous steps.
1. Go to **Experience Hub > Email**.
2. On the left pane, click **Templates** and from the list of template folders, select **USE CASE**.
4. Select **[UC] Saving product configuration** template.
**Result**: You are redirected to the code editor.
4. Edit the template according to your needs. Use the [aggregate](#create-an-aggregate) and [recommendation](#create-an-ai-recommendation) created in the previous steps.
To add all product configuration data using a single aggregate, use [Jinjava's dedicated “split” filter](/developers/inserts/filter#split) to separate such information
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**.
Configuration of the email template
6. 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**.
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 **Save**.
8. Repeat all the steps to create an additional message which will serve as a reminder of an abandoned configuration. Optionally, you can create a [voucher pool](/docs/assets/code-pools) and assign a discount as an incentive to complete the order.
## Create a workflow
---
In this step, create a workflow which sends customers an email with their saved configuration details.
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 conditions that launch the workflow. As a trigger, we will use the `configuration.saved` event, which is generated after submitting the form.
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 `configuration.saved` event.
2. Confirm by clicking **Apply**.
### 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 Send Email node
At this stage, you will send an email with confirmation for users who fill out the form requesting sending configuration link to their email address.
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](#create-an-email-template) prepared in the previous step.
3. You can define **UTM & URL parameters**.
4. Confirm by clicking **Apply**.
### Define the second Delay node
---
This node creates delay before checking whether the transaction has been made prior to sending a reminder. In our case, we assumed it will be 24 hours.
1. Add the **Delay** node. In the node settings:
1. In the **Delay** field, type `24`.
2. From the dropdown list, choose **Hours**.
2. Click **Apply**.
### Define the Profile Filter node
As the next step, add the **Profile Filter** node, which checks if the customer made a transaction in the last 24 hours. If the customer has not made a purchase, we will send them a reminder email, optionally with a discount coupon, and if they have, then the workflow ends.
1. Add the **Profile Filter** node.
2. Select **New Audience**, click **Define conditions**, change **Find all profiles matching this condition** to **Find all profiles not matching this condition** and from the **Add condition** dropdown list, select the `transaction.charge` event.
3. As the date range, select **Last 24 hours**. Confirm your choice with the **Apply** button.
4. To the *matched* path, add the **Send Email** node.
5. To the *not matched* path, add the **End** node.
6. Click **Apply**.
### Configure the second Send Email node
At this stage, you will send an email with reminder for users who filled out the form requesting sending configuration link to their email address and didn't make any purchase within last 24 hours.
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](#create-an-email-template) prepared in the previous step.
3. You can define **UTM & URL parameters**.
4. Confirm by clicking **Apply**.
### Add the finishing node
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
Automation settings
## Check the use case set up on the Synerise Demo workspace
---
You can check all the analytics and templates directly in the Synerise Demo workspace:
- [dynamic content](https://app.synerise.com/campaigns/dynamic-content/content-manager/template/247451) displaying the saving configuration form on the website
- [aggregate](https://app.synerise.com/analytics-v2/aggregates/c0855ca3-458b-32fb-83e9-ab066d4ea131) returning configuration details
- [AI recommendation](https://app.synerise.com/ai-v2/recommendations/FV5PIcmhmN0p) returning similar items
- [email template](https://app.synerise.com/campaigns/email/content-manager/template/249686) containing the link to saved configuration details and, optionally, similar product recommendations
- [workflow](https://app.synerise.com/automations/workflows/automation-diagram/85b7824c-616d-4bb9-8097-6ad8b35a2b34) sending an email with saved configuration details after submitting the form
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 19 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), `configuration.saved` (~1), [`automation.clientStartPath`](/docs/assets/events/event-reference/automation#automationclientstartpath) (~1), [`automation.clientPathStep`](/docs/assets/events/event-reference/automation#automationclientpathstep) (~6), [`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), [`recommendation.generated`](/docs/assets/events/event-reference/recommendations#recommendationgenerated) (~2).
## 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)
- [Email templates](/docs/campaign/e-mail/creating-email-templates)
- [Recommendations](/docs/ai-hub/recommendations-v2)
- [Voucher pools](/docs/assets/code-pools)
# 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)
# Transform and import customers' data to Synerise
Automation capabilities in the area of data transformation can be used to update and change large amounts of data in a fast, advanced way, eliminating the process of manually adjusting the whole file. All transformations are performed on a sample file in desired format.
In this use case, you will find out how to transform and import customer data from a `.JSON` file with data transformation and workflows.
In this use case, you will make the following modifications to the sample file:
- Edit Values:
- replace the value of the `city` attribute from blank to `unknown`; if the `city` attribute is defined, keep the existing city,
- replace the `en`, `es`, `fr` values of the `language` attribute with `English`, `Spanish`, `French`, respectively,
- replace the value of `payment_cash` and `payment_online` attributes from `1`/`0` to `cash`/`Null` and `online`/`Null`.
- Merge `payment_cash` and `payment_online` attributes into the `payment_info` attribute.
### Input data in use case
In this use case, we use two files:
- the complete `.JSON` file with your customer database. Make sure you include one of the required parameters: `clientID, uuid, email, customId`. If your workspace uses [non-unique emails](/docs/settings/configuration/non-unique-emails), use `customId` or `uuid`. The only requirement for JSON files is that they must be UTF-8 encoded.
- Prepare a sample JSON file with data you want to import. Below you will find an example how such a a file can look.
Example JSON file might look like this
If your data is complete, you can skip transforming data. But if you need to modify the file with data before an import to Synerise, you can modify the data in **Automation Hub > Transformations**. To do so, create a sample of your data and include all attributes you want to modify. If you miss the attributes in the sample file, but import the actual data with them, the data will be imported as delivered in the actual file.
## Process
---
1. [Prepare a transformation](#create-a-transformation) to transform the data in the file.
2. [Prepare a workflow](#prepare-a-workflow) to import the `.JSON` file to Synerise.
## Create a transformation
---
In this part of the process, you define the rules of modifying data before sending it to Synerise, so the data is consistent. Each of the following sub-steps describes the individual changes performed on the file.
1. Go to **Automation Hub > Transformations > New transformation**.
2. Enter the name of the transformation.
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 without a specific goal and you know the structure of the output data, skip this step.
Goals will suggest you the required fields needed to perform the import into Synerise.
### Add input data
This step 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. Click **Upload a new file or drag one here**.
2. Upload the `.JSON` file.
3. You can preview the file, then click **Apply**.
**Result:** The editor displays data from the sample.
The preview of the sample file
### Handle missing data
In this part of the process, use the **Edit Values** step to keep the existing city and replace blank values in the `city` column with `unknown`.
1. On the right panel, click **Add step** and select **Edit Values**.
2. In the configuration of the step:
1. Select the **city** column.
2. Under **Edit values by**, select **Replacing**.
3. From the dropdown below, select **Dynamic value**.
4. In the **Type value** field, paste the following Jinja code:
The configuration of the Edit Values step
3. Preview the changes in the **Result** tab.
Result after applying Edit Values step
4. Confirm by clicking **Apply**.
### Change data
As in the [previous step](#handle-missing-data), use **Edit Values** to modify the data. Add a separate rule for each of the remaining columns: `language`, `payment_cash`, and `payment_online`. Replace the language codes with language names and the payment flags with values that will be merged into `payment_info`.
1. On the right panel, select the previously created **Edit Values** step and click **Add rule**. In the configuration of the rule:
1. Select the **language** column.
2. Under **Edit values by**, select **Replacing**.
3. From the dropdown below, select **Dynamic value**.
4. In the **Type value** field, paste the following Jinja code:
5. Preview the changes in the **Result** tab and click **Apply**.
The configuration of the Edit Values rule
2. On the right panel, select the previously created **Edit Values** step and click **Add rule**. In the configuration of the rule:
1. Select the **payment_cash** column.
2. Under **Edit values by**, select **Replacing**.
3. From the dropdown below, select **Dynamic value**.
4. In the **Type value** field, paste the following Jinja code:
5. Preview the changes in the **Result** tab and click **Apply**.
3. On the right panel, select the previously created **Edit Values** step and click **Add rule**. In the configuration of the rule:
1. Select the **payment_online** column.
2. Under **Edit values by**, select **Replacing**.
3. From the dropdown below, select **Dynamic value**.
4. In the **Type value** field, paste the following Jinja code:
5. Preview the changes in the **Result** tab and click **Apply**.
After applying the changes, you will get an updated file:
Result after applying Edit Values rule
### Merge Columns
Use the **Merge Columns** step to merge `payment_cash` and `payment_online` into one `payment_info` column.
1. On the right panel, click **Add step** and select **Merge Columns**.
2. In the configuration of the step:
1. Select the **payment_cash** and **payment_online** columns.
2. In the **New column name** field, enter `payment_info`.
3. Enable **Remove original columns**.
The configuration of the Merge Columns step
3. Preview the changes in the **Result** tab.
Result after applying Merge Columns step
4. Confirm by clicking **Apply**.
### Preview and save the transformation
1. Preview the final results in the **Output** tab.
2. In the upper right corner, click **Save**.
## Prepare a workflow
---
The scenario for this use case involves a one-time import of `.JSON` file with a customer database directly 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. Select the **Run once** option.
2. Select **Immediately**.
3. Confirm by clicking **Apply**.
The configuration of the Scheduled Run node
### Select file to import
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
### Select the transformation
1. Add a **Data Transformation Studio** node.
2. In the configuration of the node, keep the default **From workflow context** option.
3. In the editor, click **Templates library**:
1. Select the [transformation you have created before](#create-a-transformation).
2. Click **Use template**.
4. Confirm by clicking **Apply**.
The configuration of the Data Transformation Studio node
You can also create a transformation directly in the **Data Transformation Studio** node instead of selecting a template.
### Add Import Profiles and finishing node
1. Add the **Import Profiles** node.
2. Optionally, in **Advanced settings**, you can change the [import mode](/docs/assets/imports/importing-clients#import-modes).
3. Add the **End** node.
4. 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 [Transformation](https://app.synerise.com/automations/data-transformation/269c63b8-ea4b-4baf-9028-005b06e8e06d) and [Workflow](https://app.synerise.com/automations/automation-diagram/39155d5e-b0cd-4d92-b887-ebf931166a96) configurations 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
---
- [Customer properties](/docs/crm/customer-properties)
- [Data Transformation](/docs/automation/data-transformation-and-imports)
- [Jinjava inserts](/developers/inserts)
# 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#tag/Events/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)
# 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)
# Display Real-Time Purchase Counts for Social Proof on Product Pages
Social proof effectively harnesses the power of the crowd, conveying the persuasive message that if many others have bought and are happy, a new customer is likely to experience the same satisfaction, further amplifying the impact of social proof in driving sales.
Social proof campaign
In this particular use case contains instruction on implementing a dynamic social proof strategy on a website to drive sales and build brand credibility. The cornerstone of this strategy is the display of real-time data showing purchase trends. This approach taps into the psychological principle of social proof, where potential customers are more likely to make a purchase if they see that a product is popular and trusted by many others.
## Prerequisites
---
- Implement a [tracking code](/docs/settings/tool/tracking_codes).
- [Implement transactions](/developers/web/transactions-sdk).
## Process
---
In this use case, you will go through the following steps:
1. [Create metrics with dynamic key](/use-cases/social-proof-trends#create-metrics-with-dynamic-key).
2. [Prepare a dynamic content](/use-cases/social-proof-trends#prepare-a-dynamic-content).
## Create metrics with dynamic key
---
Implementation of social proof on a website involves creating a metric that counts occurrence of a specific event, such as product purchase in the context of a specific item. Then, the metric ID is used in the template of the [dynamic content](/docs/campaign/dynamiccontent) which will be displayed on product pages. The result of the metric will adapt to the currently viewed product thanks to the dynamic key used in the metric.
In our case, we will create two metrics with the same conditions but analyzing different time ranges:
- [Metric with the number of bought items in the last 30 days](/use-cases/social-proof-trends#metric-with-the-number-of-bought-items-in-the-last-30-days).
- [Metric with the number of bought items in the last 30 days before 30 days](/use-cases/social-proof-trends#metric-with-the-number-of-bought-items-in-the-last-30-days-before-30-days).
### Metric with the number of bought items in the last 30 days
In this part of the process, you will create a metric that counts the occurrences of the [product.buy event](/docs/assets/events/event-reference/items#productbuy) in the context of the specific item in the last 30 days. Instead of defining the exact value of the item, we will create a dynamic key that will take the values sent through the `sku` parameter of the `product.buy` event. This solution will let the metric results to adjust to the product page currently viewed by a customer.
1. Go to **Decision Hub > Metrics > New metric**.
2. Leave the **Type**, **Aggregator** and **Occurrence type** options at default (**Event**, **Count**, **all**).
3. From the **Choose events** dropdown list, select **product.buy**.
4. Click the **+ where button** and select a parameter that indicated a product ID (in this case its **$sku**).
5. From the **Choose operator** dropdown list, select **Contain**.
6. Click the icon next to the logic operator and keep clicking until you get .
6. In the left field, enter `sku`.
7. In the right field, enter a default value of the dynamic key (0 in our example). At this stage, the default value of the dynamic key is not important.
8. Define the analyzed period (last 30 days in our example).
Metric filter
### Metric with the number of bought items in the last 30 days before 30 days
In this part of the process, you will create a metric that counts the occurrences of the [product.buy event](/docs/assets/events/event-reference/items#productbuy) in the context of the specific item in last 30 days before 30 days.
Duplicate the [previous metric](/use-cases/social-proof-trends#metric-with-the-number-of-bought-items-in-the-last-30-days) and change the analyzed period to last 30 days before 30 days.
You can prepare metrics based on other events such as [`product.addToCart`](/docs/assets/events/event-reference/items#productaddtocart) or [`page.visit`](/docs/assets/events/event-reference/web-and-app#pagevisit). By preparing metrics for these or other events, it's important to keep their retention in mind while defining the analyzed period, if you select period longer than the event retention, you will receive inaccurate results.
## Prepare a dynamic content
---
To show a social proof on your product pages, prepare a dynamic content.
1. Go to **Experience Hub > Dynamic content > Create communication**.
2. Choose **Insert Object** type.
3. In the **Audience** section, select **Everyone**.
4. In the **Content** section, select **Simple message** and by inserting CSS selector define where the social proof will display on your website.
5. In the **Content** tab, click **Create Message** and insert a code of the metrics which you prepared in the previous steps. The customer will receive information about how many times the product has been bought. You can use the following JavaScript:
Check the Javascript with a product image
(function () { const metricPrevious30 = +`{% metrics %} 2f11b5f7-ddc0-4ea1-a1c2-628dd2de0d29 {% endmetrics %}`; const metricLast30 = +`{% metrics %} d798b895-19ce-44b0-b54c-06996f7898e5 {% endmetrics %}`; const imageLink = `{{ metric_additional_params["og:image"] }}`; // For example metricPrevious30 is 100, and metricLast30 is 130. That gives 30% const percent = ((metricLast30 - metricPrevious30) / metricPrevious30) * 100; // if percent is below limit or one of metric gives 0 stop the script if (Number.isNaN(percent) || percent < +`#### type: "number", id: "Percent", defaultValue: "30" !####`) return; const wrapperEl = document.querySelector(".snr-sp__main-wrapper"); const counterEl = wrapperEl.querySelector(".snr-sp__counter"); const imgEl = document.querySelector(".snr-sp__image img"); const peopleEl = document.querySelector(".snr-sp__people"); const showLabel = () => wrapperEl.classList.remove("snr-sp__hidden"); const hideLabel = () => wrapperEl.classList.add("snr-sp__hidden"); const getPeople = (num) => (num > 1 || num == 0 ? "people" : "person"); wrapperEl.addEventListener("click", hideLabel); counterEl.innerText = metricLast30 + ""; imgEl.src = imageLink; peopleEl.innerText = getPeople(metricLast30); setTimeout(() => { showLabel(); setTimeout(hideLabel, +`#### type: "number", id: "Display time in ms", defaultValue: "5000" !####`); }, +`#### type: "number", id: "Delay time in ms", defaultValue: "2000" !####`); })();
6. Schedule when the dynamic content will be active.
Set up display settings
7. In the **Display settings** section, define the circumstances the dynamic content will be shown:
- Always on landing, on All pages if **in CSS selector** is unique selector for a product page.
- Always on landing, **on a specific URL** which indicates a product page (for example, if a URL contains product), if CSS selector is not unique for a product page.
For the purposes of this example, all necessary settings have been completed in accordance with the example in the graphic; depending on the scenario of our dynamic content, the settings may be different. You can read more about [dynamic content](/docs/campaign/dynamiccontent/creating-dynamic-content/creating-dynamic-content#define-url-targeting) in our article.
## Check the use case set up on the Synerise Demo workspace
---
Check all items (metrics and dynamic content) created in this use case in our Synerise Demo workspace:
- [Metric with the number of bought items in the last 30 days](https://app.synerise.com/analytics/metrics/d798b895-19ce-44b0-b54c-06996f7898e5),
- [Metric with the number of bought items in the last 30 days before 30 days](https://app.synerise.com/analytics/metrics/2f11b5f7-ddc0-4ea1-a1c2-628dd2de0d29),
- [Dynamic content settings](https://app.synerise.com/campaigns/dynamic-content/create/bc84f31a-e9a5-4101-a451-93bd810dce6f).
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:
[`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1).
## Read more
---
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Dynamic key](/docs/analytics/i_events-parameter-value#dynamic-key)
- [Metrics](/docs/analytics/metrics/introduction-to-metrics)
# A/B test in AI Search
By preparing A/B tests in AI Search, you can find out which configuration of the AI search brings better results in terms of conversion, revenue, and CTR in your business. This use case describes an implementation that compares the results of presenting search results promoting bestsellers against personalizing the results.
The bestsellers are selected according to item popularity, whereas personalization uses the history of a customer's activity.
## Prerequisites
---
- Import a product feed to Synerise. You can find instructions [here](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-search).
- Implement the `item.search.click` event that is generated when an item shown in the search results is clicked. Use this [API method](https://hub.synerise.com/api-reference/data-management#tag/AI-Events/operation/publishAiCompatItemSearchClickUsingPOST).
## Process
---
In this use case, you will go through the following steps:
1. [Prepare two search indexes](/use-cases/ai-search-ab-test#prepare-two-search-indexes).
2. [Prepare AB test](/use-cases/ai-search-ab-test#prepare-ab-test).
3. [Analyze results](/use-cases/ai-search-ab-test#analyze-results).
## Prepare two search indexes
---
As the first part of the process, create two separate search indexes (personalization and bestseller) which will differ only in the settings of search results hierarchy.
1. Go to **AI Hub > Indexes**.
2. Click **Add index**.
3. Follow the instructions on the interface until the configuration of Ranking (step 4). If you need more information, you can read instruction on configuring [AI Search index](/docs/ai-hub/ai-search/create-index).
4. Set the ranking for the personalization search index. You will create the besteller version later.
- For the personalization search index:
- Frequency of item page views to 70%
- Frequency of item purchases to 0%
- Personalization to 100%
- For the bestseller search index:
- Frequency of item page views to 20%
- Frequency of item purchases to 80%
- Personalization to 0%
5. Save the index. The index will be ready in several minutes.
View after saving the index
6. Create the bestseller search index. Apply the same settings as with the personalization search index apart from the Ranking settings.
## Prepare AB test
---
1. Go to **AI Hub > (AI Search) A/B/X Tests > New A/B test**.
2. Enter the name of the test.
3. In the **Variants and customer allocation** section, click **Define**.
4. Click the **Base variant** tab.
5. From the dropdown list, select one of the indices you created in [the previous part of the process](/use-cases/ai-search-ab-test#prepare-two-search-indexes).
6. Add the next variant by clicking .
7. From the **Index** dropdown list, select the second index you created in the previous part of the process. You can rename the tab for better management of the versions.
8. In the **Customer allocation** section, assign the percentage of customers to each variant.
9. Confirm the settings by clicking **Apply**.
10. Click **Save&Run**.
After some time you can [check the statistics of the A/B test](/use-cases/ai-search-ab-test#analyze-results).
## Analyze results
---
When the A/B tests has been running for long enough, you can analyze the statistics for each variant.
1. Go to **AI Hub > (AI Search) A/B/X Tests**.
2. From the list, select the test.
3. Choose the **Statistics** tab. You can find there the results for key performance indicators such as a conversion rate or revenue.
You can find more information about [A/B test statistics here](/docs/ai-hub/ai-search/ab-test-statistics).
4. Compare the statistics of the two indexes you created.
5. You can [export the settings of the winning variant](/docs/ai-hub/ai-search/configuring-ab-test#export-settings-of-the-winning-version) to your base index.
## Check the use case set up on the Synerise Demo workspace
---
In the Synerise Demo workspace, you can check the:
- [Index A](https://app.synerise.com/ai-v2/search/indices/5cd51abababc055a9c4a94984892949e1729770365/stats/global),
- [Index B](https://app.synerise.com/ai-v2/search/indices/949f07ea19ad6450e351b9139781de701729770402/stats/global),
- [A/B test](https://app.synerise.com/ai-v2/search/abtests/1087).
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), [`item.search`](/docs/assets/events/event-reference/search#itemsearch) (~1), [`item.search.click`](/docs/assets/events/event-reference/search#itemsearchclick) (~1).
## Read more
---
- [AB tests](/docs/ai-hub/ai-search/configuring-ab-test)
- [AI Search](/docs/ai-hub/ai-search)
# AI search for blogs and articles
AI Search is really helpful not only in ecommerce sites but also in searching for content e.g. in blogs. The main challenge which can be meet with the help of this search in blogs is optimizing the user experience, based on searched website content. It can increase the effectiveness of searching on your blog or any other website which is based on text content.
## Example of use - Synerise
**Challenge**
In our daily operations we use AI search in three main places on our website:
- in our [help center](/)
- in our [blog](https://synerise.com/blog)
- in our [API documentation](https://hub.synerise.com/api-reference)
AI Search on the Synerise blog
We have decided to make it as personalized as it is possible and to increase our user experience by making it more effective and easier-to-use.
At the beginning, we had to prepare an inventory of the website so we can get all information gathered from each subpage, articles from the help center, methods from API Developers Section. Then we prepared a ranking formula and selected searchable attributes and defined their importance. Based on that we are able to display proper results based on searched words.
## Prerequisites
---
To be able to implement this use case, you must:
- [Create AI search](/docs/ai-hub/ai-search/introduction-to-ai-search).
- [Prepare catalogs](/docs/assets/catalogs/creating-catalogs).
## Process
---
To set up ai serach on your website, perform the steps in the following order:
1. [Create a catalog](/use-cases/ai-search-in-blog#create-a-catalog).
2. [Create AI search](/use-cases/ai-search-in-blog#create-ai-search).
3. [Add additional query rules](/use-cases/ai-search-in-blog#add-additional-query-rules).
## Create a catalog
---
1. Go to **Data Modeling Hub > Catalogs > New Catalog**.
2. Enter the name of the catalog and confirm it by clicking **Apply**.
3. Click the catalog on the list and choose **import CSV button**.
4. Click Upload file button and select the file to be uploaded, then confirm with button - **OK**.
5. In the Order key field, type the name of the column whose values are treated as the key.
An example catalog looks like
Go to items of your website, which has one obligatory tag—the item ID. This individual ID indicates the content we want to show. Apart from that, the catalog can contain additional attributes which describe the content.
## Create AI search
---
You can use AI Search for every case (Blog, Developers, Help Center). Each of them in our case was based on different attributes.
1. Go to **AI Hub > Indexes**.
2. To select the data structure a search engine refers to while searching, click **Add index**.
1. In the **Index name** field, type the human-readable name of the index.
2. From the **Catalog** dropdown list, select an item catalog the search engine refers to.
3. Optionally, to let other users know about the purpose of the index, in the **Description** text field, add the description of the index.
4. Confirm by clicking **Save**.
3. Further configuration requires adjusing the settings in the **Ranking**, **Synonyms** and **Settings** sections.
More information about creating AI search you will find in the video.
Click for video tutorial
AI search can have different goals, depending on where we will implement it and on what database it will work.
---
Take a look at how it's working on Synerise websites. Below we present three examples.
- **Synerise Blog**
In the case of the Synerise Blog, we have information like: title, author name, author surname, description and category. That information was collected from our website and was used to prepare the AI search.
Ranking formula for AI Search
- **Synerise Developers**
In the developer section, we have some additional information that’s a little different than what we saw before. Here we have category, description, and item ID and links as well. But additionally, we have, for example, a method in which we want to send something to Synerise. We have also information about permissions for each method and additional information like service, tags and a title that describes those methods.
Ranking formula for AI Search
- **Synerise Hub**
In the case of the Help Center, we have attributes like category, link, ID, title and description. But one additional thing is involved here – we have a table of contents. So, what you can find in each article is also described here.
Ranking formula for AI Search
## Add additional query rules
---
Based on query rules, in just a few steps you can decide that if somebody enters a query, you can replace it with a different phrase or also synonym and show in the search results a specific article.
1. Prepare such query rules in **AI Hub > Indexes** > choose index from the list **> Rules**.
2. Click **create new** in query rules and complete 3 sections:
- Conditions
- Consequences
- Schedule
Final settings for AI search
As an example, if somebody enters **onboarding** in the search box, we can prepare a rule that replaces this query with a new one (first steps)
## 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)
- [AI Search statistic](/docs/ai-hub/ai-search/ai-search-statistics)
- [Catalogs](/docs/assets/catalogs/creating-catalogs)
# Import referral events from Azure Blob Storage to Synerise
Synerise allows you to collect data from any customer touchpoint. Using Synerise's seamless integration with Azure Blob Storage, you can import any data stored in this tool and use it directly in Synerise.
In this use case, we will import events which contain the data about customers' recommendations of products to other customers. These events are generated when customers recommend specific products from the website to others. Such data will be useful for further communication with these recommending customers to reward them with loyalty points for referrals, send them targeted communications and discounts.
This case is just na example, you can export any other data types according to your needs from Azure Blob Storage.
## Prerequisites
---
You must have an account on Azure AD.
## Prepare a workflow
---
Create a workflow which gets the events from Azure Blob Storage every day.
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. 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, every day at 6.00 A.M.).
The workflow will automatically launch at the scheduled time.
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 Azure Blob Storage.
1. Click **Azure Blob Storage > 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/azure-blob-storage/get-file-azure-blob-storage).
- If you selected an existing connection, proceed with the integration settings.
1. In the **Container** field, enter the name of an existing container in your storage.
If this field is already filled out, it means that the URL used in the [connection](/docs/automation/integration/azure-blob-storage/get-file-azure-blob-storage) settings contains the name of the container.
2. In the **Blob name** field, enter the name of the blob (file) you want to download from the storage.
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 Events node
---
In this step, add the **Import Events** node to import referral events directly to Synerise.
1. On the **Azure - Get File**, click **THEN**.
2. From the list that opens, select **Synerise > Import Events**.
### 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/4add05d2-20bf-4c77-a590-4fa9b81a04b4) 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), `product.referred` (~1).
## Read more
---
- [Get File](/docs/automation/integration/azure-blob-storage/get-file-azure-blob-storage)
- [Workflows](/docs/automation)
# AI recommendations enriched with customer opinions
---
Other customers opinions often have a big impact on user purchasing decisions. We consider positive and negative opinions when we buy, especially when purchasing more expensive items.
It's worth using positive opinions in AI recommendation filters or boosting when displaying recommendations on the page. This will be helpful in campaigns which are created to promote the best products to those who best match them. In this way we can highlight them and encourage more people to buy them.
## Example of use – Home appliances industry
One of our customers from the home appliances industry decided to exclude products with an average opinion below 3.0 in the recommendations on the home page. Additionally, while displaying recommendations on the site, he decided to sort the displayed products in order of number of opinions.

## Requirements
- Tracker
- Imported correct feed
- Suitable AI models trained (e.g. personalized)
- Two custom feed attributes:
- Average product opinion
Example name:
Attribute value type: numeric (float)
- Number of opinions expressed about the product
Example name:
Attribute value type: numeric (float)
## How to do it
---
1. Prepare an AI campaign that includes the right filter for the attribute with the average review.
2. Prepare dynamic content for the campaign using inserts in Jinjava. Additionally, use Jinjava to sort products by number of reviews.
{% set tab = [] %}
{% recommendations2 campaignId=campaign_hash %}
{% for p in recommended_products2 %}
{% set count = (loop.index - 1) %}
{% for r in p.customAttributes %}
{% if r.name == 'average_rating' %}
<!-- WE SAVE RATING AND INDEX OF PRODUCT -->
{% do tab.append({rating:r.value, index: count}) %}
{% endif %}
{% endfor %}
{% endfor %}
{% for r in tab|sort(true, true, 'rating') %}
{{ r }}
<!-- SHOW PRODUCTS SORTED BY RATING -->
{{ recommended_products2[r.index].productRetailerPartNo }}<br>
{% endfor %}{% endrecommendations2 %}
## 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 [Jinjava inserts](/developers/inserts/insert-usage) (recommendations)
- Read more about [Loops in Jinjava](/developers/inserts/tag)
- Read more about [Product feed preparation](/developers/product-feed)
# Google Spreadsheet integration
The Synerise and Google Sheets integration allows easy data export from Synerise to Google Sheets. Using the "Upload Data to Spreadsheet" node, you can add data as rows or columns to the spreadsheet, including various data types (events and analytics). This integration opens up new possibilities for data analysis and informed decision-making.
This use case shows a workflow configuration that sends daily information from Synerise to Google Spreadsheets about the number of transactions made on the current day, enriched with information about the date of sending this data.
## Prerequisites
---
- Check the [requirements](/docs/automation/integration/google-sheets/upload-data-to-spreadsheets#prerequisites) you must meet to integrate Synerise with Google Spreadsheets.
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CreateATransaction).
## Process
---
1. [Create a metric](#create-a-metric) that counts the number of transactions.
2. [Create an expression](#create-an-expression) that returns the current date.
3. [Create a workflow](#create-a-workflow).
## Create a metric
---
In this part of the process, you will create a metric that counts the number of transactions completed on the current day and will be sent to Google Spreadsheet.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As the metric type, select **Simple metric**.
4. As the type, leave **Event**.
5. As the aggregator, set **Count**.
6. As the occurrence type, set **All**.
7. From the **Choose event** dropdown list, select `transaction.charge`.
8. To select a specific time range, click the calendar icon. In our case, it will be **Today**. Confirm your choice with the **Apply** button.
9. Click **Save**.
Configuration of the metric returning the number of all transactions
## Create an expression
---
In this part of the process, create an expression that returns the current date.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression.
3. Set the **Expression for** option to **Attribute**.
4. Click **Select** and from the **Function** dropdown list, choose **Now**.
5. Save the expression.
Configuration of the expression returningthe current date
## Create a workflow
---
In this part of the process, create a workflow which adds a new row with the Synerise metric value to a Google Spreadsheet. The workflow starts at 6 A.M. daily and automatically updates the Spreadsheet.
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 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 A.M.
4. Confirm by clicking **Apply**.
The configuration of the Scheduled Run node
### Configure the Upload Data to Spreadsheet node
1. As the next node, add **Google Sheets > Upload Data to Spreadsheet**.
2. Click the node and then **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-sheets/upload-data-to-spreadsheets#create-a-connection).
- If you selected an existing connection, proceed to defining the integration settings.
4. Fill out the **Configure integration** form.
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, it is the last string of characters.
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:A5`, then the data will be added in a column to A4 and A5 cells in the `Sheet1` Spreadsheet.
3. From the **Dimension** dropdown list, select **Columns**.
4. In the **Values** field, enter the data you want to upload to the Spreadsheet. In this case:
In the request body with the values, we use [inserts](/developers/inserts) and Jinjava to refer to the data gathered in Synerise. Make sure to add the id of the metrics and expressions you created earlier.
The configuration of the Upload Data to Spreadsheet node
5. Confirm by clicking **Apply**.
### Add the finishing node
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
The configuration of the Workflow
The metric presented in this case is just an example. You can export any other analyses you need with the **Upload Data to Spreadsheet** node. All you have to do is replace the syntax with relevant jinjava inserts and add the corresponding analyses IDs.
## Check the use case set up on the Synerise Demo workspace
---
You can check all the configurations directly in Synerise Demo workspace:
- [Metric](https://app.synerise.com/analytics/metrics/be18d6fe-4b3a-45a3-9bd5-08a9a85652c3)
- [Expression](https://app.synerise.com/analytics/expressions/8aed3f3e-f89c-422b-9d23-6609c0ecdee8)
- [Workflow](https://app.synerise.com/automations/automation-diagram/c8171a3e-285c-43f9-9191-94fb16a744c2)
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), [`googleSheets.uploadData`](/docs/assets/events/event-reference/integration#googlesheetsuploaddata) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Automation inserts](/developers/inserts/automation)
- [Uploading data to a spreadsheet](/docs/automation/integration/google-sheets/upload-data-to-spreadsheets)
# 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 a transformation](/use-cases/import-customers-data-from-sftp#create-a-transformation) 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 a transformation
---
In this part of the process, you define the rules of modifying data.
The transformation 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 transformation and preview its results. With a [library of transformation steps](/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 Columns** step to transform a customers' marketing agreements file so it meets Synerise's requirements.
1. Go to **Automation Hub > Transformations > New transformation**.
2. Enter the name of the transformation.
3. Click **Upload a new file or drag one here**.
### Add file with sample data
This step 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. 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
```
2. Set **Delimiter** to `;` and provide **Quotation mark** and **Escape character**.
3. Click **Apply**.
The configuration of the file upload
**Result:** The editor displays data from the sample.
The preview of the sample file
### Rename Columns
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 Columns** step to rename the **newsletter agreement** column to **agreements.email**.
1. On the right panel, click **Add step**.
2. From the dropdown list, select **Rename Columns**.
3. Click the **Rename Columns** step.
4. In the configuration of the step:
1. Select the **newsletter agreement** column.
2. Under **Rename by**, select **Replacing**.
3. In the text field, enter `agreements.email`.
Example of the configuration of the Rename Columns step
5. Before you save the settings, you can check the preview of the file after changes in the **Results** tab.
6. Confirm by clicking **Apply**.
### Preview and save the transformation
1. Preview the results in the **Output** tab.
2. In the upper right corner, click **Save**.
**Result**:
The transformation configuration
After the transformation is saved, you can use it in the **Data Transformation Studio** node while preparing a workflow that imports the files.
## Prepare a workflow
---
As the second part of the process, create a workflow which imports customers' marketing agreements 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. Select the **Repeat runs** option.
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
3. Confirm by clicking **Apply**.
### Configure settings for SFTP protocol
Use the **Get File** node to retrieve the file from your server using the 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. Select the SFTP connection type as **Public key**, choose the connection in the **Select connection** field, and click **Next**.
2. Enter the path to your server.
3. Select the port.
4. Enter the path to the directory.
5. Enter the name of the file to import.
6. From the **File format** dropdown list, select **CSV**.
7. Verify and modify the delimiters if needed.
The configuration of the SFTP Get File node
3. Confirm by clicking **Apply**.
### Select the transformation
1. Add a **Data Transformation Studio** node.
2. In the configuration of the node, keep the default **From workflow context** option.
3. In the editor, click **Templates library**:
1. Select the [transformation you have created before](/use-cases/import-customers-data-from-sftp#create-a-transformation).
2. Click **Use template**.
Example of the configuration of the Data Transformation Studio node
4. Confirm by clicking **Apply**.
You can also create a transformation directly in the **Data Transformation Studio** node instead of selecting a template.
### Import customers
1. Add the **Import Profiles** node. In the settings of the node, you can check the list of the optional columns.
2. Optionally, in **Advanced settings**, you can change the [import mode](/docs/assets/imports/importing-clients#import-modes).
3. 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
## Check the use case set up on the Synerise Demo workspace
---
You can check the [transformation](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)
# 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#tag/Events/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)
# Sending metrics results to Google BigQuery
---
The integration between Synerise and Google BigQuery allows users to export various types of data from Synerise to BigQuery. This is a convenient solution as it allows data to be exported and used for further analysis in BigQuery and other Google tools such as Google Analytics.
In this use case, we will show how to send metrics results (CTR, CTOR, and OR) to a BigQuery table using a dedicated node (Upload Data to Table) in our Automation Hub. The process of creating these metrics has already been described in [this use case](/use-cases/calculate-ctr-or-ctor). In the following steps, we will create a workflow for uploading these analytics to BigQuery.
## Prerequisites
---
- Check the [requirements](/docs/automation/integration/google-bigquery/upload-data-to-bigquery#prerequisites) you must meet to integrate Synerise with Big Query.
- Prepare metrics that counts OR, CTR and CTOR based on the [use case](/use-cases//calculate-ctr-or-ctor).
## Create a workflow
---
Create a workflow which sends metrics results to Google BigQuery. The workflow starts at 6 A.M. daily and automatically sends the up-to-date metrics results to BigQuery.
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.
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 at 6:00 A.M.
4. Confirm by clicking **Apply**.
The configuration of the Scheduled Run node
### 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. Fill out the form according to the instructions in the **Define the integration settings** section.
3. In the **Rows** field, enter JSON that extracts the ID of specific metrics.
### Add the finishing node
---
1. Add the **End** node.
2. In the upper right corner, click **Save & Run**.
The configuration of the Workflow
The metrics presented in this case are just examples. You can export any other analytics you need with the Upload Data to Table node. All you have to do is replace the syntax with relevant jinjava inserts and add the corresponding analytics ID.
## 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/d161330f-deb9-4a6f-aff5-a07ec13fd945) 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 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), [`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)
# Boost customers' favorite brand in similar recommendations
Similar product recommendations are one of the popular ways of showing customers products that align with their preferences. In addition, this type of recommendation helps the customer make a purchase decision more quickly by choosing among products that are similar to those they have seen before, thus showing interest in those products.
Additional reinforcement of these recommendations with customers' favorite brands makes them even more aligned with their preferences and intrinsic expectations. In this case, such reinforcement is accomplished by using an aggregator that returns the brands of products that have been viewed most frequently by customers.
The personalization enhancement factor takes recommendations to a whole new level, where in addition to a similar product recommendation model and boosting filters, the personalization model influences the scoring of items according to each customer's preferences. The combination of all these features allows you to get the best value for customers by presenting them with the most relevant products.
## 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 brand attribute).
- [Configure an item catalog for recommendations](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations). Enable similar recommendations.
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CreateATransaction).
## Process
---
1. [Create an aggregate](/use-cases/boost-favorite-brand#create-an-aggregate).
2. [Create recommendation](/use-cases/boost-favorite-brand#create-a-recommendation).
## Create an aggregate
---
In this part of the process, create an aggregate that returns the customer's most frequently purchased product brands.
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 **product.buy** event.
5. As the event parameter, select **brand**.
6. Define the period from which the aggregate will return products from the event.
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 **Similar items** 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 **brand** attribute.
You can use the search field.
5. From the **Operator** dropdown list, select **Equals**.
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-favorite-brand#create-an-aggregate).
8. Click **Apply**.
Boosting items with the most popular customer brands
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. Enable the **Personalization** toggle.
12. From the Impact scrollbar, select how much you want the personalization model to influence the arrangement of items in the recommendation.
13. Confirm the settings by clicking **Apply**.
Example of boosting configuration
14. Save the **Boosting** section settings by clicking **Apply**.
15. Optionally, you can define the settings in the **Additional settings** section.
16. 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 ([Android](/developers/mobile-sdk/displaying-recommendations/content-widget/android) and [iOS](/developers/mobile-sdk/displaying-recommendations/content-widget/ios)).
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#tag/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/04a8575c-9c62-37bb-a4ee-c99238e38ba5) and [AI recommendation](https://app.synerise.com/ai-v2/recommendations/DSdqtmHxXDXS) 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)
# Collect and update weather information in a catalog
The targeting of advertisements or messages can be based on external data, such as weather information. This type of communication with recipients is especially relevant to companies from the medical, fashion, beverage, or agricultural industries. By collecting data on cloud cover, air temperature, and pressure, we are able to better advertise products, arouse customer interest, and even strengthen the positive perception of a brand.
This use case describes how to retrieve data from the WeatherAPI portal and save it in the Synerise catalog. As the next steps (not covered as part of this use case), you may send marketing communication to the customers encouraging them to buy sunglasses for the upcoming sunny days.
## Prerequisites
---
- [Assign the following permission](/docs/settings/tool/api) to your workspace API key allowing you to authorize requests and update contents in the catalog: `CATALOGS_ITEM_BATCH_CATALOG_CREATE`
- Create an account at the [WeatherAPI](https://www.weatherapi.com/) portal that provides weather information.
- Prepare a `CSV` file with the list of your points of sales (POS). The file must include the columns with the following names:
- `attributes.store_name`- The name of the store
- `attributes.storeId` - The ID of the store
- `email` - Email address of the POS.
- If your points of sales don't have email addresses, instead of the `email` column, add `customId` column and assign to it the same value as to `attributes.storeId`.
- If you implemented [non-unique email](/docs/settings/configuration/non-unique-emails) setting, use `customId` instead of `email`.
- `attributes.store_city` - City where the POS is located
- `attributes.latitude` - Latitude of the POS
- `attributes.longitude` - Longitude of the POS
If you want to update the weather information for the city of residence for your customers and you already have their location data (longitude and latitude) saved as attributes on the profile cards in **Behavioral Data Hub > Profiles**, you can skip this part of the process.
## Process
---
In this use case, you will go through the following steps:
1. [Import a list of offline stores](/use-cases/data_with_current_weather_information#import-a-list-of-offline-stores).
2. [Create a segmentation](/use-cases/data_with_current_weather_information#create-a-segmentation) that gathers the points of sales you imported.
3. [Create a catalog](/use-cases/data_with_current_weather_information#create-a-catalog) which will contain regularly updated weather information.
4. [Create a workflow](/use-cases/data_with_current_weather_information#create-a-workflow) which retrieves weather information from the WeatherAPI portal and saves it in the catalog.
## Import a list of offline stores
---
To collect weather information for each store, first you must import them with their location into Synerise. In this part of the process, you will import the list of POSes to Synerise as profiles (each POS will have a profile in **Behavioral Data Hub > Profiles**). This way, in the further part of the process, you will be able to create a segmentation of POSes and use it in a [workflow](/glossary/#workflow) that updates weather information for each POS.
For this purpose, you will create a workflow that will import the list of POSes to Synerise.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
3. Click **Add trigger**.
4. From the dropdown list, select **Scheduled Run**.
5. Click the node.
6. Set the **Run trigger** option to **one time**.
7. Select the **Immediately** tab.
8. Confirm by clicking **Apply**.
9. Click **THEN**.
11. From the dropdown list, select **Local File**.
10. Click the node.
11. Click **Upload a new file or drag one here**.
12. Select the file you created as a part of [prerequisites](/use-cases/data_with_current_weather_information#prerequisites).
13. If needed, modify **Delimiter**, **Quotation mark**, and **Escape character**.
14. Confirm by clicking **Apply**.
10. Click **THEN**.
15. From the dropdown list, select **Import Profiles**. This node doesn't require any configuration.
16. Click **THEN**.
17. From the dropdown list, select **End**.
Configuration of the workflow
17. Click **Save & Run**.
**Result**: Each POS have a profile.
## Create a segmentation
---
In this part of the process, create a segmentation that gathers all points of sales you imported to Synerise.
1. Go to **Decision Hub > Segmentation > New segmentation**.
2. Enter a name for the segmentation.
2. Choose the `storeId` attribute.
3. As an operator, choose **Is true**.
Configuration of the segmentation
5. Save your segmentation.
If this segmentation is to include customers, not points of sales (POS), you can, for example, use the attribute responsible for longitude and latitude with the value **"is true"** - then all customers who have this value defined on their card in Profiles will be included.
## Create a catalog
---
In this part of the process, create a catalog that will store the current weather information for each point of sales. This catalog will be later updated by [the workflow](/use-cases/data_with_current_weather_information#create-a-workflow) that requests the weather information.
1. Go to **Data Modeling Hub > Catalogs > New Catalog**.
2. Enter the name of the catalog.
3. Confirm by clicking **Apply**.
3. Find the catalog on the list and click it.
**Result**: Its URL looks as follows: `https://app.synerise.com/spa/modules/catalogs/catalogs/1234`. The number at the end is the catalog ID, save it in a notepad as you will need it later.
Instruction on creating catalogs is available [here](/docs/assets/catalogs/creating-catalogs).
## Create a workflow
---
In this part of the process, you will create a workflow for all points of sales you created (for this purpose, you will use [the segmentation you created earlier](/use-cases/data_with_current_weather_information#create-a-segmentation)). This workflow will be launched repetitively (at a frequency required by your business) to retrieve data from the [Weather API](https://www.weatherapi.com/) portal and save it in [the catalog you created eariler](/use-cases/data_with_current_weather_information#create-a-catalog).
### Add the Audience node
Start with the **Audience** node. In its configuration, you will use [the segmentation you created in previous steps](/use-cases/data_with_current_weather_information#create-a-segmentation) and define the frequency of launching the workflow.
1. Click **Add trigger**.
2. From the dropdown list, select the **Audience** node.
3. Leave the **Run trigger** option at default (**repeatable**).
4. Define the values for the **Interval** (frequency), **Begin at**, and **Timezone** fields according to your business requirements.
4. In the **Define audience** section, click **Select segment**.
5. Select [the segmentation you created in previous steps](/use-cases/data_with_current_weather_information#create-a-segmentation).
6. Confirm by clicking **Apply**.
Configuration of the Audience node
7. Confirm the settings in the node by clicking **Apply**.
### Add the Get Weather Information node
Add the **Get Weather Information** node which retrieves weather information.
1. Click **THEN**.
2. From the dropdown list, select **Get Weather Information**.
3. Click the node.
2. Click **Select connection**.
3. From the dropdown list, select the connection.
If you haven't established a connection yet, see [Create a connection](/docs/automation/integration/weatherapi/get-weather-information#create-a-connection).
4. Leave the selection in the **Weather data period** field at default (**current weather**).
5. In the **Location** field, enter `{{ customer.latitude }},{{ customer.longitude }}`
6. Fill the rest of the configuration form according to instructions [here](/docs/automation/integration/weatherapi/get-weather-information#define-the-integration-settings).
7. Confirm the settings by clicking **Apply**.
### Add the Event Filter node
By adding the **Event Filter** node, the workflow waits until the `weatherapi.getWeatherInfo` event is generated on the profile card of the points of sales. This way, you can be sure that there is weather information. The event contains parameters with weather information configured in the previous node for each POS.
1. Click **THEN**.
2. From the dropdown list, select **Event Filter**.
1. Leave the **Check** option at default.
If there are other workflows which depend on the occurrence of this event, adjust the time of checking according to your business needs.
2. Select the **weatherapi.getWeatherInfo** event.
4. Confirm by clicking **Apply**.
The configuration of the Event Filter node
### Add the Outgoing Integration node
This webhook will be used to save the retrieved information to the catalog you created in [previous part of the process](/use-cases/data_with_current_weather_information#create-a-catalog).
1. Click **THEN**.
2. From the dropdown list, select **Outgoing Integration**.
1. Select the **Custom webhook** tab.
2. In the **Action name** field, enter `save.weather` (you can use different name, it's just an example).
3. Select **POST method**.
4. In the **Endpoint** field, enter `https://hub.synerise.com/api-reference/asset-management#operation/addItemsBatch`
4. Leave **content-type** at default: `application / json`.
5. In the body of the request, paste the request body with the weather parameters returned by WeatherAPI you would like to save in the catalog. Below you can find example code:
Check the example code
This example uses inserts with [event context](/developers/inserts/automation#event-parameters) to access WeatherAPI response data from the **Event Filter** node. The parameters from the response are injected into a request to the catalogs API and saved in a catalog.
| Column name in the catalog | Information saved in the column |
|---------------------------------------|----------------------------------------------------------------|
| `StoreId` | The ID of the point of sales |
| `condition_text` | Weather condition (as a string, for example `Mist`) |
| `condition_code` | Weather condition (as [WeatherAPI code](https://www.weatherapi.com/docs/#weather-icons) ) |
| `location_name` | City name |
| `last_updated` | Local time when the real time data was updated. |
| `temp_c` | Temperature given in degrees Celsius |
| `itemKey` | Unique identifier in the catalog (in this case, same as POS ID), necessary to save the weather data to the corresponding POS entry. |
The configuration of the Outgoing Integration node
9. In the **Authorization** section, select **By API key**.
10. From the dropdown list, select the API key who has enabled the `CATALOGS_ITEM_BATCH_CATALOG_CREATE` permission.
11. Confirm the settings by clicking **Apply**.
### Set up final settings of the workflow
1. After the **Outgoing Integration** node, add the **End** node.
3. Optionally, add titles to each node so the workflow will be more understandable to your colleagues.
4. Enter the name of the workflow.
The complete configuration of the workflow
5. Finish your work:
- To save the workflow as a draft, click **Save**.
- To activate the workflow, click **Save & Run**.
As a result, you will receive a catalog with regularly updated weather data for each point of sales included in the **Audience** node.
Update weather data in catalog
## What's next
---
The outcome of this use case is a regularly updated catalog with weather data for the region of your points of sales. You can use this information in your communication with customers by [adding references to this catalog](/developers/inserts/insert-usage#extracting-values-from-catalogs) in the templates. This way, based on the weather conditions, you can prepare a message for your customers.
### Adding new POS
To add new points of sales, you can import them as shown in [this part of the process](#import-a-list-of-offline-stores) or you can add them manually in **Behavioral Data Hub > Profiles**
### Updating existing POS
To update existing POS, you can do it on their profiles in **Behavioral Data Hub > Profiles** or you can import a file with points of sales with their updated data.
### Removing POS
To remove a point of sales, go to **Behavioral Data Hub > Profiles**, find the POS you want to remove and use the context menu on the right hand side to remove it.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of use case in Synerise Demo workspace:
- [List import](https://app.synerise.com/automations/workflows/automation-diagram/e9d59ed5-88e9-4cc1-b15e-8e8ab8cfd583)
- [Catalog](https://app.synerise.com/assets/catalogs/15969)
- [Segmentation](https://app.synerise.com/analytics/segmentations/cced0b32-546e-4440-9e69-4b07a7543871)
- [Workflow configuration](https://app.synerise.com/automations/automation-diagram/b563bcc3-0c40-47a1-b75e-11ee64eac64a)
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 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), [`weatherapi.getWeatherInfo`](/docs/assets/events/event-reference/integration#weatherapigetweatherinfo) (~1), [`webhook.response`](/docs/assets/events/event-reference/integration#webhookresponse-and-custom-webhook-response-names) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Catalogs](/docs/assets/catalogs)
- [Get Weather Information node](/docs/automation/integration/weatherapi/get-weather-information)
- [Jinjava inserts](/developers/inserts/insert-usage)
- [Outgoing Integration](/docs/automation/integration/outgoing-webhook)
# Transaction trends dashboard
Creating a transaction trends dashboard is an efficient way for businesses to keep track of their financial performance by analyzing transactional data. With this reporting tool, businesses can easily monitor trends in transaction values and purchase data. The goal of this dashboard is to provide a quick and clear overview of transactional activity, helping businesses to make data-driven decisions in real time.
In this use case, you will design a transaction trends dashboard that enables businesses to gain insights into their financial performance by visualizing transactional data.
## 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#tag/Events/operation/CreateATransaction).
- Implement [OG tags](/developers/web/og-tags) on your website.
## Process
---
In this use case, you will go through the following steps:
1. [Create metrics](#create-metrics) for a number and value of transactions, Average Order Value (AOV), and number of bought products.
2. [Create a histogram](#create-a-histogram) that presents a number and value of transactions in time.
3. [Create an expression](#create-an-expression) that returns the month and year for the `product.buy` event.
3. [Create reports](#create-reports) for most frequently bought products, most frequently bought products by categories and by month, most frequently bought categories by month, most frequently visited products, most frequently visited products by categories.
4. [Create a dashboard](#create-a-dashboard) that gathers created analyses.
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 metrics
---
In this part of the process, you will create four metrics for the `transaction.charge`, `product.buy` and `Visited page` events. They will be later used in [a histogram](#create-a-histogram),[reports](#create-reports) and [the dashboard](#create-a-dashboard).
### Number of transactions
This metric will return the number of all 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 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 `transaction.charge`.
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 transactions
### Transactions value
This metric will return the value 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 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 `transaction.charge`.
6. Click the **+ where** button.
**Result**: The **Choose parameter** button appears.
7. From the **Choose parameter** dropdown list, choose `$totalAmount`.
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 value of transactions
### AOV
This metric will return the avarage order value.
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 **Average**.
4. As the occurrence type, set **All**.
5. From the **Choose event** dropdown list, select `transaction.charge`.
6. Click the **+ where** button.
**Result**: The **Choose parameter** button appears.
7. From the **Choose parameter** dropdown list, choose `$totalAmount`.
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 AOV
### Number of bought products
This metric will return the number of bought products.
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 the **+ where** 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 bought products
### Number of visits on the product page
This metric will return the number of visits on the product page.
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 `Visited page`.
6. Click the **+ where** 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**.
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 visits on the product page
## Create a histogram
---
In this part of the process, you will create a histogram for the [transactions value](#transactions-value) and [number of bought products](#number-of-bought-products) metrics. They will be later used in [the dashboard](#create-a-dashboard).
1. Go to **Decision Hub > Histograms > New histogram**.
2. Enter the name of the histogram.
3. From the **Choose metric** dropdown, select the [transactions value metric](#transactions-value) created in the previous step.
4. Click the **Interval** button and set it for **day**.
5. To select a specific time range, click the calendar icon. In our case, it will be **Last 30 days**. Confirm your choice with the **Apply** button.
6. Add another metric to the histogram:
1. Click the button.
2. Repeat steps 3-5 for the [number of bought products metric](#number-of-bought-products) created in the previous step.
7. Click **Save**.
Configuration of the histogram
## Create an expression
---
In this part of the process, create an expression for the `product.buy` event. It will return month and year of the purchase and will be later used in [reports](#create-reports).
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 `product.buy` event.
5. Build the following formula of the expression:
Configuration of the expression which returns the date in month/year format
6. Save the expression.
## Create reports
---
In this part of the process, you will create reports:
- for most frequently bought products,
- most frequently bought products by categories,
- most frequently bought products by month,
- most frequently bought categories by month,
- most frequently visited products,
- most frequently visited products by categories.
All the reports will be used in the [dashboard](#create-a-dashboard) in the further part of the process.
Most frequently bought products
This report will return the names of most frequently bought products and its values.
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 20 products.
In the Dimension section, from the dropdown list, select Events > Parameters. To be able to show product names in the report, choose `title`.
To select a specific time range, click the calendar icon. In our case, it will be Lifetime. Confirm your choice with the Apply button.
Click Save. Configuration of the most frequently bought products report
Most frequently bought products by categories
This report will return the names of most frequently bought products and its values by its categories.
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 20 products.
In the Dimension section, from the dropdown list, select Events > Parameters. To be able to show products name in the report, choose `category`.
To select a specific time range, click the calendar icon. In our case, it will be Lifetime. Confirm your choice with the Apply button.
Click Save.
Most frequently bought products - monthly comparison
This report will return the names of most frequently bought products by categories and its values in a specific month.
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 20 products.
In the Dimension section, from the dropdown list, select Events > Parameters. To be able to show product names in the report, choose `title`.
Click Add dimension.
Click Choose dimension and from the dropdown list, select Events > Expressions. To be able to show the date of the transaction in the month/year format choose the expression you created in the previous part of the process.
To select a specific time range, click the calendar icon. In our case it will be Lifetime. Confirm your choice with the Apply button.
Click Save.
Most frequently bought products by categories - monthly comparison
This report will return the names of most frequently bought products by categories and its values in a specific month.
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 20 products.
In the Dimension section, from the dropdown list, select Events > Parameters. To be able to show products name in the report, choose `category`.
Click Add dimension.
Click Choose dimension and from the dropdown list, select Events > Expressions. To be able to show the date of the transaction in the month/year format choose the expression you created in the previous part of the process.
To select a specific time range, click the calendar icon. In our case, it will be Lifetime. Confirm your choice with the Apply button.
Click Save.
Most frequently visited products
This report will return the names of most frequently visited products and its values.
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 20 products.
In the Dimension section, from the dropdown list, select Events > Parameters. To be able to show product names in the report, choose `og:title`.
Switch off the Show null values toggle.
To select a specific time range, click the calendar icon. In our case it will be Lifetime. Confirm your choice with the Apply button.
Click Save.
Most frequently visited products by categories
This report will return the names of most frequently visited products and its values by categories.
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 20 products.
In the Dimension section, from the dropdown list, select Events > Parameters. To be able to show products name in the report, choose `product:category`.
Switch off the Show null values toggle.
To select a specific time range, click the calendar icon. In our case, it will be Lifetime. Confirm your choice with the Apply button.
Click Save.
## Create a dashboard
---
In the final part of the process you will create a dashboard with the [metrics](#create-metrics), [reports](#create-reports) and [the histogram](#create-a-histogram) 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 a 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. Add a metric by clicking the on the panel.
You can adjust the size of widgest by dragging their lower right corner.
5. Edit widget contents with the editor on the right. In the **Metric** section, choose the [metric that returns the number of all transactions you have created in the previous part of the process](#number-of-transactions). You can change the title and description. Do the same for the following [metrics created in the previous part of the process](#create-metrics): transactions value, AOV, and number of bought products
Configuration of the metric widget
6. Add a histogram by clicking the Histogram icon on the panel.
7. Edit widget contents with the editor on the right. In the **Histograms** section, choose the [histogram for the transactions value and number of bought products you have created in the previous part of the process](#create-a-histogram). You can change the title and description.
8. Click the **Style** section in the widget editor and change **Visualization type** to **Column**.
Style configuration of the histogram
9. Add a report by clicking the Report icon on the panel.
10. Edit widget contents with the editor on the right. In the **Reports** section, choose the [report for most frequently bought products you have created in the previous part of the process](#create-reports). You can change the title and description.
11. Click the **Style** section in the widget editor and change **Visualization type** to **Table**.
12. Do the same for the following [reports created in the previous part of the process](#create-reports): most frequently bought products by categories, most frequently bought products - month comparison, most frequently bought products by categories - month comparison, most frequently visited products, most frequently visited products by categories.
You can look up the sample dashboard created in the Demo workspace [here](https://app.synerise.com/analytics/dashboards/9a11421a-8da9-40ad-bf9f-6693c44663f5)
10. 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).
## Check the use case set up on the Synerise Demo workspace
---
You can check all configurations directly in Synerise Demo workspace:
- Metrics
- [Number of transactions](https://app.synerise.com/analytics/metrics/6b93889f-3967-4149-b6a5-37fbd26e3155)
- [Value of transactions](https://app.synerise.com/analytics/metrics/774a54a2-9830-4e7f-9a69-c32009552a3a)
- [AOV](https://app.synerise.com/analytics/metrics/2d536298-dd87-4d73-be8f-a2ae493044fe)
- [Number of bought products](https://app.synerise.com/analytics/metrics/2ee8c7e4-300f-4d26-a0f0-0be7d0a61ecc)
- [Number of visits on the product card](https://app.synerise.com/analytics/metrics/eb1d3b8c-9e71-42bf-8cfe-6f5d56c66863)
- [Histogram](https://app.synerise.com/analytics/histograms/50645c5d-bcbd-4731-96c7-946b151621b7)
- [Expression](https://app.synerise.com/analytics/expressions/7a25c893-45be-4dfd-a54e-fa9f0ff68c5f)
- Reports
- [Most frequently bought products](https://app.synerise.com/analytics/reports/e9665c7b-03d4-42ed-9c4e-919a75e4160e)
- [Most frequently bought products by categories](https://app.synerise.com/analytics/reports/c888152c-ab63-4bb9-916e-723a54701595)
- [Most frequently bought products - month comparison](https://app.synerise.com/analytics/reports/ee008cde-256e-4767-b316-adf2855fc939)
- [Most frequently bought products by categories - month comparison](https://app.synerise.com/analytics/reports/3c286572-ba0a-47d7-9aaf-7d485910f63b)
- [Most frequently visited products](https://app.synerise.com/analytics/reports/a1867119-e1d3-4557-8523-4b8d1f416cb3)
- [Most frequently visited products by categories](https://app.synerise.com/analytics/reports/eb01a20c-12f6-45b8-bbca-402531f7e06a)
- [Dashboard](https://app.synerise.com/analytics/dashboards/9a11421a-8da9-40ad-bf9f-6693c44663f5)
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)
- [Expressions](/docs/crm/expressions)
- [Histograms](/docs/analytics/histograms)
- [Metrics](/docs/analytics/metrics)
- [Reports](/docs/analytics/reports)
# Email with discount for those who left the site
If customers were on your site and visited specific product pages, then they probably did not land on it by accident. They wanted to go beyond the main page and learn more about you and your offer. So even if they did not complete a transaction you can reach them with an attractive offer by, for example, sending them a discount in the email.
It can encourage them to make a transaction and come back to your site and **use discount to buy products** they previously viewed.
## Example of use - Retail industry
A customer from the fashion industry has prepared a different promotion for every day of Black Week. They informed users about it on their site through additional banners. However, they decided to use email as a communication channel with customers who were on the site, visited a product, but did not make a purchase. After leaving the site, these customers received information about the **discount code in an email**. It was made to encourage them to come back and finish their purchase process.
A/B Test
**Results**
- OR **10,31%**
- CTOR **31,05%**
- Conversion **2,6%**
## Prerequisites
---
To implement this use case, check those articles:
- [Tracking code](/docs/settings/tool/tracking_codes)
- [OG tags implemented](/developers/web/og-tags)
- [Transaction events tracking](/developers/web/transactions-sdk)
- [Email account configuration](/docs/campaign/e-mail/configuring-email-account)
## Process
---
To create an email with discount for those who left the site, perform the following steps:
1. [Prepare coupons](/use-cases/discount_for_those_who_left_the_site#prepare-coupons)
2. [Prepare an email template](/use-cases/discount_for_those_who_left_the_site#prepare-an-email-template)
3. [Create a workflow](/use-cases/discount_for_those_who_left_the_site#create-a-workflow)
## Prepare coupons
---
In [this](/docs/assets/code-pools) article, you will find the rules and procedures needed to create and use voucher pool in Synerise.
Depending on your needs, you can send to user general code with promotion, eg. SHOPPING20%, or coupon code individually for each user. If you decide on this second option you will have to import to Synerise coupons previously prepared in your ecommerce platform which will apply the appropriate discount in the shopping cart.
1. Go to [Vouchers](https://app.synerise.com/spa/modules/vouchers/pools/) and prepare a Voucher pool, to which you will add coupons.
2. Add an obligatory **Pool name**, and set the **Emission** start and **end dates**.
3. When the pool is created, click Import and choose CSV with vouchers.
New coupons pool
{{< tip >}}
Remember, that your csv should have only 1 column, without a name.
{{< /tip >}}
## Prepare an email template
---
1. Go to **Campaign > Email**.
2. To distribute coupon codes, prepare an email template - design banners, copy and add the ID of the coupon pool.
3. Click **Inserts** in the upper right corner, find **Pools** on the list of inserts.
4. Choose previously a prepared Coupon pool and copy and paste it in the place where the coupon code should be shown to the user. Instead of `{% voucher %} voucher-hash {% endvoucher %}`, user will see his individual coupon code.
Preparing email template
{{< tip >}}
If you would like to send the same coupon code to the user twice, eg. after 1 day if user still doesn’t make a purchase, use the same voucher hash, but add flag assign=false, like in this example: **{% voucher assign=false %} voucher-hash {% endvoucher %}**
{{< /tip >}}
## Create a workflow
---
To send emails to customers you will have to prepare a workflow.
1. Go to **Automation Hub > Workflow.**
2. Start with the **Profile Event** trigger and in the settings of the node, select the **page.visit** event.
2. As the event parameter, select **retailer_part_no** - this way, the workflow starts only when a customer visits a product page. This way the workflow will be started only by a product page visit.
{{< tip >}}
Use "." in a regular expression to accept a valid value of this parameter (except for null). This way, you know that this event has the **retailer_part_no** parameter.
{{< /tip >}}
Configuration of the Profile Event node
2. Add **Delay** and define the lag between the page visit and sending the message, in our example it is 2 hours.
Configuration of the Delay node
3. Using the **Profile Filter** node, exclude users who have made a transaction in the last 2 hours – it's important to use minutes instead of hours.
Configuration of the Profile Filter node
4. Configure the **Send Email** node by selecting the appropriate email account, choosing the template that you prepared in the previous step.
Configuration of the Send Email node
5. Specify capping to limit the number of coupons user will get (here it’s 1 for each 30 days).
6. Add End nodes where the workflow should finish for users.
7. Optionally, add titles to each node so the workflow will be more understandable for your colleagues.
8. Name the workflow and Save it or **Save & Run**.
Workflow
## Check the use case set up on the Synerise Demo workspace
---
Check the [workflow](https://app.synerise.com/automations/automation-diagram/e79a8874-7a68-474d-aa69-77d6fac6789f) in our Synerise Demo workspace.
{{% include "/reuse/use-cases/synerise-demo-workspace.md" %}}
## Generated events
This use case generates approximately 10 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) (~3), [`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 Hub](/docs/automation)
- [Email templates](/docs/campaign/e-mail)
# 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#tag/Events/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)
# Countdown timer bar on webiste
Creating a sense of urgency is one of the most effective ways to increase customer engagement and drive conversions. A countdown timer bar, which is a dynamic banner displayed at the top of a webpage, helps brands highlight time-sensitive promotions. By showing exactly how much time is left until the end of a deal, businesses can encourage faster decision-making, reduce hesitation, and boost overall campaign performance. Whether used for seasonal discounts, exclusive member offers, or last-minute deals, a countdown timer bar is a simple yet powerful tool for maximizing promotional results.
In this specific use case, we intend to introduce a dynamic countdown timer bar that displays real-time remaining promotion time to all website visitors.
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. The template is flexible – disabling the timer allows you to reuse it for alternative communication scenarios.
## Prerequisites
---
[Implement SDK to a website](/developers/web/installation-and-configuration)
## Create a dynamic content
---
Create a dynamic content campaign that will be displayed to all website visitors. We will use a predefined template for this communication, 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 **Insert object** type.
### Define audience
---
1. To select the recipients of the dynamic content, on the **Audience** tab, click **Define**.
2. Select **Everyone**.
3. Click **Apply**.
### Define content
---
In the next step, you will create the content of the dynamic content 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 **Insert object templates**.
3. Select the **Countdown timer bar** 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 countdown bar. Remember to set the correct end date of your promotion. Optionally, you can enable a button that redirects users to your promotional landing page. You can also activate or deactivate the countdown freely, depending on the needs of your communication.
Config panel
5. After customising your countdown bar, save the template.
6. Set an appropriate CSS selector to define the placement of the countdown bar. The correct selector depends on your website’s structure, so make sure to reference an element that ensures the bar is displayed in the intended position.
7. Click **Apply**.
### 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 campaign will be active. Make sure that the campaign’s display period aligns with the countdown end date. If the end date is exceeded while the campaign is still active, the dynamic content will not render on the website.
3. Click **Apply**.
2. In the **Display Settings** section, click **Define**. If you want the countdown bar to be displayed to all users continuously across the website upon landing, keep the default settings.
3. Click **Apply**.
4. Optionally, you can define the UTM parameters and additional parameters for your dynamic content campaign.
5. Click **Activate**.
## Check the use case set up on the Synerise Demo workspace
---
You can check the [dynamic content](https://app.synerise.com/campaigns/dynamic-content/create/3b199c2b-2724-45db-b05f-9b22ae4030a8) 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 2 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).
## Read more
---
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Introduction to dynamic content](/docs/campaign/dynamiccontent/introduction-to-dynamic-content)
- [Creating dynamic content](/docs/campaign/dynamiccontent/creating-dynamic-content)
- [CSS selector basics](/docs/campaign/dynamiccontent/creating-dynamic-content/css-selectors)
- [Testing dynamic content](/docs/campaign/dynamiccontent/testing-dynamic-content)
- [Dynamic content events](/docs/assets/events/event-reference/dynamic-content)
# 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)
# 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)
# Email with a promotion for products in the customers' size
Reuse the collected data about your customers in order to send personalized communication and help your customers find the best products for them. For this purpose you can use the size of a customer (you can collect it through transactions events) and send a message to the customers with the link to the discounted products in their size.
## Example of use - Retail industry
A client from the retail industry decided to increase the personalization of their communication. Using aggregates, we can find the size of the individual customer’s last purchased product to prepare a special offer. When the customer made a purchase, the size he was interested will be collected in to the system, and in subsequent mailings would receive a personalized messages with a link to the products of the selected size.
- Email communication contained the size of the customer's shoes in the subject of the message: Check before they disappear! Shoes in size 39.
- The email contained a link to a listing with the sizes adjusted to size of every individual customer.
Other customers who have not made any transaction so far, received a general email with the promotion and all available sizes, and they could specify which they are interested in.
In this way, **2 groups of customers** received an email with the same promotion, but with a completely different message.
Email with a promotion based on a customer's size
**Results**
- **21,64%** open rate for the emails with the personalized size in the title.
- **12,94%** open rate for the emails without the personalized size.
The customer had 10% more transactions from emails in which he indicated a specific customer size.
## Prerequisites
---
To be able to implement this use case, you must:
- Add [tracking code](/docs/settings/tool/tracking_codes) to your website.
- Implement [transaction events](/developers/web/transactions-sdk) where you send size of bought products.
- [Create an email account](/docs/campaign/e-mail/creating-email-campaigns).
- [Integrate forms](/developers/web/tracking-form-data).
## Process
---
To prepare an email with a promotion for the products in the customers' size, perform the following steps:
1. [Prepare an aggregate](/use-cases/email_with_a_promotion_for_products_in_the_customers_size#prepare-an-aggregate).
2. [Configure email communication](/use-cases/email_with_a_promotion_for_products_in_the_customers_size#configure-email-communication).
## Prepare an aggregate
---
Prepare the aggregate with the size of the last bought product.
1. To do it, create new [aggregate](https://app.synerise.com/spa/modules/analytics/aggregates/new).
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**.
3. Select **product.buy** event, and specify the **size parameter.**
The name of the size parameter can be different for every Synerise user - check the name of the size parameter you use in the transaction events.
Aggregate conditions
In Synerise every **transaction.charge** event generates additionally **product.buy** event, which store information about particular product which was bought – that's why in this use case we can use size parameter from such event.
## Configure email communication
---
For this scenario, you have to configure an email message which will use the aggregate you prepared in the previous step. To configure the email communication you have to define the audience, create the content and set up the final settings.
### Define Audience of email communication
Selecting the right audience is a necessary step of preparing an email.
1. Prepare such segment in [segmentation](https://app.synerise.com/spa/modules/analytics/segmentations/new) or create new segment directly in the **email message**.
2. Choose users who will get email.
In this use case our client wanted to send email to every user, who has ever made a transaction so such segment should contain of transaction.charge event which occured in lifetime period.
Define audience
### Create content
After you selected the audience, create the content of your email message.
In this example, you can create email for 2 groups of customers. One for customers who have made the transaction, and second for customers who have not made the transaction with the promotion and available sizes. We will provide you with the first scenario and the second you can made by using [email](/docs/campaign/e-mail/creating-email-campaigns) instruction.
1. At the beginning, select the email account from which the email will be sent.
2. In the **Email subject** field the enter the aggregate. For example:
{% aggregate a1872106808667667%} Check before they disappear! Shoes in size {{aggregate_result [0] | float | round (0)}} {% endaggregate%}
As a result, customer will see: **Check before they disappear! Shoes in size [size number of the customer]**.
3. To create the content of the email, click **Create message**. In the email template include the Jinajava code that contains the link to the listing of products in the customers' size:
Check the Jinjava code
<!-- Opening the tag that retrieves the value from the aggregate prepared in point 1--> {% aggregate xxx %} <!--Creating link to website with params to filter to client's size, link below is only an example --> {% set link = "your_link_to_listing.com/listing?size="+aggregate_result[0] %} <!--Adding Synerise tracking parameters --> <a href="{% preparelink %}{{link}}{% endpreparelink%}"> <!-- Adding yours banner link --> <img src="your_image.jpg" /> </a> <!--Closing of the tag that gets the value from the aggregate prepared in point 1 --> {% endaggregate %}
Create aggregate
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.
### 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
Test message can only be sent when the email has a title.
## 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
---
- [Aggregates](/docs/crm/aggregates)
- [Email communication](/docs/campaign/e-mail/creating-email-campaigns)
- [Jinjava](/developers/inserts/exptest)
- [Segmentation](/docs/analytics/segmentations/introduction-to-segmentations)
# 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).
# 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#tag/Events/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)
# Test with different types of recommendations
---
In Synerise we have many different types of recommendations. You can choose the one that best suits you and your business.
We recommended adding them in different stages of the customer journey. From which type you should start?
You can discover this only through testing. Testing different types of recommendations determine which one will convert best is the optimal solution.
## Example of use - Retail Industry
**Challenge**
We created a strategy for the website of a client from the retail industry consisting of different types of recommendations:
- Personalized recommendations on the home page
- Personalized recommendation on the listing based on gender
- Cross-selling recommendations on the product page
- Cart recommendations in the basket
- Recommendations on the zero-search results page
All of the recommendations were added to the campaign dashboard to monitor results.
The results were generally good, but we decided to compare them with the results from another brand belonging to the customer. We also decided to switch from cross-selling and cart recommendations to fully personalized recommendations because we did not have any historical transactions from the client and we wanted to compare which gave better results in a situation when you do not have any data but you want to still personalize the content.
We implemented the same recommendations as in the first brand (except the recommendations on the product page).
**Solution**
We decided to make three changes:
**1st** We put personalized recommendations everywhere on the site

**2nd** We put sets of products on the cart recommendations - when someone added a men’s shirt to a cart, we recommend only ties

**3rd** We put sets of products on the cart recommendations - when someone added a men’s trousers to a cart, we recommend only shirts

**Results**
- **2%** CTR for sets recommendations (ties to shirts)
- **3%** CTR (shirts to trousers)
- **6%** CTR - personalized basket recommendations
These results show that AI can make better decisions than even someone with lots of industry experience.
After comparing these two campaigns, we learned that:
- **14%** of users bought products based on recommendations on brand A
- **21%** of users bought products based on recommendations on brand B
Personalized recommendations for brand B worked better than mixed types of recommendations on the different steps of the journey.
We also compared two different types of recommendations in the basket:
- **~1%** Conversion rate - in case of sets of products (ties to shirt, shirt to pants)
- **4%** Conversion rate - in case of personalized recommendations
## Requirements
**General:**
- Product feed
- OG:tags
- Transactions
- Page visits (Synerise tracker)
**Additional:**
- Historical transactions
- Historical page visits
- Other activities and user behavior
## How to do it
---
1. At first you must choose what type of recommendation would you like to use on your website.
2. Set up the campaign:
- Declare the quantity of returning products in your recommendation
- Configure the recommendations filter. You can use brand filter, category, price, discounts, gender and a few other additional settings.
- Adjust the additional settings. This part will help you with choosing the optimal set of products and put them in the most favorable order.
3. Copy the campaign ID from its URL.
4. Decide where you want to display your campaign. In this case it was a dynamic content campaign.
5. In the dynamic content creator, adjust the settings:
- Choose one of two types of campaigns. In this case, it should be an inserted object, because we want to place a slider on our website.
- Define the audience – people who should see your campaign.
- Create the content - remember to copy the unique ID code from your recommendations model and put it directly in the code of dynamic content campaign as campaign ID.
- Configure the additional display settings and schedule your campaign time.
## 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
---
- Learn how to build [AI recommendations](/docs/ai-hub/recommendations-v2)
- Learn more about [dynamic content campaigns](/docs/campaign/dynamiccontent)
# 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)
# Discount coupon for installing the application
---
Mobile app can be used to **increase customer loyalty** because it allows businesses to communicate directly with their customers using ads, promotions, and notifications.
As a primary channel of communication with customers, it is very important to increase the number of application users. It is a good idea to encourage users to install the app using special benefits as an incentive. This not only helps to convince users to download and install the app, but also creates more positive engagement right from the start.
## Example of use - Retail industry
**Challenge**
A customer from the fashion industry has decided to increase the number of users of their mobile application.
To achieve this, they prepared a special promotion — a 5% discount for online shopping and in physical stores for new users of the application. After downloading it, the customer received a unique discount code available in one of the application screens, valid for 30 days. To use it efficiently and to not extend the queues at the checkout, the discount took the form of a bar code that could be easily scanned. The campaign was promoted with leaflets in physical stores and online using banners.

## Prerequisites
---
- Integration of Synerise [mobile SDK](/developers/).
- Integration of promotions.
- Import of [code pools](/docs/assets/code-pools).
## Process
---
1. [Create an aggregate](/use-cases/discount-for-app#create-an-aggregate).
2. [Create a segment](/use-cases/discount-for-app#create-a-segment).
3. [Prepare a workflow](/use-cases/discount-for-app#prepare-a-workflow).
4. [Build a segment](/use-cases/discount-for-app#build-a-segment).
## Create an aggregate
---
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. Select the `client.applicationStarted` event.
5. Define the period from which the aggregate will return products from the event.
6. Save the aggregate.

## Create a segment
---
Prepare a customer segment for which the aggregate value is 1.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Give the segmentation a meaningful name.
3. Click **Choose filter** and select an aggregate created in previous step.
4. As a operator choose **equal**.
5. As the value of aggregate add `#1`.
4. Click **Save**.

## Prepare a workflow
---
Prepare a segment of people who will be able to view the promotion in the application, ie. people who installed the application only after the promotion has started. To do this, prepare an automation that will give new users of the application a unique event (it is important because the rebate code will be available to the customers only for 30 days).
1. Go to **Automation Hub > Workflows > New workflow**.
2. Choose **Audience** as a trigger.
3. In the **Audience** node, choose segment prepared in previous step.
4. As the action node choose **Generate Event**.
5. Add json with a custom event that can be built, e.g. in this way:
In this case the action event is the key - here it will be: install.app - it will be used to prepare the proper segment.
6. Add the **End** node and save your workflow.
## Build a segment
---
Based on event created before, prepare a segment of customers who will see the promotion in the application - people who get the specific event from the automation from previous step during last 30 days.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Give the segmentation a meaningful name.
3. Click **Choose filter** and select the event from the automation from previous step.
4. Define the time range as last 30 days.
4. Click **Save**.
## What's next
---
Prepare the new promotion for this segment. Complete the promotion content and enter in the additional parameters a json containing a pool of previously imported codes:
{“poolUuid": “XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX"}. // uuid from the link of your code pool"
In order for the code to be displayed as a barcode, this option must be supported on the application side.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of use case in Synerise Demo workspace:
- [Aggregate](https://app.synerise.com/analytics/aggregates/b1e036fd-aebd-3fce-afe9-c24b273f492d)
- [Segmentation based on an aggregate that returns the number of times a customer started the mobile application ](https://app.synerise.com/analytics-v2/segmentations/6246814c-3578-4d77-8630-f4d8a0697664)
- [Workflow configuration](https://app.synerise.com/automations/workflows/automation-diagram/7bf1f995-56ca-4a12-85bf-24256a4fda1e)
- [Segmentation based on the event defined in the Generate Event node in a workflow](https://app.synerise.com/analytics-v2/segmentations/6ee14466-c3a1-4f20-9eb2-d2e3c6950148)
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:
[`client.applicationStarted`](/docs/assets/events/event-reference/web-and-app#clientapplicationstarted) (~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), `install.app` (~1), [`client.activatePromotion`](/docs/assets/events/event-reference/loyalty#clientactivatepromotion) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Import code pools](/docs/assets/code-pools)
- [Segmentation](/docs/analytics/segmentations/creating-segmentations)
- [Setting a promotions](/docs/ai-hub/promotions/creating-promotions-for-entire-basket)
# 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#tag/Events/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), [`brickwork.generated`](/docs/assets/events/event-reference/brickworks#brickworkgenerated) (~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)
# 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)
# 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#tag/Events/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#tag/Events/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)
# Extra points for purchases from the specific locations during specific time
In today's highly competitive business environment, establishing and nurturing customer loyalty holds immense significance for companies aiming to maintain their customer base and drive revenue growth. To accomplish this, deploying a well-designed loyalty program emerges as a powerful tool, incentivizing customers for their purchases and fostering continuous engagement and brand advocacy.
This specific use case delves into the implementation of a targeted loyalty program, wherein customers earn reward points for transactions conducted exclusively at a designated point of sale (POS). The program's strategic focus aligns with the grand opening of a new store, offering a limited-time promotion that is exclusively available during the opening weekend.
Following a purchase, it is possible to send customers an email informing them of their existing points balance. Although the specifics of this communication process are not addressed in this particular scenario, if you are interested in acquiring knowledge on generating analytics to calculate point balances for customers, we suggest referring to this [use case](/use-cases/loyalty-points-for-category), which offers a comprehensive, step-by-step tutorial on creating such analytics.
## Prerequisites
---
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CreateATransaction). Make sure that you implement shopID parameter that contains the ID of the point of sales where the purchase has been made.
- Implement basic [loyalty program](/use-cases/loyalty-programs-basics) based on which you granted customers with 1 point for every 1 PLN spent.
## Security configuration
Before you start working with this module, 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
---
Design a workflow that awards 150 points for completing 10 transactions within a specified timeframe and location. In our particular use case, this will apply during the weekend when the grand opening of the stationary shop will take place. For the purposes of this use case, we will use the `ShopID` of the stationary shop, which is **POS4**.
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 `transaction.charge` 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 `transaction.charge` event.
2. Click the **+ where** button and from the dropdown list, choose **shopID**.
3. From the **Choose operator** dropdown, select **Equal**.
4. In the text field, type the name of the **shopID**, as `POS4`.
5. Click the **+ where** button and from the dropdown list, choose **revenue**.
6. From the **Choose operator** dropdown, choose **More or equal to**.
7. In the text field enter `10`.
8. Click the **+ where button** and from the dropdown list, choose **TIMESTAMP**.
9. From the **Choose operator** dropdown, choose **Custom (Date)**.
10. Click **Select date range**.
11. Set the time range in which your promotion is active. In this use case, it will be one week.
2. Confirm by clicking **Apply**.
Profile Event trigger node
### Configure the Generate Event node
In this part of the process, you will create a node that generates a `points.loyalty` event which adds extra loyalty points. This event is created in addition to the regular `points.loyalty` event. In result, the customer receives points for a purchase in the specific point of sales twice:
- Points based on the loyalty points schema described as a part of prerequisites.
- Extra points through this workflow. The body of the additional event will contain 150 bonus points for purchases in location - POS4.
1. As the second node of the workflow, add **Generate Event**.
2. In the **Event name** field, enter `points.loyalty`.
4. In the **Body** section, define the parameters of this event, and click **Apply**.
**Example content of **Body** section:**
The event body is an example. You can add more parameters or change the point calculation, perform any mathematical formula according to your business needs.
Generate Event node configuration
### Add the end node
---
1. On the **Generate Event** node, click the plus icon.
2. From the dropdown list, select **End**.
3. Optionally, define **capping**.
4. Optionally, add titles to each node so the workflow will be more understandable to your colleagues.
5. 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/db6e214d-59ee-49e1-ac73-62341017f825) 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:
[`transaction.charge`](/docs/assets/events/event-reference/items#transactioncharge) (~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)
- [Expressions](/docs/crm/expressions)
- [Loyalty programs basics](/use-cases/loyalty-programs-basics)
# Using Segmentations in Expressions to Personalize Content
In an expression, you can include segmentations that consist of several subgroups and conditions to receive the subsegmentation a customer belongs to. You can later use this expression in the dynamic content to display the specific content depending on the expression result.
## 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 aggregate](/use-cases/check-if-client-in-segmentation#create-an-aggregate) that calculates the number of all transactions each customer has made.
2. [Create a segmentation](/use-cases/check-if-client-in-segmentation#create-a-segmentation) that will divide the customers into three groups.
3. [Create an expression](/use-cases/check-if-client-in-segmentation#create-an-expression) that includes in its formula only the segmentation you created in the previous part of the process.
## Create an aggregate
---
As the first part of the process, create an aggregate that calculates the number of all transactions each customer has made.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.
2. Enter the title of the aggregate.
3. Click **Analyze profiles by** and select **Count**.
4. From the **Add condition** dropdown list, select **transaction.charge**.
5. In the date range, select **Lifetime**.
6. Save the aggregate.
Configuration of the aggregate
## Create a segmentation
---
In this part of the process, create a segmentation that will divide the customers into three groups:
1. Customers who have made more than 5 transactions.
2. Customers who have made between 3 and 5 transactions.
3. Customers who have made less than 3 transactions.
The subsegments (groups) are built on the basis of the aggregate you created in the [first part](/use-cases/check-if-client-in-segmentation#create-an-aggregate) of the procedure.
### Create the first subsegmentation
Create a subsegmentation that includes only customers who have made more than 5 transactions.
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 subsegmentation.
3. From the **Choose filter** dropdown list, select the aggregate you created.
4. As the logical operator, select **More than**.
5. Next to the logical operator, in the text field enter `5`.
Configuration of the aggregate
### Create the second subsegmentation
Create a subsegmentation that includes only customers who have made between 3 and 5 transactions.
6. Under the main title of the segmentation, click the icon.
7. Enter the name of the subsegmentation.
8. From the **Choose filter** dropdown list, select the aggregate you created.
9. As the logical operator, select **Less or equal to**.
10. Next to the logical operator, in the text field, enter `5`.
11. Click **Choose filter**.
12. From the dropdown list, select the aggregate you created.
13. As the logical operator, select **More or equal to**.
14. Next to the logical operator, in the text field, enter `3`.
15. Join the two conditions by selecting **AND**.
Configuration of the aggregate
### Create the third subsegmentation
Create a subsegmentation that includes only customers who have made less than 3 transactions.
6. Under the main title of the segmentation, click the icon.
7. Enter the name of the subsegmentation.
8. From the **Choose filter** dropdown list, select the aggregate you created.
9. As the logical operator, select **Less than**.
10. Next to the logical operator, in the text field enter `3`.
Configuration of the aggregate
12. Save the segmentation.
## Create an expression
---
In this part of the process, create an expression that includes in its formula only the [segmentation](/use-cases/check-if-client-in-segmentation#create-a-segmentation) you created in the previous part of the process.
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. Optionally, switch the **Show in profile card** toggle on.
4. Click the **Select** button.
5. From the dropdown list, select **Profile**.
6. Click the button that appeared on the dashboard.
7. On the **Choose attribute** dropdown list, use the search box to find the segmentation you created.
8. Save the expression.
Configuration of the expression
## What's next
---
You can preview the results in several ways:
- **Expression preview**
The first way to check the results of the expression is the preview of the expression. In the search box, type the ID of the customer (for example, an email address), and you will get the results of the expression for the individual customer.
Expression preview
- **Customer's profile**
If you enabled **Show in profile card** option for the segmentation and expression, you can see them listed on a customer's profile.
Preview of customer's profile
1. If the customer belongs to the segmentation, its name is listed on the segmentation list.
2. The expression shows the subsegmentation to which the customer belongs.
- **Analytical dashboard**
You can create an analytical dashboard and add the expression to the dashboard. In the **Dynamic key** field, enter the ID of the customer for which you want to see the result.
Expression used in the dashboard
## Check the use case set up on the Synerise Demo workspace
---
In the Synerise Demo workspace, you can check the configuration of:
- the [aggregate that returns the number of transactions](https://app.synerise.com/analytics/aggregates/554ca4db-fdde-3682-971c-038694dcafaa),
- the [segmentation that groups customers according to the number of transactions](https://app.synerise.com/analytics/segmentations/8ef8ffa0-c7ee-42fe-bc9d-496759233ab8)
- the [expression that returns the segment to which a customer belongs](https://app.synerise.com/analytics/expressions/b42707bd-4122-4bdc-bcb6-684fefd6e055)
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)
- [Segmentation](/docs/analytics/segmentations)
# 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#tag/Events/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)
# 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)
# 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#tag/Events/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#tag/Events/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)
# 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).
# Collecting newsletter submissions from users without cookie tracking
Privacy regulations may require that users who decline cookie consent still have the ability to subscribe to communications such as a newsletter. In this use case, we’ll show you how to collect newsletter signups **without using tracking mechanisms**, and still create a compliant user profile in Synerise.
This setup ensures you're not violating privacy preferences while still growing your subscriber base.
## Prerequisites
---
A privacy-compliant form on your website that works independently of the SDK.
## Process
---
In this use case, you’ll go through the following steps:
1. [Create an incoming integration](/use-cases/do-not-track#create-an-incoming-integration) (webhook) to receive form data.
2. [Create a workflow](/use-cases/do-not-track#create-a-workflow) that listens to incoming events.
## Create an incoming integration
---
In this part of the process, you will create an incoming integration to securely receive form submissions from the newsletter form, from users who have opted out of cookies or tracking.
1. Go to **Automation Hub > Incoming > New integration**.
2. On the pop-up, select **without authentication**, **JWT authentication** or **Webhook from Meta** based on your business needs.
3. 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 will be sent.
1. Optionally, you can add an icon to this integration.
3. Confirm by clicking **Apply**.
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. Example request:
You can retrieve the data and parameters you need for your business. An example is shown above.
6. When the endpoint receives data from the request, verify the list of variables available in the **Incoming data** section. If the variables include those which are in the payload click **Apply**. If not, click **Start again** re-send request, and wait for the results.
7. Click **Save & publish**.
The full documentation of the incoming integration feature is available in the [Incoming Integration](/docs/automation/integration/incoming-webhook-node) article.
## Create a workflow
---
In this part of the process, you will build a workflow that triggers automatically each time new user data is received through the webhook. Make sure the email field is present and valid (in our case, it contains an `@` symbol). The workflow sends the email address through the Outgoing Integration node to the endpoint that creates or updates a user profile in Synerise.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Define the Business Event node
3. As the trigger, select **Business Event**. In the configuration of the node:
1. Select the [incoming integration for customer's data](#create-an-incoming-integration) you created as the first part of the process.
2. Add the condition which checks the email address is provided and correct:
1. From the **Add condition** dropdown list, select the **body.email**.
2. As the logical operator, select **Contains**.
3. In the text field, enter `@`
4. Confirm by clicking **Apply**.
Business Event node configuration
### Define the Outgoing Integration node
In this step, you’ll make an API call to create or update a Synerise profile using just the provided email address—no tracking needed. Call the endpoint that handles creating or updating user profiles in Synerise.
5. From the dropdown list, select the **Outgoing Integration** node.
6. Click the node. In the configuration of the node:
1. Select the **Custom webhook**.
2. Enter the name of the webhook.
3. Choose webhook connection type - select **By API key**.
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-reference/data-management#tag/Profile-management/operation/CreateAClientInCrm).
1. In the **Webhook name** field, enter the value that will be displayed in the `name` parameter of the event which will contain the request response.
2. Optionally, in the **Event name** field, choose an action name for the event that contains the request response from the endpoint.
If you leave the field blank, the action defaults to `webhook.response`.
3. Select the **POST** method.
3. In the URL address, enter `https://api.synerise.com/v4/clients/batch`.
Read more about the [Batch add ord update clients method](https://hub.synerise.com/api-reference/data-management#tag/Profile-management/operation/BatchAddOrUpdateClients)
4. Enter the following headers:
- set the `Content-Type` header to `application/json` (default),
- set the `Api-Version` header to `4.4`
5. Enter the request body. For the scenario described in this use case, the body is as follows:
This is just an example, you can create JSON according to your business needs.
6. Confirm by clicking **Apply**.
This operation is safe to repeat — if the profile exists (matched by email or ID), it will be updated; if not, a new one will be created.
### Add final setting to your workflow
---
1. Add the **End** node.
2. Launch the workflow by clicking **Save & Run**.
Final view of the workflow configuration
**Process logic:**
- For users who did not give consent to tracking – use the webhook + automation method described above.
- For users who gave tracking consent – submit form data as per usual.
For implementation details of form tracking, see the [documentation](/developers/web/tracking-form-data).
Learn more about the process from the [Do Not Track documentation](/developers/web/do-not-track).
## 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), [`client.add`](/docs/assets/events/event-reference/profiles#clientadd) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Business Event node](/docs/automation/triggers/businees-event-trigger)
- [Do Not Track documentation](/developers/web/do-not-track)
- [Incoming integration](/docs/automation/integration/incoming-webhook-node)
- [Outgoing Integration](/docs/automation/actions/webhook-node)
- [Outgoing integration node](/docs/automation/actions/webhook-node)
# 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#tag/Events/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)
# Promote 'Product of the Day' to Boost Sales with Dynamic Content
---
To boost your sales in your e-commerce, you can use many different useful tactics. One of them is to **promote special, selected products** visited by customers as products of the day.
It’s obvious that the important part here is to show users the necessity of fast decision (not a lot of products left, the promotion lasts only during a particular day etc.). You can use this kind of campaign to promote selected products and not only boost sales but especially the sales of specific products.
## Example of use - Retail industry
**Challenge**
Campaigns displayed to all users on the customer homepage.
This consisted of one product chosen by the customer, which is designated as the best offer of the day + additionally displaying a frame of recommendations with personalized products. The frame with the special offer is additionally supplemented with information on the number of remaining products, progress bar and counter. These elements are intended to convince the customer to buy the product now.

## Requirements
---
- Tracker Key
- Integration with AI campaigns - personalized AI campaigns
- Properly configured dynamic content campaigns
- Collecting transaction events
## How to do it
---
1. Create AI campaign with personalized recommendations.
2. Prepare the necessary metric **with the number of products purchased**

- Add the SKU of the product that should be displayed as the product of the day
- Select the campaign start and end dates to measure sales levels accordingly
3. Create the metric that **calculates the percentage of products sold** (percentages rounded to full tens to make it easier to set the progress bar display).

- Here, you have to describe how many pieces of the product are available for purchase
- Multiply the right values to get the full dozens
4. Prepare a dynamic content campaign that combines the product of the day and the recommendations.
- All dynamic elements such as counters, number of pieces and progress bar are prepared using Synerise and calculated on the basis of metrics, collecting transaction events relevant metrics.
5. Remember that the link of the product of the day will have the right marker thanks to which you will be able to create analytics.
## Check the use case set up on the Synerise Demo workspace
---
In the Synerise Demo workspace, you can check:
- [Metric one](https://app.synerise.com/analytics/metrics/be1c44ed-30fa-4865-9d87-00cf85d23fbc),
- [Metric two](https://app.synerise.com/analytics/metrics/d32ffe36-9762-4e5f-ac73-3ccdf44f3f56),
- [Dynamic content](https://app.synerise.com/campaigns/dynamic-content/create/c4efc9b8-5abd-451b-bfad-9da1da7f060e).
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
---
- Read more about [creating metrics](/docs/analytics/metrics)
- Read more about [creating dynamic content campaigns](/docs/campaign/dynamiccontent)
# Switch Brands in Product Recommendations with Custom Filters
In order to diversify or monetize positions in the recommendation frame, you can use the recommendation slots. By combining using slots and recommendation filters, you can create branding campaigns. Such campaigns can be later displayed on the product page.
In this example, we will set a campaign that will return items similar to the one that is the context.
However, when the context item's brand is “BrandA”, the first two items in the recommendation frame will be from the “BrandB” brand. This can be done to better position items from a brand that you have a partnership with, as the first two positions in a recommendation frame have the highest click-through rate. To make this possible, we will utilize slots.
The first slot will contain two items and no filter will be applied, unless the context item’s brand is “BrandA”, then they will be filtered to items that are from the “BrandB” brand.
The second slot, consisting of four items, won't have filters and will display similar items to the context one.
Brand switching campaign
## Prerequisites
---
The [similar recommendation model](/docs/ai-hub/recommendations-v2) must be enabled and ready.
## Create recommendations
---
1. Go to **AI Hub > (AI Recommendations) Models > Add recommendation**.
2. Enter the campaign name.
3. In the **Type & Items feed** section:
1. Click **Define**.
2. From the dropdown list, select the catalog that contains items for the recommendation.
3. As the type, select **Similar items**.
4. Click **Apply**.
4. In the **Items** section, click **Add slot**. You can name the slot for later reference.
5. Set the minimum and maximum number of items to `2`.
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** and choose **IQL Query**.
7. Create a filter that applies the following logic:
- If the context brand is "BrandA", filter the results to the "BrandB" brand.
- If the context brand is NOT "BrandA", no filter should be applied.
It should resemble the following filter: `IF(context.brand == "BrandA", brand == "BrandB", ALL)`
8. Add another **slot**.
9. Set minimum and maximum number of items to `4`.
10. Enable the **Keep slots in order** toggle.
11. Click **Apply**.
12. In **Boosting**, you can enable [boosting](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign#define-the-boosting-factors).
13. In **Additional settings**, you can exclude already bought products and set a metric to sort by.
14. Save the campaign by clicking **Save**.
## 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
---
- [Filters](/docs/ai-hub/recommendations-v2/recommendation-filters)
- [Recommendation campaigns](/docs/ai-hub/recommendations-v2)
# Calculate value of all sold items
You can calculate the value of sold items including items sold by weight and volume. It helps you analyze the sold products statistics in more effective way.
## Prerequisites
---
- Implement [tracking code](/developers/web/installation-and-configuration#creating-a-tracking-code) on your website.
- Implement [transactions](/docs/automation/actions/synerise-integrations/import-transactions).
## Process
---
In this use case, you will go through the following steps:
1. [Create an expression](/use-cases/calculate-items-sold-by-weight/?helpCenterAi=calc#create-an-expression) that will be available as a variable when including the `product.buy` event in analytics.
2. [Create a metric](/use-cases/calculate-items-sold-by-weight/?helpCenterAi=calc#create-a-metric) that calculates all sold items.
## Create an expression
---
In this part of the process, create an expression that will be available as a variable when including the `product.buy` event in analytics. The formula of the expression multiplies the quantity of the item by the price of a single item.
1. Go to **Behavioral Data Hub > Expressions > New expression**.
2. Enter the name of the expression.
The name of the expression is also used as the name of the event's parameter.
2. As a type of expression, select **Event**.
2. From the **Choose event** dropdown, select the `product.buy` event.
4. In the **Formula definition** section of the page, click **Select**.
**Result**: A dropdown list appears.
6. From the dropdown list, select **Event attribute**.
5. Open the settings of the event attribute by clicking the **unnamed** expression element that appeared.
6. From the **Choose parameter** dropdown, select `$finalUnitPrice`.
7. Next to the added event attribute, click the plus button.
**Result**: A dropdown list appears.
8. From the dropdown list, select **Event attribute**.
9. Open the settings of the event attribute by clicking the **unnamed** expression element that appeared.
10. From the **Choose parameter** dropdown, select `$quantity`.
11. Click the mathematical operator between the attributes and change it to multiplication.
12. Click **Save**.
The final form of an expression
## Create a metric
---
In this part of the process, create a metric that calculates all sold items. The metric reuses the expression you created in the previous part of the process.
1. Go to **Decision Hub > Metrics > New metric**.
2. Enter the name of the metric.
3. As a metric kind, select **Simple metric**.
3. 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. Click the **Choose parameter** button.
**Result**: A pop-up appears.
8. On the pop-up, click the three-dot button.
**Result**: A dropdown shows.
9. From the dropdown, select **Expressions**.
10. In the list of expressions, find the event expression you have created earlier.
11. To select a specific time range, click the calendar icon. In our case it will be **Lifetime**. Confirm your choice with the **Apply** button.
12. Click **Save**.
The final form of a metric
## What's next
---
You can reuse the expression and metric while preparing the analyses to calculate items purchased in a given campaign. You can find more instructions [here](/docs/analytics/analytics-scenarios/items-bought-after-clicking).
## Check the use case set up on the Synerise Demo workspace
---
Check the [expression](https://app.synerise.com/analytics/expressions/1302fb26-5895-40c0-8bbf-547e798329c5) and [metric](https://app.synerise.com/analytics/metrics/db5f94fa-4a80-48e0-9bab-79130d1281a8) 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 does not generate any events.
## Read more
---
- [Expressions](/docs/crm/expressions)
- [Metrics](/docs/analytics/metrics)
# 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 Hub > Transformations**. 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 transformation](/use-cases/import-xml-file#create-a-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 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 following 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 > Transformations > New transformation**.
2. Enter the name of the transformation.
3. Click **Upload a new file or drag one here**.
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 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 step 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. Upload the `.XML` file created as the part of prerequisites.
2. You can preview the file, then click **Apply**.
### Add the new column
1. On the right panel, click **Add step**.
2. From the dropdown list, select **Add Column**.
3. Click the **Add Column** step.
4. In the configuration of the step:
1. In the **Add Column** field, enter the name of the column. In this use case, it's `discounted`.
2. From the dropdown list, select **Dynamic value**.
3. 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 %}
4. Leave last select at default (**Skip row if error occurred**) to skip missing or invalid data which may occur during transformation.
5. Confirm by clicking **Apply**.
### Add the new column
1. On the right panel, click **Add step**.
2. From the dropdown list, select **Add Column**.
3. Click the **Add Column** step.
4. In the configuration of the step:
1. In the **Add Column** field, enter the name of the column. In this use case, it's `percentage_discount`.
2. From the dropdown list, select **Dynamic value**.
3. 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 %}
4. Leave last select at default (**Skip row if error occurred**) to skip missing or invalid data which may occur during transformation.
5. Confirm by clicking **Apply**.
### Edit Values
1. On the right panel, click **Add step**.
2. From the dropdown list, select **Edit Values**.
3. Click the **Edit Values** step.
4. In the configuration of the step:
1. Select the **g:availability** column.
2. Under **Edit values by**, select **Replacing**.
3. From the dropdown below, select **Dynamic value**.
4. In the **Type value** field, enter the Jinja code which replaces the value of the `g:availability` attribute from `1` and `0` to `in stock`/`out of stock`:
{% if root['g:availability'] == 1 %}in stock{% else %}out of stock{% endif %}
5. Leave last select at default (**Skip row if error occurred**) to skip missing or invalid data which may occur during transformation.
6. Confirm by clicking **Apply**.
### Preview and save the transformation
1. Preview the results in the **Output** tab.
The preview of modifications to the file
2. In the upper right corner, click **Save**.
**Result**:
The transformation configuration
## 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
1. As the trigger node, add **Scheduled Run**.
2. In the configuration of the node:
1. Select the **Run once** option.
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
### Select the transformation
1. Add a **Data Transformation Studio** node.
2. In the configuration of the node, keep the default **From workflow context** option.
3. In the editor, click **Templates library**:
1. Select the [transformation you have created before](/use-cases/import-xml-file#create-a-transformation).
2. Click **Use template**.
4. Confirm by clicking **Apply**.
Data Transformation Studio node
You can also create a transformation directly in the **Data Transformation Studio** node instead of selecting a template.
### Add import to catalog
1. On the **Data Transformation Studio** 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.
6. Click **Apply**.
### 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 [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 Studio node](/docs/automation/operation/data-transformation-node)
```
# Email with last visited brand
A good way to personalize communication is to offer customers products from a brand they recently viewed. This is an especially good solution for companies offering multiple brands.
You can build this kind personalization in a very easy way and make it possible to send an email campaign with personalized offers from specific brands to people who have viewed this brand recently.
## Example of use - Retail Industry
**Challenge**
One of our clients wanted to send to their customers personalized emails based on the last brand that the client viewed.
This company is an example of a multi-brand company in which you can select products based on brands. In the URL information of every product, they always have information about its brand.
**Solution**
Based on that we created an automation which lets us monitor the last-viewed product and the category it belongs to. Thanks to this, we were able to send personalized emails with brand-related AI recommendations. Every customer got a different email recommendation based on their previous behavior.

## Prerequisites
---
**General**
- [Tracking code](/developers/web/installation-and-configuration#creating-a-tracking-code) on your website.
- [Email account](/docs/campaign/e-mail/configuring-email-account) configured.
- [Product feed](/use-cases/import-product-feed-to-catalog) implemented.
## First concept - manual preparation without jinjava**
---
### Create an aggregate
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. Optionally, to let other users know about the objective of the analysis, write a short description.
4. Click **Analyze profiles by** and select **Last**.
5. Choose event `page.visit`, as a operator choose **URL** and add a regular expression which indicates that the URL has to contain one of the following brands.
6. Save your aggregate.
### Prepare an AI 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 and click **Define**.
4. From the **Items feed** dropdown list, select a product feed that has a trained model.
5. Select the recommendation type (you can choose the type of campaign on your own, based on your business needs).
6. Click **Save**.
7. Prepare the AI recommendations separately for every brand.
### Create email campaign
1. Go to **Experience Hub > Email campaign > Create new**.
2. Create email campaigns for every brand separately, adding the AI recommendation campaign prepared for each brand.
3. Save your campaigns.
### Prepare the automation
1. In Synerise, go to **Automation Hub > Workflows > New workflow**.
2. As the trigger node, select **Profile Event**. In the node configuration choose the event `page.visit` which tells us if the client visits a specific website with a specific url, use regular expression – this indicates that the customer visited the products from one of the following brands.
3. Add optional **Delay**.
4. Add **Profile Filter** which checks every agreement which customers have (cookie agreements, email agreements and so on).
5. **Split Path** to profile filters, which checks what the last aggregate of the customer was. Every filter indicates a different brand and sends a different campaign. For example, if the last brand a customer visited was ABC, he will get an email with products from this specific brand. We separated every segment in this place in the automation, which lets us check to which brand the customer is matched and send him personalized mailings.
6. Add node with **Email** as a result of workflow. In the node configuration choose your personalized email campaigns.
7. Add **End** node.

## Second concept - preparation with jinjava
---
We helped our client to prepare this process in a smarter way. We changed the part with all profile filters to single profile filters and only one event.
1. Create the aggregate the same as in the first concept.
2. Create the AI campaigns for each brand separately.
3. Create ONE email template with the special jinjava code. Based on the jinjava code we can create a smarter process for the whole campaign. We took the aggregate described above and checked the code to see the last brand the customer visited (what phrase customer had in the url). So if, for example, our customer viewed brand ABC, we added the code the title: ABC, an image and a link to the product. And the same applied to all other brands. So we prepared all such information in one place, in one code. So if in the aggregate we had the ABC brand – in the email template the ABC brand was added to a specific product along with a link to it. Also, we add a lot of IF’s in our jinjava code. This indicates that IF ABC brand was the last one the customer visited, then the ID of the AI campaign for the ABC brand will be used in that case. **Using this method, we can change the content of the mailing dynamically** depending on what we have in the aggregate. Information about the specific brand will go to the output in the form of dynamic code, which we have to paste in the email campaign in a specific place. Thanks to this it will change dynamically based on the results from the aggregate for a specific customer. Remember to add the AI campaign to the content of your email campaign based on the campaigns created earlier.
4. Create an automation with additional jinjava code.
1. In Synerise, go to **Automation Hub > Workflows > New workflow**.
2. As the trigger node, select **Profile Event**. In the node configuration choose the event `page.visit` which tells us if the client visits a specific website with a specific url, use regular expression – this indicates that the customer visited the products from one of the following brands.
3. Add optional **Delay**.
4. Add **Profile Filter** which checks every agreement which customers have (cookie agreements, email agreements and so on).
5. **Split Path** to profile filters, which checks what the last aggregate of the customer was. Every filter indicates a different brand and sends a different campaign. For example, if the last brand a customer visited was ABC, he will get an email with products from this specific brand. We separated every segment in this place in the automation, which lets us check to which brand the customer is matched and send him personalized mailings.
6. Add node **Send Email** as a result of workflow. Add the jinjava code to the email template instead of adding it in the form of many brand filters, which makes the whole automation very large and more complicated.
7. Add **End** node.

If you do not want to use jinjava you can use the first version of the automation. It is not forbidden but take into consideration that in this case you have to remember to add the appropriate email template and email name in the automation without any mistakes.
It is easier to create a second version with jinjava to avoid mistakes and make it faster and easier to build and to manage.
## Generated events
This use case generates approximately 13 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) (~4), [`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/introduction-to-aggregates)
- [AI campaigns](/docs/ai-hub/recommendations-v2)
- [Automation Hub](/docs/automation)
# 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)
# Find customers for a new offline shop branch
When you open a new branch of your offline store, you may want to implement a campaign that will encourage your customers to visit a new location. To find out who would be the best target of the campaign, you can use the Predictions feature.
The business goal of this use case is to find a group of customers who will be the audience of a campaign released on the occasion of opening a new store in Waverly, the fourth shop branch in Lackawanna County.
The main action in this use case is comparison of a group of customers whose location is declared to be Waverly (target group) to the group of customers who made purchases in the offline branches of your shop - source group. After the prediction is complete, the customers from the target group will be recognized by the `snr.lookalike.score` event on their profiles and the `score_label` parameter of this event indicates the level of similarity to the source group.
Based on this event, you can create a group of customers with the highest score who will be the recipients of the campaign that is released for the shop branch opening. This way, you increase the chances of reaching those for whom the location of the shop branch is more convenient and encourage them to visit the shop.
## Prerequisites
---
- [Enable the Lookalikes 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#tag/Events/operation/CreateATransaction).
## Process
---
In this use case, you will go through the following steps:
1. [Create source segmentation](/use-cases/discover-customers-for-new-shop-branch#create-source-segmentation).
2. [Create target segmentation](/use-cases/discover-customers-for-new-shop-branch#create-target-segmentation).
3. [Create a prediction](/use-cases/discover-customers-for-new-shop-branch#create-a-prediction).
## Create 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. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter a meaningful name of the segmentation.
3. Click **Choose filter**.
4. From the drop down 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).
5. As the parameter, select `source` and set its value to `POS`.
6. Using the date picker in the lower-right corner, select the date **last 60 days**.
7. Save the segmentation.
Configuration of the source segmentation
## Create 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. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter a meaningful name of the segmentation.
3. Click **Choose filter**.
4. From the dropdown list, select the **city** attribute.
5. Set the attribute value to **Waverly**.
6. Save the segmentation.
Configuration of the target segmentation
## Create a prediction
---
In this part of the process, you create a prediction that uses the segmentations you created before.
1. Go to **AI Hub > (AI Predictions) Models > New prediction**.
2. In the **Select prediction type** window that appears, click **Lookalike**.
3. Click **Apply**.
4. In the **Audience** section, click **Define**.
5. In the **Source segmentation** subsection, click **Choose segmentation**.
6. From the dropdown list, select the [source segmentation](/use-cases/discover-customers-for-new-shop-branch#create-source-segmentation) you created before.
7. In the **Target segmentation** subsection, click **Choose segmentation**.
8. From the dropdown list, select the [target segmentation](/use-cases/discover-customers-for-new-shop-branch#create-target-segmentation) you created before.
9. Confirm by clicking **Apply**.
10. In the **Settings** section, click **Change**.
11. Enable the **Set up recurring prediction calculation** option.
12. Set the recalculation of the prediction every 7 days. The segmentation is recalculated before a prediction is recalculated - recalculation of the segmentation concerns recurring predictions which intervals are longer than several hours.
13. Select the **2-point scale**.
Configuration of the prediction
14. Confirm by clicking **Apply**.
15. Click **Save & Calculate**.
## What's next
---
Based on the `snr.lookalike.score` event, you can create a segmentation for the Waverly opening 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 using [Automation Hub](/docs/automation).
## 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 workspace at the following links:
- [Segmentation of buyers in offline shops](https://app.synerise.com/analytics/segmentations/1700ded9-ea8f-48b0-928b-1666c4c6f2e9),
- [Segmentation of customers from Warsaw](https://app.synerise.com/analytics/segmentations/4f1d7cc0-c0ef-46fa-aa67-9d45363d6285),
- [Lookalike prediction](https://app.synerise.com/ai-v2/predictions/lookalike/xbpsvrwlcpcw).
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)
# 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 transformation 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 a transformation](/use-cases/export-report-sftp#create-a-transformation).
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 a 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 transformation.
## Create a transformation
---
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 transformation 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 Hub > Transformations > New transformation**.
2. Enter the name of the transformation.
3. Click **Upload a new file or drag one here**.
### Add file with sample data
This step 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.
1. Upload the file prepared in [this step](/use-cases/export-report-sftp#prepare-a-file-with-sample-data).
2. Set **Delimiter** to `;` and provide **Quotation mark** and **Escape character**.
The configuration of the file upload
3. Click **Apply**.
### Change the name of the column
1. On the right panel, click **Add step**.
2. From the dropdown list, select **Rename Columns**.
3. Click the **Rename Columns** step.
4. In the configuration of the step:
1. Select the **Value** column.
2. Under **Rename by**, from the dropdown list, select **Replacing**.
3. In the text field, enter `number of clicks`.
The configuration of the Rename Columns step
4. Confirm by clicking **Apply**.
### Preview and save the transformation
1. Preview the results in the **Output** tab.
2. In the upper right corner, click **Save**.
**Result**: You have saved a transformation and it can now be used in a workflow.
The transformation result
## 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
1. As the trigger node, add **Scheduled Run**.
2. In the configuration of the node:
1. Select the **Repeat runs** option.
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. Choose HTTPS connection type:
1. Select **Synerise API key**.
2. Below, in the **select connection** field, choose the API key with the required permissions (according to the [documentation](https://hub.synerise.com/api-reference/analytics-suite#operation/previewAllGroupingsCSVPOST_v4)).
The configuration of the HTTPS connection type
3. Click **Next**.
2. From the **Method** dropdown menu, select **POST**.
3. Enter the **URL**: `https://api.synerise.com/analytics/analytics/v4/reports/preview-csv`
4. From the **File format** dropdown menu, select **CSV**.
5. Change the default **Delimiter** to `;`.
6. 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).
7. Leave the rest of the settings as default.
The configuration of the Get File node
3. Confirm by clicking **Apply**.
### Select the transformation
1. Add a **Data Transformation Studio** node.
2. In the configuration of the node, keep the default **From workflow context** option.
3. In the editor, click **Templates library**:
1. Select the [transformation you have created before](/use-cases/export-report-sftp#create-a-transformation).
2. Click **Use template**.
The configuration of the Data Transformation Studio node
4. Confirm by clicking **Apply**.
You can also create a transformation directly in the **Data Transformation Studio** node instead of selecting a template.
### 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 the transformation, 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. Select the SFTP connection type as **Public key**, choose the connection in the **Select connection** field, and click **Next**.
2. Enter the path to your server.
3. Select the port.
4. Enter the path to the directory.
5. Enter the name of the file that the report will be saved as.
6. 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.
7. From the **File format** dropdown list, select the **CSV** format.
8. Change the default **Delimiter** to `;`.
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
## 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)
- [Transformation](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)
# Loyalty card with barcode and current point balance in a mobile app
This use case describes a scenario where you can display a loyalty card inside your mobile app, including a unique barcode that the customer can scan and the current number of collected points.
The setup is based on a predefined in-app template that you can implement easily. All you need is an in-app campaign sent to all users, triggered by an event you choose (for example, tapping the My Card button in the app). You only have to specify the attribute that contains the customer ID—this value is used to generate the barcode—and provide the ID of the expression that calculates the user’s points.
## 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#tag/Events/operation/CreateATransaction).
- Implement [basic loyalty program with points](/use-cases/loyalty-programs-basics).
- Create the [basic aggregate which counts the point balance](/use-cases/earn-burn#create-an-aggregate-counting-the-number-of-points).
## Implement a loyalty card template
---
This template displays the basic information needed to identify a loyalty member:
Example use cases:
- Showing the card at checkout
- Opening the card in the app menu
### 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 Card’ button. This ensures that the card is displayed only when the user intentionally requests it, instead of being triggered automatically.
We will use a predefined template, 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.
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** and from the list of template folders, select **Predefined templates**.
3. Select the **Loyalty card** 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 keep them or change them to fit your business needs.
1. To the **Expression ID** field, add the ID of the [expression with the point balance, created as the part of prerequisites](#prerequisites). Based on that you will see the current points balance for each user.
2. To the **Customer identifier** field, enter the name of the attribute that holds the customer’s unique code. We use this value to generate the loyalty card code. It needs to be an attribute that is unique for each customer — for example, an identifier that is aligned with your source systems and Synerise, so that both Synerise and your external systems can consistently recognize the same customer. The source of the value is up to you, as long as it stays unique per customer, because it becomes the basis for the barcode and its unique number.
The template uses the EAN_128 barcode format. If a different format is required for integration with the client’s systems, Synerise supports multiple barcode types listed in the [documentation](/developers/inserts/insert-usage#barcodes).
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. 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. In our case it should be custom event generated by your app, after e.g. tapping the `my card` button.
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 all described objects (aggregate and the in-app message) 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.
- [Loyalty coupon in-app campaign](https://app.synerise.com/communications/in-app/44f75fec-f096-4891-913d-73546ebb8df4)
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
---
- [Expressions](/docs/crm/expressions)
- [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)
# 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)
# 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#tag/Events/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)
# Push notification with price drop alert
Capturing customer attention and encouraging them to complete a purchase has become crucial for business success. Personalized push notifications about price drops are one of the most effective ways to achieve this goal. Price is often the decisive factor influencing customer purchase decisions, especially for those who are more sensitive to pricing. They might delay or even abandon a purchase if the price offer does not meet their expectations. In this context, it is crucial to inform customers about price reductions, especially those who have shown interest in a product by adding it to their favorites or cart without completing the purchase. This can be very useful in boosting sales.
The following use case provides an example of a price drop alert campaign that you can implement in your business. The scenario described involves sending mobile push notifications to customers regarding products whose price has been reduced. These products were previously added to their favorites or cart but were not purchased.
## Prerequisites
---
- Implement a [custom event](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CustomEvent) of adding products to favorites. In this use case, this event is named `product.addToFavorites`.
- [Create an item catalog](/docs/ai-hub/recommendations-v2/item-feed-requirements) that contains all product information, including current price.
- [Create a mobile push template](/docs/campaign/Mobile) to be used in the price drop campaign.
## Process
---
1. [Create a product.priceDrop event](/use-cases/mobile-push-price-drop#create-a-productpricedrop-event)
2. [Create an aggregate that returns a list of SKUs of recently purchased products](/use-cases/mobile-push-price-drop#create-an-aggregate-that-collects-sku-of-recently-purchased-products)
3. [Create an aggregate that returns a list of SKUs of items added to favorites by a customer](/use-cases/mobile-push-price-drop#create-an-aggregate-that-returns-sku-of-discounted-products-added-to-favorites)
4. [Create an aggregate that returns the latest prices of products added to favorites](/use-cases/mobile-push-price-drop#create-an-aggregate-that-collects-the-latest-prices-of-products-added-by-users-to-their-favorites)
5. [Create an aggregate that collects the last sku's of products received by users with a discounted price](/use-cases/mobile-push-price-drop#create-an-aggregate-that-collects-the-last-skus-of-products-received-by-users-with-a-discounted-price)
6. [Create a mobile push template](/use-cases/mobile-push-price-drop#create-a-mobile-push-with-template)
7. [Create a workflow](/use-cases/mobile-push-price-drop#create-a-workflow)
## Create a product.priceDrop event
---
In this part of the process, create the `product.priceDrop` event, which will later be used in aggregates and a workflow.
1. Go to **Data Modeling Hub > Events > Add event**.
3. Define the name of the event. In our case, it's `product.priceDrop`
In the API and SDK, this 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**.
5. Optionally, describe the event.
6. Enable the **Make this event available to anonymous profiles without JWT** toggle.
7. Confirm the settings by clicking **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 the name of the parameter - `sku`.
11. In the **Property name** field, enter a human-readable label 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 collects sku of recently purchased products
---
This aggregate will be used in the next part of the process to exclude products that the customer has already bought.
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 `100`.
4. Select the **Consider only distinct occurrences of the event parameter** option.
5. From the **Choose event** dropdown list, select the **product.buy** event.
6. As the event parameter, select **sku**.
7. As the analyzed period, set **Last 30 days**.
8. Save the aggregate.
Configuration of the aggregate
## Create an aggregate that returns SKU of discounted products added to favorites
---
This aggregate will be used in the further part of the process. The result of this aggregate will be filtered to prevent sending notifications about discounts on the same favorite items.
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 `100`.
5. From the **Choose event** dropdown list, select the **product.addToFavorites** event.
6. As the event parameter, select **sku**.
7. Click **+ where** button.
8. From the **Choose parameter** dropdown list, select the **sku** parameter.
9. From the **Choose operator** dropdown list, select **Not in Array**.
10. From the **Choose value** dropdown list, select the aggregate you created in the [previous step](/use-cases/mobile-push-price-drop#create-an-aggregate-that-collects-sku-of-recently-purchased-products).
11. Click **+ where** button.
12. From the **Choose parameter** dropdown list, select the **sku** parameter.
13. From the **Choose operator** dropdown list, select Boolean **Is true**.
14. As the analyzed period, set **Last 30 days**.
15. Save the aggregate.
Configuration of the aggregate
## Create an aggregate that collects the latest prices of products added by users to their favorites
---
This aggregate will return the prices of products from the [previous aggregate](/use-cases/mobile-push-price-drop#create-an-aggregate-that-returns-sku-of-discounted-products-added-to-favorites).
It is important to make sure that the conditions defined in both aggregates are the same in order to get the desired results when combining these aggregates.
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 `100`.
5. From the **Choose event** dropdown list, select the **product.addToFavorites** event.
6. As the event parameter, select **price**.
7. Click **+ where** button.
8. From the **Choose parameter** dropdown list, select the **price** parameter.
9. From the **Choose operator** dropdown list, select Boolean **Is true**.
10. Click **+ where** button.
11. From the **Choose parameter** dropdown list, select the **sku** parameter.
12. From the **Choose operator** dropdown list, select **Not in Array**.
13. From the **Choose value** dropdown list, select the aggregate you created [earlier](/use-cases/mobile-push-price-drop#create-an-aggregate-that-collects-sku-of-recently-purchased-products).
14. As the analyzed period, set **Last 30 days**.
15. Save the aggregate.
Configuration of the aggregate
## Create an aggregate that collects the last sku's of products received by users with a discounted price
---
This aggregate later in the process will be used to exclude discounted products already sent to users when the next message is executed.
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 `100`.
5. From the **Choose event** dropdown list, select the **product.priceDrop** event.
6. As the event parameter, select **sku**.
14. As the analyzed period, set **Last 30 days**.
8. Save the aggregate.
Configuration of the aggregate
## Create a mobile push with template
---
In this part of the process, create a mobile push template that will be used later in a [workflow](/use-cases/mobile-push-price-drop#create-a-workflow). It should inform a mobile app user about price drop.
1. Go to **Experience Hub > Mobile Push > 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**.
3. Create your mobile push in the code editor.
4. You can use Jinja that lets you refer to event context from the Event Filter that will be configured in [the next part of the process](#configure-the-event-filter-node). This node will be waiting for occurrence of the `product.priceDrop`. This event will contain the object with the list of products' SKU that will be retrieved to the notification template. You can learn more about the logic of inserting dynamic values in such a way in [Reusing event context from preceding nodes](/developers/inserts/automation). The following code is an example of how to do it:
The product price you were interested in is dropped. New price: ${%set eventParams = event.params%}{%set sku = eventParams.sku|split(',')|last%}{%catalogitemv2.store-1(sku)%}{%set itemObject=catalog_result%}{{itemObject.price}}{%endcatalogitemv2%}
5. In the **URL box**, add the following code, which will redirect the customer to the page of the specific product after clicking the notification:
7. Personalize other settings in the template according to your business needs.
8. Save the template.
Example of mobile push notification
## Create a workflow
---
Create a workflow that will be launched for customers that have all necessary consents to receive mobile push notifications and who added any product to favorites. If there is a price drop of products they added to favorites, they will recevie a push notification about discounts on products they liked.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Configure the trigger
---
In this part of the process, define the conditions for the audience for whom you will run this campaign. In our case, these are customers who have added products to favorites and who have necessary consents in the mobile push channel.
1. As the trigger node, select the **Audience** node. In the configuration of the node:
1. Set the **Run trigger** option to **repeatable**.
2. Set the interval at which you want to run the automation.
3. Select the time zone.
4. Select the **New audience** tab.
5. Click **Define conditions**.
6. From the choose filter dropdown list select the **product.addToFavorite** event.
7. Define the time period for the **last 30 days**.
8. From the **Choose filter** dropdown list, select the `profile.receive_push_messages`. This attribute contains the marketing consent status for push notifications.
9. From the **Choose parameter** dropdown list, select the **Equal** operator and specify the condition as **true**.
10. Click **Choose filter** and from the dropdown list, select the `snrs_has_mobile_push_devices`. It includes information on whether the customer has an active FCM token or not. For more information, please visit this [Conditions for sending and displaying mobile notifications](/docs/campaign/Mobile/mobile_campaign#conditions-for-sending-and-displaying-mobile-notifications).
11. From the **Choose parameter** dropdown list, select the **Equal** operator and set the condition to **true**.
12. Confirm by clicking **Apply**.
Configuration of the Profile filter
### Configure the Generate event node
---
1. Add the **Generate event** node. In this step, check if the product added to favorites by the user has been discounted.
In the configuration of the node:
1. Enter the **Event name**. In our case, we are using `product.addToFavorite` event.
2. In the **Body** section, use the following Jinjava and modify it to your needs:
Jinjava inserted in **Generate event** body must have all empty spaces deleted.
{
"sku": "{%set last_sku=[]%}{%set last_price=[]%}{%set last_objects_array=[]%}{%set final_sku=[]%}{%set list=[]%}{%aggregate 9d8f2b6d-c9d8-39f5-90f2-c354fd387c28%}{%-for sku in aggregate_result|reverse-%}{%do last_sku.append(sku)%}{%-endfor-%}{%endaggregate%}{%aggregate 28e5708e-b957-3b7d-ae3c-09eae2a3e29b%}{%-for price in aggregate_result|reverse-%}{%do last_price.append(price)%}{%-endfor-%}{%endaggregate%}{%aggregate 8ba45452-30e2-3107-9548-a2841040a5fe%}{%-for listSku in aggregate_result-%}{%do list.append(listSku)%}{%-endfor-%}{%endaggregate%}{%-for sku in last_sku-%}{%set index=loop.index0%} {%do last_objects_array.append({sku: sku, price: last_price[index], index: index})%}{%-endfor-%}{%set last_objects_array_uniq=last_objects_array|unique(attr='sku')%}{%-for last in last_objects_array_uniq-%}{%set key_name=last.sku%}{%catalogvar.store-1(key_name).price%}{%set catalog_item=catalog_result|float%}{%-if last.price|float > catalog_item|float-%}{%-if last.sku in list|join(',')-%}{%-else-%}{%do final_sku.append(last.sku)%}{%-endif-%}{%-endif-%}{%endcatalogvar%}{%-endfor-%}{%-for sku in final_sku-%}{{sku}}{%-if loop.index != final_sku|length-%},{%-endif-%}{%-endfor-%}{%-if final_sku|length < 1-%}{{kill}}{%-endif-%}"
}
Remember to base your code preparation on your aggregate IDs and the directories that contain them. The example code uses the IDs used in the earlier steps.
If you would like to make a change to the condition that must be met in order for the event to be generated, you can do so in this line:
{% if last.price|float > catalog_item|float %}
Currently, this condition checks if the price varies, regardless of how big the change in value will be.
The result of this node is an event, which contains the sku of the discounted products in the sku attribute, separated by commas. If the event is empty, it means that none of the products met the price drop condition.
An example of a generated event:
An example of a generated product.priceDrop event
### Configure the Event filter node
---
1. Add the **Event filter** node. In the configuration of the node:
1. Check event **for period of time**.
2. Define the time range to **1 minute**.
3. From the **Choose event** dropdown list, select the **product.priceDrop** event.
4. As the event parameter, select **sku**.
5. From the **Choose operator** dropdown list, select **Regular expression**.
6. As the value, enter `.+`
7. Confirm by clicking **Apply**.
2. For the **not matched** path, select the **End** node.
3. For the matched path, select the **Send mobile push** node.
### Configure the Send mobile push node
---
At this stage, a mobile push is sent to customers, which contains the products returned in the event from the previous step.
1. In the node configuration, select the **template type**(in our example simple push) and **push template** from the list.
2. Confirm by clicking Apply.
### Add final setting 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:
- [Aggregate that collects sku of recently purchased products](https://app.synerise.com/analytics/aggregates/cf726d37-39af-3a09-bc8b-36953f1a4411)
- [Aggregate that collects product sku's added by the users to their favorites](https://app.synerise.com/analytics/aggregates/9d8f2b6d-c9d8-39f5-90f2-c354fd387c28)
- [Aggregate that collects the latest prices of products added by users to their favorites](https://app.synerise.com/analytics/aggregates/28e5708e-b957-3b7d-ae3c-09eae2a3e29b)
- [Aggregate that counts sku's of products added to favorites by a user](https://app.synerise.com/analytics/aggregates/8ba45452-30e2-3107-9548-a2841040a5fe)
- [Workflow](https://app.synerise.com/automations/workflows/automation-diagram/3ca070b9-91c1-4883-85e8-81274a21502f)
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) (~3), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), `product.priceDrop` (~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)
- [Catalogs](/docs/assets/catalogs/introduction-to-catalogs)
- [Email campaigns](/docs/campaign/e-mail)
- [Product feed](/developers/product-feed)
- [Reusing event context from preceding nodes](/developers/inserts/automation)
- [Segmentation](/docs/analytics/segmentations)
# Find customers who are most likely to return items
Each store can identify customers who return or exchange products more often than others. In this case, we are dealing with "serial returners" - shoppers responsible for excessive returns. Some of them may have insincere intentions, while the others may suffer from controlling their buying behavior. Typically, these customers cost sellers a lot of money, so it’s helpful to know which customers are likely to return and to plan the steps to prevent frequent returns and save the company time and money.
This use case describes the process of creating a segmentation of customers with the highest propensity for returns. This segmentation can later be excluded from selected campaigns that provide promotional codes or other discounts, helping a company optimize the cost of planned campaigns that are oriented toward customers who will benefit from such a promotion and enjoy the purchase.
## Prerequisites
---
- [Integrate JS SDK](/developers/web/installation-and-configuration) or implement Synerise SDK in your [mobile application](/developers/mobile-sdk) - greater data collection will allow the model to be better trained and produce better results.
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CreateATransaction).
- [Enable the Lookalike prediction type](/docs/ai-hub/predictions/enabling-predictions#enabling-lookalikes).
- [Implement a custom event](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CustomEvent) that refers to the returned products. As an example, such an event could be named `product.return`. The exemplary event is available below:
SR.event.trackCustomEvent { "label": "The customer returned product",
"client": { "email": "testDoc@synerise.com" },
"action": "product.return",
"params": { "product_sku": "xxx", "orderId": "xxx",
"reason_of_return": "shoes were too small" } }
## Process
---
1. Create a [target segmentation](/use-cases/predicting-returns#create-a-target-segmentation).
2. Create a [source segmentation](/use-cases/predicting-returns#create-a-source-segmentation).
3. [Create a prediction](/use-cases/predicting-returns#create-a-prediction).
## Create a source segmentation
---
In this part of the process, create a source segmentation that contains customers who will be compared with the customers in the target segmentation. This segmentation includes customers who have made at least two returns in the last 30 days. The fastest way to make such a segmentation is to create a `product.return` event funnel.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation.
3. From the **Add condition** dropdown list, select the `product.return` event.
4. From the **and then** dropdown list, select the same event.
5. As the time range, set **Last 30 days**.
You can freely manage the number of events in the funnel and the selected time range to create conditions that suit your business objectives.
6. Save the segmentation.
Configuration of the target segmentation
## Create a target segmentation
---
Create a segment of customers among whom you want to find those most likely to make a return.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation.
3. From the **Add condition** dropdown list, select the `product.buy` event.
4. As the time range, set **Last 30 days**.
5. Save the segmentation.
Configuration of the source segment
## Create a prediction
---
In this part of the process, create a Lookalikes prediction which compares the two segmentations - the engine looks for customers in the target segmentation who are most similar to the customers in the source segmentation. On the profile cards of all customers from the target segmentation, a `snr.lookalike.score` event is generated. In the details of the event, you can find the **score_label** parameter that describes the similarity of a customer to the customers in the source segmentation. The **score_label** parameter for this particular prediction takes two values: low or high.
1. Go to **AI Hub > (AI Predictions) Models > New prediction**.
2. In the **Select prediction type** window that appears, click **Lookalikes**.
3. Click **Apply**.
4. In the **Audience** section, click **Define**.
5. In the **Source segmentation** subsection, click **Choose segmentation**.
6. From the dropdown list, select the [source segmentation](/use-cases/predicting-returns#create-a-source-segmentation) you created before.
7. In the **Target segmentation** subsection, click **Choose segmentation**.
8. From the dropdown list, select the [target segmentation](/use-cases/predicting-returns#create-a-target-segmentation) you created before.
9. Confirm by clicking **Apply**.
10. In the **Settings** section, click **Change**.
11. Enable the **Set up recurring prediction calculation** option.
12. Set the recalculation of the prediction every 30 days. The segmentation is recalculated before a prediction is recalculated - recalculation of the segmentation concerns recurring predictions which intervals are longer than several hours.
You can define a different recalculation time that better fits your business goals.
13. Select the **2-point scale**.
14. Confirm by clicking **Apply**.
15. Click **Save & Calculate**.
## What's next
---
Based on the `snr.lookalike.score` event, create a segmentation for cusomers with the highest lookalike score (customers who are most likely to return). 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`. Below you can find an example of the `snr.lookalike.score` event that appears in the customer profile.
Example of event `snr.lookalike.score`
An example of the segmentation of customers with the highest probability to return is shown in the following screen:
Example of segmentation based on lookalike prediction score
Later, you can use this segmentation to exclude it for example from email or SMS promotional campaigns, saving campaign costs on customers who are likely to return products purchased within these campaigns.
## 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.
- [Source segmentation](https://app.synerise.com/analytics-v2/segmentations/77193186-ce52-499e-b490-e5d46653ad73)
- [Target segmentation](https://app.synerise.com/analytics-v2/segmentations/18ded12e-5ffa-46de-a4a6-60e90beaf42a)
- [Prediction](https://app.synerise.com/ai-v2/predictions/lookalike/tiaxsmgucdrg)
Go to the Predictions tab, on the left menu select Lookalikes, and then paste the URL of [this prediction](https://app.synerise.com/ai-v2/predictions/lookalike/rugfywvfwijp).
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
---
- [Email campaigns](/docs/campaign/e-mail)
- [Predictions](/docs/ai-hub/predictions)
- [Segmentation](/docs/analytics/segmentations)
- [SMS campaigns](/docs/campaign/SMS)
# 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)
# Co-Brand Decisioning Layer segmentation based on average monthly transactions
In this use case, you will create a segmentation that groups customers based on their average number of transactions per month. This allows you to identify more and less active buyers and use that information in downstream actions, such as cross-workspace audience sharing, personalized recommendations, and dynamic content targeting.
**Context**
To make this scenario clear, we assume two separate workspaces:
- Workspace A – dedicated to Brand A
- Workspace B – dedicated to Brand B
Each workspace collects its own customer behavior data independently.
**Goal**
The main goal of this setup is to identify highly active customers (heavy buyers) in Workspace A (Brand A) and use this information in Workspace B (Brand B).
This allows you to deliver more relevant product recommendations and promotional communication to users who have already demonstrated strong purchasing intent in another brand ecosystem.
**Process**
In Workspace A (Brand A):
- Calculate the average number of transactions per user per month.
- Based on this metric, create a segment of highly active customers (heavy buyers).
- Share this audience segment with Workspace B (Brand B).
In Workspace B (Brand B):
- Target users from this imported segment when they visit Brand B.
- Use AI recommendations to present: products with a price higher than X, or
products aligned with premium or high-value categories.
As a result users identified as heavy buyers in Brand A receive more tailored, potentially higher-value offers in Brand B.
## Prerequisites
---
- Add a [tracking code](/developers/web/installation-and-configuration) to your website.
- Create a [workspace group](/docs/settings/workspace/multibrand-workspaces/create-workspace-group) connecting minimum 2 of your workspaces, giving you the possibility to synchronize profile information across them.
## Process
---
1. Create a [segmentation](/use-cases/multibrand-segmentation#create-a-segmentation-of-heavy-buyers) of heavy buyers.
2. Share the results from this segmentation [to the workspace group](/use-cases/multibrand-segmentation#prepare-the-multi-workspace-sync-of-segmentation).
3. Create [the final segmentation](#prepare-the-final-segmentation) on the second workspace based on the membership attribute synchronization.
3. Prepare the [AI recommendations](/use-cases/multibrand-segmentation#prepare-the-ai-recommendations) proposing products with the price higher than X and present them to users who are among heavy buyers on the first workspace while visiting the brand B.
4. Create a [dynamic content](/use-cases/multibrand-segmentation#create-a-dynamic-content)
## 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 > 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** (this way the aggregate result will show 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 segmentation 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
## Prepare the Multi Workspace Sync of Segmentation
1. Go to **Decision Hub > Segmentation**.
3. On the top bar on the segmentation list, click **Share as**.
4. On the pop-up, click **Multi Workspace Sync.**
5. From the Process frequency dropdown list, select how often membership attributes will be synchronized.
- Every hour - The process will start every hour. The first synchronization is performed immediately after activating the process.
- Every 6 hours - The process will start every 6 hours. The first synchronization is performed immediately after activating the process.
- Daily - The process will start once a day at a random time between 4 A.M. and 6 A.M.
6. Click **Go to sharing process.**
7. On the pop-up, select the [segmentations whose results will be shared](#create-a-segmentation-of-heavy-buyers) and synchronized to a workspace group. The results will be saved as membership attributes.
Only customers who belong to the selected segmentation and also exist in the target workspace will be assigned the membership attribute.
During the sharing process, you will be informed about the default name of the membership attribute that will be created in the target workspace. Please note that this name cannot be modified at this stage.
8. To start the process, click **Apply**.
9. Confirm by clicking **Yes, start**.
**Result:** The synchronization will occur according to the schedule. To get to know details about each synchronization time, time window and effects, see the ["Synchronization ferquency" section](/docs/settings/workspace/multibrand-workspaces/sharing-segmentation-results#synchronization-frequency).
## Prepare the final segmentation
---
On the target workspace, create a segmentation based on the synchronized membership attribute.
1. Go to **Decision Hub > Segmentations > New segmentation**.
2. Enter the name of the segmentation.
1. Click **Add condition**.
2. Select the [attribute created in the previous step](#prepare-the-multi-workspace-sync-of-segmentation). In our case it will look like this:
Membership attribute synchronization view
3. From the **Choose** dropdown list, select **is true** operator.
5. Click **Save**.
Segmentation view
## Prepare the AI recommendations
---
In this part of the process, you will configure AI Recommendation which excludes last seen and last bought products. AI Recommendation will be added to the product 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 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 **Personalized** recommendation type.
6. Confirm the settings by clicking **Apply**.
7. In the **Items** section, click **Define**.
1. Define the minimum and maximum number of items that will be recommended to the customer in each slot.
3. 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. In our case, in the **Static filter** section, click **Define filter**.
5. Select **Visual Builder**.
6. Click **Select value**.
5. Choose **$price**.
6. As an operator, choose **More than**.
7. Add the value as `100`.
4. Confirm by clicking **Apply**.
Configuration of the elastic filter
8. Define the boosting rules by clicking **Define** in the **Boosting** section.
1. In **Attributes** section, click **Add rule**.
2. Click **Define rule**.
3. Choose **Visual builder**.
3. From the **Select value** dropdown list, choose **price**.
4. As **Operator**, choose **More than**.
5. As the value, enter the minimum price a product should cost to be included in the recommendations. This way, you exclude recommending products that are too cheap and encourage the purchase of more expensive ones.
6. Click **Apply**.
7. Click **Promote**.
8. In the **Impact** section, set the impact of this rule to **High**.
9. Optionally add the **Additional settings**.
9. In the right upper corner, click **Save**.
## Create a dynamic content
---
Create a dynamic content campaign that displays the results of AI recommendations (products more expensive than 100). Use the predefined template. This dynamic content will be displayed as a pop-up on your site for customers who [are assigned with a membership attribute](#prepare-the-multi-workspace-sync-of-segmentation).
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**.
2. Select the target [segmentation](#prepare-the-final-segmentation) created based on the membership attribute synchronization in the previous step.
### 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** or create your own one from scratch.
3. In the template configuration form, use the predefine AI recommendation selector and select the [AI recommendation](#prepare-the-ai-recommendations) created in the previous step to make sure that you present only products more expensive than 100$.
Web layer template
### 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 **Advanced options**.
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 also check the configuration directly in Synerise Demo workspace:
- [Segment of heavy buyers](https://app.synerise.com/analytics/segmentations/f22d73d7-5aba-48e7-b70f-54bbc1dba0a2)
- [Target segmentation](https://app.synerise.com/analytics-v2/segmentations/86d6e5e2-1f0b-4155-a5c3-42ef9024defd)
- [AI Recommendation](https://app.synerise.com/ai-v2/recommendations/dxhcfJpHDuWA)
- [Dynamic content](https://app.synerise.com/campaigns/dynamic-content/create/799fe2e3-e9ec-4ca8-a8cb-2b3e118b0ba6)
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)
- [Multibrand workspaces](/docs/settings/workspace/multibrand-workspaces)
- [Segmentation](/docs/analytics/segmentations)
# In-app message with application update walkthrough
In-app walkthrough messages provide a seamless and user-friendly way to guide your customers through key features and updates within your application. Ensure your users stay informed about the latest enhancements, functionalities, and essential tips to maximize their experience. Enhance user engagement, foster a smooth onboarding process, and keep your audience effortlessly connected to the most valuable aspects of your application through strategically crafted in-app messages.
This scenario describes the process of creating an in-app message with information about new application updates in a walkthrough form for customers who have a new version of the application.
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 in your mobile app](/developers/mobile-sdk).
## Create an in-ap message
---
In this part of the process, you create an in-app campaign triggered by the [client.applicationStarted](/docs/assets/events/event-reference/web-and-app#clientapplicationstarted) event. We will adapt a predefined template for the message with information about new application updates, so there is no need to create a template from scratch.
1. Go to **Experience Hub > In-app messages> Create in-app**.
2. Enter a meaningful name for the in-app campaign.
### Define the audience
---
As the first step, define the target group of customers for the in-app message.
3. In the **Audience** section:
1. Click **Define**.
2. Select the **Everyone** tab.
3. Click **Apply**.
### Define content
---
1. In the **Content** section, click **Define**.:
1. Click **Create message**.
2. Go to **Predefined templates** folder and choose **Walkthrough** 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 the **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. These fields affect only the visual layer of the in-app message.
1. In the **Background** section, use the color picker to select the color of the background or enable background image and enter the link to this image (add the image to **Data Modeling Hub > Files** and then you can find there the URL to this image).
2. In the **Image** section, enable the image in your banner campaign and add the link to this image (add the image to **Data Modeling Hub > Files** and then you can find there the URL to this image).
3. In the **Header** section, enable header and add the text, font size and color of the header you want to display in the in-app message.
4. In the **Description** section, enable description and add the text, font size and color of the description you want to display in the in-app message.
5. In the **CTA button** section, enable the CTA and add the text on the button, corner radius, color, background color of the button, and add the URL to which you want to redirect users afer clicking the button.
6. In the **Close button** section, enable this option and set up the close position.
7. In the **Slide 2** and **Slide 3** sections, enable slide options and repeat steps 1-6. You can create up to 5 slides.
7. 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**.
8. To continue the process of configuring the in-app campaign, click **Next**.
9. To save your content changes, click **Apply**.
In-app content configuration
### 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 `client.applicationStarted` event.
Event [`client.applicationStarted`](/docs/assets/events/event-reference/web-and-app#clientapplicationstarted) is retained (can be seen on the activity list in the customer profile), and it only generates when the application was closed, and then opened again.
3. Click the **+ where** button and select `version`.
4. As the logical operator, select **Equal**.
5. In the text field, type the latest version of the application.
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** according to your business needs.
4. Enable the **Capping limit** toggle to limit the amount of time the in-app message can be displayed to a user in general, set it to **1**.
5. Click **Apply**.
6. Optionally, you can define the **UTM parameters** and **Additional parameters** for your in-app campaign.
You can find more on the in-app message settings in our documentation:
- [Priority](/docs/campaign/in-app-messages/create-inapp-message#priority)
- [Display settings](/docs/campaign/in-app-messages/create-inapp-message#configuration-of-display-settings)
- [UTM and URL parameters](/docs/campaign/in-app-messages/create-inapp-message#define-utm-and-url-parameters)
- [Additional parameters](/docs/campaign/in-app-messages/create-inapp-message#adding-custom-parameters)
7. 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/72048dcc-f321-49b0-8fd1-6d9f598b4a64) 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:
[`client.applicationStarted`](/docs/assets/events/event-reference/web-and-app#clientapplicationstarted) (~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)
# Mandatory mobile app upgrade message
In-app notifications on mandatory application upgrade ensure that your customers are promptly notified and guided through the essential process of updating their mobile application. Enhance user experience, maintain the application's optimal performance, and provide your customers access to the latest features and security improvements. Streamline the upgrade process and keep your customers seamlessly connected with the most up-to-date version of your application through strategic in-app messages.
This use case describes the process of creating an in-app message with information about mandatory application upgrade for customers who have an old version of the application.
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 in your mobile app](/developers/mobile-sdk).
## Create an in-ap message
---
Create an in-app campaign triggered by the [`client.applicationStarted` event](/docs/assets/events/event-reference/web-and-app#clientapplicationstarted) of the old version of the application. We will use a predefined template for the message with mandatory application upgrade information, so there is no need to create a template from scratch.
1. Go to **Experience Hub > In-app messages> Create in-app**.
2. Enter a meaningful name for the in-app campaign.
### Define the audience
---
As the first step, define the target group of customers for the in-app message.
3. In the **Audience** section:
1. Click **Define**.
2. Select the **Everyone** tab.
3. Click **Apply**.
### Define content
---
1. In the **Content** section, click **Define**.:
1. Click **Create message**.
2. Go to the **Predefined templates** folder and choose **Fullscreen** 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.
1. In the **Background** section, use the color picker to select the color of the background or enable background image and enter the link to this image (add the image to **Data Modeling Hub > Files** and then you can find there the URL to this image).
2. In the **Image** section, enable the image in your banner campaign and add the link to this image (add the image to **Data Modeling Hub > Files** and then you can find there the URL to this image).
3. In the **Header** section, enable header and add the text, font size and color of the header you want to display in the in-app message.
4. In the **Description** section, enable description and add the text, font size and color of the description you want to display in the in-app message.
5. In the **CTA button** section, enable the CTA and add the text on the button, corner radius of the button, text color, button background color, and URL to which you want to redirect a mobile app user.
6. In the **Close button** section, disable this option. Thanks to this, the in app message cannot be closed, and the user must click the CTA button.
7. 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 mobile app user.
3. Click **Apply**.
8. To continue the process of configuring the in-app campaign, click **Next**.
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 `client.applicationStarted` event.
Event `client.applicationStarted` is retained (can be seen on the activity list in the customer profile), and it only generates when the application was closed, and then opened again.
3. Click the **+ where** button and select `version`.
4. As the logical operator, select **Not equal**.
5. In the text field, type the latest app version.
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** according to your business needs.
4. Enable the **Capping limit** toggle to limit the amount of times the in-app message can be displayed to a user in general, set it to **1**.
5. Click **Apply**.
6. Optionally, you can define the **UTM parameters** and [**Additional parameters**](/docs/campaign/in-app-messages/create-inapp-message#adding-custom-parameters) for your in-app campaign.
7. 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/de9da8a0-8478-4d80-a15d-a35703958243) 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:
[`client.applicationStarted`](/docs/assets/events/event-reference/web-and-app#clientapplicationstarted) (~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)
# Personalized promotion in the mobile app with display time limitation
In today's digital age, offering personalized promotions within your mobile application is a smart strategy to elevate your customers' overall experience. By tailoring promotions to align with each user's unique preferences and needs, you can foster deeper engagement and lasting loyalty. In this use case, we will delve into the art of crafting a seamless personalized promotion experience.
This use case describes the scenario where AI Engine selects a personalized promotion for each app user. The campaign is based on the following assumptions:
- The promotion is chosen from the breakfast menu,
- It is visible on the app for three hours, specifically between 6 AM and 9 AM, and will be available for use for one hour once activated.
## Prerequisites
---
- Implement promotions in your mobile application using Synerise [mobile SDK](/developers/mobile-sdk/loyalty) or [API](https://hub.synerise.com/api-reference/authorization#tag/Authorization/operation/profileLogin).
- [Import your product feed to catalog](/use-cases/import-product-feed-to-catalog).
- [Meet the documents requirements](/docs/assets/documents/introduction-to-documents#requirements).
- Apply [this method](https://hub.synerise.com/api-reference/loyalty-and-engagement#tag/Personalized%20promotions/operation/getHandbillForClient_GET) to assign personalized promotions to a Profile.
- Create promotions and tag them to use later as a filter when creating a personalized promotion.
- Create a filter on the list of (regular) promotions to be reused while preparing the personalized promotion. In our case, we create a filter for breakfast promotions.
Click here to see how to build the filter
Go to AI Hub > Regular Promotions.
On the right side of the screen, click
Click Define.
On the pop-up, define the conditions by clicking Choose filters. The list contains all parameters from the product feed. Definition of promotion filter
To add a new condition, repeat the previous step.
Save the filter by clicking Save and Apply.
## Process
---
In this use case, you will go through the following steps:
1. [Create a personalized promotion](/use-cases/personalized-mobile-promotion-with-time-limit#create-a-personalized-promotion).
2. [Create a document](/use-cases/personalized-mobile-promotion-with-time-limit#create-a-document).
### Create a personalized promotion
---
In this part of the process, create a personalized promotions for breakfast promotions that will be active for customers for 1 hour after activation.
1. Go to **AI Hub > Personalized Promotions > New personalized promotion**.
2. Select the type of promotion - **Mobile app**.
3. In **A/B test settings**, add variants of the personalized promotion by clicking **Define**.
1. To add the first variant, click the plus button.
2. In **Advanced options**, leave the default option - **AI Engine** (the AI engine chooses the items to be included in the promotion).
3. Confirm by clicking **Apply**.
AB test settings
4. In the **Filter and limits** section, define:
- the filter you created in prerequisites,
- the number of items that match a filter,
- the order of the items in the promotion (from top to the bottom).
Filters and Limits configuration
5. In the **Activity** section, define the activity of the personalized promotion as **Relative** defining the activity time of promotion. In our case it's 1 hour.
You can find more detailed information on all Activity types [here](/docs/ai-hub/personalized-promotions/creating-ai-promotions#defining-promotion-schedule).
Personalized promotion activity
6. Optionally, define the AI Engine boosting settings. You can find the instruction on how to do that [here](/docs/ai-hub/personalized-promotions/creating-ai-promotions#ai-engine-boosting-settings).
7. After configuring all settings, publish the promotion.
### Create a document
---
Create a document with personalized promotion targeted to the whole database. The document will be used to display the promotion in the mobile app during the specific time frame. In our case, the promotion is scheduled for 1 month throughout the week, from 6 to 9 AM.
If you want to learn more about the various document settings, read the article ["Creating documents"](/docs/assets/documents/creating-documents).
1. Go to **Data Modeling Hub > Documents > Add document**.
2. Enter the name for 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. Optionally, you can choose the group to which you add your document by using the **Group** option. In this case we focus on single promotion.
4. From the **Type** drop-down list, select a document type. Document type defines how the document is validated by your mobile application. To create a new type, from the drop-down list, click **Add type**.
Full explanation of the type is available [here](/docs/assets/documents/introduction-to-documents#terminology).
5. In the **Body** field, insert JSON which includes a reference to the promotion. Below you will find an example of the document body that contains the reference to the promotion created in Synerise. `uri` used in the body aims to get personalized promotions for the customer from the available list of promotions defined earlier in the personalized promotion:
7. Optionally, to check the preview of the document for the specific customer, use **Preview body**.
8. To save your changes, click **Apply**.
Document body configuration
1. In the **Schedule** section, define the time when the document will be active.
1. Schedule the activation of the document by selecting the **Scheduled** option.
2. Define the start and end date according to your business needs. In our case it starts from the Ocrober 2nd till the October 31.
3. Turn on the switch dedicated to setting time windows for the document to be active.
4. In this case, we select all days of the week.
5. Click **+ Add time**.
6. Define the time frame in which the document will be active. In our case, we select the time between 6 and 9 AM.
Document schedule configuration
2. To save your changes, click **Apply**.
3. To activate immediately or at a scheduled date, click the **Activate** button.
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the [personalized promotion](https://app.synerise.com/campaigns/handbills/a136d91c-21db-444a-9c0b-101b9a49cd40) and [Document](https://app.synerise.com/assets/documents/bc40ec0e-61d3-4813-a02d-3c541f674d39) 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), [`snr.bestfit.score`](/docs/assets/events/event-reference/predictions#snrbestfitscore) (~1), [`client.activatePromotion`](/docs/assets/events/event-reference/loyalty#clientactivatepromotion) (~1).
## Read more
---
- [Documents](/docs/assets/documents)
- [Promotions](/docs/ai-hub/promotions)
# Personalized promotions in a mobile application
Personalized promotions play a crucial role in enhancing customer engagement and driving sales. By offering tailored discounts and exclusive deals, businesses can create a sense of value and build stronger relationships with their customers. Leveraging advanced automation and AI ensures that customers receive offers that are most relevant to their preferences, driving higher engagement and conversion rates.
This use case focuses on delivering personalized promotions directly through a mobile application. The AI-powered system assigns six tailored promotions to each customer every seven days, ensuring fresh and relevant offers. Customers can view, activate, and redeem these **mobile promotions** during their visit in the store, with the system automatically tracking their usage and marking them as redeemed. Additionally, it is possible to print personalised promotions directly on the receipt using **Check-out**, enhancing the shopping experience in the physical channel and improving customer engagement through multiple touchpoints.
In this use case, we address scenarios where a Synerise user want to import promotions from a CSV file rather than create them using the Synerise portal. However, this does not exclude cases where the user wishes to manually create promotions in the system. For such cases, the [Promotion feature](/docs/ai-hub/promotions) can be used to add promotions individually.
## Prerequisites
---
### Basic requirements
- Integrate Synerise [promotions](/docs/ai-hub/promotions).
- Implement promotions in your mobile application using Synerise [mobile SDK](/developers/mobile-sdk/loyalty) or [API](https://hub.synerise.com/api-reference/authorization#tag/Authorization/operation/profileLogin).
- [Import your product feed to a catalog](/use-cases/import-product-feed-to-catalog).
- Apply [this method](https://hub.synerise.com/api-reference/loyalty-and-engagement#tag/Personalized%20promotions/operation/getHandbillForClient_GET) to assign personalized promotion to a Profile.
- Implement those custom events in your [mobile application](/developers/mobile-sdk/event-tracking).:
- `handbill.assign`: Assigns a set of personalized promotions to a customer, refreshed every seven days. Apply [this method](https://hub.synerise.com/api-reference/loyalty-and-engagement#tag/Personalized%20promotions/operation/getHandbillForClient_GET) to assign personalized promotion to a Profile.
- `client.activatePromotion`: Tracks when a customer activates a specific promotion in the mobile app.
- `client.removePoints`: event is generated through the `/promotion/redeem` method, after the coupon is redeemed.
- `sale.processed`: Updates the system with redeemed promotions and finalized basket values. This event is generated in Synerise with details about the products purchased using Synerise promotions.
### Integrate with the checkout
Implement transactions in checkout registers using the [API](https://hub.synerise.com/api-reference/data-management#tag/Events/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.
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.
Read more about implementing Check-out promotions [here.](/use-cases/personalized-promotions-on-checkout)
Create promotions and assign tags to them for use later as a filter when creating a personalized promotion. You can do it manually, but in case of having more promotions we recommend to prepare them as a CSV file and import them to Synerise using Automation Hub. More about the integration we will discuss later as a 1st step of the process.
## Process
---
In this use case, you will:
1. [Import promotions](/use-cases/personalized-promotions#import-promotions).
1. [Create a workflow](/use-cases/personalized-promotions#create-a-workflow) to import the data about promotions to Synerise.
2. [Create a personalized promotion](#create-a-personalized-promotion) to launch an AI campaign which will choose 6 personalized promotions for each user.
## Import promotions
---
In case of having more promotions we recommend to prepare them as a CSV file and import them to Synerise using Automation Hub. The example file with the list of promotions for specific products can be prepared based on our example, described below.
Check required column names:
catalogIndexItems
storeItemType
storeIds
visibilityStatus
name
redeemQuantityPerActivation
discountValue
expireAt
description
catalogItemType
priority
discountTypediscountType
displayTo
displayFrom
redeemLimitPerClient
type
headline
startAt
storeCatalog
catalog
headerName
redeemType
If these are personalized promotions, you can set the type parameter to Personalized promotion permanently for this use case.
If you wish to generate promotions across different channels, such as on receipts in addition to the app, you can configure this within the campaign using tags. For example: Promotions marked with tag CHECKOUT will display on receipts. Promotions marked with MOBILE will appear in the app. Ensure these tags are already defined in the csv file during the preparation process as `tags.0.name`. Important: The tag must first be created in Data Modeling Hub -> Tags.
If custom information for promotions, such as unique store icons, descriptions, or additional details, is required, an appropriately structured CSV file must be prepared in advance. Read more about additional columns and their requirements [here.](https://hub.synerise.com/api-reference/loyalty-and-engagement#tag/Promotions%3A%20management/operation/CreateAPromotion)
- If you collect promotion data in a different way, and it is organized differently, you can easily transform column names and the format of their values using [data transformation](/docs/automation/data-transformation-and-imports) in Synerise.
- Data transformations during the import of promotions may require additional configuration and testing, as this depends on your implementation of the promotions.
## Create a workflow
---
In this part, you will create a workflow which imports a local file to add promotions 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 launching 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 (**one time**) and choose the **Immediately** option.
4. Confirm by clicking **Apply**.
The configuration of the Scheduled Run node
### Add local file with sample data
This node allows you to add a data sample. In our case use the csv file prepared as a part of [prerequisites](#prerequisites)
1. On the pop-up, click **Add example**.
2. Upload the CSV file from the [prerequisites](#prerequisites) as the sample data.
3. Set **Delimiter** to the delimiter that you used in your CSV file.
The delimiter is usually a comma or a semicolon, depending on the application you used to create the file and the regional settings of your system.
3. Click **Generate**.
The configuration of the Data input node
### Add import promotions node and finishing node
---
In this part of the process, you will import the transformed file with customers to Synerise.
1. Add the **Import Promotions** node.
2. Add the **End** node.
3. In the upper right corner, click **Save & Run**.
The workflow configuration
**Results**: After import, all the promotions from the file will be created in Promotions in Synerise.
## Create a personalized promotion
---
This part involves generating personalized promotions, tailored to each user based on the pool of available promotions. Synerise dynamically assigns these promotions, ensuring relevant offers for every customer.
1. Go to **AI Hub > Personalized Promotions > New personalized promotion**.
2. Select the type of promotion - **Mobile**.
3. In **A/B test settings**, click **Define**.
4. Click the plus button to create the first variant (at least one variant must exist).
5. If you want to add more variants, click the plus button again.
5. If you want to use a control group, select **Enable a control group**.
6. If you want to change the distribution of variants, use the slider.
7. In **Advanced options**, leave the default option - **AI Engine** (the AI engine chooses the items to be included in the promotion).
8. Confirm by clicking **Apply**.
4. In the **Filters and limits** section:
- Enable the **avoid overlapping promotions** option. Thanks to that, if an item is already part of an assigned promotion, a new promotion for that item won't be generated from this campaign.
- Define the filter using the tags added to the promotions to determine the channel where the promotions appear, in our case we can display 3 promotions with the tag "MOBILE".
- the number of items that match a filter,
- optionally - the order of the items in the promotion (from top to the bottom).
Filters and Limits configuration
5. In the **Activity** section, define the activity of the personalized promotion as **Relative** and set the time to 7 days.
You can find more detailed information on all Activity types [here](/docs/ai-hub/personalized-promotions/creating-ai-promotions#defining-promotion-schedule).
6. Optionally, define the AI Engine boosting settings. You can find the instruction on how to do that [here](/docs/ai-hub/personalized-promotions/creating-ai-promotions#ai-engine-boosting-settings).
7. After configuring all settings, publish the promotion.
If you want to additionally activate promotions displayed on receipts, create the same personalized promotion as described above, but **change the type to Check-out and update the** **tag to CHECKOUT**. If you require specific personalized settings based on your business needs, feel free to configure them accordingly.
Read more about implementing Check-out promotions [here.](/use-cases/personalized-promotions-on-checkout)
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration directly in Synerise Demo workspace:
- [Workflow](https://app.synerise.com/automations/workflows/automation-diagram/66f44f33-4b74-4dde-a47b-6e7e72ad2e09)
-[Personalized promotion](https://app.synerise.com/campaigns/handbills/db010e47-cc9a-4126-9125-e56b19bbc25f)
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:
[`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), [`handbill.assign`](/docs/assets/events/event-reference/loyalty#handbillassign) (~1), [`client.activatePromotion`](/docs/assets/events/event-reference/loyalty#clientactivatepromotion) (~1), [`client.removePoints`](/docs/assets/events/event-reference/loyalty#clientremovepoints) (~1), `sale.processed` (~1), [`transaction.charge`](/docs/assets/events/event-reference/items#transactioncharge) (~1), [`product.buy`](/docs/assets/events/event-reference/items#productbuy) (~2).
## Read more
---
- [Automation Hub](/docs/automation)
- [Promotions](/docs/ai-hub/promotions)
# Automated Emails for Customer Retention Using Churn Predictions
Prediction results are saved as [events to customer cards](/docs/ai-hub/predictions/custom#understanding-prediction-events). Thanks to this, a prediction can be used as a parameter in a segmentation that is the audience of a workflow.
The number of uses for churn prediction is practically unlimited. In this example, an email is sent automatically to every customer for whom the risk of churn is calculated as high after completing the prediction described in [Predict churn](/use-cases/churn-prediction).
Reduce churn
## Prerequisites
---
- Prepare a churn prediction (for example, as described in [Predict churn](/use-cases/churn-prediction)).
- Prepare the template for the email you want to send to customers who are at risk of churn, as described in [Creating email templates](/docs/campaign/e-mail/creating-email-templates).
## Process
---
1. Create a [segment](/use-cases/predictions-automation#create-a-segment-based-on-predictions) based on predictions.
2. Create [workflow](/use-cases/predictions-automation#create-workflow-to-message-customers-at-risk-of-churn) to message customers at risk of churn.
## Create a segment based on predictions
---
In this stage, you create a segment of customers who are at high risk of churn. The segment will be used in an Audience Trigger for a workflow.
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 in automations, analytics, and more.
Segment configuration
## Create workflow to message customers at risk of churn
---
1. Go to **Automation Hub > Workflows > New workflow**.
2. Add an **Audience** trigger node.
3. In the settings of the node, as the audience select the segment you created earlier.
4. Add boolean and set it as **true**.
4. Save the node configuration.
5. Add a **Send email** node.
6. Configure the sender and prepare the content as described [here](/docs/automation/actions/send-email).
7. Save the node configuration.
8. Add and **End** node.
9. Perform one of the following actions:
- If you want to send the messages immediately, click **Save & Run**.
- If you want to send the messages later, click **Save**.
**Result:** When the workflow starts, a message is sent to all customers who belonged to the segmentation at the time of starting the workflow.
## What's next
---
You can configure the workflow differently, for example by:
- using the prediction event as a trigger,
- sending other types of messages,
- adding more conditions to the audience filter,
- and more nodes, depending on your business scenario and familiarity with Automation Hub.
## 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 workspace at the following links:
- [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)
- [Workflow configuration](https://app.synerise.com/automations/automation-diagram/e0f72659-611a-4122-91a0-a99e4832a106)
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:
[`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).
## Read more
---
- [Predictions](/docs/ai-hub/predictions)
- [Workflow](/docs/automation)
# 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)
# Loyalty program points balance reminder in in-app message
Loyalty programs are an important part of any business as they help companies build strong relationships with their customers. Every brand knows that the key to building a successful brand is building long-lasting relationships with customers. The strategies used by companies may vary, but most are based on earn&burn programs. This program is quite popular with both customers and companies, although it can sometimes lead to unforeseen consequences for the business.
The most common problem companies face is that customers are not spending their loyalty points. This raises the need to encourage customers to unlock this unredeemed value. To do this, you can remind customers when their points expire to encourage them to "burn" their points, while personalizing this message to the individual customer.
This use case describes the process of creating a reminder to customers about the balance of loyalty points they have in their account and the time left until points expire using an in-app message. The created in-app will be displayed on the trigger of adding the product to the shopping cart once a day. This is an effective form of communication with customers that allows for additional outreach in the mobile channel. In this case, we assume that the redemption of points takes place on a specific day each year.
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).
- [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 [here](/docs/assets/events/event-definitions).
- 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).
- [Implement point expiration logic](https://www.synerise.com/blog/manage-the-expiration-of-points-in-your-loyalty-program-with-synerise)
- Collect [add to cart event](/docs/assets/events/event-definitions).
## 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. [Create an aggregate](/use-cases/in-app-point-balance-reminder#create-an-aggregate) that returns the sum of loyalty points for an individual customer
2. [Create an expression with points balance](/use-cases/in-app-point-balance-reminder#create-an-expression-with-points-balance)
3. [Current status of the membership](/use-cases/in-app-point-balance-reminder#current-status-of-the-membership)
4. [Create an In-app message](/use-cases/in-app-point-balance-reminder#create-an-in-app-message)
## Create an aggregate
---
Create an aggregate that returns the sum of loyalty points for an individual customer.
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 **Sum**.
4. Click the **Choose event** dropdown list.
5. From the dropdown list, select the `points.loyalty` event.
6. From the **+ where** dropdown list, select `points` parameter.
7. Using the date picker in the lower-right corner, set the time range to **Lifetime**.
8. Save the aggregate.
The aggregate that sums points from the points.loyalty event
## Create an expression with points balance
---
In this part of the process, create an [expression](/docs/crm/expressions) which will be used to calculate points balance for the customer.
In our case, the expression is built based on the `points.loyalty` event that is sent every time the customer is awarded with loyalty points.
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 [this use case](/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. On the dropdown list select the aggegate for `points.loyalty` that you created [earlier](/use-cases/in-app-point-balance-reminder#create-an-aggregate).
6. Save the expression.
The configuration of the expression
## Current status of the membership
---
Create an aggregate that analyzes a customer's current membership status. This aggregate will later be used in in-app messaging to define customers who are active participants in the loyalty program.
1. Go to **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Last**.
4. From the **Choose event** dropdown list, select the **account.status** event.
5. As the event parameter, choose **accountStatus**.
6. Using the date picker in the lower-right corner, set the time range to **Lifetime**.
7. To save the aggregate, click **Save**.
Configuration of the aggregate
## Create an in-app message
---
In this part of the process, configure an in-app campaign that displays the appropriate message to the user on the mobile app.
1. Go to **Experience Hub > In-app messages > Create in app**.
2. In the **Audience** section, click **Define**.
3. In the **New Audience** section, click **Define conditions**.
In this step, you define the group of customers who are currently active members of the loyalty program.
4. Choose **Add condition** and find the [aggregate analyzing the status of the customer's membership](/use-cases/in-app-point-balance-reminder#current-status-of-the-membership), created earlier in the process.
5. As an operator, choose **Equal** and add the value `active`.
6. Click **Apply** to save the aggregate.
The audience settings
7. In the **Content** section, click **Define**.
8. Click **Create Message** and select **Code Editor** to create the code for your in-app message.
9. Style the message according to your design preferences using HTML, CSS and JS sections. Below you can find sample code that you can use to create an in-app message.
The CSS and JS code snippets shown below can be directly copied into your in-app campaign. In the HTML code snippet, you need to replace the expression ID with the expression you created for your campaign.
(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 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" ); } }); var oneDay = 24 * 60 * 60 * 1000; var firstDate = new Date(); var endOfYear = new Date(2022, 12, 31); var diffDays = Math.round(Math.abs((firstDate - endOfYear) / oneDay)); var insertDate = document.querySelector(".changeDate"); if (diffDays > 30) { insertDate.innerHTML = "You still have <strong>" + diffDays + " days</strong> to <br> use your points before <br> they expire."; } else { insertDate.innerHTML = "You have only <strong>" + diffDays + " days</strong> to <br> use your points before <br> they expire!"; } })();
10. Click **Next**.
11. Confirm by clicking **Apply**.
12. In the **Trigger events** section, click **Define**.
13. Select **Add event** and find the **product.addToCart** event the mobile application generates.
14. From the **Parameter** dropdown list select **sku**.
15. From the **Choose operator** dropdown list, select **Regular expression**.
16. As the value, enter `.`
12. Confirm by clicking **Apply**.
The audience settings
13. In the **Schedule** section, click **Define** and set the time when the campaign will be active.
14. In the **Display Settings** section, click **Change**.
15. Define the **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 massage to the customer a maximum of 1 time in period of 1 day.
You can additionaly enable the **Capping limit** toggle to limit the amount of time the in-app message can be displayed to user in general.
The audience settings
16. Confirm by clicking **Apply**.
17. Optionally, you can define the **UTM parameters** and **Additional parameters** for your in-app campaign.
18. Activate the campaign.
## 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)
- [Expression with the points balance](https://app.synerise.com/analytics/expressions/2d4c0862-31ac-43c7-a991-97a1e5455e8a)
- [Aggregate with the current status of the membership](https://app.synerise.com/analytics/aggregates/4538a92b-b5e7-338e-a7f0-a4c690b63272)
- [In-app message configuration](https://app.synerise.com/communications/in-app/3e9721c6-ff3b-4124-9fe6-fb8799ca5a02)
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)
- [Expressions](/docs/crm/expressions)
- [In-app messages](/docs/campaign/in-app-messages)
- [Loyalty points transfer between customers](/use-cases/loyalty-points-transfer-with-push)
# 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#tag/Events/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), [`brickwork.generated`](/docs/assets/events/event-reference/brickworks#brickworkgenerated) (~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)
# Promoting high margin products in all types of recommendations
There are certain types of products that you want to promote in the recommendations by default. In this use case, we will show you how to promote high margin products in all types of recommendations. In order to do this we will use default filters.
Default filters are set up per recommendation type. To promote high margin items, we will set the filters to be elastic. This way, recommendations will always filter to products with high margin, unless there are no such products. Then the recommendations will return the rest of the products. For this approach to work, you will have to add information about the margin to the items feed or catalog as an item's attribute. The margin can be a numeric value, however, this approach will also work with labels, for example: `low`, `medium` and `high`, or even a boolean value of `true` for high margin products.
## Prerequisites
---
- The `margin` attribute must be added to the items feed or catalog.
- The recommendation models for which you want to add default filters to must be enabled.
## Create AI recommendations
---
1. Go to **Settings > AI Engine Configuration**.
2. Choose the **Items feed** for which you want to apply the filters.
3. In the **Recommendation models** section click **Show** for the chosen recommendation model.
4. Click **Add default filter**.
5. Click **Define filter**.
6. Click **Select attribute** and from the dropdown menu choose the attribute that you assigned the `margin` to.
- If your `margin` attribute contains numeric values:
1. Click **Choose** and click **More or equal**.
2. In the **Value** input type the number above which products will be included. In our example products have the `margin` value from 10 to 100, so we will type 70.
3. Click **Apply**.
- If your `margin` has labels (`low`, `medium`, `high`):
1. Click **Choose** and click **Equal**.
2. From the dropdown menu with the attribute values click `high`.
3. Click **Apply**.
7. Click **Apply**.
Default filters in recommendations
8. Repeat steps 3.- 9. for each recommendation type you want to promote high margin products in.
9. In the top right corner click **Save**.
The default filter will filter products for previously existing campaigns as well as the ones created later, for the specified recommendation type.
In order to disable the default filter for a specific campaign:
1. Go to **Experience Hub > Recommendations**.
2. Choose the campaign for which you want to turn off the default filter from the list.
3. Click **Define** in the `Additional settings` section.
4. Disable the **Default filters** toggle.
5. Click **Apply**.
6. In the top right corner click **Save**.
### Additional example
---
The screenshot below shows a situation where our margin is the average_rating. In this case, setting the index to high means selecting the filter More or equal with a value of 4.
Margin
## Check the use case set up on the Synerise Demo workspace
---
You can check the [item feed](https://app.synerise.com/ai-v2/config/edit/13168), [catalog](https://app.synerise.com/assets/catalogs/13168) and [recommendations](https://app.synerise.com/ai-v2/recommendations/vyoOsvIIHCGZ) 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
---
- [Filters](/docs/ai-hub/recommendations-v2/recommendation-filters)
- [Setting up campaigns](/docs/ai-hub/recommendations-v2/creating-recommendation-campaign)
# Export Multiple Metrics with Dynamic Keys to Amazon S3
Efficiently managing and analyzing metrics is crucial for optimizing operations and making informed decisions. However, manually creating and maintaining separate metrics for different brands, segments, or reporting needs can be time-consuming and complex. Simplify the process with dynamic keys and reduce the number of metrics required to build reports.
In this use case, we will export three metrics for two different brands to Amazon S3 - with a total of six results. We want to report on the sales volume of products in a given category and brand, as well as the number of products sold for the previous week. The metrics and dynamic keys used in this use case are only an example. You can export any other metrics with dynamic keys as needed, the value of the dynamic key can be static or dynamic (Jinjava).
## Prerequisites
---
- You must have an account on AWS.
- You must be granted a user role that includes the `Data export > Export metrics result` permission.
## Process
---
In this use case, you will go through the following steps:
1. [Create metrics](#create-metrics) with dynamic key for value of sold products and number of sold products from a specific category, value of products sold from a particular brand.
2. [Create a workflow](#create-a-workflow) sending two different metric reports to Amazon S3.
## Create metrics
---
In this part of the process, you will create three metrics for the `product.buy` event.
### Value of products sold from a category
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. From the **Choose parameter** dropdown list, select the `finalUnitPrice` parameter.
7. Click the **+ where** button.
8. From the **Choose parameter** dropdown list, select the `category` parameter.
9. From the **Choose operator** dropdown list, choose **String**, and then select **Equal**.
10. Next to the operator, click the icon until you get two fields: **Dynamic key** and **Value**.
1. In the **Dynamic key** field, enter the name of the dynamic key, in our case: `productCategory`. The value for the key will be sourced from the `category` parameter.
2. In the **Value** field, enter `none`.
6. To select a specific time range, click the calendar icon. In our case, it will be **Last week**. Confirm your choice with the **Apply** button.
7. Click **Save**.
Configuration of the value of products sold from a category metric
### Number of products sold from a category
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. From the **Choose parameter** dropdown list, select the `quantity` parameter.
7. Click the **+ where** button.
8. From the **Choose parameter** dropdown list, select the `category` parameter.
9. From the **Choose operator** dropdown list, choose **String**, and then select **Equal**.
10. Next to the operator, click the icon until you get two fields: **Dynamic key** and **Value**.
1. In the **Dynamic key** field, enter the name of the dynamic key, in our case: `productCategory`. The value for the key will be sourced from the `category` parameter.
2. In the **Value** field, enter `none`.
6. To select a specific time range, click the calendar icon. In our case, it will be **Last week**. Confirm your choice with the **Apply** button.
7. Click **Save**.
Configuration of the number of products sold from a category metric
### Value of products sold from a brand
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. From the **Choose parameter** dropdown list, select the `finalUnitPrice` parameter.
7. Click the **+ where** button.
8. From the **Choose parameter** dropdown list, select the `brand` parameter.
9. From the **Choose operator** dropdown list, choose **String**, and then select **Equal**.
10. Next to the operator, click the icon until you get two fields: **Dynamic key** and **Value**.
1. In the **Dynamic key** field, enter the name of the dynamic key, in our case: `brandName`. The value for the key will be sourced from the `brand` parameter.
2. In the **Value** field, enter `none`.
6. To select a specific time range, click the calendar icon. In our case, it will be **Last week**. Confirm your choice with the **Apply** button.
7. Click **Save**.
Configuration of the value of products sold from a brand metric
## Create a workflow
---
Create a workflow that sends the metrics data for two different brands to Amazon S3 once a week.
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. Leave the **Run trigger** option at default (**all time**).
2. Select the timezone in which the workflow will be launched.
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`.
6. Confirm by clicking **Apply**.
### Configure the Get Metrics node
---
As the next node, choose **Get Metrics** to retrieve metrics for specific categories and brand.
1. Optionally, in the **Time range** field, on the calendar, select the time range from which you want to get the results of the metric or metrics. The time range you select will override the original time range settings of the metrics.
2. In the **Select metrics** field, select [metrics created in the previous part of the process](#create-metrics).
3. In the **Dynamic keys** section:
- in the **brandName**, enter the name of the brand
- in the **productCategory**, enter the name of the category
4. Confirm by clicking **Apply**.
Get Metrics node configuration
### Configure Send file to Amazon S3 Bucket node
---
1. Click **Amazon S3 Bucket > Send 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/send-file-amazon-s3-bucket#create-a-connection).
- 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 saved.
7. In the **File name** field, enter the name of the file you want to send to the storage. If the file already exists, the contents of the file will be overwritten.
8. From the **File format** dropdown list, select the format in which the file will be saved in the storage.
9. Confirm by clicking **Apply**.
The configuration of the Send File node
10. Repeat the configuration of the second **Get Metrics** node but for a different brand and **Send file to Amazon S3 Bucket** node.
Add the second **Get Metrics** node with the same settings except for values in **brandName** and **productCategory** fields. This way, the same set of metrics will produce results for different contexts.
### 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:
- [Value of products sold from a category metric](https://app.synerise.com/analytics/metrics/9721f381-8f18-4a40-aa86-25f2824f0d41)
- [Number of products sold from a category metric](https://app.synerise.com/analytics/metrics/b1469768-a17e-4985-9544-0d23dd612afc)
- [Value of products sold from a brand metric](https://app.synerise.com/analytics/metrics/39bcbcfc-9026-4cf8-a526-77926404fd56)
- [Workflow](https://app.synerise.com/automations/workflows/automation-diagram/f604360f-0003-4749-a97a-3703d9b11a5a)
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) (~4), [`automation.clientEndPath`](/docs/assets/events/event-reference/automation#automationclientendpath) (~1), `amazonS3.sendFile` (~2).
## Read more
---
- [Automation Hub](/docs/automation)
- [Metrics](/docs/analytics/metrics)
# Exclusion of product categories from the basic points scheme
Once you have the basics of a loyalty program in place, you may want to think about implementing unique scenarios that fit the specifications of your business. There are many scenarios you can implement, and one of them may include refining the way points are rewarded. You may want to exclude certain products or product groups from rewarding points for specific business reasons.
This use case describes the process of how you can create such an exclusion by making minor modifications to an already created points scheme described in [this use case](/use-cases/loyalty-programs-basics). The points scheme is based on rewarding points for each transaction based on a predefined rule in the expression, which adds 1 point for each PLN spent and additionally rounds down to full units.
As a part of this use case, we will want to exclude the following items from rewarding of loyalty points:
- cancelled products
- products from **category1**
- products from **category2**
This use case presents one of the ways to exclude product categories from accruing loyalty points. You can find an alternative solution [in this use case](/use-cases/product-category-exclusion-with-workflow). Your choice of one of the scenarios will depend on the implementation of your loyalty program. You can always customize any solution to meet your specific business needs.
## Prerequisites
---
Implement [loyalty programs basics](/use-cases/loyalty-programs-basics)
## 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.
## Modify an aggregate counting money spent on every product within transaction
---
In this step, you will complete the already created [aggregate](/use-cases/loyalty-programs-basics#create-an-aggregate-which-counts-number-of-productbuy-events-in-a-single-transaction) with the product categories you want to exclude from accruing loyalty points for them.
1. Click the **+ where** and as the parameter select the `cancel`.
2. From the **Choose operator** dropdown list, select **Is false (Boolean)**.
The `cancel` parameter used in this use case refers to products that were previously selected by the customer, but were canceled for some reason during the purchase process. You can use any other nomenclature for this type of action while implementing transaction events.
3. Click the **+ where** and as the parameter select the `category1`.
In this use case, we use the `category1` and `category2` parameters, which correspond to different levels of product categories - from once more general, to once more specific. You can use any other nomenclature for the indication of your categories.
4. From the **Choose operator** dropdown list, select **Not in Array**.
5. In the next field, enter the values of the categories you want to exclude from loyalty point accrual.
6. Repeat steps **3-5** for other categories that you want to exclude.
7. Click **Save**.
As a result, you have set up an exclusion mechanism that will exclude certain categories from rewarding loyalty points during each customer transaction.
Aggregate counting money spent on every product within transaction excluding specific categories
## Check the use case set up on the Synerise Demo workspace
---
You can check the configuration of the [described aggregate](https://app.synerise.com/analytics/aggregates/763410fc-0774-3848-b06a-d91333db2aa0) 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
---
- [Aggregates](/docs/crm/aggregates)
Check our loyalty use cases [here](/use-cases/?ordering=DESC&sortBy=publishDate&filters=tags%3D%3D%22loyalty%22)
# 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 transformation. 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 transformation.
Click to see a sample CSV file used in this use case
## Process
---
1. [Prepare a transformation](/use-cases/import-transactions-dt#create-a-transformation) 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 a transformation
---
In this part of the process, you define the rules of modifying data.
The transformation 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 transformation and preview its results. With a [library of transformation steps](/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** step to add columns with currency code and the **Merge Columns** step to create eventSalt for the transactions.
1. Go to **Automation Hub > Transformations > New transformation**.
2. Enter the name of the transformation.
3. Click **Upload a new file or drag one here**.
### Add file with sample data
This step 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. Upload the file with the sample data.
2. Set **Delimiter** and provide **Quotation mark** and **Escape character**.
3. Click **Apply**.
**Result:** The editor displays data from the sample.
The preview of the sample file
### Add Column
You can use the **Add Column** step 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 right panel, click **Add step**.
2. From the dropdown list, select **Add Column**.
3. Click the **Add Column** step.
4. In the configuration of the step:
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. Before you save the settings, you can check the preview of the file after changes in the **Results** tab.
5. Confirm by clicking **Apply**.
5. Add two more **Add Column** steps 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 step that adds the value.currency column
### Merge Columns
You can use the **Merge Columns** step 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 step. 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. On the right panel, click **Add step**.
2. From the dropdown list, select **Merge Columns**.
3. Click the **Merge Columns** step.
4. In the configuration of the step:
1. Select the columns to be merged in this order: **orderId**, **client.email**, and **recordedAt**.
2. In the **New column name** field, enter `eventSalt`.
3. In the **Separator** field, enter `-`.
5. Before you save the settings, you can check the preview of the file after changes in the **Results** tab.
6. Confirm the settings by clicking **Apply**.
Final configuration of the Merge Columns step
### Preview and save the transformation
1. Preview the results in the **Output** tab.
2. In the upper right corner, click **Save**.
**Result**:
The transformation configuration
After the transformation is saved, you can use it in the **Data Transformation Studio** 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
1. As the trigger node, add **Scheduled Run**.
2. In the configuration of the node:
1. Select the **Run once** option.
2. Select **Immediately**.
The configuration of the Scheduled Run node
3. Confirm by clicking **Apply**.
### Select file to import
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.
The configuration of the Local File node
2. Confirm by clicking **Apply**.
### Select the transformation
1. Add a **Data Transformation Studio** node.
2. In the configuration of the node, keep the default **From workflow context** option.
3. In the editor, click **Templates library**:
1. Select the [transformation you have created before](/use-cases/import-transactions-dt#create-a-transformation).
2. Click **Use template**.
The configuration of the Data Transformation Studio node
4. Confirm by clicking **Apply**.
You can also create a transformation directly in the **Data Transformation Studio** node instead of selecting a template.
### 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
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 transformation](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-reference/profile-management#operation/ClientCompletedTransaction)
# 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)
# Extra loyalty points for fast in-store pickup
In-store pickup creates a valuable and strategic touchpoint that can drive additional sales and boost loyalty program engagement.
By rewarding customers who pick up their orders quickly with extra loyalty points redeemable for discounts or gifts, you unlock additional operational and business benefits:
- accelerating the pickup process, which frees up backroom space and improves store operations;
- reducing the number of unclaimed orders, which helps lower return-related costs;
- increasing participation in your loyalty program.
This use case presents a workflow that grants 40 loyalty points to customers who collect their order within 24 hours from the moment it becomes ready for pickup.
## Prerequisites
---
- Integrate mechanism for awarding loyalty points.
- Implement custom events:
- `orderPickup.ready` when the order is ready for pickup in-store
- `order.pickedUp` when the order is collected’
You can use the [API](https://hub.synerise.com/api-reference/data-management#tag/Events/operation/CustomEvent).
These events will be saved to the customers' profiles.
- 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 40 loyalty points for fast order pickup.
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 `orderPickup.ready` 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 `orderPickup.ready` event.
2. Confirm by clicking **Apply**.
Profile Event node configuration
### 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
In this step, you will verify whether the customer has collected the order within 24 hours from the moment it becomes ready for pickup. If not, the workflow ends for a user.
1. Add the **Profile Filter** node.
2. From the **Choose filter** dropdown list, select the `order.pickedUp` event.
3. From the **Choose parameter** dropdown list, select the `orderID` parameter.
4. From the **Choose operator** dropdown list, choose **Equal (String)**.
5. One customer can have several orders to collect, so to make sure that the `orderID` parameter for `order.pickedUp` event matches the `orderID` parameter for `orderPickup.ready` event, use the following syntax in the field `{{ automationPathSteps['nodeName'].event.params.paramName }}`, where:
1. `nodeName` is the title of the node whose data you want to refer to (in this case the title introduced was 'Order is ready for the in-store pickup’)
2. `paramName` is the name of the parameter (in this case `orderID`)
The node title to be used as `nodeName`
6. Click **Apply**.
7. To the unmatched path from the **Profile Filter** node, add the **End** node.
Profile Filter node configuration
### Congifure the Generate Event node
1. Add the **Generate Event** node.
2. In the settings of the node:
1. In the **Event name** field, from the dropdown list, select the `points.loyalty` event.
2. In the **Body** section, use the following code and modify it to your needs:
{
"points": "40",
"source": "fast pickup"
}
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/workflows/automation-diagram/a7e5ece3-6373-4a0d-8cd5-718ec0a3140c).
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:
`orderPickup.ready` (~1), `order.pickedUp` (~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), [`points.loyalty`](/docs/assets/events/event-reference/loyalty#pointsloyalty) (~1).
## Read more
---
- [Automation Hub](/docs/automation)
- [Jinjava inserts](/developers/inserts)
# In-app carousel with personalized recommendations
In-app message carousel with personalized products recommendations is a feature that displays a curated list of personalized products within a mobile application. It combines the AI recommendations possibilities of predicting the preferences of individual users and present them with relevant options through an in-app message. By offering personalized product recommendations, businesses can increase engagement, upsell opportunities and drive sales by providing users with tailored and convenient access to their preferred products.
This use case describes the process of creating a set of personalized recommendations in the form of carousel for customers who added products to their cart and sending it through an in-app message.
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
---
- [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 personalized 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#tag/Events/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 AI recommendations](#prepare-ai-recommendations).
2. [Create an in-ap message](#create-an-in-app-message) with products recommendations using the predefined template.
## Prepare AI recommendations
---
In this part of the process, you will configure a personalized recommendation which will be later used in the in-app message.
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 user 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 and settings in the **Additional settings** section.
9. In the right upper corner, click **Save**.
## Create an in-app message
---
In this part of the process, you create an in-app campaign triggered by the `product.addToCart`. We will use a predefined template for the message with personalized products, 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 had a `product.addToCart` event.
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 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 **Use Cases**.
3. Select the **In-app carousel with personalized 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 ([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 **Recommendation campaign** dropdown list, select the [recommendations you created in the previous step](#prepare-ai-recommendations). 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 **Name of product attribute with image link** field, change the default `imageLink` value to the name of the product attribute returning image link from the recommendation campaign defined before. In our case, the name of the column with image link is `image`.
4. In the **Name of the product attribute with title** field, change the default `title` value to the product attribute returning product name from the recommendation campaign defined before. In our case, the name of the column with the product name is `name`.
5. In the **Name of the product attribute with price** field, change the default `price.value` value to the product attribute returning price from the recommendation campaign defined before. In our case, the name of the column with price is `price`.
5. In the **Name of the product attribute with link** field, change the default `link` value to the product attribute returning link from the recommendation campaign defined before. In our case, the name of the column with the attribute returning link is `link`.
6. Define the color for the following fields: **Wrapper background, Header background, Header text, Close icon background** and **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. 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 campaign preview directly in the mobile app.
8. If the template is ready, in the upper right corner click **Save this template > 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 **Apply**.
10. To continue the process of configuring the in-app campaign, click **Next**.
11. 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.addToCart` event.
3. Click the **+ where** button and select `source`.
4. As the logical operator, select **Equal**.
5. In the text field, type `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.
You can additionaly 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 [Recommendations](https://app.synerise.com/ai-v2/recommendations/JmWFgGhNWtTq) and [In-app message](https://app.synerise.com/communications/in-app/a1a9fc4d-900d-4b05-977a-b81e23e11a4e) 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:
[`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)
- [Snippets](/docs/assets/snippets)
- [Recommendations](/docs/ai-hub/recommendations-v2)
- [Using in-app template builder](/docs/campaign/in-app-messages/creating-inapp-templates/creating-inapp-template)
# 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)
# 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#tag/Events/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)