Monday, August 6, 2012

Google Analytics: onMouseDown tracks more events than onClick

Recently I added some Google Analytics event tracking code to some very simple web forms across a number of sub-domains. The forms took just one field, an email address, and I placed the tracking code in the onClick event, as suggested by Google in their online documentation:
<input type="submit" onClick="_gaq.push(['_trackEvent','Subscribe','By Email','Subdomain 1']);" value="Subscribe" />
I then set about testing the forms to make sure they were tracking. Despite submitting each form at least once only 2 events were tracked. I knew that the clicks had occurred as not only was I given on screen confirmation but I received emails to let me know I had subscribed.

This is what GA was telling me for all events across all subdomains:
Despite GA knowing that 42 visits sent events only 21 were actually tracking. Strange.

Then I discovered this interesting article by Joze Uzcategui of Cardinal Path, who did an experiment to determine whether onMouseDown records a different number of events to onClick. Turns out it does.

OnMouseDown records the click as soon as the visitor starts pressing the mouse button, whereas onClick occurs after the button has then been released again. The theory is that today's super-fast browsers allow the page to unload before the onClick event has been registered. (This may be confirmed by the fact that Jose's stats showed a greater discrepancy for Chrome, Safari and Firefox than for IE.)

Jose's results were staggering. Of 235 visits, 205 onMouseDown events were recorded whereas onClick tracked a mere 122. For IE there were 5% more onMouseDown than onClick events tracked. For Firefox, this increased to 36% and for Chrome it was an astounding 84%.

This raises some interesting questions, not least where should I be recommending clients place their tracking code. Clearly it doesn't make sense to place tracking code in both events, unless you are somehow going to distinguish between them, as Jose did in his experiment. But as another reader pointed out, it may be a common and valid action for a visitor to begin to click, then change their mind and move the mouse to another part of the screen before releasing the button. I know I do this. OnMouseDown would register this as an event, when it clearly isn't. However,one could argue that having a few extra events recorded is a small price to pay to prevent so many potentially real events being ignored. Sure, GA has told me that 42 visits sent events but if I know nothing about half of these events, not even which sub-domain they came from, then what use is that to me?

Possible solutions are to:
  • Track both onMouseDown and onClick, making sure to use your labels or categories to differentiate between the two. You would still need to figure out how to use the resulting data though, perhaps taking an average to account for any mouse depress-drags.
  • Add a time delay to all events, similar to the recommended solution for outbound links.This would be imperceptible to the visitor but should delay the event for long enough for GA to track it before the page unloads.
  • Use onMouseDown instead of onClick and accept that there may be some false events recorded. Perhaps perform some user tests to determine the percentage of actions that can be assumed to be depress-drags.

I ran a quick test using IE and in the time it has taken me to write this post the event was showing in GA - this is a record for all the testing I've done across these sites so far. Just to confirm, gobsmacked as I was, I repeated the test on a further 3 sub-domains that had previously failed to track. Sure enough, those events also appeared in GA in record time. So, to be sure I tried the first one again in Chrome. Of course, just to make this a totally moot point that event turned up quick-smart too. I've since submitted 3 more forms from Chrome and 1 from IE; 2 of the Chrome forms haven't yet tracked. Clearly I have a lot more testing to do.

26 comments:

  1. Lindsay,
    I have been struggling with this for a while with several clients for event tracking in Safari and Chrome. Thanks for the suggestions. We haven't had luck with the click delay as Google recommends, but we'll try testing a mouse down event. This has clearly become a much bigger issue over the past 12 months with the growth in popularity of these browsers.

    ReplyDelete
    Replies
    1. Nếu bạn đang muốn đăng tin bán nhà hay bán đất hoặc bạn muốn mua nhà hay đất thì hãy đến với chúng tôi rao vat mien phi, với chất lương hàng đầu chúng tôi sẽ giúp các bạn , đăng tin và xem các khu vực nha dat quan go vap, ban dat quan 9, nha dat quan thu duc , nha dat quan binh tan , nha dat quan tan phu , nha dat quan tan binh và các khu vực khác trên toàn quốc với uy tín và hiệu quả cao khi bạn đến với chúng tôi.

      Delete
  2. Hi Elizabeth,

    Thanks for your comment. I'd be really interested to hear how you get on with using onMouseDown as I'm wondering whether this is the way to go. Please would you post back when you have tried it and have a bit more information?

    Cheers,
    Lindsey

    ReplyDelete
  3. Hi Lindsay,

    I think you've just solved a massive problem for me. I have a few affiliate sites that have gradually shown a deteriorating click-thru rate over the last year or so.

    I've alway wondered why IE users performed just fine while other browsers showed similar diferentials to the ones you found. I'd resigned myself to making trial and error changes to my pages (an awful lot of fruitless work) to try and nail down why other browsers performed so badly.

    Well recently I've seen a huge increase in Safari visitors who have traditionally been the absolute worst performers and it struck me that even if they hated what they saw on my page at least a few out of all those people would accidentally or curiously click something. So ! it suddenly seemed glaringly obvious that something was up with the event tracking for that particular browser.

    As a quick test I loaded windows safari and clicked a few links and waited for them to show in Google Analytics as "external" events. They did not show. So I figured this must be a hot topic among some people but after hours of searching have found very little except a reference to a bit of Google advice to put a time delay on the onclick for certain situations - it was beyond me so I moved on and finally found your post.

    I did a global change to all my onclicks to switch them to onMouseOver and after them testing just fine in safari I've now posted them on the net. I agree with you - I'd much sooner have to allow the odd "nearly click" than have no idea whats going on. I think its likely that my only reliable click thru stat has been IE for the last year or two. I am therefore now thinking that my declining click-thru performance probably matches the increase of visitors using other browsers especially safari.

    Of course there could be other issues but at least now I can stop chasing wild geese and find them.

    Thanks for being so clever and sharing this. If I find any problems I'll be sure to come back and let you know but aside from the "nearly click" issue which I would expect to be insignificant in my traffic I can't think of any potential trouble in using onMouseOver.

    very many cheers
    Phil

    PS - I always did see the odd safari click event now and then so it never occurred to me to check the tracking until the recent high numbers mad things more obvious. I wonder if the general increase in broadband has increased the chances of an onclick for an external link from being registered ???





    ReplyDelete
  4. oops - glaring error in my comment above. I did in fact use onMouseDown and not onMouseOver :s

    Phil

    ReplyDelete
  5. Hi Phil,

    Thanks for your comment. It's really interesting to see that you have actually seen this in practice and I appreciate you taking the time to tell me about it. I think a move to onMouseDown might be the way forward for me too. I'll be interested to hear if you do have any issues - but hopefully not. It would be nice to have a satisfactory solution.

    Cheers,
    Lindsey.

    ReplyDelete
  6. Well google analytic has really different now days.

    ReplyDelete
  7. It's important that you keep your overall business and web site goals in mind in order to ensure that the analytics solution you choose actually addresses these goals.call center dashboards

    ReplyDelete
  8. I'd be trampled if all sites gave articles like these awesome articles.
    LinkedIn PowerConnector

    ReplyDelete
  9. Nice answers in replace of the question with real point of view and explaining about that.
    Wikipedia’s traffic

    ReplyDelete
  10. Poker online baru kembali lagi 9 dekade, ke tahun 1998 setelah judul game pertama kali tiba di web. Namun demikian, tengara yang sebenarnya karena sejarah poker yang sebenarnya adalah tahun 2002. Per tahun kalender
    asikqq
    dewaqq
    sumoqq
    interqq
    hobiqq
    rajawaliqq
    pencetpoker
    qqonlinebet
    paito warna oregon 03
    paito warna oregon 12

    ReplyDelete
  11. If you are new user to sage 50 accounting software and looking for the sage 50 technical support.If yes than you have come to right place as we provide efficient technical support service to customers who show complete faith in us. With our efficient and highly qualified team ,we never disappoint our customers.You can reach us at 1800-910-4754 at any hour of the day. You can also visit our website at https://www.geekaccounting247.com/ for the complete knowledge of the sage products and services.

    The Services we offered are following-
    Sage 50 Technical Support Number
    Sage 100 Technical Support Number
    Sage 50 live chat
    Sage 50 Technical Support phone Number
    Sage 50 customer service number
    Sage 50 payroll support number

    ReplyDelete
  12. If you really desire to get such type of information, visit this blog quickly.
    web design deliverables

    ReplyDelete
  13. I am another customer of this site so here I saw various articles and posts posted by this site,I curious more energy for some of them trust you will give more information further.https://360digitmg.com/course/certification-program-in-data-science

    ReplyDelete
  14. Great post!! It's good to share this kind of articles and I hope you'll share an article about Data Science. By giving an institute like 360DigiTMG.it is one of the best institutes for certified courses.
    data science course in noida

    ReplyDelete
  15. Hello there to everyone, here everybody is sharing such information, so it's fussy to see this webpage, and I used to visit this blog day by day
    hrdf training course

    ReplyDelete
  16. Two full endorsement for this magnificent article of yours. I've genuinely refreshing scrutinizing this article today and I figure this might be uncommon contrasted with other articles that I've examined now. On the off chance that it's not all that much difficulty prop this work up on in a comparable quality.
    PMP

    ReplyDelete
  17. I was looking at a portion of your posts on this site and I consider this site is really enlightening! Keep setting up..
    https://360digitmg.com/course/certification-program-on-big-data-with-hadoop-spark

    ReplyDelete
  18. This is a great post; it was very edifying. I look ahead in reading more of your work.
    UX design agency

    ReplyDelete
  19. I read your blogs regularly. Your humoristic way is amusing, continue the good work!
    lead conversion system Daven Micheals

    ReplyDelete
  20. I'm glad to see the extensive unpretentious component here!.
    what is hrdf claimable

    ReplyDelete
  21. The information you have posted is important. The objections you have insinuated was worthy. Thankful for sharing.
    digital marketing courses in malaysia

    ReplyDelete
  22. Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post.
    digital marketing training institutes in hyderabad

    ReplyDelete