Skip to content

Segments

A segment is a named definition of a group of contexts: “beta customers,” “internal users,” “EU traffic.” Once defined, a segment can be referenced from any flag’s targeting rules in the same project.

The alternative is to copy the same conditions across many flags:

Flag A, rule 3:
user.email ends with "@yourcompany.com"
OR user.email ends with "@yourcontractor.com"
Flag B, rule 2:
user.email ends with "@yourcompany.com"
OR user.email ends with "@yourcontractor.com"
Flag C, rule 1:
user.email ends with "@yourcompany.com"
OR user.email ends with "@yourcontractor.com"

When you hire a new contractor, you edit three flags. With a segment:

Segment "internal-users":
user.email ends with "@yourcompany.com"
OR user.email ends with "@yourcontractor.com"
Flag A, rule 3: user is in segment "internal-users"
Flag B, rule 2: user is in segment "internal-users"
Flag C, rule 1: user is in segment "internal-users"

When you hire a new contractor, you edit the segment. Every flag picks up the change on its next datafile poll.

A segment has a key, a name, a description, and one or more segment rules. The rule structure mirrors flag targeting:

Segment "beta-customers"
Rule 1
Condition group A
user.plan is one of ["pro", "enterprise"]
user.signupDate after 2026-01-01
OR
Condition group B
organization.id is one of ["acme", "beta-org"]
Rule 2
user.email is one of ["alice@example.com", "bob@example.com"]

Rules are OR’d: a context is in the segment if any rule matches. Conditions inside a group are AND’d; groups inside a rule are OR’d. The operators are the same as in Targeting rules; see Operators.

The key is immutable after creation, because flag rules reference segments by key.

In a targeting rule condition, pick the operator is in segment or is not in segment. Then pick a segment by key.

A segment condition behaves like any other condition: it AND’s with other conditions in the group, and OR’s with other groups in the rule.

A segment rule can reference another segment via the same is in segment operator. This composes well for layering (“eu-customers” = “all customers” AND in EU). Cycles are not allowed; the dashboard refuses to save a rule that would create one.

  • A flag has one specific user to override. Use individual targeting.
  • The condition is only ever used by one flag and will not be reused. Inline it in the rule.

Segments are off by default per organization. An admin enables them from Organization features. When off, the segments section is hidden in the project sidebar and the is in segment / is not in segment operators do not appear in the rule editor.