When to Use Feature Gates vs. Experiments?
Decide whether to ship with a feature gate or run an experiment, and understand how the two work together.
Use a feature gate to control who sees a feature and roll it out gradually. Use an experiment to compare variants and measure how a change affects your metrics. Both create control and test groups, so this guide shows how to pick the right one for your launch and measurement goals.
Choose a feature gate when you want to:
- Roll out a feature safely by increasing exposure gradually while you watch your metrics.
- Target an audience, including filtering who can enter an experiment.
Choose an experiment when you want to:
- Test a hypothesis by comparing two or more variants, or personalize experiences with contextual bandits or layers.
- Run several experiments at the same time without overlapping users by placing them in the same layer.
Key differences
There are several differences between feature gates and experiments such as:
Variants
- Feature gate: Two experiences only which result in pass vs. fail metrics.
- Experiment: Contain any number of variants that can result in numerous metrics that are not necessarily pass/fail.
Gate exposures display three buckets: Pass, Fail, and Fail – Not in Analysis. Statsig uses only the balanced subset of the fail group for metric comparisons. Learn more in the gate exposure methodology.
Return values
- Feature gate: Boolean (
true/false) that lets your application toggle between code paths. - Experiment: JSON config that describes the variant (colors, copy, thresholds, and so forth).
Ramping knobs
- Feature gate: Raise Pass % to send more traffic to the new experience. Pass % can be any value from 0% to 100%, such as 99% pass and 1% fail.
- Experiment: Raise Allocation % to enroll more users. You set the split between groups before the experiment starts. The split doesn't have to be even, such as 90/10, but you can't change it after the experiment starts.
Raising either percentage keeps users who are already assigned where they are and adds new users, so you can ramp without reshuffling. Lowering it removes users.
Use feature gates and experiments together
In experiment setups, gates often act as targeting criteria. The flow looks like this:
- Targeting gate picks the eligible audience.
- Allocation % (experiment) decides how much of that audience participates.
- Split % distributes participants across variants.
After you choose a winner, lift the targeting gate and let the winning variant reach everyone.
Summary: choosing the right tool
- Start with a feature gate if you have a single variant to launch carefully.
- Choose experiments when you need quantitative comparisons across variants.
- Combine both when you want precise audience control plus rigorous measurement.
For more detail, refer to:
Was this helpful?
For AI agents: a documentation index is available at /llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.