Session Management
Sessions represent a continuous period of player activity. GameRebellion handles session lifecycle automatically, with manual overrides available.
Automatic Session Tracking
When AutoTrackSession is enabled (default), the SDK:
- Sends
session_starton successful initialization - Sends
session_stopwhen the app backgrounds (OnApplicationPause(true)) - Sends
session_startwhen the app resumes (OnApplicationPause(false)) - Sends
session_stopwithend_reason: "user_quit"onOnApplicationQuit
All of this is managed by the auto-created GRMetricsCollector component.
Manual Session Control
If you disable AutoTrackSession or remove GRMetricsCollector, manage sessions yourself:
// Start a session
GameRebellion.TrackEvent("session_start", "{}");
// Pause (app going to background)
GameRebellion.SetPaused(true);
// Resume (app returning to foreground)
GameRebellion.SetPaused(false);
// End session on quit
GameRebellion.Shutdown("user_quit");
Session Events for S2S
The S2S API provides dedicated endpoints for session management:
POST /api/v1/sessions/start
POST /api/v1/sessions/stop
POST /api/v1/sessions/end
Each accepts a JSON body with session metadata (player ID, device info, timestamps).
What Powers the Dashboards
| Metric | Derived from |
|---|---|
| DAU / MAU | Unique device_id or player_id per day/month with session_start events |
| Session length | Time between session_start and session_stop |
| Sessions per day | Count of session_start events per player per day |
| Retention | Returning players with session_start on consecutive days |