Understanding Events
Learn the core concepts of event tracking in Ilara — how events work, why they matter, and how to design your event schema.
What Are Events?
Events are discrete actions or occurrences in your game that you want to track. Each event has a name and optional properties that provide context.
{class="code-string">"event_name": class="code-string">"level_complete",class="code-string">"player_id": class="code-string">"uuid-123-456",class="code-string">"timestamp": class="code-string">"2025-01-25T10:30:00Z",class="code-string">"properties": {class="code-string">"level": 5,class="code-string">"score": 12500,class="code-string">"time_seconds": 180,class="code-string">"stars_earned": 3,class="code-string">"items_collected": [class="code-string">"coin", class="code-string">"gem", class="code-string">"key"]}}
Types of Events
Lifecycle Events
Track major player journey milestones:
Gameplay Events
Track core gameplay actions:
Economy Events
Track virtual and real currency flows:
Social Events
Track social interactions:
Event Properties
Properties add context to events. Use them to answer "who, what, where, when, why" questions about each action.
Property Types
Best Practices
- Use consistent naming:
snake_casefor all property names - Be specific:
gold_coinsnotcurrency - Include context: Track
levelwith level events - Avoid PII: Don't include email, real names, or addresses in properties
- Keep values clean: Avoid special characters in string values
class=class="code-string">"code-comment">// ✅ Good: Specific, typed, contextualIlaraClient.Instance.TrackEvent(class="code-string">"purchase_complete", new {product_id = class="code-string">"gem_pack_500",amount = 9.99,currency = class="code-string">"USD",payment_method = class="code-string">"apple_pay",is_first_purchase = false,session_number = 12});class=class="code-string">"code-comment">// ❌ Bad: Vague, inconsistent, contains PIIIlaraClient.Instance.TrackEvent(class="code-string">"purchase", new {item = class="code-string">"gems", class=class="code-string">"code-comment">// Too vaguePrice = class="code-string">"$9.99", class=class="code-string">"code-comment">// String instead of number, wrong caseuserEmail = class="code-string">"...", class=class="code-string">"code-comment">// PII - never include!data = class="code-string">"misc stuff" class=class="code-string">"code-comment">// What does this even mean?});
Event Batching
The SDK automatically batches events to optimize network usage and battery life. Events are sent when:
- The batch reaches a size threshold (default: 10 events)
- A time interval passes (default: 30 seconds)
- The app goes to background or closes
- You manually call FlushEvents()
class=class="code-string">"code-comment">// Adjust batch settings in your configvar config = new IlaraConfig {EventBatchSize = 20, class=class="code-string">"code-comment">// Events per batchEventFlushInterval = 60, class=class="code-string">"code-comment">// Seconds between auto-flush};class=class="code-string">"code-comment">// Or force immediate send for critical eventsIlaraClient.Instance.TrackEvent(class="code-string">"purchase_complete", data);IlaraClient.Instance.FlushEvents(); class=class="code-string">"code-comment">// Send immediately
Automatic Event Tracking
Ilara can automatically track common events without additional code:
_auto suffix in the dashboard. You can disable auto-tracking if you prefer manual control.Event Schema
Ilara automatically detects and validates event schemas. Once an event is tracked, its schema is inferred and subsequent events are validated against it.
View and manage schemas in Dashboard > Events > Schema.
Next Steps
- SDK Installation — Install the SDK for your platform
- Player Identification — Link events to player profiles
- Events API Reference — Full API documentation