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 enabled

With 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 enabled

Update 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

  1. Navigate to Segments in your project
  2. Click Create Segment
  3. Give it a key (e.g., beta-users)
  4. Define the conditions
  5. Save

Using Segments in Rules

In the flag rule editor, add a condition:

IF user IN SEGMENT "beta-users" THEN variant-a

You can combine segment checks with other conditions:

IF user IN SEGMENT "beta-users"
   AND country EQUALS "SE"
THEN variant-a

Segment 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:

  1. Loads the segment's conditions
  2. Evaluates them against the user's context
  3. Returns true if the user matches, false otherwise

This happens server-side during flag evaluation. No extra API calls needed.

On this page