The Ultimate Guide To Google Analytics Event Tracking

The following is a guest post by Future Buzz community member Ed Baxter.

Event tracking in Analytics is awesome! There really is no other word to describe it, so it’s unfortunate when it feels like everyone isn’t making the most out of an amazing resource built directly into Google Analytics. With that in mind, I wanted to share some of the ways that I use event tracking on real projects…

For those who haven’t used event tracking before…

(read on to know the score!)

Event tracking is very simple to set up. It takes just one line of code to fire an event to Google to track something; this could be a PDF download, a video play and so on. The code required to track an event is shown below:

 

As you can see, a typical Event is made up of several simple parts.

  • First we make a push to Google and tell it we are tracking an event.
  • Then we are telling Google the category name; for the contact email link I’ve assigned it to the category of “Contact”.
  • Then we tell Google the action taken. In this example the user has clicked the email link, so I’ve call this “Click Link”.
  • Then we are attaching a label to the event. I’ve set this as “Contact Page Sidebar”. On the real page, it has several links to the contact email address, so by using the label I’ve allowed more detailed tracking in Analytics. This is especially handy for working out which email links are being most effective.

The 4th option hasn’t been included in the example however it allows you indicate the event will not be used in the bounce rate calculation. We’ll come back to this later.

If you are new to event tracking then I’d suggest you check out Google’s official page for it, it has all the information you need to start tracking your events!

Event tracking in the real world

Now we’re all up to speed we can get stuck into the good stuff. Events can be used in all sorts of clever ways to add that additional level of detail. Here are just a few:

Downloads

Downloads to files typically aren’t tracked in Analytics by default. They don’t fire the tracking code and thus don’t show up in your reports. Not ideal! However, you can attach event tracking code to them and start measuring your downloads.

SEOmoz is using events to track outbound links to their Firefox toolbar.

Outbound Links

Ever wondered how much traffic you are referring to various websites? Event tracking on outbound links is a great way to measure this.

Live Help

Many ecommerce sites use live help to aid their customers when making purchases or by answering their questions directly and quickly. Many of these systems don’t natively integrate with Analytics however we can attach a click event to the live help link.

Baskets and Checkouts

Many websites have multiple links to their Checkout page or their Add To Cart page. Event tracking can be used to see where users are actually clicking on the page.

In the image above, event tracking is used to track where visitors are adding products to the cart from. In this case, they are adding from the category page.

Error Reporting

Tracking where users are having issues on your site is highly important if you’re interesting in improving your conversion rate. Let’s consider a typical checkout by a user: they go first to the checkout page, enter all their details, hit the submit button and then get an error on their email address or their post code. By default, Analytics doesn’t track this error; it will show another pageview but nothing more.

By firing an event, we can see what is causing issues when people progress through our forms. Over time we can see areas of the form that are problematic and take steps to correct them.

Video Plays

If you host your own videos then you can also use event tracking to see how often they are being watched.

Get events working with goals

An added bonus to events is that they can be used to create goals. Rather than setting a URL destination or a visit duration you can carefully select what type of events you’d like to track as a goal as shown below…

Use event tracking for the right reasons

Now we’ve looked at a good number of real world uses of events you might notice that it’s possible to get carried away with them. Events are powerful but they aren’t always the right solution to track what you need.

Virtual pageviews, for example, are another fantastic way of tracking data that is usually hidden. You tell Google a specific page has been viewed by using the code below:

<script type=”text/javascript”>_gaq.push(['_trackPageview', '/contact/success/']);</script>

This is very handy if you wanted to track an accordion checkout page which shows multiple sections but doesn’t “leave” the page.

Knowing when to use events or when to use virtual page views is very important if you want to keep your data clean. I recommend checking out this article.

I hope this has provided you with a better understanding of events and where you can use them. Because data is so important, it’s vital that we collect as much of it as possible to see how visitors are using our site and where we can improve.

If you have any other nifty ways of using events then I’d love to hear about them in the comments below.

Ed Baxter is the SEO manager for Ignition Search – a PPC Management & Internet Marketing agency based in Sheffield. In his spare time he’s an avid mountain biker and loves all things to do with the web. Follow Ignition Search on Twitter!