Segments
Segments are reusable groups of users for targeting feature flags. Instead of recreating "email ends with @yourcompany.com" for every internal feature, you create an "Internal Team" segment and reference it wherever needed.
When you update a segment's rules, every flag using that segment updates automatically. This keeps targeting consistent and makes bulk changes simple.
| Segment | Description | Example rules |
|---|---|---|
| Internal Team | Your employees | Email ends with @yourcompany.com |
| Beta Users | Early adopters testing new features | User has beta: true attribute |
| Enterprise Customers | High-tier paying customers | Plan equals enterprise |
| US Users | Users in the United States | Country equals US |
- Navigate to the Flags tab in your project
- Click Segments in the sidebar
- Click Create Segment
- Enter a name and description
- Define the targeting rules
Segment rules use entities to match users. Each rule checks an attribute against a condition.
Building a rule:
- Attribute: The entity property to check (e.g.,
user.email,team.plan) - Operator: How to compare the value:
equals/does not equalcontains/does not containstarts with/ends withis one of/is not one of(for lists)
- Value: What to match against
Combining rules:
You can combine multiple conditions with AND or OR logic:
user.email ends with "@yourcompany.com"
OR
user.role equals "admin"
This segment matches anyone with a company email OR anyone with the admin role.
Segments are available in all environments (Production, Preview, Development). If you need different targeting per environment, create separate segments with environment-specific names (e.g., "Beta Users - Production").
Once you've created a segment, you can use it when configuring flag targeting:
- Go to a flag's configuration
- Click the Target icon next to an environment
- Click Add a Target
- Select your segment from the dropdown
- Choose which variant to serve to users in this segment
Segments can be combined with other rules and targets in your flag configuration.
When you edit a segment's rules, the change applies everywhere the segment is used. This makes it easy to update targeting across multiple flags at once.
- Go to Segments in the Flags tab
- Click on the segment you want to edit
- Modify the rules
- Save your changes
All flags using this segment will immediately use the updated rules.
To delete a segment, it must not be in use by any flags or other segments.
You can see the flags and segments currently referencing a segment on the Segment details page.
If a segment is referenced by a flag or segment:
- Go to each flag (or segment) using the segment you want to delete
- Remove the segment from the targeting rules
- Return to Segments and delete it
- Learn about entities for defining targetable attributes
- Configure flag targeting
- Set up your SDK to pass evaluation context
Was this helpful?