Attend our live Virtual Classroom courses from a location of your choice.
Everything you'd expect from face to face training.
Virtual classrooms
Attend our live Virtual Classroom courses from a location of your choice.
Everything you'd expect from face to face training.
Virtual classrooms
How To Set Up Google Analytics Event Tracking

How to set Up Google Analytics event tracking

Event tracking is used to measure anything on a website where a user is not necessarily moving to a new page. It helps you understand how people interact with your website - this could be watching a video, downloading something, or even just scrolling down on a page.

In this guide, we’ll explain what Google Analytics event tracking is, how it works, and how you can use it on your website.

What types of events does Google Analytics track?

Common examples of events that can be tracked in Google Analytics include:

video icon

Video plays

download icon

Downloads

call tracking icon

Call tracking

(when a user phones you up direct from your website)

scroll icon

Scroll depths

flash icon

Flash elements

ajax icon

AJAX embedded elements

interactive icon

Any other interactive gadgets

more icon

And much more

Without event tracking set up, Google Analytics can only track page views rather than these on-page interactions.

How does Google Analytics event tracking work?

Event tracking works because of a syntax code that is sent to Google Analytics when triggered. This is either manually created with a customised code, or automatically formed by Google Tag Manager.

An event in Google Analytics is made up of:

Event Category – The name you supply for the group of objects you want to track (e.g. Downloads).

Event Action – The name given to the type of event you want to track for a particular web page element. This is uniquely paired with each category, and commonly used to define the type of user interaction for the web object (e.g. Click).

Event Label (optional) – The name given to the web page element you want to track. This is a string that provides additional dimensions to the event data (e.g. PDF).

Event Value (optional) – This is a numerical value you can assign to the event you want to track. This could be a numerical value (i.e. every new subscriber is worth a certain amount to your business), or more closely linked to the event (i.e. length of the video footage played).

Non-interaction (optional) – This is used to assign whether an event is considered interactive enough to alter the bounce rate. This means that if you considered somebody watching a full video to be an interaction, you could exclude them from the bounce rate if they don’t view another page afterwards. If the code is set to ‘True’, this indicates that the event hit will not be used to determine bounce rate calculation. If it is set to ‘False’, it will affect the bounce rate calculation, having the same effect as if you viewed another page on the site - even though you didn’t! You should set this to be ‘False’ when the event carries the same weight as viewing another page (i.e. playing a full video). It should be ‘True’ if it is a smaller interaction, such as scrolling down a page.

For example, an event that measures pressing play on a video:

  • Category: Video
  • Action: Play/click/submit
  • Label: [Name of video being played]
  • Value: [Time to load video]
  • Interaction type - False (0)
How does Google Analytics event category tracking work?
How does Google Analytics event tracking work?
How does Google Analytics event label tracking work?

Ensuring the naming conventions used in the above stages are clear, simple and related to the event taking place, will make your reports easier to understand - allowing for a more accurate interpretation of data, and therefore more effective business decisions.

Remember to choose your naming conventions carefully. If you decide to change the structure of your event tracking in the future, you won’t be able to change past data already gathered. So, make sure you’re confident in your choices for ongoing consistency.

How can I track events using Google Analytics?

How can I track events using Google Analytics?

Now that you understand how events are structured, it’s time to outline how tracking can be implemented.

As briefly mentioned earlier, there are two ways to set up event tracking in Google Analytics - using a customised code, or Google Tag Manager.

We explain both methods below.

1. Connect your site to Google Analytics

If you don’t already have Google Analytics on your website, you’ll need to set up a Google Analytics property and get a Google Analytics ID. You can find your Google Analytics ID by following these simple steps:

  1. Open up Google Analytics - you must be signed in.
  2. Click ‘Admin’ (at the bottom left).
  3. Select the relevant account from the menu in the ‘Account’ column.
  4. Select the relevant property from the menu in the ‘Property’ column.
  5. Under ‘Property’, press ‘Tracking Info’ and then ‘Tracking Code’
  6. Here, you’ll see your Google Analytics ID at the top of the page - it will begin with UA.

2. Add Google Analytics code to your website

Once you have this, you need to edit the following snippet, replacing GA_TRACKING_ID with your own Google Analytics ID:

<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
<script>
window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'GA_TRACKING_ID');
</script>

Wondering where to put the Google Analytics code? Simply copy and paste the above snippet right after the <head> tag on each page on your site.

3. Add more code snippets to the elements you want to track

Remember the structure of the syntax code behind an event that we spoke about earlier? You’ll need to add the event tracking code snippet to the element you want to track - with this, Google Analytics can read the structure.

The format for an event tracking code snippet is (you’ll need to dynamically change the information in blue to reflect what you want to track, keeping the naming convention consistent):

ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);

You need to add this to the element you want to track. To do this, you'll need an event handler (a HTML term that triggers your tracking code to fire once your tracked action happens).

For example, if you wanted to track somebody adding a product to their basket with the value of the item, you would edit this to:

<button onclick="ga('send', 'event', 'Ecommerce','Add to basket', 'Tshirt', 15, [fieldsObject]);">Example Button Text</button>

4. Check that your code is working

You’ve done the hard work. But don’t fall at the last hurdle - now’s the time to check your code (and therefore your event tracking) is working.

This is simple to do. Just carry out the tracked action yourself - if everything is working, this should trigger the event.

You can see if this has been tracked correctly by going into Google Analytics; select ‘Behaviour’ in the sidebar and then choose ‘Events’ from the extended options.

You should see your action recorded there. If you do, you’ve set up event tracking successfully.

How to track events Google Analytics tutorial
How to set up event tracking with Google Tag Manager

How to set up event tracking with Google Tag Manager

You don’t need to set up Google Analytics events tracking manually. In fact, many people choose not to, and prefer Google Tag Manager. So, if you’re looking for a solution that doesn’t involve codes, Google Tag Manager could be right for you.

1. Set up Google Tag Manager

First, you’ll need to create an account at tagmanager.google.com

Doing this will create something known as a ‘container’ - you need to install the container by adding its snippet onto your website.

This works similar to Google Analytics but instead of adding the Google Analytics code to each page, you need to add a Google Tag Manager code.

For more information on setting up and installing Google Tag Manager, you can read Google’s Help Center guide.

Set up Google Tag Manager screenshot

2. Enable built-in click variables

In your Google Tag Manager account, you need to enable built-in click variables - these are used to create your event tags and triggers.

To do this, select ‘Variables’ in the sidebar and then click ‘Configure’.

You should then be able to see a list of all enabled built-in variables; make sure everything under ‘Clicks’ has a tick next to it. If not, click on their boxes to check them.

Enable built-in click variables screenshot

3. Create a new tag

To track a new event, you’ll need to create a new tag related to this.

Simply select ‘Tags’ on the sidebar, then select ‘New’.

This will give you the option to select your tag type. From here, choose ‘Universal Analytics’.

Create a new tag in Google Tag Manager screenshot
Choose a new tag type in Google Tag Manager screenshot

4. Configure your tag

Set this new tag’s track type to ‘Event’.

Remembering the advice we gave for event structuring earlier, fill in all the relevant information for the event here - category, action, label, value etc.

Once done, press ‘Continue’.

Configure your tag in Google Tag Manager screenshot

5. Specify your trigger

Here, you need to specify the trigger that will make your tag fire e.g. a click on a link. You’ll have a list of trigger types to choose from, but you can also create custom events.

If you’re creating a new trigger (i.e. one you have never used before), you will need to configure this. Google Tag Manager will automatically prompt you to do this if needed.

Specify your trigger in Google Tag Manager screenshot

6. Save the finished tag

Once you’ve saved the trigger, it should show up in your event tag.

If everything looks right, simply click ‘Save Tag’ to complete this process and start tracking.

Learn more about Google Analytics

If you want to get the most out of your tracking, you can learn how to unlock its full potential with our analytics and optimisation courses - including Google Analytics training and Google Tag Manager training.

For further information about our private training sessions call us to discuss your requirements and we’ll work with you to establish the right course for you.
GET IN TOUCH
We have trained thousands of people all over the world. Helping them to learn more and achieve more.
GoogleBrand
AirBanbBrand
AdidasBrand
SonyBrand
LorealBrand