Forum Moderators: DixonJones

Message Too Old, No Replies

Google Analytics Bug(s), Time On Page grossly Inaccurate

I describe a pretty good workaround for this Analytic's bug.

         

bumpski

11:51 am on Jul 25, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Google Analytics Bug(s), Time On Page grossly Inaccurate

I describe a pretty good workaround for this Analytic's bug. You do need some javascript coding experience. I've only tried this for a few days but am pleased to finally see accurate "time on page" data for "bounce" pages (much longer times). I hope someone will find this intriguing enough to experiment and improve on it. If only Analytics provided a trackPageExit function none of this would be required. If Google doesn't provide a fix in Univeral Analytics I think this trick will still work, but I wanted to test in a known, stable, environment. I also noted during this investigation that analytics is not handling thumbnails well, thumbnails that open in the same window, but a quick fix is to open thumbnails in another tab, a compromise.

For any page Google Analytics calls a "bounce", the time on page indicated is completely inaccurate.
This make sites that have the highest quality pages appear to have poor time on site and very high bounce rates. A visitor could sit on a landing page for two minutes (or hours) and "back out" and this is still called a bounce by Analytics; sorry it's not a bounce if you use Google's definition.
[support.google.com ]
Bounce Rate is the percentage of single-page sessions (i.e. sessions in which the person left your site from the entrance page without interacting with the page).
"Interacting with the page" is the key, Analytic's definition is farcical, the only default interaction is clicking on another page, an ad, or leaving the site. I find this misrepresentation very annoying.

Using analytic events you can correct the bounce rate, but the "time on page" data is still completely wrong.
I've found a workaround that appears to accurately report the time on page for a bounced page. The workaround does not appear to affect other Analytics statistics other than correcting them.
In implementing my workaround I've also decided my definition of a "bounce" is:
1. less than 15 seconds on a page
2. and no user scrolling
If the user scrolls or views the page for more than fifteen seconds Analytics will no longer report a bounce. You can achieve this today with events, BUT, you still will not see an accurate "time on page". (Note: A page loading produces a scroll event, you must ignore this one event if your goal is to detect "user scrolling".)

The time on page correction trick
It is very simple, if you know your visitor is truly exiting the SITE, call this code:
_gaq.push(['_trackPageview','/dummy/']);
AND, set up a subdirectory filter in Google Analytics for the "/dummy/" subdirectory.
Go to Admin, Filters, Filter Name: "TimeOnPageFix", Exclude, "traffic to subdirectories", "that are equal to", "/dummy/"
Now analytics will think it's seen the second page it needs, so desperately, to time the first page, and, pushing a trackPageview to a subdirectory that is filtered does not affect your analytics results. But the "time on page" data will now be correct (see Quirks). I have tested these revised "time on page" statistics to a limited extent and they appear to accurately reflect the true visitors "time on page".
Typically one can use the onbeforeunload event, set a flag in some code that tests whether a clicked link is staying on site or exiting the site. If the outbound link is staying on site (internal) do nothing in the onbeforeunload event, but if the link is exiting the site, then do the trick, _gaq.push(['_trackPageview','/dummy/']). I put a for loop after this to hold onto the CPU for a while to let the analytics code complete its transmission; this may not be necessary. Another possibility is using onunload after onbeforeonload, or settimeout, to delay exit, but debugging this kind of code is problematic because the browser is exiting the page! Also, full cross browser support is difficult for the onbeforeunload event.
At one point during this experiment I had code that was periodically sending an activity event when a visitor had a page open in their browser. In this case I saw times on pages of hours, obviously the visitor, was working with other tabs. I also have a few pages that visitors do truly spend hours using, in one session, and in those cases the javascript on the page is sending analytics "activity events" periodically.

The Quirks
There's always a quirk when you try to do this kind of hack (actually the quirk was there already!). For the "time on page" to be accurately reported for a given page's statistics, one of your many visitors must click on a second page, what? Analytics seems to slam a zero time for a page view whenever the exit statistic is 100%, but after the page is viewed 5 or 10 or 20 times one of your visitors will likely click on a second page. So really you'll have to look at several days analytics results to see all the "time on pages" for your bounced pages.
I have some bounce pages that visitors truly use for hours, until I implemented this change the "time on page" would be reported as zero! For many of my more interesting pages the "time on page" reported has tripled or quadrupled.
I'm not sure about the user flow diagram it appears to work but I need to collect a lot more data.

Results
Comparing a few recent days data to the data in the previous month yields virtually no changes in sessions or page views recorded, BUT, the "Avg. Time on Page" has risen from 2 minutes to 11 minutes, see how important those "bounce" pages are? And this is without forcing 100% Exits to less than 100%. For pages which I know from feedback, pages which visitors must study to use, times on page have gone from a minute or two to 30 minutes, which is Analytics default maximum time of a session.
One page that had many pageviews (sessions), seesion that all were reported as Exits (100% exit) as soon as one visits that page and then clicks on another page on the site, the reported time on page jumps from 0 ZERO, to 52 minutes! And I know the content of this page will make a visitor stay for long periods of time. (This is something you can fix just by forcing a none exit event, forcing 100% Exits to be less than 100%)
Another truly interesting stat is, over a period of days, there might be 1300 Pageviews, with 9650 scroll occurrences/events. This is not a count of javascript scroll events, but a count of the many times the user chose to scroll on various pages, again clearly indicating that when Analytics was reporting a minute or two on a page the data was wholly inaccurate.
I hope to discuss this from another perspective in the Google SEO thread.

bumpski

1:44 am on Jul 26, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Moderators please remove my previous post regarding Google Analytics

bumpski

8:51 am on Sep 28, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So after running with this mod in place average time on page on one site has gone from 2 minutes 15 seconds, to 8 minutes 45 seconds, far more realistic data.

ogletree

1:32 pm on Oct 15, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



When I get some time I'm going to try this. Have you made any changes to how you are doing this?

bumpski

8:06 pm on Oct 20, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Ogletree

I have been running this pretty much unchanged since the post and am happy with the results. Time on page has increased drastically although "session" time is still very low. I still haven't played with "upgrading" to Universal Analytics.

I hope to discuss this from another perspective in the Google SEO thread.


Unfortunately Webmasterworld felt my other post trying to warn webmasters of this shortcoming and how it could drastically affect their SEO descisions was deemed inappropriate for the "Google SEO" forum topic. Since Google SEO is a pre-moderated forum the post was obviously approved by a moderator and then "pulled". Here is a link to the relocated post now in the Analytics forum.
[webmasterworld.com...]

lucy24

9:03 pm on Oct 20, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This isn't specific to GA, is it? Any javascript-based analytics should be able to do something similar.

So really you'll have to look at several days analytics results to see all the "time on pages" for your bounced pages.

time-on-page / (1 - bouncerate)
= approximate average time on page. (For some reason I find it easier to estimate this casually in my head than to remember which buttons to push on the calculator.) But it isn't only bounces; any page with a high exit rate will skew your figures for that final page. There's something to be said for the Facebook method of throwing in an extraneous "leaving this site" page, since you can simply ignore that page in analytics while using the information it gave you about the immediately preceding page.

bumpski

6:19 pm on Oct 29, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This isn't specific to GA, is it? Any javascript-based analytics should be able to do something similar.

Lucy24:

Actually, in this case, I think the limitations I'm identifying are specific to GA.

With GA, a site could have 100,000 visits to a page with each visitor staying 10 minutes and GA will report zero time on page for all 100,000 visits. If one manually visits that page with their browser and then clicks to another page on that site, then and only then will Google analytics report a non-zero average time on page. (The time is still inaccurate but at least it isn't zero!)

Yes any reasonable javascript coder could do a better job, I don't know why Google doesn't fix this. Of course for many sites it would drastically affect their data, making historical data questionable to use.

I may have explained this better in the thread I did post in Google SEO (now moved to google analytics).
[webmasterworld.com...]

I did play around with using another dummy page versus a dummy subdirectory for the "trick" I mention, but the GA results were too corrupted, sorry, I forget the details of this short experiment.

Facebooks exit page (not familiar) may well help with this problem, but I'm not sure how they would filter it from the results.

MHoffmanAXE

6:30 pm on Jan 27, 2015 (gmt 0)

10+ Year Member



Sorry - I know this is a super old post, but I found it googling for a similar solution. Anyway, the question I pose is this...

...By "adding" a page to the end of every user visit (in order to be able to calculate the ACTUAL last page of the visit), doesn't that screw up the Exit Rate on pages as well as the site? Because now, all the pages that would have been exits are going to be the pages right BEFORE the exit (with the Exit page being the fake virtual pageview)?

Am I correct in thinking this way, or no? Thanks!

bumpski

12:30 am on Jan 29, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



MHoffmanAXE

It is an incredible coincidence that I looked at this thread a day after your post.
It is very simple, if you know your visitor is truly exiting the SITE, call this code:
_gaq.push(['_trackPageview','/dummy/']);
AND, set up a subdirectory filter in Google Analytics for the "/dummy/" subdirectory.
Go to Admin, Filters, Filter Name: "TimeOnPageFix", Exclude, "traffic to subdirectories", "that are equal to", "/dummy/"
Now analytics will think it's seen the second page it needs, so desperately, to time the first page, and, pushing a trackPageview to a subdirectory that is filtered does not affect your analytics results. But the "time on page" data will now be correct (see Quirks).


I'm far from sure on this but analytics, even with this change (enhancement), is highly biased toward calling pages "exits", and in doing so ignores all statistics regarding many visits to the page in question.

MHoffmanAXE

2:17 pm on Jan 29, 2015 (gmt 0)

10+ Year Member



I'm sorry, but I may not be clear on your reply. So, you are saying that GA will recognize the filtered-out VPV enough to use it as a "Time on Page" calculation, but it WON'T recognize the filtered-out VPV enough to use it as an "Exit Page" calculation? Is that correct?

MHoffmanAXE

10:18 pm on Jan 30, 2015 (gmt 0)

10+ Year Member



Unless I've done something wrong, I think I have definitively proven this to not work. Please let me know where I have gone wrong in my testing, if so:

  1. I set up two profiles: One filtered out my home IP, and the other filtered out my home IP as well as the VPV (Virtual PageView) directory. This gave me two profiles to test on which would isolate the traffic as only being my testing.

  2. I navigated to kind of an oddball page of our site, and I sat there for a couple minutes. Then I exited my session (in this case, I clicked an outbound link).

  3. In the profile that did NOT filter out the VPV directory, I saw the hit to my "real" final page with a Time on Page of 02:49 and an Exit Rate of 0%. I also saw the hit to the VPV with an Exit Rate of 100%. While the Time on Page metric is what we'd be shooting for, the VPV definitely will mess with the Exit Rate. See more in #4 below.

  4. In the profile that DID filter out the VPV directory, I did not see any hit to the VPV directory. This was expected and good. While I did see the hit to my "real" final page, it had a time of 00:00 and an Exit Rate of 100%. In this case, we have the opposite problem from #3 above...the Time on Page is off, but now the Exit Rate is correct.

So, it seems (again, unless I am doing something wrong) that there is no catch-all solution to this problem. Bummer. :-/

lucy24

10:42 pm on Jan 30, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



:: continuing in time machine ::

I think the limitations I'm identifying are specific to GA.

In fact I see exactly the same thing in Piwik, which is why it seemed universal. Time-on-page isn't measured correctly unless there's a subsequent page to provide follow-up information. For some reason, the act of leaving/closing a page doesn't create a new timestamp, even though it's a perfectly straightforward event in its own right ("onunload" for example).

chewy

9:51 pm on May 17, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Seem to be some pretty good tools here that might help answer the questions asked - i'm just starting to explore Riveted

[riveted.parsnip.io...]

Anyone every try this one out?