Getting better results from your website starts with collecting the right data and understanding how to extract insights from it. Before you can improve performance, you need to know what users are getting up to on your website and measure how this aligns with your marketing objectives. Event tracking is one of the more advanced Google Analytics features that allows you to track specific user actions on your website – down to the very elements they’re clicking on. With these data insights, you can measure how effectively key parts of your page are performing and diagnose issues with more precision.
Here’s what you need to know about event tracking in Google Analytics.
Event tracking is a Google Analytics tool that can be used to measure user actions on your website. More specifically, it allows you to track every time a user clicks on a specific element; a link, a buy button, the play button on your video, etc. Or, you can also use event tracking to measure how far a user scrolls down the page, to understand how they’re engaging with your content.
This means you can track just about every action people are taking on your website, measure performance against highly-specific metrics and KPIs (e.g. video views, PDF downloads, etc) and test new variations against the data that matters most.
Essentially, event tracking takes off the blindfold and allows you to see what users are really doing on your site.
This code snippet allows you to track user behaviour based on the URLs they visit on your site.
Of course, you can do basic tracking with the regular Google Analytics tracking code (above), but this limits you to events defined by a new URL. This is fine when the actions you want to track direct users to a new page (e.g. an email subscription “thank you” page), and it’s a great way to track how users are progressing through your sales funnel.
However, there are several important actions you want to measure that don’t send users to a new page – and this is where event tracking comes in. For one thing, a lot of form designs don’t send users to a new page, bypassing the redirect function so as not to interrupt the user experience.
No URL means you can’t track this action with the regular Google Analytics tracking code; you need to use event tracking instead.
You can pretty much use event tracking to measure any user action that involves a click. Just because you can track something, it doesn’t mean you should, though. First, you need to pinpoint the user actions that actually contribute to your marketing objectives and put a list together, so you don’t get distracted by actions that don’t matter.
Here are some examples of the kind of actions you can track with event tracking:
Let’s say you’ve just produced a new video for one of your landing pages and you want to know it’s making a positive impact. Sure, you can simply embed your video and measure conversion rates to see if it’s turning more traffic into leads but this doesn’t give you enough data to really optimise for performance.
For example, what if conversion rates stay the same? Does this mean your expensive new video is a flop?
The first thing you want to know is how many users are actually clicking to watch the video to begin with. Because, if people aren’t even seeing your video, it’s not getting a chance to make the kind of impression you were hoping.
You can measure this with event tracking to see how many users are hitting the play button and create a custom viewer rate metric (or whatever you want to call it) in Google Analytics. If your viewer rate is low, then you know you need to start by increasing the number of users who watch it.
So you’re going to want to optimise your landing page to maximise viewer rates and see what kind of impact this has upon conversions. Which means you’ll want to look at things like placement, the copy around/before your video and any performance issues (e.g. loading times) that could be preventing people from watching. You may even want to test this optimised version of your landing page against the original to compare results.
Without event tracking, it would be impossible to understand why conversions haven’t increased.
There are two ways to set up event tracking in Google Analytics – you can either manually code it yourself or use Google Tag Manager for a code-free approach. Before you get started with event tracking, though, you’ll need to have your site connected to Google Analytics and you’ll want to be familiar with the regular Google Analytics tracking code.
If you haven’t already connected your site to Google Analytics, you can find out how to do it over at Analytics Help.
If you’re going to set up event tracking manually, then you’re going to have to add some extra code to the elements you want to collect data from. The code you’re going to work with will look something like this:
ga(‘send’, ‘event’, [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
There are four components within that code snippet that you’re going to need to define yourself: eventCategory, eventAction, eventLabel and eventValue. These are simply passed through to Google Analytics so you can differentiate between each action.
As you can see, two of these are required (category and action) while label and value are optional. It all depends on the kind of information you want relayed back to Google Analytics when a user clicks on the defined element.
It will be much easier to define these components if you analyse your website and decide which elements/actions you want to track.
So your final HTML code for one of your PDF download buttons may look like this:
<button onclick=”ga(‘send’, ‘event’, [download], [PDF], [event_tracking_guide], , [fieldsObject]);”>Example Button Text</button>
In this example, you’ve created an event for when users download your PDF guide on event tracking, placed it within the “download” category and assigned it a value of 25. As we say, planning ahead will help you define your categories and keep things tidy but setting up event tracking manually is pretty simple with some very basic HTML skills.
Once your code is in place, your tracking data will appear under Behaviour > Events in the left column in Google Analytics.
If you’re not interested in setting things up at the code level or you have a particularly complex site to work with, you might prefer to set up event tracking with Google Tag Manager instead.
You’ll need to create an account before you can get started, but all you need to do is fill out your details and agree to the T&Cs – it doesn’t take more than a few seconds.
Once your account is set up, you’ll see this dashboard:
Before you can create your first tag, you’ll need to enable the built-in click variables in Google Tag Manager. To do this, click the Variables tab in the left-hand column and then click on the red Configure button, which will bring up a checklist on the right.
Now, scroll down to the Click section of the list and check all of the items (these are all unchecked by default).
Next, you want to go back to the main dashboard, select Tags from the left-hand menu and click New on the next screen. To create your first tag, you need to start by naming your tag in the top field of the screen below and then choosing your tag type and trigger.
Once you’ve named your tag, click on the first box to choose your tag type and then select Google Analytics – Universal Analytics from the menu that pops up to the right.
Now, you’ll be asked to define the Track Type and Google Analytics setting and you’ll want to select Event from the drop-down menu that appears when you click on Track Type.
This will bring up the same event tracking components we looked at earlier, which you’ll need to fill out.
Once you’ve defined these, you can move down to the second box and choose the trigger that will fire your tag. Click on the box and then hit the + symbol to the far right of the next pop-up screen.
On the next screen, you’ll also have a field for naming your trigger and, if you click on the Trigger Configuration box, you’ll see a list of the different triggers you can select.
In this case, we want to select Click – Just Links and then select the Some Link Clicks option below. Then you’ll set the trigger to only fire when an element is clicked with a URL that contains the .pdf file extension.
Once that’s done, you can hit the Save button and your new tag should be showing in the Tags section in Google Tags Manager.
If you’re not already using event tracking in Google Analytics to improve the performance of your website, you should be. While the regular tracking code will help you optimise your sales funnels, there’s only so much you can do by tracking user behaviour via URLs and event tracking opens up a whole new wealth of data that allows you to optimise for specific user actions.
This is an essential tool for conversion rate optimisation, so follow the steps in this article and reach out to us if you have any problems.
Stu is Head of CRO at Vertical Leap.
We send a semi-regular newsletter on business and other related topics, with links to the latest stories from us and what we’re reading around the web.
Categories: Data & Analytics, SEO