How to Use Segments for Targeting
Segments are reusable groups of users defined by attribute conditions. Instead of duplicating the same targeting rules across multiple flags, define a segment once and reference it wherever you need it.
Creating a segment
Section titled “Creating a segment”- Navigate to the Segments page at
/segments. - Click Create Segment.
- Enter a name (e.g., “Beta Users”) and an optional description.
- Add one or more rules. Each rule specifies:
- An attribute from the evaluation context (e.g.,
email,plan,country). - An operator (equals, contains, in list, etc.).
- One or more values to match.
- An attribute from the evaluation context (e.g.,
- Click Save to create the segment.
Multiple rules within a segment are combined with AND logic. A user must match all rules to be included in the segment.
Using segments in targeting
Section titled “Using segments in targeting”When you create a targeting rule on a flag, you can target a segment instead of a single attribute:
- Open a flag and select an environment tab.
- Click Add Rule in the targeting panel.
- Choose the Segment match type instead of selecting an individual attribute.
- Select the segment you want to target.
- Choose which variation to serve when the segment matches.
- Save the rule.
When a user’s evaluation context matches the segment’s rules, the targeting rule fires and serves the selected variation.
Editing segments
Section titled “Editing segments”Open a segment from the Segments page and modify its rules. Changes to a segment’s rules immediately affect all flags that reference that segment. This is the key advantage of segments — update the definition in one place and every flag using it picks up the change.
Deleting segments
Section titled “Deleting segments”Before deleting a segment, remove it from all targeting rules that reference it. Deleting a segment that is still in use by a flag’s targeting rules will cause those rules to stop matching.
- Check which flags reference the segment.
- Update or remove those targeting rules.
- Return to the Segments page and delete the segment.
Example segments
Section titled “Example segments”Here are common segments teams create:
- Internal Team — Attribute
emailends with@yourcompany.com. Use this to test features internally before rolling out to customers. - Enterprise Customers — Attribute
planin list[enterprise, business]. Target premium features to paying customers. - US Users — Attribute
countryequalsUS. Roll out features by region. - Beta Users — Attribute
beta_enrolledequalstrue. Let users opt in to early access features.
Best practices
Section titled “Best practices”- Name segments clearly. Use names that describe the group, not the feature (e.g., “Enterprise Customers” not “New Dashboard Users”).
- Keep segments focused. Each segment should represent one logical group. Combine segments by using multiple targeting rules on a flag.
- Document segment purpose. Use the description field to explain what the segment is for and who maintains it.
Next steps
Section titled “Next steps”- Targeting & Segments — understand how segments fit into the evaluation model
- How to Set Up Targeting Rules — use segments in your targeting rules
- Rollout Strategies — combine segments with percentage rollouts