Amplitude calculates session length via the following formula when session ID is used as the session property:
max(client_event_time) - min(client_event_time)
Where:
-
client_event_time
is the local timestamp (UTC) when the device logged the event -
max(client_event_time)
is the local timestamp (UTC) of the last event logged by the device
Additionally, hidden, inactive, and deleted events will not be included in the session length calculation. For example, let's say you have the following series of events:
Event A --> Event B --> Event C --> Event D
If Event C and Event D are hidden, inactive, or deleted, then the max(client_event_time)
is taken from Event B instead of Event D.
Read more about how Amplitude tracks sessions in this help center article.