Tableau Consultant @ The Information Lab.... this is my personal blog.

Tim Ngwena

Home / Blog / ui

Tracking user interaction with Google Analytics. updated

Have you ever wanted to know how many people hover over a certain button but don't actually click it? or maybe you want to know how many people start filling in your form and and give up half way? or maybe you run an e-commerce or fundraising site where conversion rate optimisation could be improved, with more granular data about what people are doing when they look at your page? if so keep reading.

The challenge

Whilst building this site, I came across a small challenge. How do I track what pages users look at when everything other than the blog and portfolio items are one page. To clarify, when you click 'Home', 'Work' etc, a piece of code (javascript) wakes up and nicely moves the page down to save you scrolling down the one page design. For the code junkies out there I'm using Scrollit.js to do this and my code for page navigation looks like the image below, there's no href element that defines a link.

Enter 'event tracking'

This is where the Google Analytics' Event Tracking feature comes in. With some small modifications to the html and some labels as defined in the support document you can track events such as mouse actions e.g. clicks and hovers, keyboard strokes, form field entries and many more. I'm not often a fan of Google documentation but on this topic it's really good, check it out here to see what you can do. Granted it does require someone who knows what they are doing with basic html, preferably with javascript experience and a good knowledge of the CMS or environment the site runs under, but there are also plenty of tutorials out there that guide you through it.

My solution

Put simply, I implemented some click event tracking and some labels so that when Google analytics gets the data through, it's clear which buttons are being clicked and what actions are being taken.


The results

This all means that in google analytics, I get the following statistics about clicks on each of the menu items. 

Don't forget you can setup multiple events and tracking options on one page to build a richer picture of what's going. Now over to you, I'd love to know what you might use this for or if you already do, how's it working for you. As with everything on Google analytics, you have to allow for a small margin of error and the occasional quirk so don't take the stats as 100% fact but it will help guide your decision making.  Let me know your thoughts. 

Update 

Since this post was published, Google has launched new features and update the platform to include easier ways of tracking interactions. Head to the Google Blog to find out more