How to create a multivariate feature flag in PostHog

Create a multivariate feature flag in PostHog: set a unique flag key, choose the Multivariate type, name two variants at 50/50, and save the flag.

Quick answer

To create a multivariate feature flag in PostHog, open a new feature flag, enter a unique flag key, choose the Multivariate flag type, rename the second variant, and click Save. The default variants split rollout 50/50, so the flag is ready to serve two experiences to your users.

Steps at a glance

  1. Open a new feature flag and enter a flag key.
  2. Choose the Multivariate flag type.
  3. Expand the second variant.
  4. Rename it in the Variant key field.
  5. Click Save to create the flag.

Interactive demo

Loading demo…

Summary

A multivariate feature flag serves one of several named variants instead of a simple on or off. PostHog splits users across the variants by rollout percentage, which lets you compare two versions of an experience.

Step-by-step guide

  1. Step 1

    Name the flag

    On the new feature flag form, click the Flag key field and type a unique key. Use something descriptive, such as onboarding-checklist-style. The key is what your code checks to decide which variant to show.

  2. Step 2

    Choose Multivariate

    Under Flag type, select Multivariate. The option is described as multiple variants with rollout percentages. PostHog then adds a Variants section with two starting variants.

  3. Step 3

    Open the second variant

    In the Variants list, you see control (50%) and a second variant that is also at 50%. Click the second row to expand it and show its settings.

  4. Step 4

    Name the second variant

    Click the Variant key field, replace the default text, and type compact. The first variant stays as control, and both keep a Rollout percentage of 50, so users split evenly.

  5. Step 5

    Save the flag

    Click Save at the top right. The second row now reads compact, and your multivariate flag is created and ready to use in your code.

Why this matters

You want to test two versions of your onboarding checklist, a control and a compact layout. A multivariate flag splits users evenly between them, so you can ship both behind one key and see which one performs better.

Frequently asked questions

  • How are users split between variants by default?

    The two starting variants each have a rollout percentage of 50, so users are split evenly between them.

  • Can I add more than two variants?

    The Variants section includes an Add variant button, so you can add more variants beyond the two defaults.

Create interactive demos like this one — free, no coding required.

Start for free →