Last Updated on August 2, 2021

How a web session is defined in Analytics

A session is a group of user interactions with your website that takes place within a given time frame. You can think of a session as the container for all the actions that a user takes on your site.

One user can create multiple sessions in a day, over several days, weeks, or months. As soon as one session ends another session can begin. There are two ways a session can end:

  • Time-based expiration:
    • After 30 minutes of inactivity
    • At midnight
  • Campaign change:
    • If a user arrives via one campaign, leaves, and then comes back via a different campaign

Time-based expiration

3o minutes of inactivity

A session lasts until there are 30 minutes of inactivity. You can adjust the time limit so a session lasts from a few seconds to several hours.

If Bill comes to the site, every time he interacts with the site in any way Analytics resets the expiration time by adding an additional 30 minutes from the time of that interaction.

Below is an example of Bill’s interactions with a website:

After event 2, the session expiry is set to 14:34.

On view 1 the session is set to expire at 14:31, but as Bill continues through the site, each additional interaction moves the expiry ahead 30 minutes.

If Bill leaves a page open while taking a 31-minute lunch break, then returns to continue browsing, Analytics sets a new 30-minute expiry and a new session begins. The page Bill is on when he comes back after his break is the landing page for the new session.

End of day expiry

Bill opens your website at 11:50 PM on the 14th of August and leaves your website at 12:10 AM on the 15th of August.

The first session ends at 11:59:59 PM on the 14th of August, and the second sessions begins at 12:00 AM on the 15th of August.

End of day is determined by your view timezone settings.

Campaign based expiration

Every time a user’s campaign source changes, Analytics opens a new session. Even if an existing session is still open if the campaign source changes mid-session the first session is closed and a new session is opened.

Let’s say Bill opens your website in the following order:

In the example above, Bill first arrives at the website via the Google organic keyword Red Widgets, then later returns via the Google paid keyword Blue Widgets. 

Each search term updates the campaign, so each keyword corresponds to a new session.

What causes updates to the campaign?

Generally speaking, the campaign updates anytime the user arrives at your site via a search engine, referring website, or campaign-tagged URL. Direct traffic, however, never updates or replaces an existing campaign source such as a search engine, referring site, or campaign-tagged information.

Google Ads autotagging

In the case of Google Ads autotagging, each click generates a unique campaign value (a gclid value). Because each click has its own gclid value, each click is treated as a separate campaign and creates a new session.

Referrals

A new campaign is created every time a user clicks a link to your site from a referring site.

If Bob visits a.com and clicks a link to your site, he starts a session attributed to a referral from a.com. If he immediately visits b.com and clicks a link to your site, he starts a new session attributed to a referral from b.com.

You can use referral exclusions to prevent referrals from specific sites from creating new sessions.

Campaign Tags

The best practice is to use autotagging instead of manual campaign tags, but let’s assume that you manually tagged your Google Ads campaigns with a destination URL like this:

http://www.example.com/?utm_source=google&utm_medium=cpc&utm_campaign=camp1&utm_term=keyword&utm_content=content

Bob clicks your ad, which registers a new session for the first click. However, unlike autotagging, where multiple clicks on the ad can generate multiple corresponding sessions, manually tagged campaign parameter values remain the same for every click so the campaign isn’t updated for each click. This makes it possible to have multiple ad clicks and only one session.

If you advertise on third-party ad networks and use manual campaign tags, you should be aware that each click from a single user on those networks might not generate a corresponding session (if additional clicks happen within the 30-minute time frame). This is a common cause of data discrepancies between Analytics and other product reporting.

Direct traffic

Finally, a quick word about direct traffic in Analytics. Direct as a campaign source never overrides an existing known campaign source like a search engine, referral, or campaign source would.

Direct traffic that interacts with your content within the 30-minute session window has the same effect as leaving your website for less than 30 minutes. The existing session opens and continues from where it left off.