Skip to main content
You are viewing the documentation for Interana version 2. For documentation on the most recent version of Interana, go to


Scuba Docs

Intro to Sessions


A session is a sequence of consecutive events associated with a single actor. A session is typically identified in one of these ways:

  • All events that occur during a period of activity bounded by a specified period of inactivity
  • All events that occur between a “restart session” event

The most important use case and benefit of sessions is that they are read-time calculations, which allows you to do retroactive session creation and analysis. This means you don't need to generate a session ID during event collection, although you can still do that. You can create different session definitions per platform or create a single session across platforms. Interana allows you to specify the end of a session based on two criteria: inactivity and restart events.  Inactivity is required and restart events are optional. Here is an example of a session:

Like all other named expression builders, you can also apply arbitrary filters.

Defining session start and end points

There are two ways to define when Interana starts a new session:

  • Set an inactivity timer. This can be defined as any period from 1 second to 52 weeks of inactivity. Once this period has elapsed, Interana will automatically create a new session. 
  • Specify an event that triggers a new session. Use the Restart session event field to set a specific event that marks the end of a session (for example, page is one of logout).

Session metrics

When you create a session, Interana automatically generates four metrics that you can use for analysis:

  • Session ID (Natalie's Session): this is a unique identifier per session.
  • Session Duration (Natalie's Session.duration): the time elapsed in each session, from start to end.
  • Session Events Count (Natalie's Session.event_count): a count of events per session (equivalent to creating a per-session metric of Count Events).
  • Time in Session (username.time_in_session.Natalie's Session): the sum of time elapsed in each session per user (or actor).

By default, metrics will be computed for all sessions (session duration, and session event count). In addition, you can create custom, per-session metrics to measure specific activity during each session.

Any filters you define for a session are also used to calculate the session metrics. 

Custom session metrics

Custom session metrics are metrics you can create to apply to events which occur during a particular session. 

For example:

  • Number of purchases users made within their first login session.
  • Unique webpages users went to in sessions which last more than 1 hour.
  • How many error messages the user saw during their second attempted registration session.

Interana displays session metrics as  session  <metric name> in lists.

Automatic per-session metrics

Per-session metrics are a way to measure how may times an actor did a thing within one session.

Interana automatically creates two metrics for every session: a duration metric and an event_count metric. The duration metric is session_name.duration, and the event_count metric session_name.event_count

Interana displays auto session metrics as   session  <session_name>.duration and  session  <session_name>.event_count  in lists. 

Per-session metrics are an extremely powerful feature that allows you to treat your newly created Sessions as actors in our system. This means you can ask questions about what happens during these sessions, and calculate things on a per-session basis. Here is an example of a session metric:

Similar to the auto-generated session metrics, these per-session metrics also become available to query in Interana.

Based on the example above, you could select the per-session metric Natalie's Session.Unique Queries Per Session when building a query:

Use sessions to measure user engagement

Let's start by creating an “Engaged session,” which measures the number of sessions when a user edited at least one article. Creating this session also creates an automatically generated session metric called Engaged session.duration, which is the length of any session that meets the requirements.

See Metrics, measures, and aggregators for more information about metrics and aggregators. 

We can also create metrics within the session definition to allow us to dig deeper into this information. With session metrics, you can build metrics that rely on the session definitions.

For example, we can build a session and use the custom session metrics to measure how people are using wikipedia:

  • Engaged session.Edits per session: counts the number of edits made during any "engaged" session. We use the type column to do this, which records the type of action performed.
  • Engaged session.New articles per session: counts the number of new articles created during any "engaged" session. 
  • Engaged session.Uploads per session: counts the number of files uploaded during any "engaged" session.

When you Explore from this session using the auto-generated metrics, Interana returns a graph of the average duration of the engaged sessions:


Use sessions to build metrics

For each user who has engaged sessions, we can build a metric to measure the number of engaged sessions they have. To do this, we create a custom ratio measure where the numerator is a count of unique engaged sessions, and the denominator is a count of unique user IDs that have engaged sessions. The numerator is a count unique of the defined Engaged session, and the denominator counts the number of unique user IDs where the session metric Engaged session.events_count is greater than or equal to 1.

When you Explore using this metric, you can use the Table view to see the results:

Use sessions to build cohorts

We can create a cohort of really engaged sessions, where we count the unique session IDs that have at least one session that is not only “engaged,” but where the user has edited at least 30 articles.

When you run Explore on the cohort, you can see the number of “really engaged sessions” compared to the total number of sessions:

Chart the distribution of sessions

We can also use the Distribution View to plot distribution charts based on the session metrics. For example, this query plots the distribution of edits for any engaged session. This example uses the Engaged session.Edits per session metric as a filter to show only the distribution of engaged sessions that included between 5 edits per session and 30 edits per session.  

You can click and drag over any section to drill into the graph for those values.

Group by example: grouping by location

You can quickly compare the average duration of average engaged sessions by country. Measure by the average Engaged session.Edits per session, then group by

We can see that there's a spike in edits from users in Croatia on March 9. We can get more detail by switching to the Samples view and adding two filters: is one of Croatia and type is one of edit.  Now we can see which articles were the focus of this activity: