# How to run multiple A/B tests without overlap (mutually exclusive tests)

export const metadata = guideMeta("running-mutually-exclusive-tests");

Once you start testing seriously, one experiment at a time is too slow. You want
a homepage test, a product page test and a checkout test running together. The
question is what happens to a visitor who is eligible for more than one of them.

**Mutually exclusive tests** make sure each visitor takes part in at most one
experiment from a group. This guide explains when you need that, when you don't,
and how to set up the two most common setups in Testa.

## Why overlapping tests can mislead you

When a visitor is in two experiments at once, their behavior reflects both
changes. Most of the time that is fine. If the tests change unrelated things,
the effects average out across control and variation. It becomes a problem when
the tests **interact**:

- **Same element or message.** Test A changes the hero headline and Test B
  changes the hero image. Some visitors see a combination neither test was
  designed for.
- **Same decision.** Test A changes the price on the product page and Test B
  changes the discount at checkout. Both affect "will I buy at this price?",
  so the results contaminate each other.
- **One test changes who reaches the other.** If Test A makes more people reach
  checkout, Test B's checkout audience changes along with it.

In these cases, a winner in one test may only be a winner *because of* a
variation in the other. Mutual exclusion removes that doubt.

### When overlap is fine

Don't make every test exclusive by default. Each exclusion reduces the traffic
available to each test, and every test then takes longer. Overlap is acceptable
when the tests:

- change different, unrelated parts of the experience,
- measure different goals, and
- would plausibly have the same result whether or not the other test exists.

A reasonable rule: **exclude tests that touch the same page element, the same
offer or the same step of the funnel.** Let everything else overlap.

## How Testa decides which experiment a visitor enters

Two settings drive mutually exclusive tests in Testa:

- **Traffic allocation.** The share of eligible visitors that enters each
  experiment.
- **Experiment exclusions.** Found under **Advanced Settings**. Pick another
  experiment, and anyone already in it is kept out of this one. An exclusion
  added on one test applies in both directions.

When a visitor qualifies for several experiments, Testa's script evaluates them
in **random order** and assigns the visitor to the first one they qualify for.
Exclusions then keep them out of the rest. That random order is what lets you
split traffic evenly between exclusive tests.

<Screenshot
  src="/images/guides/traffic-allocation.png"
  alt="The traffic allocation control in an experiment's settings"
  caption="Traffic allocation controls what share of eligible visitors enters a test."
/>
<Screenshot
  src="/images/guides/experiment-exclusion.png"
  alt="Another experiment selected under Experiment exclusions"
  caption="Experiment exclusions keep visitors in one test out of another."
/>

## Setup 1: tests at different stages of the funnel

You want to test the landing page and the product page at the same time, and no
visitor should count in both.

- **Test 1** runs on the landing page (`/`).
- **Test 2** runs on the product page (`/product`).

Steps:

1. **Test 1:** set traffic allocation **below 100%**, for example 50%. Visitors
   who aren't allocated to Test 1 stay eligible for Test 2.
2. **Test 2:** set traffic allocation to **100%**, or at least higher than Test
   1.
3. In the **Advanced Settings** of either test, add the other test under
   **Experiment exclusions**.

The result: half of your landing page visitors enter Test 1. Everyone else who
reaches the product page, including visitors who skipped the landing page, can
enter Test 2. Nobody is counted in both.

> **Why Test 1 can**
>
> If the earlier test in the funnel takes 100% of visitors, everyone who reaches
> the product page through the landing page is already in Test 1. Test 2 then only
> gets visitors who skipped the landing page, which is a smaller and
> unrepresentative audience.

## Setup 2: several tests on the same page

Sometimes you'd rather run two separate tests from one entry point than one
experiment with many variations, for example when each variation is owned by a
different team, or you want to stop one test early without affecting the other.

- **Test 1:** control `/page-1`, variation `/page-2`
- **Test 2:** control `/page-1`, variation `/page-3`

Steps:

1. Set **both tests to 100%** traffic allocation.
2. In the **Advanced Settings** of Test 2, add Test 1 under **Experiment
   exclusions**.

Why this gives an even split:

- Testa evaluates the two experiments in random order and assigns the visitor to
  the first one.
- The exclusion keeps them out of the other.
- Because the order is random, traffic divides roughly 50/50 between the two
  tests.

To weight the split, for example 70/30, lower one test's traffic allocation
below 100%.

### Three or more tests

The same logic extends to more tests. Set each one to 100%, and add exclusions
so that every test excludes all the others. Each visitor lands in exactly one,
and traffic splits roughly evenly.

## Checking your setup before launch

1. **Write down the expected split.** For example, "50% of landing page
   visitors in Test 1, everyone else on the product page in Test 2." If you can't
   state it in one sentence, the setup is probably too complicated.
2. **Preview as a new visitor.** Open the site in a private window, check which
   experiment you're in, clear cookies and repeat a few times. With the
   [browser events](/guides/subscribing-to-events) you can log assignments to the
   console.
3. **Check the numbers after a day.** Compare each test's visitor counts with
   what you expected. A test far below its expected share usually means the
   allocation in an earlier test is too high.

## Common mistakes

- **Excluding everything from everything.** Unnecessary exclusions slow down
  every test in the group. Only exclude tests that interact.
- **Changing allocation mid-test.** Changing traffic allocation after launch
  changes who enters each test from that point on. Decide the setup first, then
  launch.
- **Forgetting new tests.** When you add a third test that touches the same
  area, add it to the exclusions of the existing tests too.

## FAQ

### Is a mutually exclusive test the same as a multivariate test?

No. A multivariate test deliberately combines changes to measure how they
interact. Mutually exclusive tests do the opposite: they keep experiments apart
so each one is measured on its own.

### Do exclusions reduce my sample size?

Yes. Each visitor can only count in one test, so each test gets a smaller share
of traffic and needs longer to finish. Use the [sample size calculator](/calculator)
with the traffic each test will actually receive.

### Does an exclusion need to be added on both tests?

No. An exclusion added on one test applies in both directions.

### Are exclusions checked only once?

No. Unlike targeting rules, which run on the first page load, exclusions are
checked every time a visitor loads an experiment page.
