Why use event tracking in Google Analytics?

Event tracking in Google Analytics is one of the most useful features but is used by very few companies as it is not set up “out of the box”. Those companies that aren’t using it should be. Event tracking is completely customisable and very powerful, and when combined with some JavaScript knowledge it is infinitely expandable to allow you to track almost any interaction on your site.

The data you capture and the way in which it appears within Google Analytics is completely customisable by you, making it very flexible and adaptive to your specific implementation requirements.

Event Tracking works through passing four variables to Google Analytics:

Category, Action, Label and Value

There is a fifth, optional field that specifies whether this interaction should be considered in bounce rate calculations.

Basic syntax for event tracking

In it’s simplest form, the code is structured like this:

_trackEvent(category, action, opt_label, opt_value, opt_noninteraction)

Each element is then replaced with the data you want to capture, only the category and action are required by Google Analytics, however, the optional fields should be used in 99% of implementations to provide data that may lead to additional insights. This can be static data or can be variables defined within other JavaScript on your page.

This post is just a download of ideas I’ve had for interesting/useful things to track with event tracking in Google Analytics.

 Form tracking with Google Analytics:

I could (and most likely will soon) write a separate blog post just on form tracking. It’s one thing that “out of the box” Google Analytics has always lacked in. Fortunately there is some event tracking you could  consider to help deliver insight on form performance.

Form field drop out

Simple enough, firing an event when somebody enters or exits a form field will produce a funnel showing drop off. Taking this one step further and making it more accurate, you should be looking to write a function that checks if the user has entered anything into the form field before firing the event, so we know they haven’t just clicked through them all.

Validation error tracking

Building in event tracking to your validation engine will provide a quick way to find form fields that users are struggling with – fire an event that tells you it’s a validation error and captures form name, and form field name.

Time to complete fields

By starting a JavaScript timer when a user clicks into a form field and firing an event when they exit the form field that captures the timer’s current value we can measure the time spent in each form field.

Measuring Engagement in Google Analytics:

Google Analytics has always provided some very top-level engagement metrics; Bounce rate, pages/visit, time on page etc. being the main ones. But, while these might be good indicators of engagement, it’s difficult to draw any tangible insight without more data. These event tracks look at how we could go about delivering some more meaningful insightinto user engagement on our site.

Accurate time on page:

Time on page has always been  a metric that clients want to hear about. But what they fail to grasp in 99% of cases is that this actually only tells you the time from the visitor loading Page A to their next analytics page view request, Eg. loading Page B. ie. it takes the time stamp when you load page A and subtracts that from the time stamp when you load page B. So actually if a user hits our site, lands on our page and reads all the content on there, spending a long time then exits the site we have no idea how long they spent on the page. They would also be a bounce, which is a completely separate debate on when we stop considering a user to have bounced just because they only hit one page.

To improve the accuracy of our time on page, we could set up some time-based event tracking. Create a function that fires an event to Google Analytics every 5 seconds (or more or less but be wary of the 10 million hits/month limit) and enter 5 as the event value. This tells us how long each visitor was on the page to the nearest 5 seconds. We then add up the total event value for that page and divide by number of pageviews to give time on page in seconds irrelevant of what the user does next.

Scroll reach

A long standing principle of web layout has been placing the important content above the fold. But, users these days are getting used to scrolling down pages, and actually now a more engaging experience can be delivered through long-scroll pages, such as parallax design. Toyota have a slick example of this on their new Auris page.

Clearly if you are going to create pages like this then you need to consider how to measure engagement with them. Users might be landing on your page and scrolling down all the content and engaging heavily with it but then leaving and because it is a single page visit it will still count as a bounce. So then there is the question of when to consider this user to no longer be a bounce and whether we consider this page to be a number of sub-pages. Where the user scrolls through different content sections we could fire a virtual page-view on each section or we could fire an event capturing that page section.

On top of this, we could fire events as the user scrolls a certain amount through the page, Eg. fire an event at 0%, 10%, 20% scroll etc. This would give a funnel showing drop off as users scroll down the page.

Expandable/tabbed content

This one is something that should be taken on a case by case basis as to whether you use virtual page-views or event tracking in Google Analytics. Once this is decided, it is a relatively simple job to set up events or virtual page-view to track clicks on tabbed or expandable content.


Many sites consider the number of downloads of product brochures or leaflets etc. to be a KPI. Again, there is a decision to be made as to whether to use virtual page-views, event tracking or even Ecommerce tracking. And again, once decided it is relatively straight forward to set this up.

However, for a large site with multiple downloads, it may be time consuming to apply tracking code to every download. A simpler way that I have used before would be to create a JavaScript function that automatically applies the tracking code to any linked file ending in the appropriate doc type, EG, applied to all linked files ending in .pdf, .xls, .xlsx etc.

External links clicked

Because Google Analytics cannot track visitors when they go off your site, it is best to at least understand where they are going if they are leaving through links on your site. This does of course require tagging all outbound links from your site with Event tracks, however, I have done this using a JavaScript function to automatically add an onClick event track to all outbound links.


This is by no means an exhaustive list of things you should be tracking using event tracking in Google Analytics, but it is certainly a starting point. There are many other areas to consider, such as click to call or click to email links, tracking the value of quotes generated when you don’t want to use E-commerce tracking and many others.


Event tracking in Google Analytics
Tagged on:         

One thought on “Event tracking in Google Analytics

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>