# A/B Testing

While Feature Flags is not explictily an A/B testing add-on, it could be used as such. If a feature flag has the "Percent Variant" option set to 50%, and you update the template tag to use an else conditional you can run an A/B test. The only caveat is that you can't run multi-variant tests since a feature flag only has 2 states, on and off.

```html
{if feature:your_ab_test_name}
    Show A
{if:else}
    Show B
{/if}
```

When using a "Percent Variant", the user is cookied to that flag, so they will continue to see the original or variant upon subsequent page requests if you use the same conditional in mulitple places.

{% hint style="warning" %}
The "Percent Variant" field only sets the percentage chance that a user will see a particular feature flag, and in the context of an A/B test refers to the probability for an individual user to see the content gated by the flag.\
\
Feature Flags doesn't guarantee that the overall distribution of users will be exactly in line with those probabilities. For example, if you set the "Percent Variant" value to 80%, Feature Flags does not track and guarantee evenly distributed users across the variants.
{% endhint %}


---

# 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.boldminded.com/feature-flags/docs/a-b-testing.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.
