Targeting & Segments
Advanced targeting rules and percentage rollouts
Targeting & Segments
This guide covers advanced targeting strategies for controlling who sees your features.
Targeting Rules
Targeting rules determine which variant a user receives based on their evaluation context.
Rule Structure
Each rule consists of:
- Conditions - Criteria that must match
- Variant - The value to return if conditions match
- Priority - Order of evaluation (first match wins)
Creating Rules
- Navigate to your flag in the dashboard
- Select the environment (dev, staging, prod)
- Click Add Rule
- Configure conditions and select a variant
Operators
String Operators
| Operator | Description | Example |
|---|---|---|
EQUALS | Exact match | email EQUALS "admin@company.com" |
NOT_EQUALS | Not equal | plan NOT_EQUALS "free" |
CONTAINS | Substring match | email CONTAINS "test" |
STARTS_WITH | Prefix match | email STARTS_WITH "admin" |
ENDS_WITH | Suffix match | email ENDS_WITH "@company.com" |
MATCHES | Regex match | email MATCHES ".*@(alpha|beta)\\.com" |
List Operators
| Operator | Description | Example |
|---|---|---|
IN | Value in list | country IN ["SE", "NO", "DK"] |
NOT_IN | Value not in list | plan NOT_IN ["free", "trial"] |
Numeric Operators
| Operator | Description | Example |
|---|---|---|
EQUALS | Equal to | age EQUALS 25 |
GREATER_THAN | Greater than | age GREATER_THAN 18 |
LESS_THAN | Less than | version LESS_THAN 2.0 |
Segments
Segments are reusable groups of users that can be referenced in targeting rules.
Why Use Segments?
Instead of repeating complex conditions across multiple flags:
Create a segment and reference it:
Creating Segments
- Navigate to Segments in your project
- Click Create Segment
- Define the conditions
- Save with a meaningful name
Segment Examples
Internal Users:
Beta Testers:
Enterprise Customers:
Geographic Region:
Percentage Rollouts
Gradually release features to a percentage of users.
How It Works
- User's
targetingKeyis hashed - Hash is mapped to a bucket (0-99)
- Bucket determines which variant they receive
Properties
- Deterministic - Same user always gets the same variant
- Consistent - Increasing percentage doesn't reassign existing users
- Statistically valid - Even distribution for A/B tests
Configuring Rollouts
- Navigate to your flag's environment settings
- Click Add Percentage Rollout
- Set percentages for each variant (must total 100%)
Always ensure percentages sum to 100%. The last variant receives any remainder.
Combining with Targeting
Rollouts can be combined with targeting rules:
Best Practices
1. Start Small
Begin with a small percentage (1-5%) and gradually increase:
2. Use Kill Switches
Always have a way to instantly disable a feature:
- Toggle the flag off in the dashboard
- SSE pushes the change to all clients immediately
3. Target Internal Users First
Create an "internal" segment and test new features there before broader rollout:
4. Monitor Metrics
Track key metrics during rollout:
- Error rates
- Performance
- User engagement
- Business KPIs
5. Document Your Rules
Use meaningful segment and variant names:
premium-checkout-v2instead ofvariant-aenterprise-customersinstead ofsegment-1