> For the complete documentation index, see [llms.txt](https://docs.abtasty.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.abtasty.com/recommendations-and-merchandising/how-tos/how-to-a-b-test-recommendation-strategies-using-ab-tasty-web-extensions.md).

# How to A/B test  recommendation strategies using AB Tasty Web Extensions

### Overview

The implementation relies on a clear separation of responsibilities.

#### AB Tasty side:

* Creates the A/B test
* Generates 2 variations: A and B
* Randomly assigns visitors
* Sets an experiment assignment cookie

#### Client or Agency side:

* Reads the cookie set by AB Tasty
* Interprets the assigned variation (A or B)
* Triggers the corresponding call to the Merchandising & Recommendation API

### AB Tasty Implementation

{% stepper %}
{% step %}

#### Create the test

Create an A/B test on the desired scope (product page, homepage, listing page, etc.) with two variations:

* **Variation A**
* **Variation B**

{% hint style="warning" %}
The test does not directly modify the recommendation block. It is only used to split traffic and set an assignment cookie.
{% endhint %}
{% endstep %}

{% step %}

### Set the assignment cookie

For each variation, AB Tasty sets a specific cookie identifying the assigned group.

Example:

* Group A → `ab_test_reco_1 = A`&#x20;
* Group B → `ab_test_reco_1 = B`

The exact cookie name can be adapted to your technical conventions.

This cookie is:

* Stored browser-side
* Accessible through JavaScript
* And allows the website to determine which variation the visitor belongs to
  {% endstep %}
  {% endstepper %}

### Client or agency implementation

{% stepper %}
{% step %}

#### Read the cookie

The website must read the `ab_test_reco_1` cookie.

Example:

```
const variation = getCookie("ab_test_reco_1");
```

{% endstep %}

{% step %}

### Conditional Recommendation & Merchandising API call

Depending on the cookie value:

* If `variation=A` → call Recommendation Strategy A
* If `variation=B` → call Recommendation Strategy B
  {% endstep %}
  {% endstepper %}

### Technical considerations - execution timing

The experiment assignment cookie must be read:

* After the AB Tasty script has been executed
* Before triggering the Merch & Recos API

### Notes

| AB Tasty Side      | Client Side          |
| ------------------ | -------------------- |
| Test creation      | Cookie reading       |
| Traffic allocation | A/B interpretation   |
| Cookie assignment  | Conditional API call |

* AB Tasty manages the experimentation layer
* The website controls which recommendation strategy is called


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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-a-b-test-recommendation-strategies-using-ab-tasty-web-extensions.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.
