How does Google Analytics calculate a session
During my career I had the pleasure to hear from my customers many ways of How does Google Analytics calculate a session. Unfortunately many of them were wrong and this affects their analysis and understanding the data they see in Google Analytics.
In this Article I would like to present to you the only 4 ways Google Analytics declares an end of a session
How does Google Analytics calculate a session
There are 4 ways Google Analytics declares an end of a session:
1. User is idle for more than 30 minutes
Let’s see the following example:
User viewed page A
After 20 minutes he viewed page B
After 15 minutes he viewed page A
After 35 minutes he viewed page B – This will start a new session
Why?, because there was more than 30 minutes that there was no interaction, that closed the session and the next interaction opened a new session
2. User returned with UTM parameters, this will always start a new session
What are UTM parameters?
In short, Google Analytics doesn’t always know the source of our session, did we pay for it? Is it part of a campaign?
So we can notify Google Analytics on the traffic source of our customers. We can easily build add the UTM parameters with the UTM builder
See the following scenario for how Google Analytics attributes the traffic source:
Let’s say the first session of our user is from a paid source
The second one is from an organic search
The third is from an email we sent him
And after visiting our site so many times
He types our URL in his browser, and visits our site (or opens from his bookmark)
This session won’t be direct
It will be email, because the last NON Direct traffic was email
Any traffic source overwrites Direct, up to 6 months
This means that direct traffic is either new users that reached us directly, or users that the last time came from a declared source was more than 6 months ago
How can we know rather the last traffic is email or Direct?
In my article about The Direct Session dimension, you can see how easy it is to see this, in Google Analytics.
4. User crossed during his sessions 12 o’clock at night, his session will be divided to two separate sessions
Let’s say a user started his session at 15:55 and ended it at 16:05, this is easy to see that all his interactions during these 10 minutes will be captured as one session.
On the other hand, in case a user started his session at 23:55 and ended it at 00:05, this will be divided into two sessions the first one will include all of his interactions until 00:00 and the second one, will start at 00:00 and will include all of his interactions until 00:05
5. Firing explicitly end of session with the Measurement Protocol
Using the measurement protocol (see here how to fire offline transactions to Google Analytics using the Measurement Protocol), we can fire to Google Analytics any hit we want.
We can declare that a specific hit starts a new session or ends one with the “sc” parameter
for ending a session we will fire:
sc=end
for starting a session we will fire:
sc=start
We talked about the 30 minutes session timeout and the 6 months campaign timeout
We can configure this if necessary
Under the Admin, we click on the Tracking Info, that’s in the Property menu
We can control the session timeout
And the campaign timeout
Leave a Reply
2 Comments on "How does Google Analytics calculate a session"
Thanks for making things more clear.