Creating an experiment
Contents
To create a new experiment, go to the A/B testing tab in the PostHog app, and click on the New experiment button in the top right.
This presents you with a form where you can complete the details of your new experiment:


Here's a breakdown of each field in the form:
Feature flag key
Each experiment is backed by a feature flag. In your code, you use this feature flag key to check which experiment variant the user has been assigned to.
You can use an existing feature flag if it has multiple variants and 'control' as the first variant. Otherwise, the feature flag will be created for you automatically when the experiment is created.
Advanced: It's possible to create experiments without using PostHog's feature flags (for example, if you're using a different third-party library for feature flags). For more info, read our docs on implementing experiments without feature flags.
Experiment variants
By default, all experiments have a control and test variant. You can add more variants if you like. If you need to modify the variants after you've created the experiment, you can do so from the feature flag page.
Participants are automatically split equally between variants. If you want assign specific users to a specific variant, see the section below on rollout percentage.
Participant type
By default, PostHog runs experiments at a user-level. This means that participants are assigned to a variant based on their person properties. However, if you've created groups, you can also run group-targeted experiments. This will test how a change affects your product at a group-level by providing the same variant to every member of a group.
Rollout percentage
By default, your experiment rolls out to 100% of participants. You can adjust the Rollout percentage in the variants panel during experiment creation to limit the percentage of users who are included in the experiment. This is useful when you don't want to expose all users to the experiment.
For more advanced release conditions – such as targeting specific user properties, cohorts, or groups – click Manage distribution or Manage release conditions after saving your experiment as a draft. This modifies the release conditions for the underlying feature flag.
Note: If you select a server-side event, you may see a warning that no feature flag information can be detected with the event. To resolve this issue, see step 2 of adding your experiment code and how to submit feature flag information with your events.

