What is a user session?

A user session, sometimes known as a "visit," is a group of user actions that are performed in your web application during a limited period of time. A single session typically includes multiple page loads, 3rd-party content requests, service requests, and user actions (for example, button clicks and file downloads). Each user session includes at least one user action.

Dynatrace typically shows all the sessions of each individual user, even when those sessions are anonymous (non-authenticated users identified with browser cookies) or when a user tag has been edited or deleted. For mobile apps, Dynatrace identifies individual users based on the specific mobile device they use. For web applications, user identification is achieved by storing a persistent cookie within each user’s browser. Cookies enable Dynatrace to assign even anonymous user sessions to known users. As long as a user has logged into your application at least once, you can search for and identify that user, even when the user accesses your application within anonymous, unauthenticated sessions. This is particularly useful for analyzing periods of time when a user may not have been able to log into your application due to an issue with your authentication service.

When does a user session start?

A user session starts when the first user action is initiated.

When does a user session end?

A user session ends in one of the following ways:

  • When the user closes their browser. Note that user sessions don't end when a user simply closes a browser tab.

  • After 30 minutes of browser/tab inactivity.

  • By calling the JavaScript API function dtrum.endSession(). This function can be used within your application to end user sessions automatically when, for example, the user logs out. You can also use this API call if, during testing for example, you want to immediately end browser sessions without waiting for the default 30-minute timeout. To use this function, open your browser's console and enter the call dtrum.endSession(). Your user session will then appear in the User sessions view 2-4 minutes after the end of the session.

Note:

Due to the 30-min timeout, finished user sessions don't immediately appear in User sessions view. Finished sessions appear only after 30 minutes. Even when a browser is closed, it takes 30 minutes before a user session is displayed in User sessions view, because the browser doesn't send any sort of "Browser closed" or "tab closed" signal. This means that if you switch to a global analysis time frame that is less than or equal to 30 minutes, you won’t see user sessions that were completed within the past 30 minutes. Dynatrace presents only completed user sessions within which the first user action was initiated during the selected analysis time frame. The same holds true for user sessions where the JavaScript API function dtrum.endSession() is used and you select a global analysis time frame of less than 2-4 minutes.

How are user actions grouped into user sessions?

Dynatrace stores some information in session cookies and local storage. This enables the correlation of user actions into one user session. This session information is erased however when (1) the browser is closed, (2) the user clears their browser cookies, or (3) the user cleans up their local storage. In such cases, the next initiated user action starts a new user session.

Suppose for example that a user performs 10 user actions every 1-2 minutes and after each user action the user either closes their browser or deletes their browser cookies. In such a situation, 10 user sessions would appear in User sessions view, each comprised of a single user action.

Consider another example: A user session is initiated, but after a few minutes the user walks away and leaves their browser window open. If the user returns to the application within the 30-min timeout window, their next actions will be considered part of the same user session. If the user is away from their computer for more than 30 minutes, a new user session will start. If the user were to close their browser before taking their break, a new user session will start when the user returns to the application, regardless of how long they were away from their computer.

How is user session duration calculated?

User session duration is the elapsed time between initiation of the first user action in a session and the completion of the last user action in the session.

Note: Timeout periods (which include no user activity) aren't factored into user session duration measurements.