Can't find what you are looking for?

Email us at info@vertical-leap.uk or call us on 023 9283 0281. Alternatively, fill out the form on our contact us page.

Upwards trending arrow image to illustrate blog on using event tracking

How to use event tracking to significantly improve your website

Categories: Data & analytics, PPC, SEO

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.

What is event tracking in Google Analytics?

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.

Google Analytics code snippet

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.

What else can you use event tracking for?

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:

  • Lightbox conversions: Conversions that don’t redirect users to another page.
  • Digital downloads: Measure the number of users who download your PDFs and other digital downloads.
  • Video content: Track how many users click the play button, hit pause and how long they watch your video for.
  • Outbound links: See when users are clicking through external pages.
  • Affiliate links: Measure how effective your affiliate marketing strategy is.
  • Web forms: Monitor form abandon rates, field errors and other form optimisation issues.
  • Click-to-call numbers: Measure how effectively you’re generating enquiries from mobile users.
  • Scrolling: You can also track how far users scroll down the page to understand how much of your content they’re viewing and whether they’re seeing key elements – e.g. CTAs.

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.

How to set up event tracking in Google Analytics

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.

1. Setting up event tracking manually

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.

Four components of the Google Analytics code snippet

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.

  • eventCategory: This is an overall group of events, which will include multiple actions within the same category – eg: download, video, form, CTA etc.
  • eventAction: The specific action for each event within its category – eg: PDF for downloads, play for video, submit for forms, click for CTAs.
  • eventLabel: A label which you can use to add more information – for example, if you have multiple PDF downloads, you can label them individually to identify them.
  • eventValue: Allows you to set a numerical value to the action to differentiate the importance of individual actions.

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], [25], [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.

Where to find the Events menu in Google Analytics under Behaviour > Events

However, in order to track things like outbound links (links to other websites), PDF files, links that open up your Email program, video player interactions, or anything that isn’t the traditional page view, a JavaScript “onClick” function using the Google Analytics event tracking schema is often used to accomplish the task that the Google Analytics tracking code can’t.

2. Setting up event tracking with Google Tag Manager

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:

Google Tag Manager screenshot

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.

The Variables screen in Google Tag Manager

Now, scroll down to the Click section of the list and check all of the items (these are all unchecked by default).

Click options in Google Tag Manager

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.

Tag Configuration for event tracking n Google Tag Manager

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.

Choose tag type in Google Tag Manager

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.

Define the Event track type in Google Analytics

This will bring up the same event tracking components we looked at earlier, which you’ll need to fill out.

Configuring the Google Analytics tag type

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.

Trigger screenshot in Google Tag Manager

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.

Choose trigger type in Google Tag Manager

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.

Configure Trigger type

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.

Stuart has been a part of the Vertical Leap family since 2010 and enjoys helping people with great ideas find their audience, using organic SEO. Outside of his obsessions with organic SEO, data visualisation and spreadsheets, his favourite away-from-work activities include lazing on beaches, country walks and – most importantly – country pubs.

More articles from
Back to top