Skip to content

How to Set Up Targeting Rules

Targeting rules let you control which users see which variation of a feature flag. Instead of toggling a flag on for everyone, you can roll out features to specific users based on attributes like email, plan, country, or any custom property.

Targeting rule editor showing a condition group with two conditions combined by ANY: plan equals enterprise OR email ends with @beta.example.com

  1. Open a flag from the Flags page at /flags.
  2. On the flag detail page, select an environment tab (e.g., Development, Staging, Production).
  3. The targeting configuration panel appears below the toggle.

Targeting rules only apply when the flag is on. When the flag is off, all users receive the off variation.

  1. Click Add Rule in the targeting panel.
  2. Choose an attribute from the evaluation context (e.g., email, plan, country, user_id, or any custom attribute your application sends).
  3. Choose an operator:
    • equals / not equals — Exact match.
    • contains / not contains — Substring match.
    • starts with / ends with — Prefix or suffix match.
    • in list / not in list — Match against multiple values.
  4. Enter the values to match against.
  5. Select the variation to serve when this rule matches.
  6. Click Save to apply the rule.

Rules are evaluated top-to-bottom. The first rule that matches a user’s context determines the variation they receive. No further rules are checked after a match.

  • Drag rules to reorder them in the targeting panel.
  • Place more specific rules above general ones. For example, put a rule targeting a single user above a rule targeting all Pro plan users.

When a flag is on and no targeting rules match a user, the fallthrough variation is served. Configure the fallthrough variation in the environment configuration section below the rules list.

Make sure the fallthrough variation is set to a sensible default for users who do not match any rule.

Instead of serving a single variation, you can configure a rule or the fallthrough to use a percentage rollout. This distributes users across variations by percentage (e.g., 80% false, 20% true) for gradual feature launches.

Use the Evaluate feature on a flag to test what a specific user would receive:

  1. Click the Evaluate button on the flag detail page.
  2. Enter a JSON evaluation context (e.g., {"user_id": "123", "plan": "pro", "country": "US"}).
  3. See which variation would be served and which rule matched.

This is useful for verifying your targeting configuration before deploying changes.

Goal: Give Pro plan users early access to a new feature.

  1. Open the flag and select the Production environment.
  2. Turn the flag on.
  3. Click Add Rule.
  4. Set attribute to plan, operator to equals, value to pro.
  5. Select the true variation.
  6. Set the fallthrough variation to false.
  7. Save. Pro users now see the feature; everyone else does not.