# How to use recommendations in emails campaign

AB Tasty collects user events associated with `USER_ID` for data collection. Algorithms are trained for various scenarios such as discovering similar items, finding complementary products, and identifying bestsellers. The Algorithm Builder is used to build recommendations, which can be input-based (like those similar to the last viewed items) or non-input (such as bestsellers and new releases). There's also a data enrichment protocol that includes the exchange of a flat file mapping `USER_ID` to recommended products. In the near future, an API token will allow direct synchronization with Adobe Campaign.

#### How It Works

1. **Data Collection**
   * AB Tasty retrieves user events tied to `USER_ID`.
   * Algorithms trained (similar, complementary, bestsellers, etc.).
2. **Build Recommendation**
   * Use Ranking Blocks in Strategy Builder.
   * Input-based (similar to last viewed).
   * Non-input (bestsellers, new releases).
3. **Data Enrichment Protocol**
   * Exchange flat file (USER\_ID → RECO products).

## Prerequisites

* Ensure navigation events contain `USER_ID`.
* Configure file exchange protocol or direct API access.

## Deploying a new email recommendation

{% stepper %}
{% step %}

### Create a recommendation strategy in AB Tasty.

{% embed url="<https://docs.abtasty.com/~/revisions/qwC2vgJ0JzjAiTAzF6Mb/recommendations-and-merchandising-1/getting-started/recommendations/creating-a-recommendation>" %}
{% endstep %}

{% step %}

### Deploy the recommendation on Email campaign

After save your recommendation strategy, click on "deployment settings" on the bottom of the strategy builder.&#x20;

<figure><img src="/files/O6Uf2PFmjmwqS6G5PIbA" alt=""><figcaption></figcaption></figure>

{% tabs %}
{% tab title="Option 1 : JSON" %}
If in your Email tool support API request in JSON format you can use the Recommendation API request. \
\
Use the first part of the deployment page :

<figure><img src="/files/T7ZwMMXJBDyIiCvywGam" alt=""><figcaption></figcaption></figure>

Click on copy icon to have the ID of the recommendation in order to make the request API.

```
GET https://uc-info.eu.abtasty.com/v1/reco/[SITE_ID]/recos/[RECO_ID]?variables=[VARIABLES]&fields=[FIELDS]
```

<table><thead><tr><th>Parameter</th><th width="295.9453125">Description</th><th>Exemple</th></tr></thead><tbody><tr><td><code>RECO_ID</code></td><td>The unique identifier of your recommendation (copied from the platform).</td><td><code>5a936bc0-fbd1-4048-81a8-b94da73178e2</code></td></tr><tr><td><code>SITE_ID</code></td><td>Your AB Tasty site identifier.</td><td><code>952</code></td></tr><tr><td><code>VARIABLES</code></td><td>JSON-encoded dynamic variables used by the recommendation</td><td><code>JSON.stringify({</code><br><code>"viewing_item": "46857036202293",</code><br><code>"viewed_items": [</code><br><code>"46855642644789"</code><br><code>]</code><br><code>})</code></td></tr><tr><td><code>FIELDS</code></td><td>Optional JSON-encoded fields to retrieve from the query. By default, only id.</td><td><code>JSON.stringify([ "img_link", "id", "price", "catalog_page_path", "name", "revenues_last_30_days" ])</code></td></tr></tbody></table>

{% hint style="info" %}
You can also have the code to implemente in *CURL*, *Javascript* or *Python* to clicking on "Code" button.
{% endhint %}
{% endtab %}

{% tab title="Option 2 : Email Tools" %}
If you have an email tool that is compatible with feeds, use the second part of the deployment recommendation page.

Today, we have implemented the following email tools:

* <mark style="color:orange;">**Brevo**</mark> \
  <https://app.gitbook.com/o/iFKI1JaxSfPoiGt4tT2k/s/6Yw9IRJ6KbbucQPwZUCZ/~/changes/352/recommendations-and-merchandising-1/how-tos/deploy-a-strategy/how-to-deploy-a-recommendation-strategy-on-web/how-to-embed-personalized-recommendations-in-emails-campaign/how-to-deploy-recommendation-in-brevo>
  {% endtab %}

{% tab title="Option 3 : HTML" %}
If in your Email tool support API request in HTML format you can use the Template feature to have the result of recommendation in HTML.

1. **Create a template** <https://docs.abtasty.com/~/revisions/673CGZcWTYG6dra0XItJ/recommendations-and-merchandising-1/how-tos/how-to-create-a-template-of-recommendation>
2. Then, you can use the second part of the deployment recommendation page to **have the code to implemented in your tool**.&#x20;

   Today, we have implemented the following email tools:

   * <mark style="color:orange;">**SFMC**</mark>\
     [https://docs.abtasty.com/\~/revisions/4h93YjMk2bPutMvfaOT0/recommendations-and-merchandising-1/how-tos/how-to-configure-your-email-integration/how-to-configure-sfmc-integrati](https://docs.abtasty.com/~/revisions/4h93YjMk2bPutMvfaOT0/recommendations-and-merchandising-1/how-tos/how-to-configure-your-email-integration/how-to-configure-sfmc-integration)
     {% endtab %}
     {% endtabs %}

{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.abtasty.com/recommendations-and-merchandising/how-tos/how-to-deploy-a-strategy/how-to-deploy-a-recommendation-strategy-on-web/how-to-use-recommendations-in-emails-campaign.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
