Segments
Create dynamic player segments based on attributes, behavior, and lifecycle stage. Use segments to target feature flags, notifications, and A/B tests.
12 min read
What Are Segments?
Segments are dynamic groups of players defined by rules. When a player matches the rules, they automatically join the segment. When they no longer match, they leave.
Real-Time Membership
Segment membership is evaluated in real-time. Changes to player attributes or behavior immediately affect their segment membership.
Segment Types
| Type | Description | Use Case |
|---|---|---|
| Attribute-Based | Filter by player properties | VIP players, specific countries, high-level |
| Behavior-Based | Filter by event history | Recent purchasers, tutorial completers |
| Lifecycle-Based | Filter by lifecycle stage | At-risk players, new players |
| Computed | Complex calculations | Top 10% spenders, highly engaged |
Building Segments
Using the Dashboard
Create segments in Dashboard > Segments > Create Segment:
- Click "Create Segment"
- Name your segment (e.g., "Whale Players")
- Add rules using the visual builder
- Preview matching players
- Save and activate
Rule Operators
Comparison Operators
| Operator | Symbol | Types | Example |
|---|---|---|---|
| Equals | == | All | level == 50 |
| Not Equals | != | All | country != "US" |
| Greater Than | > | Number | session_count > 10 |
| Greater or Equal | >= | Number | total_revenue >= 100 |
| Less Than | < | Number | days_since_last_session < 7 |
| Less or Equal | <= | Number | age <= 25 |
String Operators
| Operator | Description | Example |
|---|---|---|
contains | String contains substring | email contains "@gmail" |
starts_with | String prefix match | device_id starts_with "ios_" |
ends_with | String suffix match | username ends_with "_pro" |
matches | Regex match | email matches ".*@company\\.com$" |
Collection Operators
| Operator | Description | Example |
|---|---|---|
in | Value in list | country in ["US", "CA", "UK"] |
not_in | Value not in list | lifecycle_stage not_in ["churned"] |
contains_any | Array has any of | achievements contains_any ["first_win"] |
contains_all | Array has all of | badges contains_all ["gold", "platinum"] |
Time Operators
| Operator | Description | Example |
|---|---|---|
within_last | Within time window | last_purchase within_last "7d" |
before | Before date | first_seen_at before "2025-01-01" |
after | After date | last_seen_at after "2025-01-01" |
Compound Rules
Combine rules with AND/OR logic for complex targeting:
Complex Segment Rules
json
{class="code-string">"operator": class="code-string">"AND",class="code-string">"conditions": [{class="code-string">"field": class="code-string">"total_revenue",class="code-string">"operator": class="code-string">">=",class="code-string">"value": 100},{class="code-string">"operator": class="code-string">"OR",class="code-string">"conditions": [{class="code-string">"field": class="code-string">"country",class="code-string">"operator": class="code-string">"==",class="code-string">"value": class="code-string">"US"},{class="code-string">"field": class="code-string">"country",class="code-string">"operator": class="code-string">"==",class="code-string">"value": class="code-string">"CA"}]},{class="code-string">"field": class="code-string">"last_seen_at",class="code-string">"operator": class="code-string">"within_last",class="code-string">"value": class="code-string">"30d"}]}class=class="code-string">"code-comment">// Matches: Players who spent $100+ AND(are from US OR CA) AND were active in last 30 days
Behavior-Based Rules
Target players based on their event history:
Behavior Segment
json
{class="code-string">"operator": class="code-string">"AND",class="code-string">"conditions": [{class="code-string">"type": class="code-string">"event_count",class="code-string">"event_name": class="code-string">"purchase_complete",class="code-string">"operator": class="code-string">">=",class="code-string">"value": 3,class="code-string">"time_window": class="code-string">"30d"},{class="code-string">"type": class="code-string">"event_exists",class="code-string">"event_name": class="code-string">"tutorial_complete"},{class="code-string">"type": class="code-string">"event_property",class="code-string">"event_name": class="code-string">"level_complete",class="code-string">"property": class="code-string">"level",class="code-string">"operator": class="code-string">">=",class="code-string">"value": 10}]}class=class="code-string">"code-comment">// Matches: Players who made 3+ purchases in 30 days,class=class="code-string">"code-comment">// completed tutorial, and reached level 10+
Prebuilt Segments
Ilara includes prebuilt segments for common use cases:
| Segment | Description | Auto-Rules |
|---|---|---|
| New Players | First 7 days | first_seen_at within_last "7d" |
| Whales | Top 1% spenders | total_revenue >= percentile(99) |
| At Risk | Engagement declining | lifecycle_stage == "at_risk" |
| Churned | No activity 14+ days | lifecycle_stage == "churned" |
| Non-Payers | Never purchased | is_payer == false |
| Power Users | Daily active 7+ days | active_days_last_7 >= 7 |
Using Segments in SDKs
Check Segment Membership
csharp
class=class="code-string">"code-comment">// Check if player is in a specific segmentbool isWhale = await IlaraClient.Instance.IsInSegment(class="code-string">"whales");if (isWhale){ShowVIPOffer();}class=class="code-string">"code-comment">// Get all segments for current playerstring[] segments = await IlaraClient.Instance.GetPlayerSegments();foreach(string segment in segments){Debug.Log($class="code-string">"Player is in segment: {segment}");}
Segment Analytics
Track segment performance in the dashboard:
- Size Over Time: Track segment growth/shrink
- Conversion Rates: Compare metrics across segments
- Revenue Attribution: Revenue by segment
- Engagement Metrics: Session frequency, duration
Next Steps
- Feature Flags — Target flags to segments
- Churn Prediction — AI-powered at-risk segments
- AI Messages — Personalized outreach by segment