Experiment with feature flags
Learn how to run AB tests and perform gradual rollouts with feature flags.
Using feature flags lets you experiment with new features by controlling their availability through configuration rather than code deployments. Instead of releasing multiple versions of your application, you use a flag to enable or disable a feature, allowing different user groups to experience different behaviors at the same time.
This approach is especially useful for more complex tests as it decouples experimentation from releases. Teams can test ideas faster, reduce risk, and react immediately to results. If a variation underperforms or introduces friction, it can be disabled instantly without rolling back code or interrupting the user experience.
Feature flags also expand what you can test. Beyond copy or visual changes, you can test functional behavior, flows, or entirely new capabilities, while maintaining precise control over exposure and measurement.
How to use feature flags
Running a feature flag experiment follows a simple and structured flow.
Create a component for your flag
Start by creating a component that represents the flag that will enable or disable what you want to test. Typically, this component has only a boolean attribute that accepts a value for true and another for false, such as on and off or enable and disable. This attribute acts as the feature flag switch in your application.

Create a slot for your flag
Next, create a slot to hold the value of your flag. Define a default value, which represents the behavior users will see before the experiment starts or when no experience is applied. Then, integrate this slot into your application.

Create your experiment
Create an experience and define the audience you want to include in the test. You can either run your AB test for all users or segment it to a specific user group.
Next, set up your experiment variants and assign a different value to the flag for each one, such as on for one variant and off for the other. Don’t forget to configure the main goal you want to measure.
Review and publish
Once everything is configured, review your setup and publish the experiment. From this point on, we will handle the delivery of each variant and the collection of data. From there, monitor the results to understand how each variation performs and guide your next decisions.
Analyze the results
Feature flag experiments make it easy to understand how a feature impacts your key metrics. By comparing the performance of each variant, you can understand whether the new feature improves engagement, conversion, retention, or any other metric that matters to your business.
Because feature flags are dynamic, they also enable faster decision-making. If a variant shows signs of friction or negatively impacts performance, you can disable it immediately to limit exposure and avoid issues at scale. These real-time insights help teams identify problems early and refine features before completely rolling them out.
As a best practice, feature flags should be actively maintained. Regularly reviewing and removing unused or outdated flags prevents technical debt, keeps your codebase easier to manage, and reduces the risk of unexpected behavior in future experiments.