How To Setup Google Analytics Event Tracking

In this post, I will show you how to set up goals in Google Analytics and how to set up Google Analytics Event Tracking using the WordPress Events Plugin.

Google Analytics Event Tracking

Google Analytics is one of the best website analytics software out there. If you own a website, you shouldn’t be without it. It can tell you everything that you will want to know about its performance and more!

One of the reasons why Google Analytics is so powerful is due to the fact that it not only shows the basic things like the number of visits, time on site and where your visits come from, but it can help you track your conversions and ROI.

In this article, I will show you how to track conversions on your website through the use of Goals and Event Tracking.

Before we get started, I will assume you already have Universal Analytics setup (the newer and more improved version of Classic Analytics) and have your head around the basics. If you are not yet confident with the basics, please take a read of my other post here, before continuing: Understanding Google Analytics For Beginners.

What Is Google Analytics Event Tracking?

Google Analytics Event Tracking allows you to measure how visitors interact with your website. This is achieved by adding event tracking code to the various elements of your website that you want to track. When a visitor takes an action on those elements, the tracking code is fed back to Google Analytics.

There are 4 variables used in the tracking code:

  • Category (required) – to specify the type of element that was interacted with.
  • Action (required) – the specific action the visitor took to trigger the event.
  • Label (optional) – any additional context about the interaction.
  • Value (optional) – the numerical value of the event.

By default, Google Analytics records events as interactions, which therefore affects your bounce rate. If you want to stop Google Analytics from using the event in bounce rate calculations, you can also add the following additional variable:

  • NonInteraction (optional) – A boolean value that when set to ‘1’ excludes the event from affecting your bounce rate.

The end result is tracking code that should look something like this, which uses the ‘onClick’ JavaScript function for Universal Analytics:

onClick=”ga(‘send’, ‘event’, ‘category’, ‘action’, ‘label’, value, {‘NonInteraction’: 1});”

What Should I Track With Event Tracking?

Knowing what to track will depend upon your website and what you want from it, which will be different for everyone. So, the first step is to take a few minutes to look and think about your website and its purpose?

Are you looking for people to contact you, either using a contact form or a clickable email? Is it to get people to signup to a newsletter or maybe you want people to download an ebook? Whatever it is, take the time to think about the actions that you want people to take, and that matter to you the most.

The types of actions you can track with Google Analytics Event Tracking are:

  • Calls-to-Action (CTA’s)
  • Downloads
  • Sign-ups
  • Form submissions
  • Email addresses
  • Phone calls
  • Outbound links

How Do I Add Event Tracking To My Website?

Once you know what you want to track, you can start adding the tracking code to those elements. This is done by adding the additional code to a link, so when someone clicks on it, Google Analytics will record the click.

Here is an example on how you can use this code to track downloads of a PDF:

<a href=”http://improveposition.co.uk/seo-ebook.pdf” onClick=”ga(‘send’, ‘event’, ‘PDF Downloads’, ‘Click’, ‘SEO Ebook’);”>Download Our SEO Ebook</a>

In this example, I have called the category ‘PDF Downloads’, as I can group all different types of PDF downloads under this one category. The action is ‘Click’ as this is the action the visitor needs to take to download the PDF. I have also given a label of ‘SEO Ebook’ as this is the name of the PDF file, so I can easily see which file this event refers to.

With this event, there is no need for a value and I do want it to be classed as an interaction, so I have left these variables out of the code.

How To Set Up Goals In Google Analytics

Once you have added your tracking code to the elements of your site that you want to track, you need to know how to set up goals in Google Analytics that correspond with your event. A goal is basically a final conversion that you want Google Analytics to show in your reports.

To set up goals in Google Analytics:

  1. Login to Google Analytics and go to the Admin screen
  2. Under the ‘View’ column, click ‘Goals’
  3. Click on the ‘New Goal’ button to add a new goal
  4. Select ‘Custom’ instead of one of the pre-defined templates and click ‘Continue’
  5. Give your goal a name, under ‘Type’ select ‘Event’ and click ‘Continue’
  6. Enter your variables and click ‘Create Goal’

The below screenshot shows how to set up goals in Google Analytics for our PDF download example:

How To Set Up Goals In Google Analytics

The final step is to check that your event is working, as it should. The easiest and quickest way to do this is to go to the reports view and click on ‘Real-Time’ and then ‘Events’. In a new window, open up your website and click your element to trigger the event. Now switch back to Google Analytics and you should see the event appear in the report. Now you know how to set up goals in Google Analytics.

WordPress Events Plugin

For those of you using WordPress, I have a little trick to make implementing events easier and faster, which involves using the WordPress events plugin WP Google Analytics Events.

I use this WordPress events plugin for many of our client websites and found this particularly useful, as some WordPress themes do not allow the use of JavaScript within links when using visual composers. The WordPress events plugin helps get around this issue by using ids and classes to help track both clicks and scrolls on a page.

To see how quick and easy it is to setup the WordPress events plugin, watch their demo video below:

If you are using a plugin for your Google Analytics tracking code, I would also advise checking the settings to see if the plugin is not already recording some kind of events for you. For example, we recommend the Google Analytics For WordPress plugin that has a setting within it that automatically tracks various downloads and links as events.

To see which kind of events may already be tracked on your site, log in to Google Analytics and go to ‘Behaviour’ – ‘Events’ – ‘Overview’. Make sure you select a wide date range to ensure you get a full picture of the data. You can then see which events are being tracked and use this data to setup corresponding goals.

Looking For More Information?

If you want more information on how to set up goals in Google Analytics, Google Analytics event tracking or the WordPress events plugin, do get in touch by leaving your comments below. I would love to hear how you are using Google Analytics event tracking and whether you have your own hints and tips for implementing it.

One area that we have not covered is eCommerce Tracking, which takes things a step further by allowing you to track the physical sales on your site and how visitors are interacting with your checkout. If you have an online store, especially if you are using WooCommerce, make sure you read our post on Google Analytics eCommerce Tracking.

Michael is a successful entrepreneur with a strong background in all areas of web development, online marketing, graphic design and IT. As the current owner of Improve Position, as well as a small range of other related businesses, Michael's enthusiasm shines through with his passion to help others understand and succeed in the world of online business marketing.

Leave Us Your Comments
 

Learn About Us

We are a full service agency that deliver compelling digital marketing solutions. Our winning formula and experience helps to deliver outstanding results across several key business areas.

Request a free quote

We offer professional SEO services that can help your website increase organic search drastically and compete for 1st page rankings of highly competitive keywords.

More from our blog

See all posts