Skip to main content

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:

  1. Sends session_start on successful initialization
  2. Sends session_stop when the app backgrounds (OnApplicationPause(true))
  3. Sends session_start when the app resumes (OnApplicationPause(false))
  4. Sends session_stop with end_reason: "user_quit" on OnApplicationQuit

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

MetricDerived from
DAU / MAUUnique device_id or player_id per day/month with session_start events
Session lengthTime between session_start and session_stop
Sessions per dayCount of session_start events per player per day
RetentionReturning players with session_start on consecutive days