Targeting rules
A targeting rule is one row in a flag’s rule list, in one environment. It has a list of conditions and a result. If the conditions match, the rule serves its result. Rules are evaluated in order; the first one that matches wins.
The structure
Section titled “The structure”Rule 1 Condition group A user.plan is one of ["pro", "enterprise"] AND user.country is one of ["us", "ca"] OR Condition group B organization.id is one of ["acme", "beta-org"] → serve variation "true"
Rule 2 Condition group A device.os is "ios" → serve a percentage rollout: 50% true, 50% false (bucket by user)
Default rule → serve variation "false"Conditions inside a group are AND’d. Groups inside a rule are OR’d. Rules are evaluated top to bottom; the first rule whose conditions match decides the result.
A condition
Section titled “A condition”A condition is (attribute) (operator) (values):
user.plan is one of ["pro", "enterprise"]user.country is not "fr"organization.id starts with "acme-"user.signupDate before 2026-01-01The attribute path is kind.attribute. The kind is one declared in Context kinds; the attribute is anything the context carries on that kind.
The operator picks how the comparison runs. The full catalog (string, numeric, date, semver, segment membership) is in Operators.
A condition with multiple values is OR’d internally: user.plan is one of ["pro", "enterprise"] matches if the plan is either.
Missing attributes
Section titled “Missing attributes”If the context does not carry the attribute the rule asks for, the rule is skipped, not failed. Evaluation moves to the next rule.
This matters most for anonymous contexts: a rule that says user.plan is "pro" on a context that has no user.plan will skip cleanly, not match.
The result side
Section titled “The result side”A rule’s result is one of:
- A single variation: every context that matches gets the same value.
- A percentage rollout: matching contexts are bucketed and split across variations by weight. See Percentage rollouts.
The default rule (the one at the bottom of the list, with no conditions) catches everything that no other rule matched.
Reordering
Section titled “Reordering”Rules are drag-to-reorder in the dashboard. Order matters a lot:
- Put narrow rules (“specific paying customers”) above broad rules (“all paying customers”).
- Put kill-switch rules (serve the off-variation to a misbehaving region) at the very top so they cannot be shadowed.
Sketch: a common pattern
Section titled “Sketch: a common pattern”A typical flag rollout looks like this, top to bottom:
- Individual overrides are handled by individual targeting, one tier above rules. No need for a rule.
- Internal users:
user.email ends with "@yourcompany.com"→ on. - Beta customers:
user is in segment "beta-customers"→ on. - Percentage rollout: no conditions, serve 10% on / 90% off, bucket by
user. - Default rule: serve off.
To expand the rollout, increase the percentage in rule 4. To launch fully, change the default rule to “on” and remove rule 4.
Related
Section titled “Related”- Operators for the full operator catalog.
- Individual targeting for
(kind, key) → variationoverrides above rules. - Segments for reusable group definitions referenced by
segment_match. - Evaluation order for where rules sit in the full decision chain.