How Amplitude calculates session length

When you use session ID as the session property, Amplitude calculates session length with this formula:

plaintext
*max(client\_event\_time) - min(client\_event\_time)*

In this formula:

  • client_event_time is the local timestamp (UTC) when the device logged the event.
  • min(client_event_time) is the local timestamp (UTC) of the first event logged by the device.
  • max(client_event_time) is the local timestamp (UTC) of the last event logged by the device.

Amplitude excludes hidden, inactive, and deleted events from the session length calculation.

Example event sequence:

Event A --> Event B --> Event C --> Event D

If Event C and Event D are hidden, inactive, or deleted, Amplitude uses max(client_event_time) from Event B instead of Event D.

For more information about how Amplitude tracks sessions, refer to Track sessions.

Was this helpful?