Creating feature change experiments
Read time: 6 minutes
Last edited: Dec 12, 2024
Overview
This topic explains how to set up and configure a feature change experiment in LaunchDarkly.
Configuring a feature change experiment requires several steps:
- Creating the flag and its variations,
- Creating one or more metrics,
- Building the experiment,
- Turning on the feature flag, and
- Starting an iteration.
These steps are explained in detail below.
Prerequisites
Before you build an experiment, you should read about and understand the following concepts:
- randomization units
- primary and secondary metrics
- mutually exclusive experiments
- attribute filters
- Bayesian and frequentist statistics
Create flags
Before you begin an experiment, create a flag with the variations you plan to test the performance of. You do not need to toggle on the flag before you create the experiment, but you do have to toggle on the flag before you start an experiment iteration.
To learn more, read Creating new flags and Creating flag variations.
Create metrics
Metrics measure audience behaviors affected by the flags in your experiments. You can use metrics to track all kinds of things, from how often end users access a URL to how long that URL takes to load a page. You can reuse metrics in multiple experiments, or create new ones for your feature change experiment. To learn how to create a new metric, read Metrics.
The default metric analysis method is "Average." The use of percentile analysis methods with LaunchDarkly experiments is in beta. If you use a metric with a percentile analysis method in a an experiment with a large audience, the experiment results tab may take longer to load, or the results tab may time out and display an error message. Percentile analysis methods are also not compatible with CUPED adjustments.
If you want to learn which flag variation performs better, it must be possible for that metric to measure something in all of the flag variations within the experiment. To learn more, read Metrics and flag variations.
You can use one or more metrics or standard metric groups in feature change experiments. However, you cannot use funnel metric groups in feature change experiments. To learn more, read Metric groups.
Build experiments
You can view all of the experiments in your environment on the Experiments list.
To build an experiment:
- Click Create and choose Experiment. The "Create experiment" page appears.
- Enter a Name.
- Enter a Hypothesis.
- Select the Feature change experiment type.
- (Optional) If you want to include the experiment in a holdout, click Advanced, then select a Holdout name.
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 Mutually exclusive experiments.
- Click Next. The "Choose randomization unit and attributes" step opens.
- Choose a context kind from the Randomization unit menu.
- If you included the experiment in a holdout, the experiment's randomization unit is automatically set to the holdout's randomization unit.
- (Optional) Choose up to five context attributes to filter results by.
- Click Next. The "Select metrics" step opens.
- Add a Metric or Metric group, or click Create to create and use a new metric or new standard metric group. The metrics you select must use the same randomization unit as the experiment.
- A list of environments displays. It shows which environments have received events for these metrics. If no environments are receiving events, check that your SDKs are configured correctly.
- (Optional) If you have added multiple metrics, click the crown icon to change the primary metric:
- Click Next. The "Choose flag variations" step opens.
- Choose a Flag to use in the experiment, or click Create flag to create and use a new flag.
- Click Next. The "Set audience" step opens.
- (Optional) Check the Add experiment to layer checkbox if you want to exclude contexts in this experiment from other experiments.
Expand layer options
A layer is a set of experiments that cannot share traffic with each other. All of the experiments within a layer are mutually exclusive, which means that if a context is included in one experiment, LaunchDarkly will exclude it from any other experiments in the same layer.
To add the experiment to a layer:
- Click Select layer to add the experiment to an existing layer.
- Select the layer you want to add the experiment to.
- If you do not have a layer configured or need to create a new layer, click Create layer.
- Add a Name and Description.
- Click Next.
- Add a Reservation amount. This is the percentage of the contexts within this layer you want LaunchDarkly to include in this experiment.
- In the "Define audience" section, choose which targeting rule to run the experiment on.
- If you want to restrict your experiment audience to only contexts with certain attributes, create a targeting rule on the flag you include in the experiment and run the experiment on that rule.
- If you don't want to restrict the audience for your experiment, run the experiment on the flag's default rule. If the flag doesn't have any targeting rules, the flag's default rule will be the only option.
- Enter the percentage of traffic you want to include in the experiment.
- Select which control variation you want LaunchDarkly to serve to the remaining population.
-
(Optional) Advanced: For most experiments, we recommend leaving the Advanced options on their default settings. To learn more, read Carryover bias and variation reassignment.
- Choose how you want to split the experiment audience:
- Equally splits the experiment traffic equally between all variations in the experiment.
- Percentage allows you to select specific percentages for each variation.
- Click Next. The "Choose your statistical approach and define success" step opens.
- Select a statistical approach of Bayesian or Frequentist.
- If you selected a statistical approach of Bayesian, select a preset or Custom success threshold.
- If you selected a statistical approach of frequentist, select:
- a preset or Custom significance level.
- a One-sided or Two-sided direction of hypothesis test, depending on how confident you are as to whether the difference between the control and treatment variations will be positive or negative.
- Click Finish. You are returned to the experiment's Design tab.
After you have created your experiment, the next steps are to toggle on the flag and start an iteration.
You can also use the REST API: Create experiment
Turn on feature flags
For an experiment to begin recording data, the flag used in the experiment must be on. To learn how, read Turning flags on and off.
You can build multiple experiments on the same flag, but you can run only one of those experiments at a time.
Start experiment iterations
After you create an experiment and toggle on the flag, you can start an experiment iteration in one or more environments.
To start an experiment iteration:
- Navigate to the Experiments list.
- Click on the environment section containing the experiment you want to start.
- If the environment you need isn't visible, click the + next to the list of environment sections. Search for the environment you want, and select it from the list.
- Click on the name of the experiment you want to start an iteration for. The Design tab appears.
- Click Start.
- Repeat steps 1-4 for each environment you want to start an iteration in.
Experiment iterations allow you to record experiments in individual blocks of time. To ensure accurate experiment results, when you make changes that impact an experiment, LaunchDarkly starts a new iteration of the experiment.
To learn more about starting and stopping experiment iterations, read Managing experiments.
You can also use the REST API: Create iteration