Donate Ethereum to this address
If you find the blog useful and would like to show some support, a little donation of Ethereum would help to keep this site alive. Appreciate it!
First ImpressionWhen we talk about time on page and session duration, what are the first definitions that come into your mind? Time on page – The amount of time spent on a page. Session duration – The amount of time spent in a single session. Seems straightforward right? N.o.p.e. Take a look at the screenshots below… Average time on page = 0 second? How is that possible? Same goes for average session duration. If the metric definitions above were accurate, this should have never happened. And if that’s not proof enough, try looking at your data and you will most probably find that in some cases, average session duration is less than average time on page. So what’s the issue here?
True DefinitionThere is nothing wrong with the definitions given above. Let us recap. Time on page – The amount of time spent on a page. Session duration – The amount of time spent in a single session. Then what’s the problem?
Technical LimitationThe reason why we are unable to accurately capture time on page and session duration is… the way vendors calculate them. It’s not the vendors’ fault that they did a poor job at capturing these 2 time metrics. It’s more of the technical limitation they are facing. Let’s look at one of the possible scenario: The image above depicts an user visiting 3 pages before heading for the exit. The time indicated on top of each page shows when the user first landed on the page itself. Notice the ??? on top of the user exit? I’m not trying to make you guess here. That is the technical limitation we spoke of earlier. There is no good way for the vendors to tell when the user exits a website. Internally, we could have the developers capture the time by making use of some functions (onunload, onbeforeunload, etc) that supposedly fire before an user exits a webpage. But it isn’t that simple. Every browser works differently in one way or another (especially Safari thanks to Apple always wanting to be the “special” kid. Yay!), which also means that those functions mentioned previously work differently on different browsers. Long story short, it is almost impossible to capture the time an user exits a webpage.
Time on page & Session durationBy now, you should have a rough idea where I am going with this. Let’s revisit the user journey again: Time on page is calculated based on the timestamp of next page less the timestamp of the page in question. Time on page 1 = 11:04 – 11:00 = 4mins Time on page 2 = 11:06 – 11:04 = 2mins Using the knowledge gained… Time on page 3 = ??? – 11:06 = 0min Since the vendors can’t determine the time when the user leaves page 3, all they can do is to record a value of 0. Therefore… Session duration = 4mins + 2mins + 0min = 6mins There you go. We have explained how time on page can be 0, but that doesn’t account for why average duration session can be less than average time on page.
Average time on page & Average session durationThe image above depicts a bounce, which occurs when an user exited the website after visiting only one page. As you can imagine, both time on page and session duration are 0 in this case.
Average time on pageLet’s take a closer look at Average time on page.
Average time on page = Sum of time on page / (Total no. of pageviews – Total no. of exits)You can see that it is divided by the total number of pageviews less the total number of exits. What it means is that we are not taking into account all the bounces in our calculation. All those time on page with a value of 0? They are excluded! With this, we have a clearer definition for average time on page:
Average amount of time spent on the page where users have visited at least 1 other page beyond this pageIt’s a mouthful, but that’s what it is. Note that this metric is slightly optimistic, in the sense that we have omitted the timings where users came to our site and left without visiting another page (bounce).
Average session duration
Average session duration = Sum of session duration / Total no. of sessionsFor average session duration, somehow, we do not exclude sessions with a value of 0. Don’t ask me why, but that’s what Google Analytics has decided to go with. Let me take a stab at defining average session duration:
Average amount of time approximately spent in a session less the amount of time spent on the last page visited, including sessions with a value of 0Phew. That was crazy.