Variations
A variation is one of the possible values a flag can return. Every flag has at least two. Targeting rules, individual targets, and default rules all pick a variation by name; the SDK returns its value.
Value types
Section titled “Value types”A flag is one of four value types, fixed at creation:
| Type | Use it for | Example variations |
|---|---|---|
boolean | On/off switches, kill switches, simple A/B. | true, false |
string | Variant names, copy, choice between known strings. | "control", "variant-a", "variant-b" |
number | Numeric thresholds, sample rates, request limits. | 0, 100, 1000 |
json | Any structured value. | {"theme":"dark","density":"compact"} |
A boolean flag always has exactly two variations. The other types let you add as many as you want; in practice, keep the list short.
Naming variations
Section titled “Naming variations”Every variation has a name (for the dashboard and the audit log) and a value (what the SDK returns). The name is independent of the value; you can call a string variation “Control copy” and have its value be "You'll love this".
For non-boolean flags, the variation name is what shows up in targeting rules. So name them for the reader of the rule:
✗ variation v1 = "purple"✗ variation v2 = "blue"
✓ variation control = "purple"✓ variation experiment = "blue"Off-variation
Section titled “Off-variation”Each environment carries an off-variation: the variation served when targeting for that flag is off. Pick the safest value. For a kill switch, the off-variation is the path that does nothing. For a new feature, the off-variation is the old behavior.
The off-variation is also what the SDK returns when the flag is archived.
Changing variations
Section titled “Changing variations”You can rename a variation or change its value at any time, but think before you do. Changing a variation’s value changes what every targeting rule that points at it returns, immediately, in that environment. If a rule on rule paying-customers serves variation new-checkout = "/checkout/v2", and you change that to "/checkout/v3", every paying customer flips.
You cannot delete a variation that any rule, target, or default points to. Repoint or remove the references first.
Related
Section titled “Related”- Feature flags for where variations live.
- Targeting rules for how a rule picks a variation.
- Percentage rollouts for splitting traffic across variations by weight.