This topic explains how to use layers to set up mutually exclusive experiments in LaunchDarkly. Mutually exclusive experiments are two or more experiments configured to prevent contexts from being included in more than one of them at a time.
Usually, it is not a problem to include a context in multiple experiments. However, there are some cases in which you may not want to include a context in more than one experiment at a time. For example, you may be concerned about collisions between experiments that are testing similar parts of your app, like two different changes to the same section of your app’s user interface (UI), or experiments running on both the back end and front end of the same functionality. In this case you can eliminate the interaction effect between experiments using layers.
Mutually exclusive experiments and holdout experiments are similar, but are used for different reasons. Mutually exclusive experiments use layers to ensure end users are not included in two or more specific experiments at the same time. Holdout experiments withhold a set of end users from all experiments. To learn more, read Holdouts.
LaunchDarkly Experimentation achieves mutually exclusive experiments using “layers.” You can add two or more experiments to a layer to ensure that those experiments never share the same traffic.
For example, you can create a “Checkout” layer that you add all of your experiments related to the checkout process to. Then, if you run multiple experiments at once, customers are never exposed to more than one experimental variation at a time.
Here is an example of three different layers: a “Promotions” layer with three experiments, a “Product pages” layer with two experiments, and a “Checkout” layer with three experiments:

In the example, customer A can’t be included in more than one experiment in the “Promotions” layer, more than one experiment in the “Product pages” layer, nor more than one experiment in the “Checkout” layer. Customer A can simultaneously be included in the “Promo modal,” “Personalization at quick view,” and “Checkout flow” experiments, because those experiments are all in different layers.
Before you create an experiment, decide how much of the layer’s traffic you want to include in the experiment. This is called the “reservation amount.” The more experiments you expect to include in the layer, the lower the reservation amount be.
For example:
As new contexts encounter experiments within the layer, LaunchDarkly will assign contexts based on each experiment’s reservation amount. You can change an experiment’s reservation amount on the experiment’s Design tab.
In the below example:
Here is an illustration of the audience allocation:

When you create an experiment, you can either:
Experiments can either be in a holdout, or in a layer, but not both. If an experiment is part of a holdout, you will not see the option to add it to a layer when you create it. To learn more, read Holdouts.
To create a new layer:

This new layer is now available to add additional experiments to.
You can also use the REST API: Create layer
To add a new experiment to an existing layer:

You can also use the REST API: Create experiment
To remove an experiment from a layer:
Before you can archive an experiment, you must remove it from any layers.