

If you are using Amplitude's SDKs, this happens automatically. All events within the same session share the same session ID. This timeout window can be customized via the JavaScript SDK configuration options.Īmplitude automatically generates a session ID for each new session that ID is the session's start time in milliseconds since epoch (also known as the Unix timestamp).

All events fired within 30 minutes of each other are counted as part of the same session. Web sessions time out after 30 minutes by default. On a browser, a session begins when the website is opened and the SDK is initialized it ends when the last event is triggered.Note that you can define your own session expiration time by calling setMinTimeBetweenSessionsMillis(timeout), where the timeout input is in milliseconds. All events sent within five minutes of each other are counted towards the current session. For mobile, a session begins when the app is brought into the foreground it ends when the app goes into the background and no events are fired for at least five minutes.The specifics differ slightly between mobile and web applications: Generally, a session is the period of time a user has your app in the foreground or has your website open.

By the time you're finished, you should have a solid understanding of how best to incorporate sessions into your Amplitude analyses. This article will explain how Amplitude defines and tracks user sessions. The most direct way to build a session-based analysis is with the User Sessions chart however, you can incorporate sessions into other types of analyses through user and event properties. In Amplitude, sessions are a useful metric for understanding the frequency and duration of your users' engagement with your product.
