> Synerise Documentation — Use Cases (Part 1 of 3)
>
> This is part 1 of 3 of the "Use Cases" section. To reconstruct the full section, fetch all 3 parts in order (part 1, part 2, …) and concatenate them. Each article begins with a top-level "# " heading. The manifest listing all sections is at https://hub.synerise.com/llms-full.txt
# Web push with voucher and promotion for different categories
This use case highlights the functionality provided by Synerise through web push notifications - with a keen focus on user engagement and conversion, Synerise introduces a possibility to add two buttons to a web push campaign. These buttons not only act as navigation tools, directing users to the online store, but also serve as triggers, offering a tailored and interactive experience.
This campaign focuses on a targeted approach aimed at users, who have visited specific category, but have not yet made a purchase. The web push notification will highlight special active promotions in the women’s category, which, in our case, will include jewelry and watches. However, this targeting can be customized based on various criteria, such as previously viewed categories (e.g., men/women), where dynamic content placed on the page, which the web push button redirects to, adapts to show relevant promotions based on the visited category. It can also be tailored to other specific user segments, offering flexibility to match our needs.
The campaign described in this specific use case, involves adding two buttons, each associated with a unique listing of products: "watches" and "jewelry" for women. After clicking these buttons, users will go to a specific category page where dynamic content with the unique voucher will be displayed.
What is important you can enrich this use case using personalized recommendations, promotional recommendations or instead add the link to dedicated landing page with personalized promotions.
**Data Modeling Hub > Voucher Pools > Add pool**.
2. On the pop-up, fill in the following fields:
1. In the **Pool name** field, enter the name of the pool (the name is only visible on the list of the voucher pools).
2. Optionally, from the **Barcode** type dropdown list, select the type of codes which will be imported in the CSV file to Synerise.





curl --location --request POST 'https://{SYNERISE_API_BASE_PATH}/automation-endpoint/endpoints/END_ID/trigger' \
--header 'Content-Type: application/json' \
--data-raw '{
"opinion": "Great company",
"email": "xyz@test.com"
}'
6. When the endpoint receives data from the request, verify the list of variables. If the variables include those which are in the payload (in this case, opinion and email), click **Define**. If not, click **Start again** re-send request, and wait for the results.
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [
{ name: "Send to Synerise ", functionName: "doGet" },
];
ss.addMenu("Export to Synerise", menuEntries);
}
function doGet() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var range = sheet.getRange(2, 1, 1000, 2); // 1000 is number of last row
var values = range.getValues();
for (var row in values) {
if (values[row][0].length != 0 && values[row][1].length != 0) {
var obj = {};
obj.email = values[row][0]
obj.opinion = values[row][1]
UrlFetchApp.fetch('#insert_endpoint_URL_here#', {
"method": "post",
payload: JSON.stringify(obj), headers: { "content-type": "application/json" }
})
}
}
}
5. To save the script, in the program controls bar, click the disk icon.
6. In the menu on the left side, click the clock icon > **Triggers** .
7. In the right bottom corner, click the **Add Trigger** button.
8. Configure as below:
{
"label":"customer made an opinion about company",
"client":{
"email":"{{ request.body.email }}"
},
"action":"company.opinion",
"params":{
"opinion":"{{ request.body.opinion }}"
}
}
{% voucher assign=false %} pool-uuid {% endvoucher %}
`{{ automationPathSteps['voucherCheck'].event.params.voucherCode }}`
Note that `voucherCheck` is the name of the **Event Filter** trigger added manually.
{"code":"{{ automationPathSteps['transactionCode'].event.params.discountCode }}"}
Note that `transactionCode` is the name of the **Profile Event** trigger added manually.
In this Jinjava we reference to code that has been used. Because this code was assigned in the first workflow to the user who shares it, the voucherCode.redeemed event (which is the result of using this API request) is assigned to the profile of the person who shares the code. Such configuration is crucial for the [third workflow](#create-third-workflow) which sends out reward discount code which is based on the `voucherCode.redeemed` event.
3. Confirm by clicking **Apply**.
{
"label": "Order delivered",
"action": "order.delivered",
"client": {
"email": "john.doe@test.com"
},
"params": {
"orderId": "1988100"
}
}
In the Sender details section, select the email account from which the email will be sent.
In the Content section, select the email template.
In the email subject, you can insert information about order ID, which is retrieved from the Profile Event trigger. Insert the `{{ automationPathSteps['OrderDelivered'].event.params.orderId }}` snippet, which will display as the order ID . Note that `OrderDelivered` is the name of the Profile Event trigger added manually.
In the UTM & URL parameters section, add the parameters to your email.
Confirm by clicking Apply.




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 HubSpot. The system waits for the incoming request for 1 minute and 30 seconds.
Replace the endpoint URL from the example below with the endpoint URL from step 4.
An example of cURL request:
curl --location 'https://api.synerise.com/automation-endpoint/endpoints/112ae31f-1a3e-4729-89ae-3b37eb7475f4/trigger' \ --header 'Content-Type: application/json' \ --data-raw '{ "associated-company": { "company-id": 43535242, "portal-id": 123413, "properties": { "address": { "value": "NYC 123 Main Street, US" }, "city": { "value": "NEW YORK" }, "cliente": { "value": "123413" }, "closedate": { "value": "1519039262794" }, "country": { "value": "USA" }, "createdate": { "value": "1519038967696" }, "associated-owner": { "email": "joedoetesthb@example.com", "first-name": "", "hubspot-user-id": 123454321, "last-name": "", "type": "PERSON" } , "canonical-vid": 11 } } }'Navigate to the Workflows in the HubSpot and create a new workflow that will send a webhook with the selected clients segments to Synerise.
[
{
"email": "{{request.body['associated-company'].properties['associated-owner'].email }}",
"city": "{{request.body['associated-company'].properties.city.value}}",
"attributes": {
"closedDate":"{{request.body['associated-company'].properties.closedate.value}}",
"createdate": "{{request.body['associated-company'].properties.createdate.value}}"
},
"tags": [
"hubspot integration"
]
}
]
<!-- Content for users with woman attribute value -->
{% if customer.user_gender == "woman" %}
Check new woman collection
<!-- Content for users with man attribute value -->
{% elif customer.user_gender == "man" %}
Check new man collection
<!-- Content for users without such attribute -->
{% else %}
Check new collection
{% endif %}
3. Optionally, you can define settings in OS tabs. Select the OS for which your notification is dedicated, if you create a template for both OS, fill out the settings in both tabs: **iOS** and **Android**.
4. In the **Action type** section, define what happens when the customer clicks the notification, choose **Deep linking** or **Open URL**. Use the same code as in the **Message** field:
<!-- Content for users with woman attribute value -->
{% if customer.user_gender == "woman" %}
Check new woman collection
<!-- Content for users with man attribute value -->
{% elif customer.user_gender == "man" %}
Check new man collection
<!-- Content for users without such attribute -->
{% else %}
Check new collection
{% endif %}
5. If your template is ready, click **Next**.
The expression creates the following logic:
The logic in the expression compares the number of products purchased after the last finished quest to the target amount, which is 10 units needed to complete the quest. There are two possible scenarios:
If the number of products purchased in a single transaction exceeds the target of 10, the surplus is not carried over to the next quest.
The expression will produce one of two results based on certain conditions:
{
"gameName": "Towel's quest"
}
2. Confirm by clicking **Apply**.
{
"gameName": "Towel's quest",
"points": 1000
}
2. Confirm by clicking **Apply**.
{
"current_status": " {% expression %} 1c92f585-3342-4fbd-af05-93f53ebe5882 {% endexpression %} ",
"description": "Buy 10 product from towels category and get 1000 loyalty points",
"format": "stamps",
"image": "https://ecommerce.pl/media/catalog/product/towels/1/image/9df78eab33525d08d6e5fb8d27136e95/94989/regina-wish-recznik-papierowy-bialy-2-rolki-reczniki-papierowe-artykuly-higieniczne_0.jpg",
"name": "Towels",
"prize": "1000",
"prizeType": "points",
"target": "{% expression %} 930673cb-28d2-4a81-9100-7306bdfcce86 {% endexpression %}",
"visibility": "1"
}
In the `current_status` and `target` parameters, we are referring to the expressions created earlier in the process. The `current_status` expression returns the actual number of products bought by the client, while the `target` expression determines the number of products needed to complete the quest.
5. Save by clicking **Apply**.


{
"time": "x",
"label": "x",
"action": "x",
"client": {
"uuid": "xxx-xxx-xxx"
},
"params": {
"temp1": "x",
"temp2": "x",
"temp3": "x",
"temp4": "x"
}
}
2. When our devices are configured and they are sending data to this URL we can start to create an automation.
3. Automations allow us to convert received data into events on our device cards.
- We use business events as a trigger, which means that our automation will be triggered every time our end point receives some data. So, when one of our devices sends any data, our automation will be triggered.
- Then it will send outgoing webhooks. And here in the body of our outgoing webhook, we use Jinjava in order to get information about the values of these particular parameters.
#### Case 1: Making smart alerts about temperature deviation problems
1. Go to **Automation Hub > Workflow > New workflow.**
2. Start with the **Profile Event** trigger and in the settings of the node, select the **custom.temp** event. This automation is triggered every time this event appears on the profile card.
3. Choose **Update Profile** action. Update the device status to online because when the device is sending data, that means it's online.
4. Choose **Profile Filter**. In this step we check if the average of the last 4 measurements was between 10 and 15 degrees. Because let's assume that this is the temperature that we want to have.
5. If **Profile Filter** is **matched** add **Update Profile** node. In settings define that it should updating a temperature status into “in scale” and then the automation is ending with **End node**.
6. But when our average temperature falls below 10 degrees or moves above 15 degrees, our automation will go with a different path. If **Profile Filter** is **not matched** add some **Delay node**.
7. Next, add another **Profile Filter** in which we check if the last temperature status was “in scale”. We do it for the purpose of capping.

{% recommendations3 campaignId=nBzlR4BQtyvD %}
{% set item = recommended_products3[0] %}
{
"label": "Webpush recommendation",
"client": {
"id": {{ customer.id }}
},
"action": "webpush.recommendation",
"params": {
"title": "{{ item.title }}",
"imageLink": "{{ item.imageLink }}",
"link": "{{ item.link }}"
}
}
{% endrecommendations3 %}
Where:
- The `campaignId=nBzlR4BQtyvD` is the Id of the recommendation campaign you created earlier [in this step](/use-cases/webpush-with-recommended-products#create-personalized-recommendation-campaign).
- All params contain information about recommended product are used in the [webpush template](/use-cases/webpush-with-recommended-products#create-a-web-push-template).
6. Click **Apply**.


{
"points": " {% expression %} a7d340ac-906d-49af-83a1-fbe4015bc76f {% endexpression %} ",
}
The result of such action will be such an event:
{
"query": "{{event.params.query}}",
"limit":6
}
**Where:**
| Phrase | Explanation |
|------------ |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `query` | this is the phrase the customer used in their search, taken from the event triggering the workflow -

<!-- Opening the tag that retrieves the value from recommendation prepared in point 1--> {% recommendations3 campaignId=xxx %} for loop below: <!-- In the section {% for r in recommended_products3 %} a {% endfor %} there is access to all variables from a given object (products here) - which parameters you add to the template depends on you. --> {% for r in recommended_products3 %} <!-- {{ r.itemId }} {{ r.title }} {{ r.imageLink }}{{r.price.value}}{{r.salePrice.value}} - parameters taken from the recommendation. The itemId is a standard name, but others (like category, price, salePrice, title, imageLink) only depend on names defined in the feed--> {{r.itemId}} {{r.title}} {{r.imageLink}} {{r.price.value}} {{r.salePrice.value}} {% endfor %} <!-- Closing of the tag that gets the value from the recommendation prepared in point 1 --> {% endrecommendations3 %}




{% aggregate 6b686d01-758f-328a-859b-91e3542c5bbe %} {{ aggregate_result[0] }} {% endaggregate %}
{% set mainShop = customer.StoreId %}
{% catalogitemv2.UC-ShopsSale11092023(mainShop) %}
Get ready for shopping at your favorite local spot, {{ catalog_result.StoreName }}! 🌟
🎁 Enjoy jaw-dropping discounts of up to 30% off on absolutely everything in-store!
📍 Find us at {{ catalog_result.Street }} in the heart of {{ catalog_result.City }}.
{% endcatalogitemv2 %}
Where:
- `StoreId` - the name of the attribute assigned to the user profile reflecting the store ID,
- `UC-ShopsSale11092023` - is the name of the created catalog,
- `StoreName`, `Street`, `City` - are the names of the columns defined in the catalog.














{
"itemKey": "{{client.phone}}",
"value": {
"id": "{{client.id }}",
"phone": "{{client.phone}}"
}
}
5. As the authorization method, select **by API key**.




<div class="in-app-wrapper bottom_bar"> <div class="in-app-close"> <svg viewBox="0 0 24 24" class="close-m"> <path fill="none" d="M0 0h24v24H0z"></path> <path d="M13.06 12l4.72-4.72a.75.75 0 00-1.06-1.06L12 10.94 7.28 6.22a.75.75 0 00-1.06 1.06L10.94 12l-4.72 4.72a.75.75 0 101.06 1.06L12 13.06l4.72 4.72a.75.75 0 001.06-1.06z"> </path> </svg> </div> <div class="in-app-content"> <p class="in-app-title">Do you like our products?</p> <p class="in-app-subtitle">Let us know your taste 🔥</p> </div> </div>@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;900&display=swap"); .in-app-wrapper.bottom_bar { margin: 15px; background-color: whitesmoke; height: 95px; border-radius: 30px; box-shadow: 0 0px 10px 0 rgba(35, 41, 54, 0.2); display: flex; flex-direction: column; flex-wrap: nowrap; align-content: center; justify-content: center; align-items: center; } .in-app-close { cursor: pointer; position: absolute; padding: 10px; top: 15px; right: 15px; } .in-app-close svg { width: 32px; height: 32px; } .in-app-content { text-align: center; } .in-app-title { margin: 0; font-weight: 600; font-size: 20px; margin-bottom: 2px; font-family: "Nunito", sans-serif; } .in-app-subtitle { margin: 0; font-size: 14px; font-family: "Nunito", sans-serif; }(function () { var inApp = document.querySelector('.in-app-wrapper.bottom_bar'); var close = inApp.querySelector('.in-app-close'); close.addEventListener('click', function () { SRInApp.close(); }) var content = inApp.querySelector('.in-app-content'); content.addEventListener('click', function () { SRInApp.close(); setTimeout(function() { SRInApp.trackCustomEvent('preferences.trigger', {}, 'Preferences trigger event'); }, 0) }) })();
<div class="in-app-close" style="width: 100%;text-align: right;width: 90%;"> <svg viewBox="0 0 24 24" class="close-m"> <path fill="none" d="M0 0h24v24H0z"></path> <path d="M13.06 12l4.72-4.72a.75.75 0 00-1.06-1.06L12 10.94 7.28 6.22a.75.75 0 00-1.06 1.06L10.94 12l-4.72 4.72a.75.75 0 101.06 1.06L12 13.06l4.72 4.72a.75.75 0 001.06-1.06z"> </path> </svg> </div> <div class="frame"></div> <div class="icons"> <svg id="hate" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128.07 127.89"> <path class="a" d="M128.07,64.07c-.5,36.31-28,63.57-64,63.82S-.17,99.33,0,63.29C.17,28.25,29.23-.3,64.43,0A63.88,63.88,0,0,1,128.07,64.07ZM45.32,38.54c-2.44.36-4.63,1.12-6,3.68a6.39,6.39,0,0,0,.94,7.83A143,143,0,0,0,50.42,60.36c2.73,2.48,3.44,4.31.2,7a98.44,98.44,0,0,0-9.52,9.53c-3.62,4-3.66,7.48-.47,10.59,2.82,2.76,7.12,2.54,10.7-.79,3.05-2.83,5.91-5.86,8.85-8.8,2.58-2.57,5.16-2.53,7.73,0,2.83,2.81,5.62,5.67,8.52,8.42,3.87,3.68,8.08,4.08,11,1.15,3.23-3.21,3-6.85-.83-11C83.57,73.21,80.44,70,77.1,67c-2.37-2.13-2.71-3.65-.13-5.91,3.24-2.85,6.15-6.08,9.2-9.15,4.17-4.2,4.66-8,1.45-11.34-2.93-3-7.58-2.61-11.49,1.19-3.34,3.25-6.66,6.52-9.85,9.91-1.64,1.74-2.85,1.73-4.49,0-3.32-3.5-6.84-6.81-10.21-10.26A9,9,0,0,0,45.32,38.54Z" /> <path d="M45.32,38.54a9,9,0,0,1,6.26,2.87c3.37,3.45,6.89,6.76,10.21,10.26,1.64,1.73,2.85,1.74,4.49,0,3.19-3.39,6.51-6.66,9.85-9.91C80,38,84.69,37.52,87.62,40.57c3.21,3.34,2.72,7.14-1.45,11.34-3,3.07-6,6.3-9.2,9.15-2.58,2.26-2.24,3.78.13,5.91,3.34,3,6.47,6.24,9.53,9.52,3.87,4.16,4.06,7.8.83,11-2.95,2.93-7.16,2.53-11-1.15-2.9-2.75-5.69-5.61-8.52-8.42-2.57-2.54-5.15-2.58-7.73,0-2.94,2.94-5.8,6-8.85,8.8-3.58,3.33-7.88,3.55-10.7.79-3.19-3.11-3.15-6.6.47-10.59a98.44,98.44,0,0,1,9.52-9.53c3.24-2.72,2.53-4.55-.2-7A143,143,0,0,1,40.28,50.05a6.39,6.39,0,0,1-.94-7.83C40.69,39.66,42.88,38.9,45.32,38.54Z" /> </svg> <svg id="like" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128.06 127.99"> <path class="a" d="M128.06,63.83a63.65,63.65,0,0,1-64,64.16A63.57,63.57,0,0,1,0,64a64,64,0,0,1,128.06-.13ZM96,56.53c0-5.82-3.9-13.3-10.19-16.05-6.9-3-13.67-2.67-19.37,2.82-2,1.9-3.16,1.41-4.93-.17-2.34-2.08-4.86-3.89-8.25-4.24-9.13-.92-15.31,2.3-19.11,10.25-3.89,8.11-2.42,17.27,4,23.34,7.5,7,15.22,13.88,22.77,20.89,2.06,1.92,3.76,2.27,6,.21C74.36,86.7,82,80,89.39,73.09,93.57,69.21,96.06,64.45,96,56.53Z" /> <path d="M96,56.53c.08,7.92-2.41,12.68-6.59,16.56C82,80,74.36,86.7,66.93,93.58c-2.23,2.06-3.93,1.71-6-.21-7.55-7-15.27-13.84-22.77-20.89-6.46-6.07-7.93-15.23-4-23.34,3.8-8,10-11.17,19.11-10.25,3.39.35,5.91,2.16,8.25,4.24,1.77,1.58,2.95,2.07,4.93.17,5.7-5.49,12.47-5.84,19.37-2.82C92.08,43.23,96,50.71,96,56.53Z" /> </svg> </div>@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;900&display=swap"); html, body { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; overflow: hidden; font-family: "Nunito", sans-serif; background-color: rgba(0, 0, 0, 0.4); } .frame { position: relative; width: 90%; height: 70%; max-width: 400px; max-height: 600px; z-index: 1; } .icons { margin-top: 3vh; user-select: none; z-index: 1; } .icons>svg { width: 10vh; height: 10vh; max-width: 60px; max-height: 60px; border-radius: 50%; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); cursor: pointer; } .icons>svg:nth-child(1) { fill: #fb4f68; margin-right: 2vh; } .icons>svg:nth-child(2) { fill: #4dca93; } .icons>svg>path:nth-child(1) { fill: #fff; } .card { background-color: #fff; position: absolute; display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 100%; color: #f1f1f1; border-radius: 10px; user-select: none; cursor: pointer; overflow: hidden; background-size: cover; background-repeat: no-repeat; background-position: center; touch-action: none; } .card .is-like { width: 100%; height: 100%; position: absolute; opacity: 0; } .card .is-like::after { position: absolute; left: 50%; bottom: 30%; transform: translateX(-50%) rotate(-10deg); width: 30%; height: 13%; font-size: 3em; letter-spacing: 0.2em; font-weight: 600; border-radius: 0.15em; display: flex; align-items: center; justify-content: center; } .card .like::after { content: "👍"; } .card .nope::after { content: "👎"; } .card .bottom { width: 100%; height: 25%; background: linear-gradient(to top, #000000b8, #00000000); display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding-left: 7%; font-weight: 400; padding-bottom: 25px } .card .bottom .title>span:nth-child(1) { font-size: 2em; font-weight: 700; margin-right: 0.2em; } .card .bottom .title>span:nth-child(2) { font-size: clamp(13px, 1.5em, 25px); } .card .bottom .title>span:nth-child(2)>b { font-size: 0.6em; margin-right: 0.2em; } .card .bottom .info { margin: 0; } @media screen and (max-height: 540px) { .frame { width: 90%; height: 70%; font-size: 13px; } } @media screen and (max-height: 440px) { .frame { font-size: 8px; } } .in-app-close svg { width: 32px; height: 32px; cursor: pointer; background-color: #000; fill: #fff; } .in-app-close { max-width: 400px; margin-bottom: 16px; }let imgCount = 0; const data = {% set arr = [] %}{% recommendations3 campaignId=CAMPAIGN-ID %}{% for p in recommended_products3 %}{% set obj = {itemId: p.itemId, img: p.image_link, name: p.title, price: p.price, distance: p.category} %}{% do arr.append(obj) %}{% endfor %}{{arr|tojson}}{% endrecommendations3 %} const frame = document.body.querySelector(".frame"); data.forEach((_data) => appendCard(_data)); let current = frame.querySelector(".card:last-child"); let likeText = current.children[0]; let startX = 0, startY = 0, moveX = 0, moveY = 0; document.querySelector("#like").onclick = () => { moveX = 1; moveY = 0; complete('like'); }; document.querySelector("#hate").onclick = () => { moveX = -1; moveY = 0; complete('hate'); }; function appendCard(data) { const firstCard = frame.children[0]; const newCard = document.createElement("div"); newCard.className = "card"; newCard.setAttribute('data-sku', data.itemId); newCard.setAttribute('data-brand', data.name); newCard.setAttribute('data-title', data.distance); newCard.style.backgroundImage = `url(${data.img})`; newCard.innerHTML = `
LIKE
${data.name}
${data.price}zł
${data.distance}
`; if (firstCard) frame.insertBefore(newCard, firstCard); else frame.appendChild(newCard); imgCount++; } function initCard(card) { card.addEventListener("pointerdown", onPointerDown); } function setTransform(x, y, deg, duration) { current.style.transform = `translate3d(${x}px, ${y}px, 0) rotate(${deg}deg)`; likeText.style.opacity = Math.abs((x / innerWidth) * 2.1); likeText.className = `is-like ${x > 0 ? "like" : "nope"}`; if (duration) current.style.transition = `transform ${duration}ms`; } function onPointerDown({ clientX, clientY }) { startX = clientX; startY = clientY; current.addEventListener("pointermove", onPointerMove); current.addEventListener("pointerup", onPointerUp); current.addEventListener("pointerleave", onPointerUp); } function onPointerMove({ clientX, clientY }) { moveX = clientX - startX; moveY = clientY - startY; setTransform(moveX, moveY, (moveX / innerWidth) * 50); } function onPointerUp() { current.removeEventListener("pointermove", onPointerMove); current.removeEventListener("pointerup", onPointerUp); current.removeEventListener("pointerleave", onPointerUp); if (Math.abs(moveX) > frame.clientWidth / 2) { current.removeEventListener("pointerdown", onPointerDown); complete(String(moveX).match('-') ? 'hate' : 'like'); } else cancel(); } function complete(type) { try { const flyX = (Math.abs(moveX) / moveX) * innerWidth * 1.3; const flyY = (moveY / moveX) * flyX; setTransform(flyX, flyY, (flyX / innerWidth) * 50, innerWidth); SRInApp.trackCustomEvent('preferences.action', { actionType: type, itemId: current.getAttribute('data-sku'), title: current.getAttribute('data-title'), brand: current.getAttribute('data-brand') }, 'Preferences action'); const prev = current; const next = current.previousElementSibling; if (next) initCard(next); current = next; likeText = current.children[0]; // appendCard(data[imgCount % 4]); setTimeout(() => frame.removeChild(prev), innerWidth); } catch(error) { document.querySelector('body').style.backgroundColor = 'rgba(0, 0, 0, 0.6)'; document.querySelector('body').innerHTML = '<h1 style="color: #fff; width: 90%; max-width: 400px;">Thank you!<br>We will reach out to you</h1>'; setTimeout(function(){ SRInApp.close(); }, 3000) } } function cancel() { setTransform(0, 0, 0, 100); setTimeout(() => (current.style.transition = ""), 100); } var close = document.querySelector('.in-app-close svg'); close.addEventListener('click', function () { SRInApp.close(); }) initCard(current);
To create an aggregate with product rejected by the customer, duplicate the aggregate created above and change the value of the parameter to `hate`.

In the Type and limits section of specific promotion - in the Priority field, enter a number that defines the promotion’s priority.
Priority controls the display order in the customer’s view. 1 is the highest. If multiple applicable promotions share the same priority, the one created earlier will be shown first.










{ "name": "Top Products", "recommendations": "{% recommendations_json3 campaignId=COhsCCOdu8Cg %} {% endrecommendations_json3 %}" } Where "campaignId" is the ID of your recommendation.



{
"time": "",
"label": "refer a friend points",
"action": "points.upcharge",
"client": {
"id": {{event.params['body.customers[0].id']}}
},
"params": {
"points": {% expression %} f05e644c-7009-49d0-9208-18e9319af4a5 {% endexpression %},
"description": "referral_points"
}
}
7. In the **Authorization** section, select **by API key** as your method of authorization.
1. From the dropdown list below, select your **API key**.
8. Click **Apply**.
### Add the End node
1. On the **Outgoing Integration** node, click the plus button.
2. From the dropdown list, select **End**.
3. Save and activate the automation by clicking **Save&Run**.
{ "notification": { "title": "You have earned 500 points!", "body": "Congratulations!!! You just earned 500 points for the registration of a new referred user!", "sound": "default", "priority":"high" }, "data": { "issuer": "Synerise", "message-type": "static-content", "content-type": "simple-push", "content": { "notification": { "action": { "type": "OPEN_APP" } } }, "payload": { "type": "points-earned", "pointsReward": "{% expression %} f05e644c-7009-49d0-9208-18e9319af4a5 {% endexpression %}", "title": "You have earned 500 points!", "subtitle": "Thank you for being with us!", "description": "You receive 500 points for the registration of a new user. You can earn {% expression %} 819f23f5-4f97-4039-b3ef-eb83130ac7c6 {% endexpression %} more points for the registration of additional users in the application." } } }
{ "variables": [ { "name": "storeId", "value": "{ customer storeId %}" } ] }
{# Here we retrieve the results of reports from previous nodes #} {% set raport1 = automationPathSteps['data1'].event.params['body.data[0].values[0]'] %} {% set allRaports = [raport1] %} {# We iterate over retrieved reports and add arrays of skus of products from them to the skusArrays #} {% set skusArrays = [] %} {%- for raport in allRaports -%} {% set arr = [] %} {%- for entry in raport -%} {% do arr.append(entry.name[0]) %} {%- endfor -%} {% do skusArrays.append(arr) %} {%- endfor -%} {% set finalArr = [] %} {%- for skuArr in skusArrays -%} {%- for sku in skuArr -%} {%- if finalArr|length < 10 -%} {% catalogitemv2.store-1(sku) allowEmpty=True %} {% set prod = catalog_result %} {%- if prod.name and prod.brand -%} {#Here we can add conditions to check#} {%- do finalArr.append({ 'sku': sku, 'name': prod.name, 'productUrl': prod.productUrl, 'price': prod.price, 'brand': prod.brand.label }) -%} {%- endif -%} {% endcatalogitemv2 %} {%- endif -%} {%- endfor -%} {%- endfor -%} {% set data = [] %} {# Here we set the final object to send #} {%- for promotion in finalArr -%} {% do data.append({ "client": { "customId": "{% customer StoreId %}" }, "label": "Magic products", "action": "magic.products", "type": "custom", "params": promotion, }) %} {%- endfor -%} {# We convert the object to JSON and this is the body of our request #} {% if data|length > 0 %} {{ data|tojson }} {% else %} {{ [{ "client": { "customId": "{% customer StoreId %}" }, "label": "Magic products", "action": "magic.products", "type": "custom", "params": { "alert": "No products matched the conditions" } }] | tojson }} {% endif %}
(function(){ var availableMetrics = []; //Adding metric prepared in point 1.1 var firstMetricsVal = "{% socialproof %} xxx {% endsocialproof %}"; //Adding metric prepared in point 1.2 var secondMetricsVal = "{% socialproof %} xxx {% endsocialproof %}"; //Adding variant text for 1st metric one for person var textFirstMetricOnePerson = 'person is watching this product now.'; //Adding variant text for 1st metric for few people var textFirstMetricPeople = 'people are watching this product now.'; //Adding variant text for 2nd metric for person var textSecondMetricOnePerson = 'sold in the last 1 hour.'; //Adding variant text for 2nd metric for few people var textSecondMetricPeople = 'sold in the last 1 hour.'; function handleCounterText(val, variantA, variantB) { if (val.length === 1) { let finalVariant = getWordVariant(+val, variantA, variantB); return `${val} ${finalVariant}`; } else { let lastNumber = val.slice(-1); let finalVariant = getWordVariant(+lastNumber, variantA, variantB); return `${val} ${finalVariant}`; } } function getWordVariant(num, variantA, variantB) { if (num == 1) { return variantA; } else { return variantB; } } var firstMetrics = `
`; var secondMetrics = `
`; if (firstMetricsVal >= 1) { availableMetrics.push(firstMetrics); } if (secondMetricsVal >= 1) { availableMetrics.push(secondMetrics); } var wrapper = document.querySelector('#synerise-social-proof-place'); wrapper.style.position = "fixed"; var availableMetricsCounter = 0; setInterval(function() { if (document.querySelector('#synerise-social-proof') !== null&&document.querySelector('#synerise-social-proof>p')){ wrapper.removeChild(document.querySelector('#synerise-social-proof')); }; wrapper.insertAdjacentHTML('beforeend', availableMetrics[availableMetricsCounter]); if (availableMetrics.length === 1) { return; } if (availableMetricsCounter >= availableMetrics.length - 1) { availableMetricsCounter = 0; } else { availableMetricsCounter++; } }, 3000); })()(function(){ //Adding metric prepared in point 1.1 var firstMetricsVal = "{% socialproof %} xxx {% endsocialproof %}"; //Adding metric prepared in point 1.2 var secondMetricsVal = "{% socialproof %} xxx {% endsocialproof %}"; //Adding variant text for 1st metric one for person var textFirstMetricOnePerson = 'person is watching this product now.'; //Adding variant text for 1st metric for few people var textFirstMetricPeople = 'people are watching this product now.'; //Adding variant text for 2nd metric for person var textSecondMetricOnePerson = 'sold in the last 1 hour.'; //Adding variant text for 2nd metric for few people var textSecondMetricPeople = 'sold in the last 1 hour.'; function handleCounterText(val, variantA, variantB) { if (val.length === 1) { let finalVariant = getWordVariant(+val, variantA, variantB); return `${val} ${finalVariant}`; } else { let lastNumber = val.slice(-1); let finalVariant = getWordVariant(+lastNumber, variantA, variantB); return `${val} ${finalVariant}`; } } function getWordVariant(num, variantA, variantB) { if (num == 1) { return variantA; } else { return variantB; } } var firstMetrics = `
`; var wrapper = document.querySelector('#synerise-social-proof-place'); wrapper.style.position = "fixed"; if(firstMetricsVal >=1||secondMetricsVal >= 1){ if (document.querySelector('#synerise-social-proof') !== null){ wrapper.removeChild(document.querySelector('#synerise-social-proof')); }; wrapper.insertAdjacentHTML('beforeend',firstMetrics ); } })()










Below you will find cURL with a ready request, which you can use in the Postman tool, where:
curl --location --request POST 'https://api.synerise.com/v4/clients/batch' \ --header 'Accept: application/json' \ --header 'Api-Version: 4.4' \ --header 'Authorization: Bearer xxx' \ --header 'content-type: application/json' \ --data-raw '[ { "customId": "Insert a voucher pool ID here", "firstName": "Insert a voucher pool name", "agreements": { }, "attributes": { "voucherpool_id": "Insert a voucher pool ID here" }, "tags": [ "voucher_campaign" ] } ]' In this code we used the specific method from our API. Read also about the authorization process.
Send this request as many times as you need, just changing the `voucherpool_id`, `firstName`, and `customId` parameters. The voucher pools created in Behavioral Data Hub > Profiles will be available on the list of unrecognized profiles.
{%set link = "https://app.synerise.com/assets/vouchers/pools/*/coupons"%}
<p>{{customer.firstname}},</p>
<h1> Alert for Voucher pool: {{customer.firstname}} </h1>
<p> Remaining: {{ event.params['voucherCount'] }} vouchers </p>
<a href='{{link|replace("*",customer.voucherpool_id)}}'>
<p> Link to voucher pool {{customer.firstname}} </p></a>
5. Adjust the design of the template according to your needs.
6. Save the template.
## Create a workflow
---
In this step create a workflow which sends the email alert if the number of codes in a voucher pool is lower than 500.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
### Configure the Audience node
---
In this part of the process, select the audience for which you will run this campaign - all vouchers added as profiles. In our case, we start the workflow everyday at 7 A.M., for profiles (voucher pools) who has the `voucherpool_id` parameter defined.
<!-- candidates -->
{% set NEWSLETTER = {"name": "NEWSLETTER", "expression":0, "metric":0} %}
{% set MOBILE_PUSH = {"name": "MOBILE_PUSH", "expression":0, "metric":0}%}
{% set CANDIDATES = [NEWSLETTER, MOBILE_PUSH]%}
<!-- value assignment -->
{% expressionvar 37368423-6210-4ee4-bd67-5e2143544576 %}{% do
NEWSLETTER.update({"expression": expression_result})%}{%endexpressionvar%}
{metricsvar metric_id:550060f2-4feb-a6a5-46e8ad01b8ac%}{%do
NEWSLETTER.update({"metric_result})%}{% endmetricsvar %}
{% expressionvar 6e3206d9-708a-4fc5-bfe4-88fea18da90f %}{% do
MOBILE_PUSH.update({"expression_result})%}{% endexpressionvar %}
{% metricsvar metric_id:85651a3a-5163-4b1f-971a-4109e83bf753 %}{% do
MOBILE_PUSH.update ({"metric":metric_result})%}{% endmetricsvar %}
<!-- candidates by expression-->
{set expression_winners = [] %}
{% for candidat in CANDIDATES %}
{% if candidat["expression"] > candidat ["metric"] %}
{% do expression_winners.append(candidat)%}
{% endif %}
{% endfor %}
<!-- print winner-->
{% if expression_winners|count !=0 %}
{% set winner = expression_winners|sort(true, true, 'expression')|first %}
{% else %}
{% set winner = CANDIDATES|random %}
{% endif %}
{{winner}}
Everything here is based on jinjava, which produced the event at the very end of this calculation. Based on that we can actually select the segment in which we want to send the message automatically.
## Generated events
This use case does not generate any events.
## Read more
---
- [Aggregates](/docs/crm/aggregates/introduction-to-aggregates)
- [Automation Hub](/docs/automation)
- [Basic optimizer configuration](/use-cases/campaign-optimizer)
- [Build segmentation](/docs/analytics/segmentations/creating-segmentations)
- [Expressions](/docs/crm/expressions)
- [Metrics](/docs/analytics/metrics)
# Cloning Complex Analyses and Segmentations Across Workspaces
For organizations operating in multiple workspaces, transferring analytics from one workspace to another can be challenging and time-consuming, especially when the analytics involved are complex and interdependent. The Synerise's clone feature is designed to alleviate these difficulties by streamlining the transfer process and ensuring that all dependencies and mapping relationships are maintained.
In this use case, we delve into a practical implementation of cloning RFM segmentation analytics that requires the transfer of a complex, nested analysis. Using cloning, we ensure that all necessary dependencies are maintained, and mapping conflicts are resolved in a timely and efficient manner.
You will find a detailed guide on how to create a RFM analysis in [this use case](/use-cases/rfm-analysis).



















icon.
7. For the following segments, add the conditions listed below:
- For the 400 segment: more than the value of the `0.20` quantile **AND** less than `0.40` quantile
- For the 300 segment: more than the value of the `0.40` quantile **AND** less than `0.60` quantile
- For the 200 segment: more than the value of the `0.60` quantile **AND** less than `0.80` quantile
- For the 100 segment: less than the value of the `0.80` quantile **AND** segment of loyal customers **AND** add the **transaction.charge** event with the **Lifetime** time range.
icon.
7. For the following segments, add the conditions listed below:
- For the 40 segment: more than the value of the `0.60` quantile **AND** less than `0.80` quantile
- For the 30 segment: more than the value of the `0.40` quantile **AND** less than `0.60` quantile
- For the 20 segment: more than the value of the `0.20` quantile **AND** less than `0.40` quantile
- For the 10 segment: less than the value of the `0.20` quantile **AND** segment of loyal customers **AND** add the **transaction.charge** event with the **Lifetime** time range.
icon.
7. For the following segments, add the conditions listed below:
- For the 4 segment: more than the value of the `0.60` quantile **AND** less than `0.80` quantile
- For the 3 segment: more than the value of the `0.40` quantile **AND** less than `0.60` quantile
- For the 2 segment: more than the value of the `0.20` quantile **AND** less than `0.40` quantile
- For the 1 segment: less than the value of the `0.20` quantile **AND** add the **transaction.charge** event with the **Lifetime** time range.
icon.
7. Repeat steps from 3 to 7 for the rest of the categories.
"constant": {% metricsvar metric_id:97488c6a-746e-42fc-a1ca-b2fb4b8dfa94%}{{ metric_result|round(3,'floor') }} {% endmetricsvar %}
{ "analysis": { "title": "[UC] RFM - Recency Score", "description": "", "segments": [ { "title": "500", "description": "", "filter": { "matching": true, "expressions": [ { "name": "", "type": "ATTRIBUTE", "matching": true, "attribute": { "expressions": [ { "constraint": { "type": "NUMBER_ONE", "logic": "LESS", "value": { "type": "CONSTANT", "constant": {% metricsvar metric_id:97488c6a-746e-42fc-a1ca-b2fb4b8dfa94%}{{ metric_result|round(3,'floor') }} {% endmetricsvar %} } }, "attribute": { "type": "EXPRESSION", "id": "73d13360-2074-463c-9978-79861889dff0" } } ] } } ], "expression": { "name": "", "type": "ATTRIBUTE", "matching": true, "attribute": { "expressions": [ { "constraint": { "type": "NUMBER_ONE", "logic": "LESS", "value": { "type": "CONSTANT", "constant": {% metricsvar metric_id:97488c6a-746e-42fc-a1ca-b2fb4b8dfa94%}{{ metric_result|round(3,'floor') }} {% endmetricsvar %} } }, "attribute": { "type": "EXPRESSION", "id": "73d13360-2074-463c-9978-79861889dff0" } } ] } } }, "profileMetrics": [] }, { "title": "400", "description": "", "filter": { "matching": true, "expressions": [ { "name": "", "type": "ATTRIBUTE", "matching": true, "attribute": { "expressions": [ { "constraint": { "type": "NUMBER_ONE", "logic": "MORE_OR_EQUAL", "value": { "type": "CONSTANT", "constant": {% metricsvar metric_id:97488c6a-746e-42fc-a1ca-b2fb4b8dfa94%}{{ metric_result|round(3,'floor') }} {% endmetricsvar %} } }, "attribute": { "type": "EXPRESSION", "id": "73d13360-2074-463c-9978-79861889dff0" } } ] } }, { "type": "OPERATOR", "logic": "AND" }, { "name": "", "type": "ATTRIBUTE", "matching": true, "attribute": { "expressions": [ { "constraint": { "type": "NUMBER_ONE", "logic": "LESS", "value": { "type": "CONSTANT", "constant": {% metricsvar metric_id:e571679c-0f04-466f-aa43-ff6d5023bb09%}{{ metric_result|round(3,'floor') }} {% endmetricsvar %} } }, "attribute": { "type": "EXPRESSION", "id": "73d13360-2074-463c-9978-79861889dff0" } } ] } } ], "expression": { "type": "FUNCTION", "function": "AND", "arg1": { "name": "", "type": "ATTRIBUTE", "matching": true, "attribute": { "expressions": [ { "constraint": { "type": "NUMBER_ONE", "logic": "LESS", "value": { "type": "CONSTANT", "constant": {% metricsvar metric_id:e571679c-0f04-466f-aa43-ff6d5023bb09%}{{ metric_result|round(3,'floor') }} {% endmetricsvar %} } }, "attribute": { "type": "EXPRESSION", "id": "73d13360-2074-463c-9978-79861889dff0" } } ] } }, "arg2": { "name": "", "type": "ATTRIBUTE", "matching": true, "attribute": { "expressions": [ { "constraint": { "type": "NUMBER_ONE", "logic": "MORE_OR_EQUAL", "value": { "type": "CONSTANT", "constant": {% metricsvar metric_id:97488c6a-746e-42fc-a1ca-b2fb4b8dfa94%}{{ metric_result|round(3,'floor') }} {% endmetricsvar %} } }, "attribute": { "type": "EXPRESSION", "id": "73d13360-2074-463c-9978-79861889dff0" } } ] } } } }, "profileMetrics": [] }, { "title": "300", "description": "", "filter": { "matching": true, "expressions": [ { "name": "", "type": "ATTRIBUTE", "matching": true, "attribute": { "expressions": [ { "constraint": { "type": "NUMBER_ONE", "logic": "MORE_OR_EQUAL", "value": { "type": "CONSTANT", "constant": {% metricsvar metric_id:e571679c-0f04-466f-aa43-ff6d5023bb09%}{{ metric_result|round(3,'floor') }} {% endmetricsvar %} } }, "attribute": { "type": "EXPRESSION", "id": "73d13360-2074-463c-9978-79861889dff0" } } ] } }, { "type": "OPERATOR", "logic": "AND" }, { "name": "", "type": "ATTRIBUTE", "matching": true, "attribute": { "expressions": [ { "constraint": { "type": "NUMBER_ONE", "logic": "LESS", "value": { "type": "CONSTANT", "constant": {% metricsvar metric_id:8031ccf4-2444-42bf-8eba-ba61d952d52f%}{{ metric_result|round(3,'floor') }} {% endmetricsvar %} } }, "attribute": { "type": "EXPRESSION", "id": "73d13360-2074-463c-9978-79861889dff0" } } ] } } ], "expression": { "type": "FUNCTION", "function": "AND", "arg1": { "name": "", "type": "ATTRIBUTE", "matching": true, "attribute": { "expressions": [ { "constraint": { "type": "NUMBER_ONE", "logic": "LESS", "value": { "type": "CONSTANT", "constant": {% metricsvar metric_id:8031ccf4-2444-42bf-8eba-ba61d952d52f%}{{ metric_result|round(3,'floor') }} {% endmetricsvar %} } }, "attribute": { "type": "EXPRESSION", "id": "73d13360-2074-463c-9978-79861889dff0" } } ] } }, "arg2": { "name": "", "type": "ATTRIBUTE", "matching": true, "attribute": { "expressions": [ { "constraint": { "type": "NUMBER_ONE", "logic": "MORE_OR_EQUAL", "value": { "type": "CONSTANT", "constant": {% metricsvar metric_id:e571679c-0f04-466f-aa43-ff6d5023bb09%}{{ metric_result|round(3,'floor') }} {% endmetricsvar %} } }, "attribute": { "type": "EXPRESSION", "id": "73d13360-2074-463c-9978-79861889dff0" } } ] } } } }, "profileMetrics": [] }, { "title": "200", "description": "", "filter": { "matching": true, "expressions": [ { "name": "", "type": "ATTRIBUTE", "matching": true, "attribute": { "expressions": [ { "constraint": { "type": "NUMBER_ONE", "logic": "MORE_OR_EQUAL", "value": { "type": "CONSTANT", "constant": {% metricsvar metric_id:8031ccf4-2444-42bf-8eba-ba61d952d52f%}{{ metric_result|round(3,'floor') }} {% endmetricsvar %} } }, "attribute": { "type": "EXPRESSION", "id": "73d13360-2074-463c-9978-79861889dff0" } } ] } }, { "type": "OPERATOR", "logic": "AND" }, { "name": "", "type": "ATTRIBUTE", "matching": true, "attribute": { "expressions": [ { "constraint": { "type": "NUMBER_ONE", "logic": "LESS", "value": { "type": "CONSTANT", "constant": {% metricsvar metric_id:fb1c9bff-ce29-42c0-93ee-b56f092ae03f%}{{ metric_result|round(3,'floor') }} {% endmetricsvar %} } }, "attribute": { "type": "EXPRESSION", "id": "73d13360-2074-463c-9978-79861889dff0" } } ] } } ], "expression": { "type": "FUNCTION", "function": "AND", "arg1": { "name": "", "type": "ATTRIBUTE", "matching": true, "attribute": { "expressions": [ { "constraint": { "type": "NUMBER_ONE", "logic": "LESS", "value": { "type": "CONSTANT", "constant": {% metricsvar metric_id:fb1c9bff-ce29-42c0-93ee-b56f092ae03f%}{{ metric_result|round(3,'floor') }} {% endmetricsvar %} } }, "attribute": { "type": "EXPRESSION", "id": "73d13360-2074-463c-9978-79861889dff0" } } ] } }, "arg2": { "name": "", "type": "ATTRIBUTE", "matching": true, "attribute": { "expressions": [ { "constraint": { "type": "NUMBER_ONE", "logic": "MORE_OR_EQUAL", "value": { "type": "CONSTANT", "constant": {% metricsvar metric_id:8031ccf4-2444-42bf-8eba-ba61d952d52f%}{{ metric_result|round(3,'floor') }} {% endmetricsvar %} } }, "attribute": { "type": "EXPRESSION", "id": "73d13360-2074-463c-9978-79861889dff0" } } ] } } } }, "profileMetrics": [] }, { "title": "100", "description": "", "filter": { "matching": true, "expressions": [ { "name": "", "type": "ATTRIBUTE", "matching": true, "attribute": { "expressions": [ { "constraint": { "type": "NUMBER_ONE", "logic": "MORE_OR_EQUAL", "value": { "type": "CONSTANT", "constant": {% metricsvar metric_id:fb1c9bff-ce29-42c0-93ee-b56f092ae03f%}{{ metric_result|round(3,'floor') }} {% endmetricsvar %} } }, "attribute": { "type": "EXPRESSION", "id": "73d13360-2074-463c-9978-79861889dff0" } } ] } }, { "type": "OPERATOR", "logic": "AND" }, { "name": "", "type": "FUNNEL", "matching": true, "funnel": { "title": "unnamed", "completedWithin": {}, "dateFilter": { "type": "ABSOLUTE" }, "steps": [ { "action": { "id": 68600, "name": "transaction.charge" }, "title": "Unnamed Step", "expressions": [], "eventName": "transaction.charge" } ], "exact": false } } ], "expression": { "type": "FUNCTION", "function": "AND", "arg1": { "name": "", "type": "FUNNEL", "matching": true, "funnel": { "title": "unnamed", "completedWithin": null, "dateFilter": { "type": "ABSOLUTE" }, "steps": [ { "action": { "id": 68600, "name": "transaction.charge" }, "title": "Unnamed Step", "expressions": [], "eventName": "transaction.charge" } ], "exact": false } }, "arg2": { "name": "", "type": "ATTRIBUTE", "matching": true, "attribute": { "expressions": [ { "constraint": { "type": "NUMBER_ONE", "logic": "MORE_OR_EQUAL", "value": { "type": "CONSTANT", "constant": {% metricsvar metric_id:fb1c9bff-ce29-42c0-93ee-b56f092ae03f%}{{ metric_result|round(3,'floor') }} {% endmetricsvar %} } }, "attribute": { "type": "EXPRESSION", "id": "73d13360-2074-463c-9978-79861889dff0" } } ] } } } }, "profileMetrics": [] } ], "unique": true }, "allowNull": true }
{
"content-type": "promotion",
"background-color": "#123321",
"title": "Christmas Promotion",
"promotion": "{% promotion fields=uuid,name,discountType,discountValue,code,params,tags,type,price,images,description,expireAt %} 3a3750b0-c00b-4c57-9c5f-d55652b417a0 {% endpromotion %}"
}
















{ "time": "2023-02-15T15:24:49Z", "action": "nps.sent", "label": "", "client": { "id": 5092159999, "email": "e0097757-d1e2-44ac-ba3c-d97979a354c1@anonymous.invalid", "uuid": "e0097757-d1e2-44ac-ba3c-d97979a354c1" }, "params": { "eventCreateTime": "2023-02-15T15:25:08.861Z", "name": "John", "surname": "Doe", "location": "Warsaw", "age": "23", "feedback": "I am very satisfied with the service. The support team was responsive and helpful.", "product_id": "PROD123", "order_id": "ORD456", "nps_score": 9, "NPSsource": "mobile_app" } }{ "NPSsource": "{{ event.params.NPSsource }}" }{ "eventCreateTime": "{{ event.params.eventCreateTime }}", "name": "{{ event.params.name }}", "surname": "{{ event.params.surname }}", "location": "{{ event.params.location }}", "age": "{{ event.params.age }}", "feedback": "{{ event.params.feedback }}", "product_id": "{{ event.params['product_id'] }}", "order_id": "{{ event.params['order_id'] }}", "nps_score": "{{ event.params['nps_score'] }}" }
{ "data": [
{
"event_name": "PageVisit",
"event_time": {{ (event.params.time / 1000)|int }},
"event_source_url": "{{ event.params.uri }}",
{% if event.params['product:retailer_part_no'] %}
"currency": "PLN",
"content_type": "product",
"content_ids": ["{{ event.params['product:retailer_part_no'] }}"],
"value": {{ event.params['product:price:amount']|int }},
{% endif %}
"user_data": {
"client_ip_address": "{{ event.params.ip }}",
"client_user_agent": "",
"em": ["{% if 'anonymous' in client.email %}{% else %}{{ client.email|trim|lower|hash("SHA-256") }}{% endif %}"],
"ph": ["{% if 'phone' in customer|string %}{{ client.phone|trim|lower|hash("SHA-256") }}{% endif %}"],
"fbc": "",
"fbp": ""
},
"custom_data": {}
}]
}
where:
| Line number | Description |
| --- | --- |
| 4 | Inserts event time from the trigger node and re-calculates it into seconds (this is required by Facebook). |
| 5 | Inserts URI from the trigger node as the `event_source_url` param. |
| 6-11 | If the visited page has product metadata, inserts that metadata. |
| 13 | Inserts customer's IP from the trigger node. |
| 15 | Inserts email encoded using SHA-256 algorithm, if available. |
| 16 | Inserts phone number encoded using SHA-256 algorithm, if available. |





{
"sku": "
{% set last_sku=[] %}
{% set last_price=[] %}
{% set last_objects_array=[] %}
{% set final_sku=[] %}
{% set list=[] %}
{% aggregate LAST-ITEM-ID %} {# aggregate collecting product sku #}
{% for sku in aggregate_result|reverse %} {# saving sku from aggregate to last_sku variable #}
{% do last_sku.append(sku) %}
{% endfor %}
{% endaggregate %}
{% aggregate LAST-PRODUCT-PRICE %} {# aggregate collecting product prices #}
{% for price in aggregate_result|reverse %} {# saving prices from the aggregate to the price variable #}
{% do last_price.append(price) %}
{% endfor %}
{% endaggregate %}
{% aggregate LAST-PRODUCT-PRICE-DROP-SKU %} {# aggregate containing previously shown items #}
{% for listSku in aggregate_result %} {# preparation of a variable list with items to be excluded #}
{% do list.append(listSku) %}
{% endfor %}
{% endaggregate %}
{% for sku in last_sku %} {# creating an object containing the product id and price #}
{% 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') %} {# downloading sku from objects for comparison with the catalog #}
{% for last in last_objects_array_uniq %}
{% set key_name=last.sku %}
{% catalogvar.CATALOG-WITH-ACTUAL-PRICE(key_name).ATTRIBUTE-ACTUAL-PRICE %} {# catalog from which we retrieve the price with the selected attribute #}
{% set catalog_item=catalog_result|float %}
{% if last.price|float > catalog_item|float %} {# condition to check if there has been a price drop #}
{% if last.sku in list|join(',') %} {# condition that adds a comma to items that are affected by the price drop and are not in the list variable #}
{% else %}
{% do final_sku.append(last.sku) %}
{% endif %}
{% endif %}
{% endcatalogvar %}
{% endfor %}
{% for sku in final_sku %} {# listing the final sku in the sku parameter #}
{{sku}}
{% if loop.index != final_sku|length%},{% endif %}
{% endfor %}
{% if final_sku|length < 1 %} {# condition to check if any product had a price drop #}
{{kill}}
{% endif %}"
}
{% 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.
{% set sku_array = event.params.sku %} {% set sku_from_array = sku_array|split(',') %} <ul> {% for sku in sku_from_array %} <li data-snr-ai-product-id="{% catalog.Snrs-produktu-ogTag(sku).product:retailer_part_no %}"> <a class="snrs-AI--item-link" href="{% catalog.Snrs-produktu-ogTag(sku).og:url %}" title="{% catalog.Snrs-produktu-ogTag(sku).og:title %}"> <img src="{% catalog.Snrs-produktu-ogTag(sku).og:image %}" class="products-slider__item-image snrAI-product-image snrAI-product-image-{% catalog.Snrs-produktu-ogTag(sku).og:image %}" width="90" alt="{% catalog.Snrs-produktu-ogTag(sku).og:title %}" id="snrAI-image-{% catalog.Snrs-produktu-ogTag(sku).product:retailer_part_no %}"> <h3 class="snrs-AI-product--product-name"> <span class="snrs-AI-product--name-first">{% catalog.Snrs-produktu-ogTag(sku).og:title %}</span> </h3> </a> </li> {% endfor %} </ul>
{
"label": "Delay notification",
"action": "order.delayed",
"client": {
"email": "john.doe@example.com"
},
"params": {
"reason": "info28",
"orderId": "1988100"
}
}
## Prepare an email template
---
In this part of the process, prepare an email template that includes the information about the order ID.
If you have more than one reason for the order delay, prepare template for each reason of delay. Later on, you can prepare workflow for every reason.
1. Go to {{ event.params.orderId }}
It will be replaced with the actual ID of the order.


{% recommendations3 campaignId=yYr1om9rS8H1 %} {% for p in recommended_products3 %} <td style="width: 146px;text-align: center;padding: 0 2px;" data-snr-ai-product-id="{{ p.productRetailerPartNo }}"> <a style="width: 150px;color: #3b4652;text-decoration: none;font-family: Arial;" class="snrs-AI--item-link" href="{{ p.link }}" title="{{ p.title }}"> <img src="{{ p.image_link }}" class="products-slider__item-image snrAI-product-image snrAI-product-image-{{p.productRetailerPartNo}}" width="90" alt="{{ p.title }}" id="snrAI-image-{{ p.productRetailerPartNo }}" /> <h3 class="snrs-AI-product--product-name"> <span class="snrs-AI-product--name-first">{{ p.title }}</span> </h3> </a> </td> {% endfor %} {% endrecommendations3 %}

<form class="search-form"> <input type="text" placeholder="Search..." class="input" id="searchfaq" autocomplete="off"> <div class="search-button" id="search-button"> <span class="search-svg" id="search-svg"> </span> </div> </form> <div id="results" class="results" style="display:none"> <ul id="result_filters" class="result filters"> <li> <a tabindex="1"> <p style="margin:0px;font-weight:bold">Category:</p> <div class="filterPills"></div> </a> </li> </ul> <ul id="result_articles" class="result articles"></ul> </div>.result { max-height: 485px !important; height: auto !important; } .result { position: unset; left: 0; top: unset; } .result a { text-align: left } .results { position: absolute; left: 0; top: 100%; width: 100%; } #result_filters a { justify-items: center;display: flex;align-items: center; } .filterPills { justify-items: center;display: flex;align-items: center; overflow-x: hidden; height: 100%; padding: 4px 0px; } .filterPill input[type="checkbox"]:checked+label { background: #0b68ff; color: white; border: 1px solid #0b68ff; } .filterPill{white-space: nowrap;} .filterPill label { margin: 0px 3px; background: white; border-radius: 50px; border: 1px solid #dbe0e3; color: #6a7580; font-weight: 500; flex: 0 0 70px; height: 25px; transition: all .3s ease; text-align: center; width: 100%; padding: 0px 8px 2px 8px; cursor: pointer; font-size: 12px; } .search-form{ width: 500px; margin: auto; }var searchApp = (function () { var _filters = { category: [] }; var _clear = null; var _query = null; function init() { document.querySelector('#searchfaq').addEventListener('input', returnedFunction); document.querySelector('.search-form').addEventListener('submit', function (e) { e.preventDefault() }); document.querySelector('#searchfaq').addEventListener('blur', function () { setTimeout(function () { if (document.querySelector('#searchfaq') != document.activeElement) { document.querySelector('#results').style.display = 'none'; } }, 150) }); document.querySelector('#searchfaq').addEventListener('focus', function () { if (document.querySelector('.filterPill')) { document.querySelector('#results').style.display = 'block'; } else { } }); }; var returnedFunction = debounce(function () { _clear = true; _query = document.querySelector('#searchfaq').value; getQuery(_query); }, 300); function getQuery(query) { var xhttp = new XMLHttpRequest(); if (_clear) { _filters.category = []; } // change index and token for those in your profile var url = 'https://api.synerise.com/search/v2/indices/24248c7557155c3e783d00a522649d4c1667544086/autocomplete'; var params = '?query=' + query + '&includeFacets=unfiltered&facets=*&clientUUID=' + SyneriseTC.uuid + '&limit=4&token=FEE539C0-D206-A685-88F8-0E433FCDFD1D' + '&filters=' + getFilters().filters; xhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { var _response = JSON.parse(this.response); if (_response.data.length > 0) { document.querySelector('#searchfaq').style.border = '0px'; document.querySelector('#results').style.display = 'block'; if (_clear) { setFilters(_response); } setAuto(_response, query, _response.correlationId); document.querySelector('#results').style.display = 'block'; } else { document.querySelector('#searchfaq').style.border = '2px solid rgb(255 0 0 / 56%)'; } } }; xhttp.open('GET', (url + params), true); if (_query.trim() != "") { xhttp.send(); } else { document.querySelector('#search').style.border = '2px solid rgb(255 0 0 / 56%)'; } }; function getFilters() { var categoryFilter = _filters.category.join('OR'); var availabilityFilter = '(availability==true)'; var mergedFilters = availabilityFilter + (categoryFilter ? 'AND(' + categoryFilter + ')' : ''); return { filters: mergedFilters } }; function getQueryWithTimeout(option) { _clear = false; setTimeout(function () { getQuery(_query); }, 300) }; function arrayRemove(arr, value) { return arr.filter(function (elemen) { return elemen != value; }); }; function setsetCategories2Logic() { var _checkboxes = document.querySelectorAll('[type="checkbox"][name="category_lvl_1"]'); [].forEach.call(_checkboxes, function (checkbox) { checkbox.addEventListener('change', function (item) { document.querySelector('#searchfaq').focus(); var filter = 'category_lvl_1' + '=="' + item.target.value + '"'; if (item.target.checked) { _filters.category.push(filter); } else { _filters.category = arrayRemove(_filters.category, filter); } getQueryWithTimeout(); }) }); }; function setFilters(response) { // change response.extras.allFacets.Category for value from your index var _category = Object.keys(response.extras.allFacets.Category); document.querySelector('.result.filters .filterPills').innerHTML = ''; [].forEach.call(_category, function (category, index) { document.querySelector('.result.filters .filterPills').innerHTML = document.querySelector('.result.filters .filterPills').innerHTML + '<div class="filterPill"><input id="category_' + category + '" type="checkbox" name="category_lvl_1" hidden="" value="' + category + '"><label for="category_' + category + '">' + category + '</label></div>' }); setsetCategories2Logic(); }; function setAuto(response, query, correlationId) { var _products = response.data document.querySelector('.result.articles').innerHTML = ''; // change product.linkToQuestion, product.title and product.Category for values from response of your index [].forEach.call(_products, function (product, index) { document.querySelector('.result.articles').innerHTML = document.querySelector('.result.articles').innerHTML + '<li>' + '<a href="' + product.linkToQuestion + '?demoAi=' + _query + '" tabindex="1">' + '<p style="margin:0px;font-weight:bold">' + product.title + '</p>' + '<p style="margin:0px;font-size:10px;margin-top:5px">' + product.Category + '</p>' + '</a>' + '</li>' }); }; function debounce(func, wait, immediate) { var timeout; return function executedFunction() { var context = this; var args = arguments; var later = function () { timeout = null; if (!immediate) func.apply(context, args); }; var callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) func.apply(context, args); }; }; return { init: init }; })(); searchApp.init();




In this metric, you check the number of products by using in the metric formula the aggregate that returns the SKU of the products viewed within a campaign.
Additionally, narrow down the results by using the timestamp parameter. Set the time stamp to include the purchases after the first click at the product in the campaign. For that purpose, use the aggregate that calculates the timestamp of the first product visit.
This metric returns the total sum of products bought after clicking a campaign. The metric uses the expression that multiplies the product price by the product quantity.
You can duplicate the metric that calculates the number of products bought after clicking a product, change the aggregator from Count to Sum and use the expression that multiplies the price by the quantity.
This metric is based on the `transaction.charge` event (this event collects an array of products included in the transaction). The metric reuses the aggregate that returns the list of products bought after clicking the campaign to check if the order ID of the product is included in the transaction. The scope of the metric is narrowed down by the aggregate that returns the timestamp of the first visit at the product page.
This metric is based on the `transaction.charge` event (this event collects an array of products included in the transaction). The metric reuses the aggregate that returns the list of products bought after clicking the campaign to check if the order ID of the product is included in the transaction. The scope of the metric is narrowed down by the aggregate that returns the timestamp of the first visit at the product page.
If you have already created a metric for the number of transactions with the products bought after clicking a campaign, you can duplicate it and change the aggregator type and use the `totalAmount` parameter.



{%- set getFields=["code"] -%}
{%- promotions fields=getFields tagNames=["categoryPromo"] -%}
{%- for item in promotions_result -%}
{{ item }}{%- endfor -%}
{%- endpromotions -%}
4. [Define the rest of the settings](/docs/campaign/dynamiccontent/creating-dynamic-content).
## Check the use case set up on the Synerise Demo workspace
---
You can check the [aggregate](https://app.synerise.com/analytics-v2/aggregates/78b590fc-88bd-3831-8419-5c080efceeec), [segmentation](https://app.synerise.com/analytics-v2/segmentations/3ae2e8a9-8f63-4c51-978b-32e245cfb331) and [promotion configuration](https://app.synerise.com/campaigns/promotions/ca9b580d-e0a6-47ad-9c65-520dd68398ae) directly in Synerise Demo workspace.
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.
## Generated events
This use case generates approximately 3 events per profile that completes the flow:
[`dynamicContent.show`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentshow) (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1), [`client.activatePromotion`](/docs/assets/events/event-reference/loyalty#clientactivatepromotion) (~1).
## Read more
---
- [Dynamic content](/docs/campaign/dynamiccontent)
- [Recommendations](/docs/ai-hub/recommendations-v2)
# Integration with Storyly
The user engagement platform [Storyly](https://www.storyly.io/) allows to embed full-screen, interactive stories, in both mobile applications and websites. With those stories you can post interactive ads and engaging videos with call to action. You can include GIFs, use ready made templates or create your own without the use of code. To improve your communication and drive conversion you can use customer data collected in Synerise to personalize the stories.
In this use case, we will enrich stories with information about customer's favourite day for shopping, to show them personalized stories in the mobile app. This information will be extracted using an expression and passed to the mobile application in a document.
{
"storyly_fav_day": "{% expression %} insert the ID of the expression {% endexpression %}"
}
6. Click **Apply** to save the document.



(function () {
function findLaunchSend() {
const value = localStorage.getItem(`dcCampaignId`);
const dcFirst = 'ffdb6568-e699-49fb-a3a7-5ce94ab1f04f';
const dcSecond = 'c8c19320-82c7-4fc8-b1af-0feb561dcea5';
const dcThird = '1cb31d0a-95ee-42fc-bc5e-95737e223992';
const dcFourth = '41f3d86a-eb8c-4c97-b769-b72b05b0e1af';
if (value === null || value === dcFourth) {
SR.dynamicContent.get(dcFirst);
localStorage.setItem('dcCampaignId', dcFirst);
} else if (value === dcFirst) {
SR.dynamicContent.get(dcSecond);
localStorage.setItem('dcCampaignId', dcSecond);
} else if (value === dcSecond) {
SR.dynamicContent.get(dcThird);
localStorage.setItem('dcCampaignId', dcThird);
} else if (value === dcThird) {
SR.dynamicContent.get(dcFourth);
localStorage.setItem('dcCampaignId', dcFourth);
} else {
console.log("Invalid data in localStorage");
}
}
findLaunchSend();
})();





email,newsletter_agreement john.doe@synerise.com,enabled kathy.smith@synerise.com,enabled lily.novak@synerise.com,enabled matt.turner@synerise.com,enabled








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.
Name and save the filter by clicking Save filter.
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Number of people signed in for the videocall: `{% metricsvar metric_id:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX %}{{ metric_result }}{% endmetricsvar %}`\nNumber of people having the videocall today: `{% metricsvar metric_id:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX %}{{ metric_result }}{% endmetricsvar %}`"
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "check dashboard",
"emoji": true
},
"url": "https://app.synerise.com/spa/modules/dashboards/analytics/dashboards/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
}
}
]
}
In the JSON body:
- Insert the ID of the metric you created in the [previous step](/use-cases/slack-integration#create-a-metric-in-synerise).
- Optionally, if you want to refer users to the analytical dashboard, for the `url` parameter, insert the link to the dashboard. If you choose not to, remove the `accessory` object from the JSON body.
3. Confirm by clicking **Apply**.
5. Add the **End** node.
6. Launch the workflow by clicking **Save&Run**.
{
"points": "{{ event.params.$finalUnitPrice * event.params.$quantity }}",
"promo": "ChristmasPromo"
}




{
"value": {
"key": "copyKey",
"copy": "Today, the use limit on this offer has already been reached 😞 Come back tomorrow!"
},
"itemKey": "copyKey"
}
{
"name": "Extra points for buying a soda",
"points": "1500"
}
3. Click **Apply**.
{
"value": {
"key": "copyKey",
"copy": "Buy a soda and get extra 1500 loyalty points!
Take advantage of this offer while you still can!"
},
"itemKey": "copyKey"
}
{
"copy": "{% set key = 'copyKey' %}{% catalog.UC-limited-promotion(key).copy %}"
}
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 %}

{% set fieldsVar = ["code", "params", "name", "status", "images", "params", "description", "headline", "tags"] %}
{% promotions fields=fieldsVar %}
{% set count = 0 %} {%- for i in promotions_result -%}
{%- if count < noOfItems && i.tags|selectattr("name", "equalto", "home")|length > 0 -%}
{% set fieldsVar = ["code", "params", "name", "status", "images", "params", "description", "headline"] %}
{% promotions fields=fieldsVar %}
{% set count = 0 %} {%- for i in promotions_result -%} {%- if count < noOfItems -%}
{ "category": "coffee", "itemId": "{{ event.params.$sku }}", "predictedTime": "{% set avgTime = [] %}{% aggregate PASTE_AGGREGATE_ID_HERE %}{%set timeDiff = []%}{% for item in range(aggregate_result|length-1) %}{%set diff = aggregate_result[loop.index] - aggregate_result[loop.index-1]%}{% do timeDiff.append(diff)%}{% endfor %}{% set temp = timeDiff|sum/(aggregate_result|length-1) %}{% do avgTime.append(temp) %}{{ datetimeformat(unixtimestamp(null) + avgTime[0], '%Y-%m-%d') }}{% endaggregate %}", "predictedTimeInDays": "{{avgTime[0]/86400000}}" }


{
"iss": "https://securetoken.google.com/chat-41de4",
"aud": "chat-41de4",
"auth_time": 1760008107,
"user_id": "Lanl0b6unJUPX0QEHBhqsQRSsJq1",
"sub": "Lanl0b6unJUPX0QEHBhqsQRSsJq1",
"iat": 1760008107,
"exp": 1760011707,
"email": "john.doe.test@example.com",
"email_verified": false,
"firebase": {
"identities": {
"email": ["john.doe.test@example.com"]
},
"sign_in_provider": "password"
}
10. Enable Claim Validation. It is recommended to enable claim validation to verify token claims during the authentication process. This ensures that only valid and trusted tokens are accepted.
Replace `your_campaign_ID` with the ID of the AI recommendation (either of the bestselling shoes suitable for asphalt or off-road). The ID of the AI campaign is contained in the URL of the recommendation.
<!-- Downloading the AI campaign --> {% recommendations3 campaignId=your_campaign_ID %} {% for p in recommended_products3 %} <li data-snr-ai-product-id="{{p.itemId}}"> <a class="snrs-AI--item-link" href="{{p.link}}" title="{{p.title}}"> <img src="{{ p.imageLink }}"class="products-slider__item-image snrAI-product-image snrAI-product-image-{{p.itemId}}" width="90" alt="{{p.title}}" id="snrAI-image-{{p.itemId}}"> <h3 class="snrs-AI-product--product-name"> <span class="snrs-AI-product--name-first">{{p.title}}</span> </h3> <span class="snrs-AI-product--series">{{p.attributes.series}}</span> </a> </li> {% endfor %} {% endrecommendations3 %}
curl --location --request POST 'https://{SYNERISE_API_BASE_PATH}/automation-endpoint/endpoints/END_ID/trigger' \
--header 'Content-Type: application/json' \
--data-raw '{
"firstname": "test",
"lastname": "test",
"email": "test"
}'
6. When the endpoint receives data from the request, verify the list of variables. If the variables include those which are in the payload (in this case, firstname, lastname, and email), click **Define**. If not, click **Start again** re-send request, and wait for the results.
{
"email": "{{ request.body.email }}",
"firstname": "{{ request.body.firstname }}",
"lastname": "{{ request.body.lastname }}"
}
5. In the **Authorization** section, select **By API key**.
6. From the dropdown list, select API key that has permissions to create or update customer's data.

clientId,email,newsletter_agreement 111111111,john.doe@synerise.com,enabled 222222222,kathy.smith@synerise.com,enabled 333333333,lily.novak@synerise.com,enabled 444444444,matt.turner@synerise.com,enabled










{% brickworksgeneratevar schemaId=banner recordId=promo6 %}{%set data = brickworks_result %} <div class="banner" data-slug="{{ data.__slug }}"> <div class="banner-image"> <img src="{{ data.image.medium | default(data.image.large) }}" alt="{{ data.headline }}" /> </div> <div class="banner-content"> <h1 class="headline">{{ data.headline }}</h1> <p class="description"> {{ data.descrption }} </p> <div id='expiry' class="meta" data-expiry="{{ data.expireAt }}"> <span id="countdown"> </div> <a class="cta" href="{{ data.actionbuttonlink }}" target="_blank"> {{ data.actionbuttontext }} </a> </div> </div> {% endbrickworksgeneratevar %}
{% brickworksgeneratevar schemaId=bannersv2 recordId=activeBanners %}{%set data = brickworks_result.bannersv2 %} <div class="carousel" id="carousel"> <div class="track"> {% for item in data %} <div class="banner"> <div class="image"> <img src="{{ item.image.thumb | default(item.image.large) }}" alt="{{ item.headline }}" /> </div> <div class="content"> <div class="headline">{{ item.headline }}</div> <div class="description">{{ item.descrption }}</div> <div class="footer"> <a class="cta" href="{{ item.actionbuttonlink }}">{{ item.actionbuttontext }}</a> <div class="expiry" data-expiry="{{ item.expireAt }}">—</div> </div> </div> </div> {% endfor %} </div> <div class="dots"></div> </div> {% endbrickworksgeneratevar %} {% endbrickworksgeneratevar %}





{
"credential": {
"recipient": {
"name": "{{ event.params.firstName }} {{ event.params.lastName }}",
"email": "{% customer email %}",
"group_id":"{% set key = event.params.certificationId %}{% catalogitem.certificationList(key) %}{% set object = catalog_result %}{{ object.get('accredibleid')}}{% endcatalogitem %}"
}
}}
curl --location --request POST 'ENDPOINT_URL_FROM_STEP_3' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "john.doe@example.com",
"formType": "formTitle",
"VehicleCondition": "neutral",
}'
5. In the **Incoming data** section in Synerise, click **Retrieve data**. The system waits for the incoming request for 1 minute and 30 seconds.
## Create a workflow
---
In this part of the process, you create a workflow in Synerise. The workflow starts with the business event trigger that is launched every time a customer submits the form. In response to that, on the profile of the customer who submitted the form, an event is saved with the answers in the survey in the form of parameters.
1. Go to **Automation Hub > Workflows > New workflow**.
2. Enter the name of the workflow.
3. As the first node, select **Business Event**. In the configuration of the node:
1. Select the incoming webhook you created as the first part of this use case.
2. Confirm by clicking **Apply**.
{
"action": "form.submit",
"label": "Customer submitted a survey",
"client": {
"email": "{{request.body.email}}"
},
"params": {
"formTitle": "{{request.body.formTitle}}",
"VehicleCondition": "{{request.body.VehicleCondition}}"
}
}
<h4>Intro</h4> <div style="max-width: 360px"> <img src="#### type: "string", groupName: "Intro", groupId: "Intro", label: "Banner", id: "image_1", defaultValue: "lorem_image" !####" /> <p>#### type: "string", groupName: "Intro", groupId: "Intro", label: "Title", id: "intro_1", defaultValue: "lorem_title" !####</p> </a> </div> <hr> <h4>Item 1</h4> <div style="max-width: 360px"> <a href="#### type: "string", groupName: "Item 1", groupId: "item_1", label: "Link", id: "link_1", defaultValue: "lorem_link" !####"> <img src="#### type: "string", groupName: "Item 1", groupId: "item_1", label: "Photo", id: "image_1", defaultValue: "lorem_image" !####" /> <p>#### type: "string", groupName: "Item 1", groupId: "item_1", label: "Title", id: "title_1", defaultValue: "lorem_title" !####</p> <p>#### type: "string", groupName: "Item 1", groupId: "item_1", label: "Description", id: "desc_1", defaultValue: "lorem_description" !####</p> <p>#### type: "string", groupName: "Item 1", groupId: "item_1", label: "Price", id: "price_1", defaultValue: "lorem_price" !####</p> </a> </div>
<!-- Downloading the AI campaign --> {% recommendations2 campaignId=cg3HBgRC5P2h %} {% for p in recommended_products2 %} <li data-snr-ai-product-id="{{p.productRetailerPartNo}}"> <a class="snrs-AI--item-link" href="{{p.link}}" title="{{p.title}}"> <img src="{{ p.imageLink }}" class="products-slider__item-image snrAI-product-image snrAI-product-image-{{p.productRetailerPartNo}}" width="90" alt="{{p.title}}" id="snrAI-image-{{p.productRetailerPartNo}}"> <h3 class="snrs-AI-product--product-name"> <span class="snrs-AI-product--name-first">{{p.title}}</span> </h3> </a> </li> {% endfor %} {% endrecommendations2 %}
{%- set final_objects_for_alert=[] -%}
{%- set added_objects=[] -%}
{%- set last_add_fav_skus=[] -%}
{%- set last_add_fav_prices=[] -%}
{%- aggregate 1227553d-114a-3c19-b618-6c3afc9d7a32 -%}
{%- for items in aggregate_result -%}
{%- do last_add_fav_skus.append(items) -%}
{%- endfor -%}
{%- endaggregate -%}
{%- aggregate 1227553d-114a-3c19-b618-6c3afc9d7a32 -%}
{%- for price in aggregate_result -%}
{%- do last_add_fav_prices.append(price) -%}
{%- endfor -%}
{%- endaggregate -%}
{%- for added in last_add_fav_skus -%}
{%- do added_objects.append({'sku': added, 'price': last_add_fav_prices[loop.index0]}) -%}
{%- endfor -%}
{%- set final_price_alert_fav_skus=[] -%}
{%- for item in added_objects -%}
{%- catalogitemv2.(item.sku) allowEmpty=True -%}
{%- set object = catalog_result -%}
{%- if object.availability == 'true' -%}
{%- set _catalog_price = catalog_result.get('effectivePrice') -%}
{%- set catalog_price = _catalog_price | float -%}
{%- set item_price = item.price|float -%}
{%- set is_discounted = item_price > catalog_price -%}
{%- if is_discounted -%}
{%- do final_price_alert_fav_skus.append(item) -%}
{%- endif -%}
{%- endif -%}
{%- endcatalogitemv2 -%}
{%- endfor -%}
{%- set added_objects=[] -%}
{%- set last_add_fav_skus=[] -%}
{%- set last_add_fav_prices=[] -%}
{%- aggregate 34f469d8-f83d-32e5-b0e1-10f73b0a0179 -%}
{%- for items in aggregate_result -%}
{%- do last_add_fav_skus.append(items) -%}
{%- endfor -%}
{%- endaggregate -%}
{%- aggregate 4148b6aa-4488-39d1-81b8-a29ed5b23424 -%}
{%- for price in aggregate_result -%}
{%- do last_add_fav_prices.append(price) -%}
{%- endfor -%}
{%- endaggregate -%}
{%- for added in last_add_fav_skus -%}
{%- do added_objects.append({'sku': added, 'price': last_add_fav_prices[loop.index0]}) -%}
{%- endfor -%}
{%- set final_price_alert_cart_skus=[] -%}
{%- for item in added_objects -%}
{%- catalogitemv2.(item.sku) allowEmpty=True -%}
{%- set object = catalog_result -%}
{%- if object.availability == 'true' -%}
{%- set _catalog_price = catalog_result.get('effectivePrice') -%}
{%- set catalog_price = _catalog_price | float -%}
{%- set item_price = item.price|float -%}
{%- set is_discounted = item_price > catalog_price -%}
{%- if is_discounted -%}
{%- do final_price_alert_cart_skus.append(item) -%}
{%- endif -%}
{%- endif -%}
{%- endcatalogitemv2 -%}
{%- endfor -%}
{%- set added_objects=[] -%}
{%- set last_add_fav_skus=[] -%}
{%- set last_add_fav_prices=[] -%}
{%- aggregate 51d1daac-8483-351f-ae01-ea0b5455fba0 -%}
{%- for items in aggregate_result -%}
{%- do last_add_fav_skus.append(items) -%}
{%- endfor -%}
{%- endaggregate -%}
{%- aggregate 51d1daac-8483-351f-ae01-ea0b5455fba0 -%}
{%- for price in aggregate_result -%}
{%- do last_add_fav_prices.append(price) -%}
{%- endfor -%}
{%- endaggregate -%}
{%- for added in last_add_fav_skus -%}
{%- do added_objects.append({'sku': added, 'price': last_add_fav_prices[loop.index0]}) -%}
{%- endfor -%}
{%- set final_price_alert_desktop_skus=[] -%}
{%- for item in added_objects -%}
{%- catalogitemv2.(item.sku) allowEmpty=True -%}
{%- set object = catalog_result -%}
{%- if object.availability == 'true' -%}
{%- set _catalog_price = catalog_result.get('effectivePrice') -%}
{%- set catalog_price = _catalog_price | float -%}
{%- set item_price = item.price|float -%}
{%- set is_discounted = item_price > catalog_price -%}
{%- if is_discounted -%}
{%- do final_price_alert_desktop_skus.append(item) -%}
{%- endif -%}
{%- endif -%}
{%- endcatalogitemv2 -%}
{%- endfor -%}
{%- set added_objects=[] -%}
{%- set last_add_fav_skus=[] -%}
{%- set last_add_fav_prices=[] -%}
{%- aggregate adb929ff-f56c-37d6-b5d8-61d88449d2e1 -%}
{%- for items in aggregate_result -%}
{%- do last_add_fav_skus.append(items) -%}
{%- endfor -%}
{%- endaggregate -%}
{%- aggregate adb929ff-f56c-37d6-b5d8-61d88449d2e1 -%}
{%- for price in aggregate_result -%}
{%- do last_add_fav_prices.append(price) -%}
{%- endfor -%}
{%- endaggregate -%}
{%- for added in last_add_fav_skus -%}
{%- do added_objects.append({'sku': added, 'price': last_add_fav_prices[loop.index0]}) -%}
{%- endfor -%}
{%- set final_price_alert_mobile_skus=[] -%}
{%- for item in added_objects -%}
{%- catalogitemv2.(item.sku) allowEmpty=True -%}
{%- set object = catalog_result -%}
{%- if object.availability == 'true' -%}
{%- set _catalog_price = catalog_result.get('effectivePrice') -%}
{%- set catalog_price = _catalog_price | float -%}
{%- set item_price = item.price|float -%}
{%- set is_discounted = item_price > catalog_price -%}
{%- if is_discounted -%}
{%- do final_price_alert_mobile_skus.append(item) -%}
{%- endif -%}
{%- endif -%}
{%- endcatalogitemv2 -%}
{%- endfor -%}
{%- set seen = [] -%}
{%- set excluded = [] -%}
{%- aggregate b5fc6392-65f1-32d3-9ed1-a41f209ea4c5 -%}
{%- for result in aggregate_result -%}
{%- set raw = result|string -%}
{%- set split1 = raw|split('excluded=[') -%}
{%- if split1|length > 1 -%}
{%- set inside = split1[1]|split(']') -%}
{%- for item in inside[0]|split(', ') -%}
{%- set trimmed = item|trim -%}
{%- if trimmed != '' and (trimmed in excluded == false) -%}
{%- do excluded.append(trimmed) -%}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- endfor -%}
{%- endaggregate -%}
{%- set filtered_cart = [] -%}
{%- for item in final_price_alert_cart_skus -%}
{%- if item.sku != '' and (item.sku in excluded == false) and (item.sku in seen == false) -%}
{%- do filtered_cart.append(item.sku) -%}
{%- do seen.append(item.sku) -%}
{%- endif -%}
{%- endfor -%}
{%- set filtered_fav = [] -%}
{%- for item in final_price_alert_fav_skus -%}
{%- if item.sku != '' and (item.sku in excluded == false) and (item.sku in seen == false) -%}
{%- do filtered_fav.append(item.sku) -%}
{%- do seen.append(item.sku) -%}
{%- endif -%}
{%- endfor -%}
{%- set filtered_viewMobile = [] -%}
{%- for item in final_price_alert_mobile_skus -%}
{%- if item.sku != '' and (item.sku in excluded == false) and (item.sku in seen == false) -%}
{%- do filtered_viewMobile.append(item.sku) -%}
{%- do seen.append(item.sku) -%}
{%- endif -%}
{%- endfor -%}
{%- set filtered_viewWeb = [] -%}
{%- for item in final_price_alert_desktop_skus -%}
{%- if item.sku != '' and (item.sku in excluded == false) and (item.sku in seen == false) -%}
{%- do filtered_viewWeb.append(item.sku) -%}
{%- do seen.append(item.sku) -%}
{%- endif -%}
{%- endfor -%}
{%- set new_excluded = [] -%}
{%- if filtered_cart|length > 0 -%}
{%- set new_excluded = filtered_cart -%}
{%- elif filtered_fav|length > 0 -%}
{%- set new_excluded = filtered_fav -%}
{%- elif filtered_viewMobile|length > 0 -%}
{%- set new_excluded = filtered_viewMobile -%}
{%- elif filtered_viewWeb|length > 0 -%}
{%- set new_excluded = filtered_viewWeb -%}
{%- endif -%}
{%- set finalObj = {'emailCartSku': filtered_cart,'emailCartCount': filtered_cart|length,'emailFavSku': filtered_fav,'emailFavCount': filtered_fav|length,'emailViewMobileSku': filtered_viewMobile,'emailViewMobileCount': filtered_viewMobile|length,'emailViewWebSku': filtered_viewWeb,'emailViewWebCount': filtered_viewWeb|length,'excluded': new_excluded} -%}{{ finalObj }}
{
"eventdata": "{% snippet %} SNIPPET_HASH {% endsnippet %}",
"newsletterAgreement": "{{ customer.newsletter_agreement }}",
}
Where:
- `eventdata` — references the [snippet](#create-the-snippet-with-price-drop-detection-logic) created in the previous step. Replace `SNIPPET_HASH` with the actual snippet hash.
- `newsletterAgreement` — captures the user's email consent status at the time of event generation.
Optionally, you can add extra parameters to support further personalization in your email templates, such as loyalty program membership or customer tier.
The `eventdata` parameter will be populated by the snippet. Below is an example of the generated output (the actual number of SKUs depends on each user's activity and which products have had a price drop):
`emailCartSku=[SKU1,SKU2], emailCartCount=2, emailFavSku=[SKU3], emailFavCount=1, emailViewMobileSku=[SKU4], emailViewMobileCount=1, emailViewWebSku=[SKU5,SKU6,SKU7], emailViewWebCount=3, pushCartSku=[SKU1], pushCartCount=1, pushFavSku=[SKU3], pushFavCount=1, pushViewMobileSku=[SKU4], pushViewMobileCount=1, pushViewWebSku=[SKU5], pushViewWebCount=1, excluded=[SKU1,SKU2]`
In this example, `emailCartSku` is the highest-priority non-empty category (the "winning" category), so the `excluded` list contains only the cart SKUs (`SKU1,SKU2`). Products from other categories (favorites, mobile viewed, web viewed) are not excluded yet and will be eligible for communication on subsequent days.
The key fields in `eventdata` are:
- `emailCartSku` / `emailCartCount` — SKUs and count of discounted cart products.
- `emailFavSku` / `emailFavCount` — SKUs and count of discounted favorite products.
- `emailViewMobileSku` / `emailViewMobileCount` — SKUs and count of discounted products viewed in the mobile app.
- `emailViewWebSku` / `emailViewWebCount` — SKUs and count of discounted products viewed on the website.
- `excluded` — list of product SKUs from the winning priority category, to be excluded from future sends.
3. Confirm by clicking **Apply**.
<!--[if mso ]><style>sup, sub { font-size: 100% !important; } sup { mso-text-raise:10% } sub { mso-text-raise:-10% }</style> <![endif]-->
<!-- Start Gmail Promo Tab annotations code -->
<div itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="#### type: "string", groupName: "Promotion tag", groupId: "promotion-tag", defaultValue: "Synerise Demo Shop", id: "promotion-tag__company-name", label: "Company name" !####" />
<meta itemprop="logo" content="#### type: "string", groupName: "Promotion tag", groupId: "promotion-tag", defaultValue: "https://demoshop.synerise.com/media/athlete2/Demos/ca/logo-ca.png", label: "Company image", id: "promotion-tag__img-link" !####" />
</div>
<div itemscope itemtype="http://schema.org/EmailMessage">
<meta itemprop="subjectLine" content="#### type: "string", groupName: "Promotion tag", groupId: "promotion-tag", defaultValue: "Free shipping", label: "Subject line", id: "promotion-tag__subject-line" !####" />
</div>
<div itemscope itemtype="http://schema.org/DiscountOffer">
<meta itemprop="description" content="#### type: "string", groupName: "Promotion tag", groupId: "promotion-tag", defaultValue: "Free shiping", label: "Description", id: "promotion-tag__description" !####" />
<meta itemprop="discountCode" content="#### type: "string", groupName: "Promotion tag", groupId: "promotion-tag", id: "promotion-tag__code", label: "Code", defaultValue: "WELCOME20" !####" />
<meta itemprop="availabilityStarts" content="#### type: "string", groupName: "Promotion tag", groupId: "promotion-tag", defaultValue: "2024-10-15T00:00:00+00:00", label: "Start date", id: "promotion-tag__start-date" !####" />
<meta itemprop="availabilityEnds" content="#### type: "string", groupName: "Promotion tag", groupId: "promotion-tag", defaultValue: "2024-10-17T23:59:59+00:00", label: "End date", id: "promotion-tag__end-date" !####" />
</div>
<div itemscope itemtype="http://schema.org/PromotionCard">
<meta itemprop="image" content="FILL BANNER IMG" />
</div>
<!-- End Gmail Promo Tab annotations code -->
This will add the following fields in the **Config** section:



{
"description": "Points for returning bottles",
"displayHeader": "Eco - second life of your bottle",
"points": "{{event.params.productsCount|multiply(10)|int}}"
}
In the jinjava code presented above, `points` is the number of points added to the profile. This number is counted based on the `productsCount` from the `client.returnBottles` event, which stores the number of returned bottles. In our use case, the number of points is the number of bottles multiplied by 10.




[
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "{% customer firstname %}"
},
{
"type": "text",
"text": "{% aggregate c37acfe7-08a1-345c-a3e7-da795bb6a326 %}{% for item in aggregate_result %}{% catalog.store-1(item).name %}{% endfor %}{% endaggregate %}"
},
{
"type": "text",
"text": "{% voucher %} 8c3c8fd3-e7e9-487d-ba89-0b7824f65f33 {% endvoucher %}"
}
]
},
{
"type": "button",
"parameters":
"index": "0",
"sub_type": "url", [
{
"type": "url",
"text": "{% aggregate c37acfe7-08a1-345c-a3e7-da795bb6a326 %}{% for item in aggregate_result %}{% catalogvar.store-1(item).url %}{{ catalog_result|replace('https://yourshop.com', '') }}{% endcatalogvar %}{% endfor %}{% endaggregate %}"
}
]
},
{
"type": "header",
"parameters": [
{
"type": "image",
"image": {
"link": "{% aggregate c37acfe7-08a1-345c-a3e7-da795bb6a326 %}{% for item in aggregate_result %}{% catalogvar.store-1(item).image %}{{ catalog_result }}{% endcatalogvar %}{% endfor %}{% endaggregate %}"
}
}
]
}
]
9. Click **Apply**.
The following table explains all the inserts used in the body, button and header sections shown above.
| Section | Insert value | Insert explanation |
|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| body | `{% customer firstname %}` | The value of this insert is used as the value of `{{1}}`, so the name of a customer can be displayed in the message. |
| body | `{% aggregate c37acfe7-08a1-345c-a3e7-da795bb6a326 %} {% for item in aggregate_result %} {% catalog.store-1(item).name %} {% endfor %} {% endaggregate %}` | The value of this insert is used as the value of `{{2}}` to return a product that the customer bought the last time and did not purchase again within the estimated time period. |
| body | `{% voucher %} 8c3c8fd3-e7e9-487d-ba89-0b7824f65f33 {% endvoucher %}` | The value of this insert is used as the value of `{{3}}`. In this example, we assign a voucher code from the voucher pool to an individual customer. |
| button | `{% aggregate c37acfe7-08a1-345c-a3e7-da795bb6a326 %}{% for item in aggregate_result %}{% catalogvar.store-1(item).url %}{{ catalog_result\|replace('https://yourshop.com', '') }}{% endcatalogvar %}{% endfor %}{% endaggregate %}` | The value of this insert is used to return product url. Here we specify the URL omitting the domain, because we define the domain in the Meta platform, as you can see in the screenshot with the [button creation](/use-cases/send-replenishment-message-on-whats-app#create-a-message-template-in-the-meta-portal). |
| header | `{% aggregate c37acfe7-08a1-345c-a3e7-da795bb6a326 %}{% for item in aggregate_result %}{% catalogvar.store-1(item).image %}{{ catalog_result }}{% endcatalogvar %}{% endfor %}{% endaggregate %}` | This value of insert is used to return the url to the product image in header. |

category,city,itemId,lat,lon,postalCode,state,streetAddress,streetName,streetNumber,title STORE,Washington,497,38.897,-77.0251,20073,District of Columbia,3960 Killdeer Terrace,Hanson,8,Nienow and Sons STORE,Brooklyn,69,40.6924,-73.9666,11205,New York,7720 Mockingbird Circle,Bultman,39231,Baumbach-Glover STORE,Los Angeles,742,33.9754,-118.417,90094,California,85774 Stone Corner Street,Washington,652,Grimes LLC STORE,Little Rock,197,34.6725,-92.3529,72209,Arkansas,97498 Bunting Road,Boyd,712,Frami Inc STORE,Salem,622,44.8685,-123.0438,97306,Oregon,40 Dorton Court,Esch,79,Roberts and Sons STORE,Brea,550,33.9187,-117.8892,92822,California,92 Di Loreto Street,Golden Leaf,16877,Hermann-Bergnaum STORE,Sacramento,966,38.3774,-121.4444,94207,California,7250 Green Ridge Center,Kensington,6,Jacobson-Cronin STORE,Baton Rouge,492,30.3795,-91.1671,70820,Louisiana,3351 Grim Lane,Del Mar,5638,Bahringer Inc STORE,Dallas,710,32.7673,-96.7776,75387,Texas,0 Talisman Junction,Glendale,480,"Rippin, Wiza and Borer"








{ "analysis": { "title": "bestsellers [\"mobiles_tablets > mobiles\"] 30D", "description": "", "filter": { "matching": true, "expressions": [], "expression": { "name": "", "type": "EMPTY" } }, "reportMetrics": [ { "metricId": "8e03bdb3-408a-4a3b-bc96-4e5392a08735", "dateFilter": { "type": "RELATIVE", "duration": { "type": "DAYS", "value": 30 }, "offset": { "type": "DAYS", "value": 0 } }, "comparison": { "dateFilter": { "type": "ABSOLUTE" } }, "action": { "id": 71248, "name": "product.buy" }, "format": { "dataFormat": "numeric", "useSeparator": true, "compactNumbers": false, "fixedLength": 1 }, "grouping": { "type": "TOP", "top": 100 }, "groups": [ { "title": "$sku", "type": "EVENT", "format": { "dataFormat": "numeric", "useSeparator": true, "compactNumbers": false, "fixedLength": 1 }, "attribute": { "type": "PARAM", "param": "$sku", "id": "parameters:551610043" } } ], "eventName": "product.buy" } ] }, "allowNull": true }
{% set id = 0 %} {% set batch = [] %} {% for entry in event.params['body.data[0].values[0]'] %} {% set id = id|add(1) %} {% set item = {"itemKey":id|string,"value":{"no":id|string,"sku":entry.name[0], "transactions":entry.value}} %} {% do batch.append(item) %} {% endfor %} {{batch|tojson}}
{% set positions = range(1,101) %} {% set bestsellersMobileList = [] %} {% for position in positions %} {% catalogitem.bestsellersMobile(position) %} {% do bestsellersMobileList.append(catalog_result.sku) %} {% endcatalogitem %} {% endfor %} var bestsellersMobileSKUs = {{bestsellersMobileList|tojson}}; var bestsellersMobileHTML = `Bestseller
`; let bestsellersMobileURL = location.href; document.body.addEventListener('click', () => { requestAnimationFrame(() => { setTimeout(() => { bestsellersMobileURL !== location.href && showBestsellersMobile(); bestsellersMobileURL = location.href; }, 1000) }); }, true); function showBestsellersMobile() { var elements = document.querySelectorAll("a[data-sku]"); for (var i = 0; i < elements.length; i++) { if (bestsellersMobileSKUs.includes(elements[i].getAttribute("data-sku"))) { elements[i].insertAdjacentHTML('afterend', bestsellersMobileHTML); elements[i].addEventListener("click", function() { SR.event.trackCustomEvent( "dynamicContent.click", { "eventLabel": "Dynamic content click", "campaignName": "Label", "sku": this.getAttribute("data-sku"), "title": this.getAttribute("title"), "category": this.getAttribute("data-category") }, "Dynamic content click" ); }); } } } showBestsellersMobile();
<!-- 1. Get last boght products --> {% set lastBoughtProducts = []%} {% aggregate 245aa662-d642-352e-acef-18198604ac13 %} {%- for item in aggregate_result -%} {% do lastBoughtProducts.append(item)%} {%- endfor -%} {% endaggregate %} <!-- 2. Get recommendations for each of the last bpugt products --> {% set productsWithCrossSell = [] %} {%- for p in lastBoughtProducts -%} {% set itemContext = []%} {% do itemContext.append(p)%} {% recommendations3 campaignId=VR6SOFcDEbAg itemsIds=itemContext %} {% set prodObj = { "id": p, "crossSell": recommended_products3 }%} {%do productsWithCrossSell.append(prodObj)%} {% endrecommendations3 %} {%- endfor -%} <div class="cross-sell-wrapper unique-identifier"> <div class="left-carousel-wrapper"> <!-- 3. For each last bought product: get info about product from catalog --> <div class="snrs-left-carousel-header">Last bought</div> <div class="left-carousel my-main-carousel"> {% for product in productsWithCrossSell %} {% set key = product.id %} {% catalogitemv2.store-1(key) allowEmpty=true %} {% set object = catalog_result %} {% set name = object.name %} {% set img = object.image %} <div class="carousel-item" data-product-id="{{ product.id }}"> <img src="{{img}}""> <!-- <p class="snrs-prod-title">{{name}}</p> --> </div> {% endcatalogitemv2 %} {% endfor %} </div> </div> <div class="right-tabs-wrapper"> <!-- 4. Group products form each reco by categories (lowest level) --> {% for product in productsWithCrossSell %} {% set prodCategories = [] %} {% set categoryGroups = [] %} {% for p in product.crossSell %} {% set category = p.category|split(">")|last %} {% if prodCategories is not containing category %} {% do prodCategories.append(category) %} {% endif %} {% endfor %} {% for category in prodCategories %} {% set prodsArray = [] %} {% for p in product.crossSell %} {% set cat = p.category|split(">")|last %} {% if category == cat %} {# {% do prodsArray.append(p.itemId) %}#} {% do prodsArray.append(p) %} {% endif %} {% endfor %} {% set categoryWithProds = { "category": category, "products": prodsArray } %} {% do categoryGroups.append(categoryWithProds) %} {% endfor %} <!-- 5. Build tabs - the first is active by default --> <div class="product-tabs" data-product-id="{{ product.id }}"> {% set rangeMax = categoryGroups|length + 1%} {% for i in range(1, rangeMax) %} <input type="radio" name="tab-{{ product.id }}" id="tab-{{ product.id }}-{{ i }}" {% if i == 1 %}checked{% endif %}> {% endfor %} <div class="tab-labels"> {% for catGroup in categoryGroups %} {% set i = loop.index %} <label for="tab-{{ product.id }}-{{ i }}" class="tab-label">{{ catGroup.category }}</label> {% endfor %} </div> <!-- 6. Display reco products --> <div class="tab-contents"> {% for catGroup in categoryGroups %} {% set i = loop.index %} <div class="tab-content"> <div class="products-carousel"> {#{% for itemId in catGroup.products %} <div class="cross-sell-item"> Produkt ID: {{ itemId }} </div> {% endfor %}#} {% for p in catGroup.products %} <a href="{{p.productUrl}}" class="cross-sell-item"> <img src="{{p.image}}"> <p class="snrs-prod-title">{{p.name}}</p> <p class="snrs-prod-price">${{p.price}}</p> </a> {% endfor %} </div> </div> {% endfor %} </div> </div> <!-- 7. Styles controlling the tabs --> <style> {% for product in productsWithCrossSell %} {% set prodCategories = [] %} {% for p in product.crossSell %} {% set category = p.category|split(">")|last %} {% if prodCategories is not containing category %} {% do prodCategories.append(category) %} {% endif %} {% endfor %} {% set rangeMax = categoryGroups|length + 1%} {% for i in range(1, rangeMax) %} #tab-{{ product.id }}-{{ i }}:checked ~ .tab-labels .tab-label:nth-of-type({{ i }}), #tab-{{ product.id }}-{{ i }}:checked ~ .tab-contents .tab-content:nth-of-type({{ i }}) { display: block; } {% endfor %} {% endfor %} </style> {% endfor %} </div> </div> {% endfor %}(function(){ 'use strict'; // 1. Add carousel library var tns=function(){function e(){for(var e,t,n,i=arguments[0]||{},a=1,r=arguments.length;a<r;a++)if(null!==(e=arguments[a]))for(t in e)n=e[t],i!==n&&void 0!==n&&(i[t]=n);return i}function t(e){return["true","false"].indexOf(e)>=0?JSON.parse(e):e}function n(e,t,n){return n&&localStorage.setItem(e,t),t}function i(){var e=window.tnsId;return window.tnsId=e?e+1:1,"tns"+window.tnsId}function a(){var e=document,t=e.body;return t||(t=e.createElement("body"),t.fake=!0),t}function r(e){var t="";return e.fake&&(t=P.style.overflow,e.style.background="",e.style.overflow=P.style.overflow="hidden",P.appendChild(e)),t}function o(e,t){e.fake&&(e.remove(),P.style.overflow=t,P.offsetHeight)}function s(e){var t=document.createElement("style");return e&&t.setAttribute("media",e),document.querySelector("head").appendChild(t),t.sheet?t.sheet:t.styleSheet}function l(e,t,n,i){"insertRule"in e?e.insertRule(t+"{"+n+"}",i):e.addRule(t,n,i)}function c(e){return("insertRule"in e?e.cssRules:e.rules).length}function u(e,t){return Math.atan2(e,t)*(180/Math.PI)}function f(e,t){var n=!1,i=Math.abs(90-Math.abs(e));return i>=90-t?n="horizontal":i<=t&&(n="vertical"),n}function d(e,t){return e.className.indexOf(t)>=0}function v(e,t){d(e,t)||(e.className+=" "+t)}function h(e,t){d(e,t)&&(e.className=e.className.replace(t,""))}function p(e,t){return e.hasAttribute(t)}function m(e,t){return e.getAttribute(t)}function y(e){return void 0!==e.item}function g(e,t){if(e=y(e)||e instanceof Array?e:[e],"[object Object]"===Object.prototype.toString.call(t))for(var n=e.length;n--;)for(var i in t)e[n].setAttribute(i,t[i])}function b(e,t){e=y(e)||e instanceof Array?e:[e],t=t instanceof Array?t:[t];for(var n=t.length,i=e.length;i--;)for(var a=n;a--;)e[i].removeAttribute(t[a])}function x(e){e.style.cssText=""}function T(e){p(e,"hidden")||g(e,{hidden:""})}function E(e){p(e,"hidden")&&b(e,"hidden")}function C(e){return e.offsetWidth>0&&e.offsetHeight>0}function w(e){return"boolean"==typeof e.complete?e.complete:"number"==typeof e.naturalWidth?0!==e.naturalWidth:void 0}function N(e){for(var t=document.createElement("fakeelement"),n=(e.length,0);n<e.length;n++){var i=e[n];if(void 0!==t.style[i])return i}return!1}function O(e,t){var n=!1;return/^Webkit/.test(e)?n="webkit"+t+"End":/^O/.test(e)?n="o"+t+"End":e&&(n=t.toLowerCase()+"end"),n}function D(e,t){for(var n in t){var i=("touchstart"===n||"touchmove"===n)&&W;e.addEventListener(n,t[n],i)}}function k(e,t){for(var n in t){var i=["touchstart","touchmove"].indexOf(n)>=0&&W;e.removeEventListener(n,t[n],i)}}function A(){return{topics:{},on:function(e,t){this.topics[e]=this.topics[e]||[],this.topics[e].push(t)},off:function(e,t){if(this.topics[e])for(var n=0;n<this.topics[e].length;n++)if(this.topics[e][n]===t){this.topics[e].splice(n,1);break}},emit:function(e,t){this.topics[e]&&this.topics[e].forEach(function(e){e(t)})}}}function M(e,t,n,i,a,r,o){function s(){r-=l,u+=f,e.style[t]=n+u+c+i,r>0?setTimeout(s,l):o()}var l=Math.min(r,10),c=a.indexOf("%")>=0?"%":"px",a=a.replace(c,""),u=Number(e.style[t].replace(n,"").replace(i,"").replace(c,"")),f=(a-u)/r*l;setTimeout(s,l)}Object.keys||(Object.keys=function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}),function(){"use strict";"remove"in Element.prototype||(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}();var P=document.documentElement,I=!1;try{var S=Object.defineProperty({},"passive",{get:function(){I=!0}});window.addEventListener("test",null,S)}catch(e){}var W=!!I&&{passive:!0},H=navigator.userAgent,L=!0,z={};try{z=localStorage,z.tnsApp&&z.tnsApp!==H&&["tC","tSP","tMQ","tTf","tTDu","tTDe","tADu","tADe","tTE","tAE"].forEach(function(e){z.removeItem(e)}),z.tnsApp=H}catch(e){L=!1}localStorage||(z={});var B=document,R=window,j={ENTER:13,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40},q=t(z.tC)||n("tC",function(){var e=document,t=a(),n=r(t),i=e.createElement("div"),s=!1;t.appendChild(i);try{for(var l,c=["calc(10px)","-moz-calc(10px)","-webkit-calc(10px)"],u=0;u<3;u++)if(l=c[u],i.style.width=l,10===i.offsetWidth){s=l.replace("(10px)","");break}}catch(e){}return t.fake?o(t,n):i.remove(),s}(),L),G=t(z.tSP)||n("tSP",function(){var e,t,n=document,i=a(),s=r(i),l=n.createElement("div"),c=n.createElement("div");return l.style.cssText="width: 10px",c.style.cssText="float: left; width: 5.5px; height: 10px;",e=c.cloneNode(!0),l.appendChild(c),l.appendChild(e),i.appendChild(l),t=c.offsetTop!==e.offsetTop,i.fake?o(i,s):l.remove(),t}(),L),F=t(z.tMQ)||n("tMQ",function(){var e,t=document,n=a(),i=r(n),s=t.createElement("div"),l=t.createElement("style"),c="@media all and (min-width:1px){.tns-mq-test{position:absolute}}";return l.type="text/css",s.className="tns-mq-test",n.appendChild(l),n.appendChild(s),l.styleSheet?l.styleSheet.cssText=c:l.appendChild(t.createTextNode(c)),e=window.getComputedStyle?window.getComputedStyle(s).position:s.currentStyle.position,n.fake?o(n,i):s.remove(),"absolute"===e}(),L),U=t(z.tTf)||n("tTf",N(["transform","WebkitTransform","MozTransform","msTransform","OTransform"]),L),X=t(z.tTDu)||n("tTDu",N(["transitionDuration","WebkitTransitionDuration","MozTransitionDuration","OTransitionDuration"]),L),V=t(z.tTDe)||n("tTDe",N(["transitionDelay","WebkitTransitionDelay","MozTransitionDelay","OTransitionDelay"]),L),Y=t(z.tADu)||n("tADu",N(["animationDuration","WebkitAnimationDuration","MozAnimationDuration","OAnimationDuration"]),L),K=t(z.tADe)||n("tADe",N(["animationDelay","WebkitAnimationDelay","MozAnimationDelay","OAnimationDelay"]),L),Q=t(z.tTE)||n("tTE",O(X,"Transition"),L),J=t(z.tAE)||n("tAE",O(Y,"Animation"),L);F||(G=!1);var Z=function(t){function n(){return R.innerWidth||B.documentElement.clientWidth||B.body.clientWidth}function a(e){var t;do{t=e.clientWidth,e=e.parentNode}while(!t);return t}function r(e){var n=t[e];return!n&>&&yt.indexOf(e)>=0&>.forEach(function(t){mt[t][e]&&(n=!0)}),n}function o(e,n){n=n?n:xt;var i,a={slideBy:"page",edgePadding:!1,autoHeight:!0};if(!tt&&e in a)i=a[e];else if("items"===e&&o("fixedWidth"))i=Math.floor(pt/(o("fixedWidth")+o("gutter")));else if("autoHeight"===e&&"outer"===kt)i=!0;else if(i=t[e],gt&&yt.indexOf(e)>=0)for(var r=0,s=gt.length;r<s;r++){var l=gt[r];if(!(n>=l))break;e in mt[l]&&(i=mt[l][e])}return"slideBy"===e&&"page"===i&&(i=o("items")),i}function y(e){return q?q+"("+100*e+"% / "+qt+")":100*e/qt+"%"}function N(e,t,n){var i="";if(e){var a=e;t&&(a+=t),i=n?"margin: 0px "+(pt%(n+t)+t)/2+"px":lt?"margin: 0 "+e+"px 0 "+a+"px;":"padding: "+a+"px 0 "+e+"px 0;"}else if(t&&!n){var r="-"+t+"px",o=lt?r+" 0 0":"0 "+r+" 0";i="margin: 0 "+o+";"}return i}function O(e,t,n){return e?(e+t)*qt+"px":q?q+"("+100*qt+"% / "+n+")":100*qt/n+"%"}function P(e,t,n){var i="";if(lt){if(i="width:",e)i+=e+t+"px";else{var a=tt?qt:n;i+=q?q+"(100% / "+a+")":100/a+"%"}i+=ln+";"}return i}function I(e){var t="";if(e!==!1){t=(lt?"padding-":"margin-")+(lt?"right":"bottom")+": "+e+"px;"}return t}function S(e){e=e||R.event,clearTimeout(Ct),Ct=setTimeout(function(){if(st){var t=n();xt!==t&&(xt=t,W(),"outer"===kt&&en.emit("outerResized",Qe(e)))}},100)}function W(){var e=bt,t=Kt,n=Ot,i=sn;if(pt=a(ct),ot=a(ut),gt&&H(),e!==bt||Pt){var r=It,s=Lt,u=Pt,f=Mt,d=At,v=rn;if(Ot=o("items"),Dt=o("slideBy"),rn=o("disable"),sn=!!rn||!!on&&ht<=Ot,Ot!==n&&(Zt=qt-Ot,si()),rn!==v&&$(rn),sn!==i&&(sn&&(Kt=tt?jt:0),L()),e!==bt&&(St=o("speed"),Mt=o("edgePadding"),At=o("gutter"),Pt=o("fixedWidth"),rn||Pt===u||pe(),(Lt=o("autoHeight"))!==s&&(Lt||(ut.style.height=""))),It=!sn&&o("arrowKeys"),It!==r&&(It?D(B,vn):k(B,vn)),mn){var h=Dn,p=kn;Dn=!sn&&o("controls"),kn=o("controlsText"),Dn!==h&&(Dn?E(An):T(An)),kn!==p&&(Cn.innerHTML=kn[0],wn.innerHTML=kn[1])}if(yn){var m=Pn;Pn=!sn&&o("nav"),Pn!==m&&(Pn?(E(In),Ke()):T(In))}if(xn){var y=ti;ti=!sn&&o("touch"),ti!==y&&tt&&(ti?D(ft,hn):k(ft,hn))}if(Tn){var g=ri;ri=!sn&&o("mouseDrag"),ri!==g&&tt&&(ri?D(ft,pn):k(ft,pn))}if(bn){var b=Un,x=Kn,C=Jn,w=Yn;if(sn?Un=Kn=Jn=!1:(Un=o("autoplay"),Un?(Kn=o("autoplayHoverPause"),Jn=o("autoplayResetOnVisibility")):Kn=Jn=!1),Yn=o("autoplayText"),Xn=o("autoplayTimeout"),Un!==b&&(Un?(Qn&&E(Qn),jn||Gn||De()):(Qn&&T(Qn),jn&&ke())),Kn!==x&&(Kn?D(ft,fn):k(ft,fn)),Jn!==C&&(Jn?D(B,dn):k(B,dn)),Qn&&Yn!==w){var A=Un?1:0,M=Qn.innerHTML,S=M.length-w[A].length;M.substring(S)===w[A]&&(Qn.innerHTML=M.substring(0,S)+Yn[A])}}if(!F){if(sn||Mt===f&&At===d||(ut.style.cssText=N(Mt,At,Pt)),tt&<&&(Pt!==u||At!==d||Ot!==n)&&(ft.style.width=O(Pt,At,Ot)),lt&&(Ot!==n||At!==d||Pt!=u)){var W=P(Pt,At,Ot)+I(At);zt.removeRule(c(zt)-1),l(zt,"#"+an+" > .tns-item",W,c(zt))}Pt||Kt!==t||ye(0)}Kt!==t&&(en.emit("indexChanged",Qe()),ye(0),Qt=Kt),Ot!==n&&(ne(),se(),ee(),navigator.msMaxTouchPoints&&re())}lt||rn||(ae(),Ve(),pe()),z(!0),ee()}function H(){bt=0,gt.forEach(function(e,t){xt>=e&&(bt=t+1)})}function L(){var e="tns-transparent";if(sn){if(!Nt){if(Mt&&(ut.style.margin="0px"),jt)for(var t=jt;t--;)tt&&v(vt[t],e),v(vt[qt-t-1],e);Nt=!0}}else if(Nt){if(Mt&&!Pt&&F&&(ut.style.margin=""),jt)for(var t=jt;t--;)tt&&h(vt[t],e),h(vt[qt-t-1],e);Nt=!1}}function z(e){Pt&&Mt&&(sn||pt<=Pt+At?"0px"!==ut.style.margin&&(ut.style.margin="0px"):e&&(ut.style.cssText=N(Mt,At,Pt)))}function $(e){var t=vt.length;if(e){if(zt.disabled=!0,ft.className=ft.className.replace(nn.substring(1),""),x(ft),Ht)for(var n=jt;n--;)tt&&T(vt[n]),T(vt[t-n-1]);if(lt&&tt||x(ut),!tt)for(var i=Kt,a=Kt+ht;i<a;i++){var r=vt[i];x(r),h(r,nt),h(r,rt)}}else{if(zt.disabled=!1,ft.className+=nn,lt||ae(),pe(),Ht)for(var n=jt;n--;)tt&&E(vt[n]),E(vt[t-n-1]);if(!tt)for(var i=Kt,a=Kt+ht;i<a;i++){var r=vt[i],o=i<Kt+Ot?nt:rt;r.style.left=100*(i-Kt)/Ot+"%",v(r,o)}}}function _(){if(Bt&&!rn){var e=Kt,t=Kt+Ot;for(Mt&&(e-=1,t+=1);e<t;e++)[].forEach.call(vt[e].querySelectorAll(".tns-lazy-img"),function(e){var t={};t[Q]=function(e){e.stopPropagation()},D(e,t),d(e,"loaded")||(e.src=m(e,"data-src"),v(e,"loaded"))})}}function ee(){if(Lt&&!rn){for(var e=[],t=Kt,n=Kt+Ot;t<n;t++)[].forEach.call(vt[t].querySelectorAll("img"),function(t){e.push(t)});0===e.length?ie():te(e)}}function te(e){e.forEach(function(t,n){w(t)&&e.splice(n,1)}),0===e.length?ie():setTimeout(function(){te(e)},16)}function ne(){_(),oe(),de(),Ke(),le()}function ie(){for(var e,t=[],n=Kt,i=Kt+Ot;n<i;n++)t.push(vt[n].offsetHeight);e=Math.max.apply(null,t),ut.style.height!==e&&(X&&ve(St),ut.style.height=e+"px")}function ae(){Et=[0];for(var e,t=vt[0].getBoundingClientRect().top,n=1;n<qt;n++)e=vt[n].getBoundingClientRect().top,Et.push(e-t)}function re(){ct.style.msScrollSnapPointsX="snapInterval(0%, "+100/Ot+"%)"}function oe(){for(var e=Kt+Math.min(ht,Ot),t=qt;t--;){var n=vt[t];t>=Kt&&t<e?p(n,"tabindex")&&(g(n,{"aria-hidden":"false"}),b(n,["tabindex"]),v(n,En)):(p(n,"tabindex")||g(n,{"aria-hidden":"true",tabindex:"-1"}),d(n,En)&&h(n,En))}}function se(){if(!tt){for(var e=Kt+Math.min(ht,Ot),t=qt;t--;){var n=vt[t];t>=Kt&&t<e?(v(n,"tns-moving"),n.style.left=100*(t-Kt)/Ot+"%",v(n,nt),h(n,rt)):n.style.left&&(n.style.left="",v(n,rt),h(n,nt)),h(n,it)}setTimeout(function(){[].forEach.call(vt,function(e){h(e,"tns-moving")})},300)}}function le(){if(Pn&&(Ln=Hn!==-1?Hn:Kt%ht,Hn=-1,Ln!==zn)){var e=Mn[zn],t=Mn[Ln];g(e,{tabindex:"-1","aria-selected":"false"}),g(t,{tabindex:"0","aria-selected":"true"}),h(e,Bn),v(t,Bn)}}function ce(e){return"button"===e.nodeName.toLowerCase()}function ue(e){return"true"===e.getAttribute("aria-disabled")}function fe(e,t,n){e?t.disabled=n:t.setAttribute("aria-disabled",n.toString())}function de(){if(Dn&&!Wt&&!Ht){var e=Nn?Cn.disabled:ue(Cn),t=On?wn.disabled:ue(wn),n=Kt===Jt,i=!Wt&&Kt===Zt;n&&!e&&fe(Nn,Cn,!0),!n&&e&&fe(Nn,Cn,!1),i&&!t&&fe(On,wn,!0),!i&&t&&fe(On,wn,!1)}}function ve(e,t){e=e?e/1e3+"s":"",t=t||ft,t.style[X]=e,tt||(t.style[Y]=e),lt||(ut.style[X]=e)}function he(){var e;if(lt)if(Pt)e=-(Pt+At)*Kt+"px";else{var t=U?qt:Ot;e=100*-Kt/t+"%"}else e=-Et[Kt]+"px";return e}function pe(e){e||(e=he()),ft.style[Ut]=Xt+e+Vt}function me(e,t,n,i){for(var a=e,r=e+Ot;a<r;a++){var o=vt[a];i||(o.style.left=100*(a-Kt)/Ot+"%"),X&&ve(St,o),at&&V&&(o.style[V]=o.style[K]=at*(a-e)/1e3+"s"),h(o,t),v(o,n),i&&Rt.push(o)}}function ye(e,t){isNaN(e)&&(e=St),jn&&!C(ft)&&(e=0),X&&ve(e),li(e,t)}function ge(e,t){Ft&&si(),(Kt!==Qt||t)&&(en.emit("indexChanged",Qe()),en.emit("transitionStart",Qe()),jn&&e&&["click","keydown"].indexOf(e.type)>=0&&ke(),$t=!0,ye())}function be(e){return e.toLowerCase().replace(/-/g,"")}function xe(e){if(tt||$t){if(en.emit("transitionEnd",Qe(e)),!tt&&Rt.length>0)for(var t=0;t<Ot;t++){var n=Rt[t];n.style.left="",X&&ve(0,n),at&&V&&(n.style[V]=n.style[K]=""),h(n,it),v(n,rt)}if(!e||!tt&&e.target.parentNode===ft||e.target===ft&&be(e.propertyName)===be(Ut)){if(!Ft){var i=Kt;si(),Kt!==i&&(en.emit("indexChanged",Qe()),X&&ve(0),pe())}ee(),"inner"===kt&&en.emit("innerLoaded",Qe()),$t=!1,zn=Ln,Qt=Kt}}}function Te(e,t){if(!sn)if("prev"===e)Ee(t,-1);else if("next"===e)Ee(t,1);else if(!$t){var n=Kt%ht,i=0;if(n<0&&(n+=ht),"first"===e)i=-n;else if("last"===e)i=ht-Ot-n;else if("number"!=typeof e&&(e=parseInt(e)),!isNaN(e)){var a=e%ht;a<0&&(a+=ht),i=a-n}Kt+=i,Kt%ht!=Qt%ht&&ge(t)}}function Ee(e,t){if(!$t){var n;if(!t){e=e||R.event;for(var i=e.target||e.srcElement;i!==An&&[Cn,wn].indexOf(i)<0;)i=i.parentNode;var a=[Cn,wn].indexOf(i);a>=0&&(n=!0,t=0===a?-1:1)}if(Wt){if(Kt===Jt&&t===-1)return void Te("last",e);if(Kt===Zt&&1===t)return void Te(0,e)}t&&(Kt+=Dt*t,ge(n||e&&"keydown"===e.type?e:null))}}function Ce(e){if(!$t){e=e||R.event;for(var t,n=e.target||e.srcElement;n!==In&&!p(n,"data-nav");)n=n.parentNode;p(n,"data-nav")&&(t=Hn=[].indexOf.call(Mn,n),Te(t,e))}}function we(){Rn=setInterval(function(){Ee(null,Vn)},Xn),jn=!0}function Ne(){clearInterval(Rn),jn=!1}function Oe(e,t){g(Qn,{"data-action":e}),Qn.innerHTML=Zn[0]+e+Zn[1]+t}function De(){we(),Qn&&Oe("stop",Yn[1])}function ke(){Ne(),Qn&&Oe("start",Yn[0])}function Ae(){Un&&!jn&&(De(),Gn=!1)}function Me(){jn&&(ke(),Gn=!0)}function Pe(){jn?(ke(),Gn=!0):(De(),Gn=!1)}function Ie(){B.hidden?jn&&(Ne(),Fn=!0):Fn&&(we(),Fn=!1)}function Se(){jn&&(Ne(),qn=!0)}function We(){qn&&(we(),qn=!1)}function He(e){switch(e=e||R.event,e.keyCode){case j.LEFT:Ee(e,-1);break;case j.RIGHT:Ee(e,1)}}function Le(e){switch(e=e||R.event,e.keyCode){case j.LEFT:case j.UP:case j.PAGEUP:Cn.disabled||Ee(e,-1);break;case j.RIGHT:case j.DOWN:case j.PAGEDOWN:wn.disabled||Ee(e,1);break;case j.HOME:Te(0,e);break;case j.END:Te(ht-1,e)}}function ze(e){e.focus()}function Be(e){function n(e){return t.navContainer?e:Sn[e]}var i=B.activeElement;if(p(i,"data-nav")){e=e||R.event;var a=e.keyCode,r=[].indexOf.call(Mn,i),o=Sn.length,s=Sn.indexOf(r);switch(t.navContainer&&(o=ht,s=r),a){case j.LEFT:case j.PAGEUP:s>0&&ze(Mn[n(s-1)]);break;case j.UP:case j.HOME:s>0&&ze(Mn[n(0)]);break;case j.RIGHT:case j.PAGEDOWN:s<o-1&&ze(Mn[n(s+1)]);break;case j.DOWN:case j.END:s<o-1&&ze(Mn[n(o-1)]);break;case j.ENTER:case j.SPACE:Hn=r,Te(r,e)}}}function Re(){ye(0,ft.scrollLeft()),Qt=Kt}function je(e){return e.target||e.srcElement}function qe(e){return e.type.indexOf("touch")>=0}function Ge(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Fe(e){if(ai=0,wt=!1,ni=ii=null,!$t){e=e||R.event;var t;qe(e)?(t=e.changedTouches[0],en.emit("touchStart",Qe(e))):(t=e,Ge(e),en.emit("dragStart",Qe(e))),ni=parseInt(t.clientX),ii=parseInt(t.clientY),$n=parseFloat(ft.style[Ut].replace(Xt,"").replace(Vt,""))}}function Ue(e){if(!$t&&null!==ni){e=e||R.event;var n;if(qe(e)?n=e.changedTouches[0]:(n=e,Ge(e)),_n=parseInt(n.clientX)-ni,ei=parseInt(n.clientY)-ii,0===ai&&(ai=f(u(ei,_n),15)===t.axis),ai){qe(e)?en.emit("touchMove",Qe(e)):(oi||(oi=!0),en.emit("dragMove",Qe(e))),wt||(wt=!0);var i=$n;if(lt)if(Pt)i+=_n,i+="px";else{var a=U?_n*Ot*100/(ot*qt):100*_n/ot;i+=a,i+="%"}else i+=ei,i+="px";U&&ve(0),ft.style[Ut]=Xt+i+Vt}}}function Xe(e){if(!$t&&wt){e=e||R.event;var t;qe(e)?(t=e.changedTouches[0],en.emit("touchEnd",Qe(e))):(t=e,en.emit("dragEnd",Qe(e))),_n=parseInt(t.clientX)-ni,ei=parseInt(t.clientY)-ii;var n=Boolean(lt?_n:ei);if(ai=0,wt=!1,ni=ii=null,lt){var i=-_n*Ot/ot;i=_n>0?Math.floor(i):Math.ceil(i),Kt+=i}else{var a=-($n+ei);if(a<=0)Kt=Jt;else if(a>=Et[Et.length-1])Kt=Zt;else{var r=0;do{r++,Kt=ei<0?r+1:r}while(r<qt&&a>=Et[r+1])}}if(ge(e,n),oi){oi=!1;var o=je(e);D(o,{click:function e(t){Ge(t),k(o,{click:e})}})}}}function Ve(){ut.style.height=Et[Kt+Ot]-Et[Kt]+"px"}function Ye(){Sn=[];for(var e=Kt%ht%Ot;e<ht;)!Ht&&e+Ot>ht&&(e=ht-Ot),Sn.push(e),e+=Ot;(Ht&&Sn.length*Ot<ht||!Ht&&Sn[0]>0)&&Sn.unshift(0)}function Ke(){Pn&&!gn&&(Ye(),Sn!==Wn&&([].forEach.call(Mn,function(e,t){Sn.indexOf(t)<0?T(e):E(e)}),Wn=Sn))}function Qe(e){return{container:ft,slideItems:vt,navContainer:In,navItems:Mn,controlsContainer:An,hasControls:mn,prevButton:Cn,nextButton:wn,items:Ot,slideBy:Dt,cloneCount:jt,slideCount:ht,slideCountNew:qt,index:Kt,indexCached:Qt,navCurrentIndex:Ln,navCurrentIndexCached:zn,visibleNavIndexes:Sn,visibleNavIndexesCached:Wn,event:e||{}}}t=e({container:B.querySelector(".slider"),mode:"carousel",axis:"horizontal",items:1,gutter:0,edgePadding:0,fixedWidth:!1,slideBy:1,controls:!0,controlsText:["prev","next"],controlsContainer:!1,nav:!0,navContainer:!1,navAsThumbnails:!1,arrowKeys:!1,speed:300,autoplay:!1,autoplayTimeout:5e3,autoplayDirection:"forward",autoplayText:["start","stop"],autoplayHoverPause:!1,autoplayButton:!1,autoplayButtonOutput:!0,autoplayResetOnVisibility:!0,loop:!0,rewind:!1,autoHeight:!1,responsive:!1,lazyload:!1,touch:!0,mouseDrag:!1,nested:!1,freezable:!0,onInit:!1},t||{}),["container","controlsContainer","navContainer","autoplayButton"].forEach(function(e){"string"==typeof t[e]&&(t[e]=B.querySelector(t[e]))});var Je=R.console&&"function"==typeof R.console.warn;if(!t.container||!t.container.nodeName)return void(Je&&console.warn("Can't find container element."));if(t.container.children.length<2)return void(Je&&console.warn("Slides less than 2."));if(t.responsive){var Ze={},$e=t.responsive;for(var _e in $e){var et=$e[_e];Ze[_e]="number"==typeof et?{items:et}:et}t.responsive=Ze,Ze=null,0 in t.responsive&&(t=e(t,t.responsive[0]),delete t.responsive[0])}var tt="carousel"===t.mode;if(!tt){t.axis="horizontal",t.rewind=!1,t.loop=!0,t.edgePadding=!1;var nt="tns-fadeIn",it="tns-fadeOut",at=!1,rt=t.animateNormal||"tns-normal";Q&&J&&(nt=t.animateIn||nt,it=t.animateOut||it,at=t.animateDelay||at)}var ot,st,lt="horizontal"===t.axis,ct=B.createElement("div"),ut=B.createElement("div"),ft=t.container,dt=ft.parentNode,vt=ft.children,ht=vt.length,pt=a(dt),mt=t.responsive,yt=[],gt=!1,bt=0,xt=n();if(mt){gt=Object.keys(mt).map(function(e){return parseInt(e)}).sort(function(e,t){return e-t}),gt.forEach(function(e){yt=yt.concat(Object.keys(mt[e]))});var Tt=[];yt.forEach(function(e){Tt.indexOf(e)<0&&Tt.push(e)}),yt=Tt,H()}var Et,Ct,wt,Nt,Ot=o("items"),Dt="page"===o("slideBy")?Ot:o("slideBy"),kt=t.nested,At=o("gutter"),Mt=o("edgePadding"),Pt=o("fixedWidth"),It=o("arrowKeys"),St=o("speed"),Wt=t.rewind,Ht=!Wt&&t.loop,Lt=o("autoHeight"),zt=s(),Bt=t.lazyload,Rt=[],jt=Ht?2*ht:0,qt=tt?ht+2*jt:ht+jt,Gt=!(!Pt||Ht||Mt),Ft=!tt||!Ht,Ut=lt?"left":"top",Xt="",Vt="",Yt=o("startIndex"),Kt=Yt?function(e){return e%=ht,e<0&&(e+=ht),e=Math.min(e,qt-Ot)}(Yt):tt?jt:0,Qt=Kt,Jt=0,Zt=qt-Ot,$t=!1,_t=t.onInit,en=new A,tn=ft.id,nn=" tns-slider tns-"+t.mode,an=ft.id||i(),rn=o("disable"),on=t.freezable,sn=!!rn||!!on&&ht<=Ot,ln="inner"===kt?" !important":"",cn={click:Ee,keydown:Le},un={click:Ce,keydown:Be},fn={mouseover:Se,mouseout:We},dn={visibilitychange:Ie},vn={keydown:He},hn={touchstart:Fe,touchmove:Ue,touchend:Xe,touchcancel:Xe},pn={mousedown:Fe,mousemove:Ue,mouseup:Xe,mouseleave:Xe},mn=r("controls"),yn=r("nav"),gn=t.navAsThumbnails,bn=r("autoplay"),xn=r("touch"),Tn=r("mouseDrag"),En="tns-slide-active";if(mn)var Cn,wn,Nn,On,Dn=o("controls"),kn=o("controlsText"),An=t.controlsContainer;if(yn)var Mn,Pn=o("nav"),In=t.navContainer,Sn=[],Wn=Sn,Hn=-1,Ln=Kt%ht,zn=Ln,Bn="tns-nav-active";if(bn)var Rn,jn,qn,Gn,Fn,Un=o("autoplay"),Xn=o("autoplayTimeout"),Vn="forward"===t.autoplayDirection?1:-1,Yn=o("autoplayText"),Kn=o("autoplayHoverPause"),Qn=t.autoplayButton,Jn=o("autoplayResetOnVisibility"),Zn=["<span class='tns-visually-hidden'>"," animation</span>"];if(xn)var $n,_n,ei,ti=o("touch"),ni=null,ii=null,ai=0;if(Tn)var ri=o("mouseDrag"),oi=!1;sn&&(Dn=Pn=ti=ri=It=Un=Kn=Jn=!1),U&&(Ut=U,Xt="translate",Xt+=lt?"X(":"Y(",Vt=")"),function(){ct.appendChild(ut),dt.insertBefore(ct,ft),ut.appendChild(ft),ot=a(ut);var e="tns-outer",n="tns-inner",i=r("gutter");if(tt?lt&&(r("edgePadding")||i&&!t.fixedWidth)?e+=" tns-ovh":n+=" tns-ovh":i&&(e+=" tns-ovh"),ct.className=e,ut.className=n,ut.id=an+"-iw",Lt&&(ut.className+=" tns-ah",ut.style[X]=St/1e3+"s"),""===ft.id&&(ft.id=an),nn+=G?" tns-subpixel":" tns-no-subpixel",nn+=q?" tns-calc":" tns-no-calc",tt&&(nn+=" tns-"+t.axis),ft.className+=nn,tt&&Q){var s={};s[Q]=xe,D(ft,s)}e=n=null;for(var u=0;u<ht;u++){var f=vt[u];f.id||(f.id=an+"-item"+u),v(f,"tns-item"),!tt&&rt&&v(f,rt),g(f,{"aria-hidden":"true",tabindex:"-1"})}if(Ht||Mt){for(var d=B.createDocumentFragment(),p=B.createDocumentFragment(),m=jt;m--;){var x=m%ht,E=vt[x].cloneNode(!0);if(b(E,"id"),p.insertBefore(E,p.firstChild),tt){var C=vt[ht-1-x].cloneNode(!0);b(C,"id"),d.appendChild(C)}}ft.insertBefore(d,ft.firstChild),ft.appendChild(p),vt=ft.children}for(var w=Kt,k=Kt+Math.min(ht,Ot);w<k;w++){var f=vt[w];g(f,{"aria-hidden":"false"}),b(f,["tabindex"]),v(f,En),tt||(f.style.left=100*(w-Kt)/Ot+"%",v(f,nt),h(f,rt))}if(tt&<&&(G?(l(zt,"#"+an+" > .tns-item","font-size:"+R.getComputedStyle(vt[0]).fontSize+";",c(zt)),l(zt,"#"+an,"font-size:0;",c(zt))):[].forEach.call(vt,function(e,t){e.style.marginLeft=y(t)})),F){var A=N(t.edgePadding,t.gutter,t.fixedWidth);l(zt,"#"+an+"-iw",A,c(zt)),tt&<&&(A="width:"+O(t.fixedWidth,t.gutter,t.items),l(zt,"#"+an,A,c(zt))),(lt||t.gutter)&&(A=P(t.fixedWidth,t.gutter,t.items)+I(t.gutter),l(zt,"#"+an+" > .tns-item",A,c(zt)))}else if(ut.style.cssText=N(Mt,At,Pt),tt&<&&(ft.style.width=O(Pt,At,Ot)),lt||At){var A=P(Pt,At,Ot)+I(At);l(zt,"#"+an+" > .tns-item",A,c(zt))}if(lt||rn||(ae(),Ve()),mt&&F&>.forEach(function(e){var t=mt[e],n="",i="",a="",s="",l=o("items",e),c=o("fixedWidth",e),u=o("edgePadding",e),f=o("gutter",e);("edgePadding"in t||"gutter"in t)&&(i="#"+an+"-iw{"+N(u,f,c)+"}"),tt&<&&("fixedWidth"in t||"gutter"in t||"items"in t)&&(a="#"+an+"{width:"+O(c,f,l)+"}"),("fixedWidth"in t||r("fixedWidth")&&"gutter"in t||!tt&&"items"in t)&&(s+=P(c,f,l)),"gutter"in t&&(s+=I(f)),s.length>0&&(s="#"+an+" > .tns-item{"+s+"}"),n=i+a+s,n.length>0&&zt.insertRule("@media (min-width: "+e/16+"em) {"+n+"}",zt.cssRules.length)}),tt&&!rn&&pe(),navigator.msMaxTouchPoints&&(v(ct,"ms-touch"),D(ct,{scroll:Re}),re()),yn){var M=tt?jt:0;if(In)g(In,{"aria-label":"Carousel Pagination"}),Mn=In.children,[].forEach.call(Mn,function(e,t){g(e,{"data-nav":t,tabindex:"-1","aria-selected":"false","aria-controls":vt[M+t].id})});else{for(var H="",j=gn?"":" hidden",w=0;w<ht;w++)H+='<button data-nav="'+w+'" tabindex="-1" aria-selected="false" aria-controls="'+vt[M+w].id+j+'" type="button"></button>';H='<div class="tns-nav" aria-label="Carousel Pagination">'+H+"</div>",ct.insertAdjacentHTML("afterbegin",H),In=ct.querySelector(".tns-nav"),Mn=In.children}if(Ke(),X){var U=X.substring(0,X.length-18).toLowerCase(),A="transition: all "+St/1e3+"s";U&&(A="-"+U+"-"+A),l(zt,"[aria-controls^="+an+"-item]",A,c(zt))}g(Mn[Ln],{tabindex:"0","aria-selected":"true"}),v(Mn[Ln],Bn),D(In,un),Pn||T(In)}if(bn){var V=Un?"stop":"start";Qn?g(Qn,{"data-action":V}):t.autoplayButtonOutput&&(ut.insertAdjacentHTML("beforebegin",'<button data-action="'+V+'" type="button">'+Zn[0]+V+Zn[1]+Yn[0]+"</button>"),Qn=ct.querySelector("[data-action]")),Qn&&D(Qn,{click:Pe}),Un?(De(),Kn&&D(ft,fn),Jn&&D(ft,dn)):Qn&&T(Qn)}mn&&(An?(Cn=An.children[0],wn=An.children[1],g(An,{"aria-label":"Carousel Navigation",tabindex:"0"}),g(Cn,{"data-controls":"prev"}),g(wn,{"data-controls":"next"}),g(An.children,{"aria-controls":an,tabindex:"-1"})):(ct.insertAdjacentHTML("afterbegin",'<div class="tns-controls" aria-label="Carousel Navigation" tabindex="0"><button data-controls="prev" tabindex="-1" aria-controls="'+an+'" type="button">'+kn[0]+'</button><button data-controls="next" tabindex="-1" aria-controls="'+an+'" type="button">'+kn[1]+"</button></div>"),An=ct.querySelector(".tns-controls"),Cn=An.children[0],wn=An.children[1]),Nn=ce(Cn),On=ce(wn),de(),D(An,cn),Dn||T(An)),ti&&D(ft,hn),ri&&D(ft,pn),It&&D(B,vn),"inner"===kt?en.on("outerResized",function(){W(),en.emit("innerLoaded",Qe())}):(D(R,{resize:S}),"outer"===kt&&en.on("innerLoaded",ee)),_(),ee(),L(),z(),en.on("indexChanged",ne),"function"==typeof _t&&_t(Qe()),"inner"===kt&&en.emit("innerLoaded",Qe()),rn&&$(!0),st=!0}();var si=function(){return Ht?function(){var e=Jt,t=Zt;if(tt)if(e+=Dt,t-=Dt,Mt)e+=1,t-=1;else if(Pt){var n=At?At:0;pt%(Pt+n)>n&&(t-=1)}if(Kt>t)for(;Kt>=e+ht;)Kt-=ht;else if(Kt<e)for(;Kt<=t-ht;)Kt+=ht}:function(){Kt=Math.max(Jt,Math.min(Zt,Kt))}}(),li=function(){return tt?function(e,t){t||(t=he()),Gt&&Kt===Zt&&(t=-((Pt+At)*qt-ot)+"px"),X||!e?(pe(t),e&&C(ft)||xe()):M(ft,Ut,Xt,Vt,t,St,xe),lt||Ve()}:function(e){Rt=[];var t={};t[Q]=t[J]=xe,k(vt[Qt],t),D(vt[Kt],t),me(Qt,nt,it,!0),me(Kt,rt,nt),Q&&J&&e||xe()}}();return{getInfo:Qe,events:en,goTo:Te,play:Ae,pause:Me,isOn:st,rebuild:function(){return Z(t)},destroy:function(){if(k(R,{resize:S}),k(B,vn),zt.disabled=!0,Ht)for(var e=jt;e--;)tt&&vt[0].remove(),vt[vt.length-1].remove();var n=["tns-item",En];tt||(n=n.concat("tns-normal",nt));for(var i=ht;i--;){var a=vt[i];a.id.indexOf(an+"-item")>=0&&(a.id=""),n.forEach(function(e){h(a,e)})}if(b(vt,["style","aria-hidden","tabindex"]),vt=an=ht=qt=jt=null,Dn&&(k(An,cn),t.controlsContainer&&(b(An,["aria-label","tabindex"]),b(An.children,["aria-controls","aria-disabled","tabindex"])),An=Cn=wn=null),Pn&&(k(In,un),t.navContainer&&(b(In,["aria-label"]),b(Mn,["aria-selected","aria-controls","tabindex"])),In=Mn=null),Un&&(clearInterval(Rn),Qn&&k(Qn,{click:Pe}),k(ft,fn),k(ft,dn),t.autoplayButton&&b(Qn,["data-action"])),ft.id=tn||"",ft.className=ft.className.replace(nn,""),x(ft),tt&&Q){var r={};r[Q]=xe,k(ft,r)}k(ft,hn),k(ft,pn),dt.insertBefore(ft,ct),ct.remove(),ct=ut=ft=Kt=Qt=Ot=Dt=Ln=zn=mn=Sn=Wn=this.getInfo=this.events=this.goTo=this.play=this.pause=this.destroy=null,this.isOn=st=!1}}};return Z}(); // 2. Build carousel for products from aggregate const sliderMain = tns({ container: '.unique-identifier .my-main-carousel', items: 1, slideBy: 1, controls: true, nav: false, gutter: 10 }); // 3. Synch tabs with carousels function updateTabs(info) { let index, activeSlide; // Update slider for more than 1 product if (info && info.slideItems && info.slideItems.length) { index = info.index; activeSlide = info.slideItems[index]; } else { // Fallback for single product activeSlide = document.querySelector('.unique-identifier .glider-slide[data-product-id]'); } if (activeSlide) { const productId = activeSlide.getAttribute('data-product-id'); const productTabsAll = document.querySelectorAll('.unique-identifier .product-tabs'); const productTabsEl = document.querySelector(`.unique-identifier .product-tabs[data-product-id="${productId}"]`); productTabsAll.forEach(tab => tab.style.display = "none"); if (productTabsEl) { productTabsEl.style.display = "flex"; } } } updateTabs(sliderMain?.getInfo?.()); if (sliderMain?.events?.on) { sliderMain.events.on('indexChanged', updateTabs); } // 4. Init recomendation carousels document.querySelectorAll('.unique-identifier .products-carousel').forEach((carousel, index) => { tns({ container: carousel, items: 3, slideBy: 1, controls: true, center: false, nav: false, gutter: 10, loop: false, responsive: { 0: { items: 2 }, 768: { items: 4 } } }); }); })()
{% set additionalParamSku = metric_additional_params[ "product:retailer_part_no" ] %}
{% catalogitem.catalog-name(additionalParamSku) %}
{% set object = catalog_result %}
{{ object.get("superOffer") }}
{{ object.get("quantityInStock") }}
{% endcatalogitem %}
Where:
- `superOffer` is the column name from your catalog in which you can find the information if the specific product has the "Super Offer" label.
- `quantityInStock` is the column name from your catalog in which you can find the information how many products are in the stock currently.
- `metric_additional_params ["product:retailer_part_no"]` is the ID of the product on the website, extracted from [OG tags](/developers/inserts/dynamic-content#accessing-meta-properties).
- `catalog-name` is the name of the product catalog.
{% set additionalParamSku = metric_additional_params[ "product:retailer_part_no" ] %}
{% catalogitem.additional-info(additionalParamSku) %}
{% set object = catalog_result %}
<div class ="short-description">
<h3>Quantity In Stock</h3>
{{ object.get ("quantityInStock") }}
</div>
{% set ifOffer = object.get ("superOffer") %}
{% if ifOffer == 'true' %}
<div class="short-decription">
<h3 style="color: red">Super Offer</h3>
</div>
{% endif %}
{% endcatalogitem %}
<form action="" method="post" data-synerise="exit.survey "> <p>Why do you leave?</p> <div> <input type="radio" data-synerise="answer" id="stock" value="stock" name="answer"> <label for="stock">I didn’t find what I was looking for </label> </div> <div> <input type="radio" data-synerise="answer" id="prices" value="prices" name="answer"> <label for="prices">It was too expensive </label> </div> <div> <input type="radio" id="ux" data-synerise="answer" value="ux" name="answer"> <label for="ux">The website is not user friendly </label> </div> <input type="submit" value="Save"> </form><form action="" method="post" data-synerise="exit.survey "> <p>Why do you leave?</p> <div> <input type="radio" data-synerise="stock" id="stock" value="yes" name="stock"> <label for="stock">I didn’t find what I was looking for </label> </div> <div> <input type="radio" data-synerise="prices" id="prices" value="yes" name="prices"> <label for="prices">It was too expensive </label> </div> <div> <input type="radio" id="ux" data-synerise="ux" value="yes" name="ux"> <label for="ux">The website is not user friendly </label> </div> <input type="submit" value="Save"> </form>

{
"score": "{% expression %} rfm-score-expression {% endexpression %}",
"rfmSegmentName": "{% expression %} rfm-segment-name-expression {% endexpression %}"
}
- Replace `rfm-score-expression` with the ID of [the expression that calculates the RFM score](/use-cases/rfm-analysis#create-an-expression).
- Replace `rfm-segment-name-expression` with ID of the expression you created in [this part of the process](/use-cases/google-analytics-integration#create-an-expression-that-returns-rfm-segment-name).
7. Confirm by clicking **Apply**.

(function()
{if (document.querySelector('.account-link')){ // collecting information about whether the user is logged in
document.querySelectorAll(".current")[1].addEventListener("click", function () { // condition that the campaign should be displayed after clicking the dropdown with a mass of stone
document.querySelector('.sale').style.display='block'; // event that is sent when the campaign is displayed
SR.event.trackCustomEvent('sale', {
action: "rings_show"
}, 'Secret sale');
});
}
}());
2. Apply appropriate settings that will allow messages to be displayed on selected collections.
3. Attach custom events to measure campaign results.
4. Create analytics that will allow you to check campaign performance.
## 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), `sale` (~1), [`dynamicContent.click`](/docs/assets/events/event-reference/dynamic-content#dynamiccontentclick) (~1).
## Read more
---
- Read more about [custom events](/developers/web/event-tracking#declarative-tracking-custom-events)
- Read more about [dynamic content campaigns](/docs/campaign/dynamiccontent)
# Product-recipe matching for enhanced culinary experience
Today's customers are fans of convenience and are looking for quick and efficient solutions to meet their needs. When it comes to food, customers usually purchase products with a specific dish in mind or look for inspiration to create a delicious meal.
By matching products with recipes and vice versa, businesses can inspire customers to purchase the products needed for their next culinary adventure while also providing them with creative recipe ideas. This approach not only increases the average order value, but it also enhances the overall shopping and cooking experience. By seamlessly integrating shopping and recipe discovery, businesses can provide a more intuitive and satisfying experience for their customers, ultimately leading to increased loyalty and revenue growth.




curl 'https://api.synerise.com/search/v2/indices/8f3a20c375803e5807244e6bbc803fea1688306195/list?token=FEE539C0-D206-A685-88F8-0E433FCDFD1D&clientUUID=bbe22634-0105-41f3-ad7f-b2766071a012&limit=26&filters=itemId%20IN%20%5B%22100019%22,%22100010%22,%22100016%22,%2210006%22,%2210003%22,%2210001%22,%2210008%22,%22100023%22%5D'
Explanation of the respective elements of the request:
https://api.synerise.com/search/v2/indices/8f3a20c375803e5807244e6bbc803fea1688306195/list
token=FEE539C0-D206-A685-88F8-0E433FCDFD1D
clientUUID=bbe22634-0105-41f3-ad7f-b2766071a012
filters=itemId IN ["10001","10006"]
- **token**: the token parameter contains the authentication UUID (tracker key) that gives access to API,
- **clientUUID**: the parameter contains the identifier of the customer for which the request is sent,
- **filters**: is a parameter that specifies the criteria by which the elements should be retrieved. In this case, we are looking for items whose title matches one of the values in the array (10001, 10006). In other words, with **itemId** we retrieve the ingredients from which we can prepare the meals we are currently reviewing.
### Show related recepies on the ingredient page
---
An example of cURL request:
curl 'https://api.synerise.com/search/v2/indices/0036645cd9413eccbd31877a8c967e991688311535/list?token=FEE539C0-D206-A685-88F8-0E433FCDFD1D&clientUUID=bbe22634-0105-41f3-ad7f-b2766071a012&limit=26&filters=itemId%20IN%20%5B%2230003%22,%2230004%22,%2230005%22,%2230007%22,%2230009%22,%2230000%22,%2230001%22,%22300010%22,%22300011%22,%22300012%22,%2230002%22,%2230006%22%5D'
Explanation of the respective elements of the request:
https://api.synerise.com/search/v2/indices/0036645cd9413eccbd31877a8c967e991688311535/list
token=FEE539C0-D206-A685-88F8-0E433FCDFD1D
clientUUID=bbe22634-0105-41f3-ad7f-b2766071a012
filters=itemId IN ["30001","30002"]
- **token**: the token parameter contains the authentication UUID (tracker key) that gives access to the API,
- **clientUUID**: the parameter contains the identifier of the customer for which the request is sent,
- **filters**: is a parameter that specifies the criteria by which the elements should be retrieved. In this case, we are looking for items whose title matches one of the values in the array (30001, 30002). In other words, with **itemId** we retrieve recipes for meals we can prepare from the ingredient we are currently viewing.
## Check the use case set up on the Synerise Demo workspace
---
You can check all the analytics directly in the Synerise Demo workspace:
- [Ingredients catalog](https://app.synerise.com/assets/catalogs/17889)
- [Recipe catalog](https://app.synerise.com/assets/catalogs/17890)
- [Ingredients index](https://app.synerise.com/ai-v2/search/indices/8f3a20c375803e5807244e6bbc803fea1688306195/stats/global)
- [Recipe index](https://app.synerise.com/ai-v2/search/indices/0036645cd9413eccbd31877a8c967e991688311535/stats/global)
If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.
If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy 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:
[`item.search`](/docs/assets/events/event-reference/search#itemsearch) (~2), [`item.search.click`](/docs/assets/events/event-reference/search#itemsearchclick) (~1).
## Read more
---
- [AI engine configuration](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-search#selecting-attributes-for-preview)
- [AI search](/docs/ai-hub/ai-search/introduction-to-ai-search)
- [Catalogs](/docs/assets/catalogs)
# In-app message with a price drop for recently viewed products
In-app messaging has become an essential tool for businesses as it provides a direct and personal communication channel with customers.
Price drops are a key aspect of business strategy to drive sales, increase customer engagement, and enhance brand loyalty. In an ever-competitive market, price drops can help companies stand out and create a unique value proposition for their customers. With the right strategy, price drops can produce significant results, leading to revenue growth and increased customer engagement.
For customers, price drops represent an opportunity to save money on products that interest them. This, in turn, can increase customer loyalty and satisfaction and encourage repeat purchases.
The scenario described in this use case involves using an in-app message to notify customers of price drops on recently viewed products. The in-app message will be displayed right after the start of the mobile session only for customers for whom the product they were viewing has actually been reduced in price.
## Prerequisites
---
- Implement [Synerise tracking code](/developers/web/installation-and-configuration) on your website.
- Implement [OG Tags](/developers/web/og-tags) on your website.
- [Prepare a product feed](/docs/ai-hub/recommendations-v2/item-feed-requirements) with attributes to be used in item comparison recommendations.
- [Configure an item catalog for recommendations](/docs/settings/configuration/ai-engine-configuration/engine-configuration-for-recommendations). Enable the item comparison recommendations.
- Meet the minimum data requirements of interactions and events.
At least 10,000 item page visits for **Item comparison recommendations**.
## Create a recommendation
---
1. Go to
<form action="" method="post" data-synerise="BF_Preferences"> <input type="email" placeholder="E-mail" data-synerise="email" > <label> <input type="checkbox" data-synerise="BF_email_agreement" data-synerise-value="1"> I consent to the processing of my email address by xxxx in order to send me a newsletter with xxxx offers. </label> <label> <input type="checkbox" data-synerise="tvs" data-synerise-value="interested"> tvs </label> <label> <input type="checkbox" data-synerise="music" data-synerise-value="interested"> music </label> <label> <input type="checkbox" data-synerise="clothes" data-synerise-value="interested"> clothes </label> <input type="submit" value="Save" /> </form>
{
"points": "100"
}
3. Click **Apply**.
