Segments
Reusable user groups for targeting
Segments are named groups of users defined by targeting rules. Instead of repeating complex conditions across multiple flags, define them once as a segment.
Why Segments?
Without segments, you repeat rules everywhere:
Flag: new-checkout
Rule: IF email ENDS_WITH "@company.com" OR plan EQUALS "enterprise" THEN enabled
Flag: new-dashboard
Rule: IF email ENDS_WITH "@company.com" OR plan EQUALS "enterprise" THEN enabled
Flag: new-api
Rule: IF email ENDS_WITH "@company.com" OR plan EQUALS "enterprise" THEN enabledWith segments:
Segment: "power-users"
email ENDS_WITH "@company.com" OR plan EQUALS "enterprise"
Flag: new-checkout
Rule: IF user IN SEGMENT "power-users" THEN enabled
Flag: new-dashboard
Rule: IF user IN SEGMENT "power-users" THEN enabled
Flag: new-api
Rule: IF user IN SEGMENT "power-users" THEN enabledUpdate the segment once, all flags update.
Common Segments
Internal Users
email ENDS_WITH "@yourcompany.com"Beta Testers
email IN ["beta1@example.com", "beta2@example.com"]
OR tag EQUALS "beta-tester"Enterprise Customers
plan EQUALS "enterprise"
OR account_type IN ["enterprise", "enterprise-plus"]Nordic Region
country IN ["SE", "NO", "DK", "FI", "IS"]Creating Segments
- Navigate to Segments in your project
- Click Create Segment
- Give it a key (e.g.,
beta-users) - Define the conditions
- Save
Using Segments in Rules
In the flag rule editor, add a condition:
IF user IN SEGMENT "beta-users" THEN variant-aYou can combine segment checks with other conditions:
IF user IN SEGMENT "beta-users"
AND country EQUALS "SE"
THEN variant-aSegment Scope
Segments are scoped to a project. If you need the same segment in multiple projects, create it in each project.
Evaluation
When a flag rule references a segment, Flipswitch:
- Loads the segment's conditions
- Evaluates them against the user's context
- Returns true if the user matches, false otherwise
This happens server-side during flag evaluation. No extra API calls needed.