This article will help you:
The User Sessions chart helps analyze your users through various session-based metrics. By showing you the distribution of session lengths, average session length, and average sessions per user, it can help you answer questions like:
- How frequently are users engaging with your product?
- How long are they engaging with your product?
- How do these metrics compare to other segments of users?
Before you begin
Be sure to read our article on building charts in Amplitude, as this is where you'll learn the basics of Amplitude's user interface. You should also familiarize yourself with our helpful list of Amplitude definitions.
You'll also want to read up on session IDs and how Amplitude tracks sessions, where you'll also find instructions on setting custom session properties.
Set up a User Sessions chart
Most Amplitude charts rely on the Events Module to build an analysis. The User Sessions chart does not have an Events Module, so it works a little differently.
Instead, a user sessions analysis will break out your users into groups based on certain characteristics of their sessions spent using your product.
You can also use this chart to count the number of events users fire during their sessions. This lets you assess engagement during a particular period of activity, as opposed to during an entire day, week or month.
Build a User Sessions chart
To build your own user sessions chart, follow these steps:
- In the Sessions Module (where you'd ordinarily find an Events Module), use the Count drop-down menu to specify whether you'd like your User Sessions chart to measure sessions, or events performed within sessions.
- If you're counting events performed within sessions, specify the event (or events) you're interested in counting. If you're measuring sessions instead, skip this step.
- Next, select the event (or events) that should appear in a session in order for it to be included in this chart:
- In the Segmentation Module, identify the user segment you want to include in this analysis. You can import a previously-saved segment by clicking Saved Segments and selecting the one you want from the list. Otherwise, Amplitude begins from the assumption that your analysis will target all users.
- If you do not want to import a previously-saved user segment, you can start building your own by adding properties. To do so, click + where, choose the property you want to include, and specify the property value you’re interested in.
- You can narrow your focus even further by telling Amplitude you only want to include users who have already performed certain actions. To do so, click + perform, then choose the event you’re interested in.
- If desired, add another user segment by clicking + Add Segment, and repeating steps 3 and 4.
- If you selected Sessions in Step 1, choose from the following chart options:
- Total Sessions: Graphs the total number of sessions across all users, which is calculated by counting the total number of valid sessions within the interval. (When session IDs are instrumented, "valid" means a session with an ID other than 'none' or '-1.') Total Sessions does not count sessions containing only inactive events.
- Time Spent: Graphs the total sum of all session lengths within the interval.
- Time Spent per User: Graphs the average amount of time spent in sessions per interval which is calculated by taking the sum of all session lengths within the interval, and dividing by the total number of active users in the interval.
- Avg Length: Graphs the average session length, which is calculated by taking the sum of all session lengths within the interval, and dividing it by the total number of sessions in that interval.
- Length Distribution: Displays the distribution of session lengths in a histogram. Customize the shape of the distribution by setting the minimum and maximum session lengths. The minimum value is inclusive, and the maximum value is exclusive. The example above shows session length distribution for sessions between 1 and 30 minutes in length in intervals of 5 minutes.
- Avg Per User: Graphs the average number of sessions per user, which is calculated by dividing the total number of valid sessions in an interval by the total number of active users in the same interval.
If, on the other hand, you selected Events performed within sessions, choose from the following chart options instead:
- Average Events per Sessions: Graphs the average number of times a selected event is performed per session. The time series returned will plot the number of times the event is performed by users in a session per interval (day, week, month, etc.). Use this to analyze average engagement.
- Total Events Across Sessions: Graphs the total number of times a selected event is performed within sessions. Like plotting totals in Event Segmentation, this shows the number of times users have performed a particular action across all sessions in an interval.
- Distribution: Graphs a distribution of the number of sessions that include a selected event. The x-axis shows a range of the number of times the selected event is performed, and the y-axis plots the number of sessions in the time range. This analysis can help show which of your users have the highest, or lowest in-session engagement. Use the bin size customization controls to adjust the sizing of the bins and distribution of the data, or use the Custom Buckets modal to set individual ranges for each bucket:
- Use the date picker to set the timeframe of your analysis.
NOTE: Sessions lasting longer than a day are excluded from analyses.
The three ways Amplitude records sessions
Amplitude records sessions on either the server side or the client side. Additionally, client side sessions can be either mobile or web.
- Server side: You can use the HTTP API v2 to track sessions on the server side by including a value in the session_id field. The session_id value will be the number of milliseconds since epoch, counting from the start of the session.
- Client side (mobile): When using Amplitude's mobile SDKs, events triggered within 5 minutes of each other are, by default, counted towards the current session. The time of the first event marks the start time of a session, and the last event triggered marks the end time of a session. For example, the first event could be marked by an 'Open App' event. In addition, Amplitude will count events sent within five minutes of each other towards the current session.
Additionally, you can define a session without instrumenting your events first, by setting a custom session property.
NOTE: The User Sessions chart will only display data if you are sending a session ID with your events. Amplitude's SDKs will handle this for you automatically, unless you flag an event as out-of-session (assigning the session ID a value of '-1'). However, if you're using Amplitude's HTTP API, you'll have to explicitly send a
session_id with your events.
How filtering works in the User Sessions chart
Filtering events for the User Sessions chart is a multi-step process. The order of those steps is important to understand.
First, Amplitude will filter for events that match the property filters. Once those are returned, Amplitude takes those events and groups them into sessions, enabling Amplitude to calculate session length and count events performed each session.
Another way to phrase this is, property filters occur before session filters. So Amplitude filters on raw events first, then on the filtered events.
Only events with property filters are considered when computing session length.
The data table
Underneath the chart is a table of sessions data. You can specify which segments you see in the graph by clicking on a segment name in the data table. You can download the table by clicking Export CSV.