In the past month, what is the average length of each user session, for each day?
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
In this example, for every user, we want to measure the number of sessions where they edited one or more Wikipedia articles. The session will stop when the user is inactive for 60 minutes or more.
Building the query
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
typecolumn 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: