Creating mutually exclusive experiments
Read time: 8 minutes
Last edited: Nov 09, 2024
Experimentation is available to all customers on a Developer, Foundation, or Enterprise plan. If you're on an older Pro or Enterprise plan, Experimentation is available as an add-on. To learn more, read about our pricing. To subscribe to a different plan, contact Sales.
Overview
This guide provides an example of how to create mutually exclusive experiments using experiment layers. Mutually exclusive experiments are two or more experiments configured to prevent contexts from being included in more than one experiment at a time.
Generally, it is not a problem to include a context in multiple experiments. Our Experimentation offering minimizes interaction effects using audience allocation, and you can be confident in the winning variation even when running multiple concurrent experiments with overlapping audiences.
However, there are some cases in which you may not want to include each 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 these cases, you can create mutually exclusive experiments using experiment layers.
Prerequisites
To complete this tutorial, you must have the following prerequisites:
- An active LaunchDarkly account with Experimentation enabled, and with permissions to create flags, edit experiments, and edit layers
- Familiarity with LaunchDarkly's Experimentation feature
- A basic understanding of your business's needs or key performance indicators (KPIs)
Concepts
Before you begin, you should understand the following concepts:
Layers
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 experiment variation at a time.
To learn more, read Experiment layers.
Reservation amounts
Before you create an experiment, you should 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:
- If you plan to have only two experiments in the layer, you might want to reserve 50% of traffic for each.
- If you plan to have five experiments in the layer, you might want to reserve 20% for each.
As new contexts encounter experiments within the layer, LaunchDarkly will assign contexts based on each experiment's reservation amount.
In this example, each experiment will have a reservation amount of 25%. Although there are only three planned experiments for this layer, leaving an extra 25% available means you could add a fourth experiment later.
Get started
Here is an example of multiple experiments split between three different layers. The "Promotions" layer includes three experiments, the "Product pages" layer includes two experiments, and the "Checkout" layer includes three experiments:
In this 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.
This guide will walk you through creating a "Promotions" layer and the three mutually exclusive experiments within it.
Create experiment flags
To begin, create the flags you will use in your experiments within the layer.
In this example, you will create three boolean experiment flags, one for each experiment in the layer:
- the "Promo modal" flag,
- the "Promo banner" flag, and
- the "Promo at cart" flag.
To learn how, read Experiment flags.
Create metrics
Next, create or select existing metrics to use in your experiments. In this example, you will be using a clicked or tapped conversion metric to measure completed checkouts.
To create the new metric:
- Navigate to the Metrics list.
- Click Create metric. The "Create metric" dialog appears.
- Select a metric kind of Clicked or tapped.
- Enter one or more CSS selectors in the Click targets field. In this example, you are using
.button.checkout
. - Specify the Target type you want to track behavior on. In this example, you are using "Simple match."
- Enter the Target URL. In this example, you are using
https://www.example.com/checkout
. - Select Occurrence.
- In the "Metric definition" section, select percentage of User units
- Enter "Completed checkouts" as the Name for the metric.
- Enter "Customers who complete a checkout by clicking the 'purchase' button" for the Description.
- Click Create metric.
Here is what the metric looks like:
To learn more, read Clicked or tapped conversion metrics.
Create the first experiment and layer
Now, you will create the first experiment and the layer together.
Here's how:
- Click Create and choose Experiment. The "Create experiment" page appears.
- Enter "Promo modal" for the Name.
- Enter a Hypothesis.
- Select the Feature change experiment type.
- Click Next. The "Choose randomization unit and attributes" step opens.
- Choose the "user" context kind from the Randomization unit menu.
- Click Next. The "Select metrics" step opens.
- Add the "Completed checkouts" Metric you created in the Create metrics step.
- Click Next. The "Choose flag variations" step opens.
- Choose the "Promo modal" Flag you created in the Create experiment flags step.
- Click Next. The "Set audience" step opens.
- Check the Add experiment to layer checkbox.
- Click Create layer.
- Add "Promotions" as the layer Name.
- Click Next.
- Enter a Reservation amount of 25%.
- In the "Define audience" section, choose which targeting rule to run the experiment on. In this example, you will use the flag's default rule.
- Enter the percentage of traffic you want to include in the experiment. In this example, you will include 5% of your audience.
- Select which control variation you want LaunchDarkly to serve to the remaining population. In this example, you will select "False."
- Select = Split equally to divide the experiment audience between the true and false variations.
- Click Finish. You are returned to the experiment's Design tab.
Create the second and third experiments
To create the second and third experiments, you will repeat the process above, except you will use different flags, and you will add the experiments to the new layer you just created.
To create the second experiment:
- Click Create and choose Experiment. The "Create experiment" page appears.
- Enter "Promo banner" for the Name.
- Enter a Hypothesis.
- Select the Feature change experiment type.
- Click Next. The "Choose randomization unit and attributes" step opens.
- Choose the "user" context kind from the Randomization unit menu.
- Click Next. The "Select metrics" step opens.
- Add the "Completed checkouts" Metric.
- Click Next. The "Choose flag variations" step opens.
- Choose the "Promo banner" Flag.
- Click Next. The "Set audience" step opens.
- Check the Add experiment to layer checkbox.
- Click Select layer.
- Select the "Promotions" layer from the menu.
- Enter a Reservation amount of 25%.
- In the "Define audience" section, choose which targeting rule to run the experiment on. In this example, you will use the flag's default rule.
- Enter the percentage of traffic you want to include in the experiment. In this example, you will include 5% of your audience. You can increase this percentage later, up to 100%, if needed.
- Select which control variation you want LaunchDarkly to serve to the remaining population. In this example, you will select "False."
- Select = Split equally to divide the experiment audience between the true and false variations.
- Click Finish. You are returned to the experiment's Design tab.
To create the third experiment:
- Click Create and choose Experiment. The "Create experiment" page appears.
- Enter "Promo at cart" for the Name.
- Enter a Hypothesis.
- Select the Feature change experiment type.
- Click Next. The "Choose randomization unit and attributes" step opens.
- Choose the "user" context kind from the Randomization unit menu.
- Click Next. The "Select metrics" step opens.
- Add the "Completed checkouts" Metric.
- Click Next. The "Choose flag variations" step opens.
- Choose the "Promo at cart" Flag.
- Click Next. The "Set audience" step opens.
- Check the Add experiment to layer checkbox.
- Click Select layer.
- Select the "Promotions" layer from the menu.
- Enter a Reservation amount of 25%.
- In the "Define audience" section, choose which targeting rule to run the experiment on. In this example, you will use the flag's default rule.
- Enter the percentage of traffic you want to include in the experiment. In this example, you will include 5% of your audience.
- Select which control variation you want LaunchDarkly to serve to the remaining population. In this example, you will select "False."
- Select = Split equally to divide the experiment audience between the true and false variations.
- Click Finish. You are returned to the experiment's Design tab.
Toggle on the flags
When you are ready to run your experiments, toggle On the related flags.
Start experiment iterations
The last step is to start an iteration for each of your mutually exclusive experiments.
To start your experiment iterations:
- Navigate to the Experiments list.
- Click on "Promo modal."
- Click Start.
- Repeat steps 1-3 for the remaining two experiments.
You are now running three mutually exclusive experiments, with no overlap between the contexts included in each.
Read results
When you are finished running your experiments, you can look at which variations had the highest probability to be best to decide which features to ship to your customers. To learn more, read Winning variations.
Conclusion
In this guide, you learned how to create layers to prevent contexts from being included in multiple concurrent experiments.
Mutually exclusive experiments are not limited to two or three at a time. When it's time to create your own, you can create as many mutually exclusive experiments as you need to prevent collisions between experiments running on similar parts of your app or infrastructure.
Your 14-day trial begins as soon as you sign up. Get started in minutes using the in-app Quickstart. You'll discover how easy it is to release, monitor, and optimize your software.
Want to try it out? Start a trial.