Measuring time on a website can be hard. Really hard. Every web analytics tool has issues, and that includes Google Analytics.
I’d like to clarify how Google Analytics track time on page and visit length. It’s probably different than you think.
Understanding Engagement Hits
The key to understanding Google Analytics time calculations is understanding the data that is sent to Google. We affectionately refer to these data as HITS. I know, that’s a terrible term to use when talking about analytics. But they really are hits.
Data hits are the image requests sent to Google Analytics. Three are six different types of data hits in Google Analytics:
- Pageview hits
- Event hits
- Ecommerce transaction hits
- Ecommerce transaction item hits
- User defined hits (this is the predecessor of custom variables)
- Social plugin hits
While these are all data hits they are not all engagement hits.
An engagement hit is any hit that is not marked as “non interaction” and is not filled only with custom variable information. This means that the hit has at least page information, ecommerce transaction information, ecommerce item information, event information or social tracking information.
Filtering the above list of data hits using the engagement hit definition results in five types of engagement hits:
- Pageview hits
- Interactive event hits
- Ecommerce transaction hits
- Ecommerce transaction item hits
- Social plugin hits
You’re probably wondering, “what the heck does this have to do with time calculations?”
Most analytics tools use the time between pageviews to track time. But Google Analytics time calculations uses engagement hits to get a more accurate measure of time on page and time on site.
How Time on Page is Calculated
Time on Page is calculated in two different ways. The calculation depends if the visit has one pageview OR if the visit has multiple pageviews.
When There are Multiple Pageviews in a Visit
This is pretty easy to understand.
If there are multiple pageviews during a visit then the time calculation is based on the start time between the current page and the start time of the next page hit. Here’s a visual representation.

Image #1: When there is more than one pageview in a visit, Google Analytics uses the time between pages to measure time on page.
Pretty easy, right? Most tools work this way, measuring time based on pageviews. But this leads to trouble.
We can’t calculate the time on the last page of the visit because there is no pageview after the last page. Stay tuned, more on this later.
When There is Only One Pageview in the Visit
Most people believe that Google Analytics can not, and does not, calculate time on page when there is only one page viewed in a visit. This is partially correct.
If no other page is viewed during the visit, Google Analytics use the time between the initial page hit and the last engagement hit that follows the page hit.
Time on Page = (time of last “engagement hit” on page) – (time of first hit from page)
Let me make this clear, if a visit only contains one pageview (i.e. the visit is a bounce) then Google Analytics can track time on page by using other engagement hits.
If you add multiple engagement hits to a page you can get a more accurate measure of time on page and site, as shown in the image below.

Image #2: Google Analytics uses the last "engagement hit" to measure time on page when there is only one pageview during a visit.
This was the whole reason behind the posts Advanced Content Tracking Part 1 and Advanced Content Tracking Part 2.
How Visit Length is Calculated
Visit length also uses engagement hits to get a more accurate measure of time. Rather than use just the time between pageviews, the visit length measurement includes the time between the first hit and the last engagement hit of the session.
Visit Length = (time of last “engagement hit” of visit) – (time of first hit of visit)
Let’s look at a real example. Here we see a number of pages in a visit. Normally, if we only measured visit length based on page load time we’d miss all of the time on the exit page.
But because there is an engagement event on the exit page we get a more accurate measure of the visit.
It’s also importnat to note that in the previous example Google Analytics will also use the engagement hit to calculate the time on page for the exit page. In Image #1 it was not possible to calculate the time on the exit page because there was no final engagement hit after page 3.
But in Image #3 there is an engagement hit on the exit page. So Google Analytics will use that piece of data to calculate the time.
Don’t forget, there are other engagement hits, like the ecommerce transaction hit, that can also be used to more accurately measure the length of a visit.
I hope this post demystified how Google Analytics tracks time.
Let’s hear it for greater accuracy!
What happens when you set the non-interaction parameter in the event to true? Is this only influencing the bounce rate, or also time on page?
Would Google ever consider automatically firing off an engagement hit every 10 seconds or so that would solve this problem for all even if they don’t implement any type of advanced tracking features such as event, ecommerce, user defined or social plugin tracking? This type of hit could be in its own category (possibly called something like “time tracking”) so as to never get mixed up with the other types of hits.
Justin, could you explain a little more (clearly to a wanna be GA ninja) what exactly makes a “hit” trigger? Also, does your blog post mean that if one of those 6 engagement hits don’t occur then time is not going to be calculated on a one page visit, or on the last page of a series of pages visited?
Thanks for clarifying, Justin – remember that at your level of experience and expertise, many of us below you need explanations that come from “the beginner mind” (shoshinsha).
Thanks!
David
@ Béate: When you specify an event hit as non-interactive it will not alter the bounce rate or the time calculations.
@Brendan: No. In my opinion there really isn’t a problem. GA and almost ever tool out there uses a well accept methodology for tracking time. If you want something more accurate it’s up to each individual site owner to decide how to proceed. That’s why GA has flexible tools, like event tracking. So you can customize the tracking to meet your needs.
@David: Hits are triggered by the JavaScript tracking code. Correct, if there is no engagement hit on a one-page visit then there is no way to calculate time. Or if there is no engagement hit on an exit page then there is no time calculated for the exit page.
Hi Justin,
Are you planning a part 2 to this post? The time measuring problem becomes messier especially when the session has pages open in multiple tabs.
IMHO, I would discourage most people from using the time measure/s from the web analytics tools. Apart from the measurement problem that you touched upon, it is quite normal for the same activity taking significantly different time for different individuals. Say, even for a mundane activity of buying a can of milk, I may pick up the standard brand size in 5 seconds and you may spend time checking the Best Before dates and take 25 seconds. If viewed through a web analysts’ perspective, neither the average time 15 seconds nor segmenting the fast vs. slow interactions will help unless supported by an understanding of the needs (which may need more tracking / data points).
As a stand alone metric, I’d say, time on page/site can only be used in very specific cases. And, more often than not, I have seen it being misused and misinterpreted.
~Subhash
@ Subhash: I was not planning a second part, but that’s a good idea.
In general, I’m perfectly fine with people using time metrics in an analytics tool. We all know that averages can be heavily skewed, but it’s a starting point. I also believe with the proper segmentation applied I believe the time based measurements are OK. If we can eliminate the outliers we can get a more accurate measure of behavior.
If you need something more detailed you can always use an advanced technique, like Advanced Content Tracking, to get a more accurate measure of time.
@Justin: I understand that the current method of tracking and reporting time on page and time on site is pretty much an industry standard, but why forfeit better analytics data for the sake of the status quo with this regards to this particular issue? Google has made other fairly significant changes to how it calculates certain metrics, not least of which is the change in August 2011 as to how sessions are calculated.
Hi Justin,
Thanks for this advanced explanation, this definitely encourage me to implementing advanced content tracking.
Also keep to get a more detail post on the following topic when you have a chance:
-Location report accuracy in city level when people using ISP providers from another city.
(GA use maxmind?) this should be much easier when IPV6 completed take over IPv4?
and is the schedule report on PDF coming back?
What if visitors quit directly from Page-3 without any event…
@Justin,
I wasn’t refering to just the problem with averages alone, even though that is what most analytics tools show (as a starting point). The larger issue that I have with a metric like time is that it isn’t easy to connect the metric with real world. It just isn’t very actionable.
For instance, if there are two pages (or two sources of traffic, for that matter) having a different time on page, there is hardly anything that we can interpret from the number.
Can you think of any use cases where the time measure is critical, esp. from a business user perspective?
Imho, Time data is collected by web analytics tools and is therefore packaged and presented to the users. It may actually be misleading users from exploring the more important aspects that the analytics tools track.
Subhash
Hi Justin,
I wanted to know whether I can make changes in the parameters passed in the _.GIF request. I need to append mobile numbers at the end of my URL. I there any other way so that i can pass the mobile number to the _.GIF request.
Thank you,
Rijesh
@Brendan: To some extent we need to maintain the status quo as to maintain user sanity. With some many people using analytics any change to metrics calculations can be very disrupting. I completely agree that we need to be forward looking, and we are on many issue, but we also need to maintain user sanity. Don’t worry, this conversation is ongoing.
@Jeffery: I’ll see if I can put together a post of geo-data.
@Ram: If a visitor leaves from Page 3, and there is no event on Page 3, then there is no Time on Page calculation for page 3. But GA will calculate time on site based on when Page 1 loads to when Page 3 loads.
@Subhash: Time calculations are a gateway. They’re a way for people that have no other way to measure engagement, to measure engagement. So if I’m a publisher, or if I’m measuring a support site, I need something to start measuring how people use the site. At the very least, the actionability should be to drive more detailed measurement.
All great comments, thank you.
Hi, thanks for the guide.
how about if i want to track time on a external page to track a video duration?
so, for example, if i do
[‘_setAccount’, ‘UA-xxxxxxx-1’],
[‘_setDomainName’, ‘www.mydomain.com’],
[‘_trackPageview’, ‘/fakePage.html’]
and every minuts :
[‘_setAccount’, ‘UA-xxxxxxx-1],
[‘_setDomainName’, ‘www.mydomain.com’],
[‘_trackEvent’, ‘manualEvent’, ‘timeKeep’]
it will works?
thanks.
@Andrea: Hmmmm. Well, if you are trying to track something on an external page then you need to place the code on the external page. If you can do that, then you can execute a series of event every few minutes or seconds, to track the visitor’s activity. But you need to be able to monitor what’s happening on that external site.
Justin, is it possible to create a javascript that fires a GA event to “fix” the single-page/no engagement hit time on site issue? In some cases, we are only trying to get people to read a page with no interaction. I would like to gauge awareness by determining if visitors are actually consuming the information, or are they a true bounce. Currently, from what you are saying, I am not able to.
@Andrew: Check out my article on Advanced Content tracking. I think it’s what you’re looking for.
Hi Justin,
Regarding Google Analytics Premium Google states Hits processed per month = 1 Billion
When estimating the hits my web site generates the best way will be to sum up all of the below?
– Pageview hits
– Event hits
– Ecommerce transaction hits
– Ecommerce transaction item hits
– User defined hits (this is the predecessor of custom variables)
– Social plugin hits
Could there be other hit counts to worry about?
Is there a better way to do this? Wish there was a total count somewhere to ensure I have the correct total and a way to stop data with say disabling trakcing code with tag manager in certain areas of the site. I want to ensure that I don’t exceed the 1 billion hit limit per month to avoid the extra cost. Will Google send a giga bill once I have 1 billion and one hit for a month? I know there a tiered price levels.
@Maarten: Yes, that’s a good way to estimate hits. The premium team can help you estimate and monitor the number of hits that you send to Google Analytics. I think most people are either well below or well above 1 Billion. I don’t think you’d get in trouble for 1,000,000,001 hits :)
Hi Justin, Great article. I have a question about time a single page. What constitutes an “engagement event” on a single page? I can see what your arrows are pointing to. Is it when a visitor scrolls down the page?
@JP: An engagement event includes pageviews, events and transactions. All of those hit-types will extend the session. The default code will not track scroll or any visitor clicks.
Hope that helps!