How to Measure True Time with Google Analytics

How To Measure True Time With Google Analytics

If you are familiar with how web analytics tools measure time spent on page or site, you know that time spent on the last page is (usually) counted as 0 seconds. With other words, time on last page is not measured.

The reason this isn’t measured is simply that the web analytics tool need to have a start point and a end point. On the last page of the visitors visit, there isn’t a end point normally to calculate time against.

To be able to get time spent on last page you have to be able measure 2 things:

  1. Clicks on Back Button
  2. Visitors leaving by Closing their Browser or Browser Tab

In this article I show you how you can measure “True” Time spent on your website with Google Analytics by measuring Back Button and Visitors who leave by Closing their Browser.

Google Analytics True Time Comparison

The time difference between Standard Time Measurment and “True” Time Measurement can be huge.

How to measure “True” Time by Tracking Back Button and users who leave by Closing their Browser

There are 3 steps you have to do to be able to do this tracking.

Step 1.
The first thing you should do is to create a new Google Analytics profile with a new profile ID. You shouldn’t implement this measurement in your regular Google Analytics profile. This method will “kill” your Bounce Rate in addition to that your time spent reports of course will be inflated. With other words, we are going to track data to 2 different profiles in Google Analytics.

The principle for tracking to 2 different profiles is shown below using Google Analytics Asynchronous code.

Step 2.
The next thing you have to do is to download this ZIP-file. The ZIP-file contains 2 files and is necessary in the measurement of the Back Button.

  1. Blank.html – This is an empty HTML-file that you must upload to the root of your domain (
  2. Backfix.js – This is the javascript that does all the magic that is necessary to be able to track the Back Button

The solution I’m using to track the Back Button is a slightly modified solution borrowed from the Browser Back Button Detection article by Brook Bryan. The original solution was creating 404-errors that Google Analytics counted, so the only thing I have done is to fix that.

Upload backfix.js to for example a folder called script.

Step 3.
This is the last step. Copy and paste the code below between <head> and </head>on your website.

If you have done everything correctly, you should if you drill down to you Event Tracking Report find a report called Track Time. There you will find a report similar to the screenshot below.

How To Measure True Time With Google Analytics

Event Labels in that report will be the URL the visitor was on before he either clicked the back button or closed the browser. Event Value reported is the number of seconds from the visitor arrived to the page and until the browser was closed or the back button was clicked.

If you drill down even more in your numbers you will perhaps get the same feeling as me:

Time spent on page or site isn’t the same as time spent interaction with your content.

Things to be aware of – and Why did I do this?

First, I’m not a programmer so if you find any errors or don’t like mye code, please tell it nicely.

This measurement method also shows why this method isn’t a standard method in web analytics tools – this method isn’t accurate. Only around 80 % of my visitors are measured using this method, which is why I have written “True” Time and notTrue Time in this blog post.

Since I’m normally a person that will speak out for actionable analytics, which this isn’t, so why did I do this?

An important part of web analytics is to be curious. If you aren’t curious you will find it more difficult to be friend with your data. With other word, the reason for me to do this was simply because I was curious and had some geek time to use.

Leave a comment

Your email address will not be published.