I know there’s been a couple of topics on Amplitudes session’s logic, but I haven’t found an answer to my question.
We’re using the Unity SDK on mobile and trying to measure the duration of players’ game sessions and detect when they quit the app. The trackingSessionEvents
flag is enabled.
Here’s what we’re seeing in the logs:
-
A custom
Level_Start
event is immediately followed by Amplitude’sEnd Session
event. -
Then, much later, a
Level_End
event is fired — accompanied by aStart Session
.
This seems to happen because:
-
The level lasts more than 5 minutes.
-
No custom events are fired during the level (we don’t need any mid-level events).
However, I’m very confident that the app remained in the foreground well over 1.5 minutes between Level_Start
and Level_End
, and the player didn’t briefly background the app right after level start. Player heuristics confirm ongoing interaction.

According to the docs:
ea session] ends when the app goes into the background and fires no events for at least five minutes.
As far as I understand, this means that the absence of events for 5 minutes is not a sufficient condition, the app must also stay in the background for those 5 minutes. Or am I wrong? What if the app goes into background, then (quickly) goes back into foreground and doesn’t fire events for 5 minutes? For this case the condition from the docs doesn’t seem clear.
And, once again -- “End Session” and “Level_Start” (just as “Start Session” and “Level_End”) mustn’t have come at the same second as there was at least some foreground activity.
So, the question is, may there be something wrong with the configuration? Or do I miss something from the docs that could explain such behavior?