As you run new experiments or roll out new feature flags, you may have features that are only relevant to users if another feature has been enabled for them. You may want to evaluate those dependencies first and then use those results in the evaluation of your flag or experiment.
Amplitude Experiment allows you to create dependencies for your flags and experiments on prerequisite flags or experiments.
This feature is available to users on Enterprise plans who have purchased Amplitude Experiment. See the pricing page for more details.
Configure flag prerequisites in the Dependencies card, which you can find below the Overview card for experiments and below the Settings card for flags.
For a given flag or experiment, this card provides a summary of all flag dependencies including its prerequisite flags, experiments, mutual exclusion, and holdout groups as well as a list of the flags and experiments that are dependent on it.
To configure new prerequisites, click the edit icon.
In the Dependencies edit drawer, click Add Dependency to add a new prerequisite flag or experiment.
Select the flag or experiment you wish to create the dependency on.
Flags and experiments are eligible to be used as a prerequisite if:
You can't add a prerequisite that would cause a circular dependency loop.
Then, select the variants that you want to be dependent on. Off is a special value that represents when users weren't included in the prerequisite flag or experiment.
To finish adding the dependency, click Save.
Before you activate a flag or start an experiment, ensure that prerequisite flags are active and variant assignment works as intended. You can't start the experiment until prerequisite flags and activate experiments.
For flags and experiments with dependents, Amplitude prevents the following actions:
This example provides you more information about how evaluation works when there are prerequisite flags.
Example scenario: I want to ensure that my new feature flag (Flag-B) rolls out to users who have seen another feature (Flag-A). In Flag-B, I have added a dependency for the on variant of Flag-A and activated both flags.
When Amplitude evaluates users for Flag-B:
First, check if the user is in Flag-B’s testers.
Evaluate the user for dependencies, in this case: Flag-A.
Evaluate the user for Flag-B.
Targeting for Flag-B determines what variant (if any) the user receives, and the flag dependency on Flag-A has no effect at this point.
Flag prerequisites are extremely flexible and have many use cases. That said, here are some common examples.
Use flag prerequisites to build a primary feature with multiple sub-features. Sub-features require the primary feature to be on
, unless a user is individually included as a tester in one of the sub-features. Targeting and bucketing applied to the primary feature are effectively applied to all sub-features which list the primary feature as a prerequisite.
Common use cases for release groups are:
This example contains a primary-feature
flag and sub-feature
flags which list the primary feature as a prerequisite.
The primary-feature
flag targets all users where user property premium
is true
with 100% allocation. Therefore, sub-features only evaluate if the user has the required user property, and meet the sub-feature's criteria -- unless the user is individually included in the sub-feature's testers section.
sub-feature-1
flag contains an extra targeting criteria for users where the user property beta
is true
. To be assigned sub-feature-1
a user have the premium
and beta
user properties equal to true
.sub-feature-2
flag allocates 100% of users. All users where the premium
user property is true
is assigned.sub-feature-3
flag allocates 0% of users. No users are assigned to sub-feature-3
, even if the premium
user property is true
.Use flag prerequisites to build complex hierarchies of mutually exclusive experiments which start at different times. Dependent experiments list a prerequisite on an existing active experiment evaluating to off
. This effectively targets all users who weren't allocated to the existing experiment. Continue this chain to add more mutually exclusive experiments if the previous experiment doesn't all users.
In this example, experiment-1
is running, and experiment-2
, which is mutually exclusive to experiment-1
, is set to run.
experiment-1
experiment allocates 20% of users 50/50 control/treatment.experiment-2
experiment lists experiment-1
as a prerequisite, and allocates 100% of users 50/50 control/treatment.Experiment assigns 20% of users to experiment-1
and the assigns the remaining 80% to experiment-2
. Experiment assigns no users variants for both experiment-1
and experiment-2
, unless they're a tester.
Thanks for your feedback!
June 24th, 2024
Need help? Contact Support
Visit Amplitude.com
Have a look at the Amplitude Blog
Learn more at Amplitude Academy
© 2024 Amplitude, Inc. All rights reserved. Amplitude is a registered trademark of Amplitude, Inc.