Switchflag
Platform

Targeting Rules

Configure targeting rules in the dashboard to control who sees a feature based on user attributes.

Overview

Targeting rules let you return different flag values based on user attributes (the evaluation context). Rules are configured per environment — each environment can have different rules.

Adding rules

  1. Navigate to your flag's detail page
  2. Select an environment
  3. Click Add Rule
  4. Configure the rule:
FieldDescription
AttributeThe context property to check (e.g. email, country, userId)
OperatorHow to compare — see Operators
ValueWhat to compare against
Return ValueThe value to return when this rule matches

Rule evaluation

Rules are evaluated in order — first match wins. If no rules match, the flag returns its default behavior (see Evaluation Engine).

Common patterns

Internal access

Give your team early access:

AttributeOperatorValueReturn
emailendsWith@yourcompany.comtrue

Country-based rollout

Target specific regions:

AttributeOperatorValueReturn
countryin["US", "CA"]true

Gradual percentage rollout

Roll out to 25% of users:

AttributeOperatorValueReturn
percent25true

Combined rules

Internal team gets access, plus 10% of US users:

#AttributeOperatorValueReturn
1emailendsWith@yourcompany.comtrue
2countryequalsUS
2percent10true

Rule order matters — see Rule Ordering.