Guide

User Targeting

Show a feature to a specific group, beta users, internal staff, paying customers, anyone in us-west-2, with rules that match against your context attributes.

Targeting rules

A rule is an ordered list of conditions. The first rule that matches wins; its value is returned. If no rules match, the flag falls through to the rollout (or the default).

Each condition has three parts:

  • Attribute: any key from the evaluation context.
  • Operator: equals, not_equals, contains, starts_with, ends_with, in, not_in, greater_than, less_than, regex.
  • Value: a literal or list to compare against.

Common patterns

  • Beta users: plan == 'beta'
  • Internal staff: email ends_with '@yourcompany.com'
  • Geographic: country in ['US', 'CA']
  • Pro tier with feature opted in: plan == 'pro' AND betaOptIn == true

Custom attributes

Anything you put in the context object is fair game. Common additions:

  • orgId: for B2B targeting at the workspace level.
  • signupAt: to gate features for users created after a date.
  • experimentArm: when chaining experiments.
  • locale: to ship language-specific UI gradually.
Tip: Compose context once per request, not per flag call. Most apps build it from the session and pass the same object to every evaluate call.

Rule ordering

Rules evaluate top-to-bottom. Put your highest-specificity rules first (internal staff) and your broadest rules last (geographic). Drag-and-drop ordering in the dashboard updates everywhere within seconds.