session_start and session_end events record the start and the end of a game session: one run of the game, from launch to quit, or until the player is away for 30 minutes. They are track events. The game reports read them: D1, D7 and D30 retention count a return with session_start, and Session length and Playtime per DAU read duration_s of session_end. See game metrics.
Every event of a session has the same session_id. The SDK makes a new ID for each session.
When they are sent
The Godot, Unity and Unreal SDKs, and the Web SDK withgame: true, send them for you.
- Quit: a desktop game delays its quit to send
session_endand the queue, for at most 2 seconds by default. The option isquit_timeout_sin Godot,QuitTimeoutSecondsin Unity, and Quit Timeout Seconds in Unreal. Unsent events stay on disk for the next launch. - Focus: focus loss and pause save the state and send the queue. The session stays open while the player is away for less than 30 minutes.
- Crash: after a crash, the next launch ends the old session and sends
game_crashin the session that crashed. - Web SDK in game mode: each page load starts a new session.
session_endis sent onpagehide,reset()orshutdown(), or, after 30 minutes without events or at 24 hours, with the next event. - Consent mode: no session before
set_consent(true). - Server builds: a dedicated server sends no session events unless you turn on
track_server_builds. See For multiplayer games. - Other engines: a game that sends app events over HTTP sends
session_startandsession_enditself, with a newsession_idfor each session.
Properties
session_start has no properties.
Sample payload
Session ID rules
Reports count sessions fromsession_id, for websites and games alike. A web or app event must follow the session ID contract:
- An event with an
anonymous_idhas asession_id. - The
session_idis not theanonymous_id. - An event before consent has no
anonymous_idand nosession_id.
FAQ
Why do my session counts look wrong?
Why do my session counts look wrong?
Check that your game sends both events. A
before_send callback that drops session_start or session_end changes your session counts: sample your own events only. A game on app events must send them itself.Does a player who alt-tabs for a few minutes start a new session?
Does a player who alt-tabs for a few minutes start a new session?
No. The session stays open for 30 minutes without focus or events. After that, the next activity starts a new session.
Can a server event be in a game session?
Can a server event be in a game session?
Yes. Send the client’s
session_id with the server event, and it is in that session. Without it, the event joins a session of the same anonymous_id by time. See session ID of the client.