Event Tracking in Google Analytics

event tracking in google analytics

Event tracking is a method in Google Analytics that allows you to track user interactions which would have not normally been tracked by Google’s default tracking code. Adding a an additional piece of code to your website will allow you to track everything thing from clicks on your social buttons, form completions to how many people watched a video embedded on the site. This blog post will give you the basics so you can get to grips with tracking events on your own site along with examples

Anatomy of Event Tracking Code

_gaq.push([‘_trackEvent’, ‘Category’, ‘Action’, ‘Label’, ‘Value’]);

You can set up event tracking in GA by calling the _trackEvent() method each time the event you want to track occurs. This method is used to record/track an event.

 Category – It is the name given to group of similar events which you want to track. For e.g. ‘videos

Action – Name given for the action taken during the event e.g. ‘play’, ‘stop’, ‘pause’, ‘share’ etc.

Label (Optional) – additional information about the webpage element you want to track like the name of the downloadable pdf

Value (Optional) – This field is optional and It is the numerical value assigned to the event you want to track. For e.g. monetary value of that event

How it works

Let’s say you are looking to track how many people downloaded the whitepaper on your site.

If you were not using event tracking you would set your download link a bit like this

<a href="http://www.example.com/downloads/whitepaper.pdf">Download the whitepaper here </a>

However, if you want to track the event in GA you need to add some extra code

<a href="http://www.example.com/downloads/whitepaper.pdf" onClick="_gaq.push(['_trackEvent', 'PDF', 'Download', 'Whitepaper Name']);">Download the whitepaper here </a>

Now you can check in Google Analytics the number of times this event is triggered so you can monitor how efficient it is.

Where to look for the results

You can find Event Tracking results under the Content tab in your analytics sidebar. Here, you can navigate to the drop down menu titled “Events” where you can see the sections as shown below.

event tracking

What Can You Track?

With event tracking enabled you can track

a) Downloads

b) Outbound Links

c) Add To Basket / Checkouts (eCommerce sites)

d) Form Completions

e) Error reporting

f) Video tracking – plays, pauses etc

There will be seperate blog posts in the future outlining best practices in tracking these individual events.

Get Clever with Event Tracking

Data is important. You can use it to make important decisions. I hope this article acts as a good starter guide to setting up your own events within your Google Analytics account.