Docs/Core Concepts/Segments

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

TypeDescriptionUse Case
Attribute-BasedFilter by player propertiesVIP players, specific countries, high-level
Behavior-BasedFilter by event historyRecent purchasers, tutorial completers
Lifecycle-BasedFilter by lifecycle stageAt-risk players, new players
ComputedComplex calculationsTop 10% spenders, highly engaged

Building Segments

Using the Dashboard

Create segments in Dashboard > Segments > Create Segment:

  1. Click "Create Segment"
  2. Name your segment (e.g., "Whale Players")
  3. Add rules using the visual builder
  4. Preview matching players
  5. Save and activate

Rule Operators

Comparison Operators

OperatorSymbolTypesExample
Equals==Alllevel == 50
Not Equals!=Allcountry != "US"
Greater Than>Numbersession_count > 10
Greater or Equal>=Numbertotal_revenue >= 100
Less Than<Numberdays_since_last_session < 7
Less or Equal<=Numberage <= 25

String Operators

OperatorDescriptionExample
containsString contains substringemail contains "@gmail"
starts_withString prefix matchdevice_id starts_with "ios_"
ends_withString suffix matchusername ends_with "_pro"
matchesRegex matchemail matches ".*@company\\.com$"

Collection Operators

OperatorDescriptionExample
inValue in listcountry in ["US", "CA", "UK"]
not_inValue not in listlifecycle_stage not_in ["churned"]
contains_anyArray has any ofachievements contains_any ["first_win"]
contains_allArray has all ofbadges contains_all ["gold", "platinum"]

Time Operators

OperatorDescriptionExample
within_lastWithin time windowlast_purchase within_last "7d"
beforeBefore datefirst_seen_at before "2025-01-01"
afterAfter datelast_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:

SegmentDescriptionAuto-Rules
New PlayersFirst 7 daysfirst_seen_at within_last "7d"
WhalesTop 1% spenderstotal_revenue >= percentile(99)
At RiskEngagement declininglifecycle_stage == "at_risk"
ChurnedNo activity 14+ dayslifecycle_stage == "churned"
Non-PayersNever purchasedis_payer == false
Power UsersDaily active 7+ daysactive_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 segment
bool isWhale = await IlaraClient.Instance.IsInSegment(class="code-string">"whales");
 
if (isWhale)
{
ShowVIPOffer();
}
 
class=class="code-string">"code-comment">// Get all segments for current player
string[] 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