How To Create Google Analytics Events Tracking Manually Or In Google Tag Manager

In our previous article, Why Is Your Bounce Rate So Low & How To Fix It?, we discussed how Google Analytics Events affect a page’s bounce rate and how to fix events that are influencing it negatively. However, we didn’t go into how to create Events or why. So, we’re going to fix that here.

What are Events in Google Analytics?

In short, an Event tracks a user’s interaction with a web page. Google Analytics generally tracks Page View hits, which means a user lands on the page and GA records it. However, we all know that a user does not just land on a page and then move to a new one. They click things, hover over things, see pop-ups and so on; but Google doesn’t track these ‘interactions’. Whilst the list of interactions on a page are endless, examples are:

  • Download a file
  • Press Play/Pause/Stop on a video
  • Add a product to a basket
  • Sort a list of products by a certain parameter
  • Click on a button
  • Click on the chat functionality
  • Submit a form
  • Share a page
  • Click on an external link
  • View a popup
  • Click on a popup

A Google Analytics Event fixes this by tracking the interactions on a page that you wish to track. They can be seen in the Events Report in Google Analytics.

Google Analytics Event Structure

A Google Analytics Event is structured using Category, Actions and Labels. Whilst you need to use most of these, the values are completely up to you. There are no hard-fast rules, but, generally, they’re used as below:

Event Category

The top-level category you wish to give to a single or group of similar Categories. Examples are:

  • Videos
  • Outbound Links
  • On Page Buttons
  • PDFs

Event Action

The kind of interaction you are tracking. Examples are:

  • Download
  • Play Video
  • Name of Button clicked

Event Label

More information on the event. E.g.:

  • Name of file downloaded
  • Name of Video

Event Value (Optional)

The value you are assigning to an Event. This can be anything from monetary value to weight or time etc

Non-Interaction

We have explained this in the article https://www.propellernet.co.uk/bounce-rate-low-fix/. Essentially, a non-interaction dictates whether the Event is the cause of a user doing something on the page or not. It tells Google Analytics whether to change the bounce rate of the page if the Event occurs.

Basically, it allows you to decide whether tracking the event means an actual interaction takes place. These are the rules:

  • A non-interaction set to false means an interaction did take place
  • A non-interaction set to true means an interaction didn’t take place

Non-Interaction = False

  • The user clicks on a product image
  • The user fills out a form
  • The user clicks on an interactive map
  • The user presses play on a video

All of the above means the user did something on the page.

Non-Interaction = True

  • A video starts playing when the user lands on the page
  • The user has seen a product
  • The user landed on a page
  • A banner has popped up on the page

How to setup Google Analytics Events on your website

There are two main ways of setting up events in Google Analytics:

How to set up Google Analytics Events Manually by adding the Event code to your website

Setting up Google Analytics Events manually is the original way to do it, and is by far the hardest. It involves adding code to the site, every time you want to create an event. This is likely to be one of the reasons why it used to be a very under-used method of tracking in GA. This changed with Google Tag Manager, which is the easiest way of setting up events. However, if it’s not possible to add GTM or another Tag Manager solution to your site, this is the way you will need to set up events.

The code added to the site is additional Google Analytics code and needs to be placed wherever you want to track the activity happening on the page, for instance, on the button you wish to track. The event code is always laid out in the following order:

  1. Category
  2. Action
  3. Label (optional)
  4. Value (optional)
  5. Fields Objects (Non-Interaction etc. – optional)

The syntax for a GA event is below and needs to be added to whatever you’re tracking.

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

The Event code needs to be followed in that order, Category, Action, Label, Value, Fields Object. So, the tracking could look like:

ga('send','event','On Page Navigation','Buttons','GTM Training',0,{'nonInteration':false});

As the field name hasn’t been specified, Google Analytics will presume it’s in the order given above, which is fine if you include everything. However, if you don’t, you’ll need to leave an empty field. For instance, if the above event didn’t include a label, it would be written as:

ga('send','event','On Page Navigation','Buttons','', 150, {'nonInteration':false});

If you don’t do this, GA will presume the Event Value is the Event Label and budge it forward.

As mentioned, this will then need to be added to the factor you want to track as below. So if we are tracking this button:

[maxbutton id=”3″ ]

The code would be:

<a href="https://www.propellernet.co.uk/services/training/google-tag-manager-training/" class="maxbutton-3 maxbutton maxbutton-google-tag-manager-training" ga('send','event','On Page Navigation','Buttons','GTM Training',0,{'nonInteration':false});">Google Tag Manaager Training</a>

Once this has been included on the code on your website, you’ll be able to see how many people triggered it in the Events report in GA:

This will then need to be placed on every piece of code you wish to track.

NB: I’ve used ‘ga’ as the analytics code, but if you re using the gtag snippet, replace this with ‘gtag’ and remove ‘send’. More instruction for gtag can be found at https://developers.google.com/analytics/devguides/collection/gtagjs/events.

To do this on every page is a lot of work, and you can see why it’s not done that often. The next section talks about how to do this in Google Tag Manager, which takes a fraction of the time to setup.

How to Set Up Google Analytics Events in Google Tag Manager

So we’ve talked about how to set up a GA Event manually, but don’t let that put you off – it’s far easier with Google Tag Manager.

Before you create an Event in Google Tag Manager, you’ll need to make sure you have a Google Page View Tag set up; that’s pretty standard though. The tasks you need to follow are:

  1. In the Tag Screen, Click New
  2. Select a Google Analytics Tag and in the Track Type drop-down, select ‘Event’
  3. Choose your Category, Action, Label or Value
  4. Choose whether the Non-Interaction is False or True
  5. Select your Google Analytics Setting Variable or enter your Google Analytics UA Number
  6. Add Your Trigger
  7. Name Your Tag
  8. Preview and Test
  9. Publish

So, again, let’s create a Google Analytics event for the below button.

[maxbutton id=”1″]

  1. In the Tag Screen, Click New
  2. Select a Google Analytics Tag and in the Track Type drop-down, select ‘Event’
  3. Choose your Category, Action, label or Value
  4. Choose whether the Non-Interaction is False or True
  5. Select your Google Analytics Setting Variable or enter your Google Analytics UA Number
  6. Add Your Trigger
  7. Name Your Tag
  8. Preview and Test
    For more information about this, read our  guide on how to use Google Tag Manager preview & debug mode
  9. Publish

Once you’ve published and people start interacting with the Event you’ve set up, you will start seeing them in the Real Time Events Report, and the normal Events report in Google Analytics. If you are using a browser plugin such as Tag Assistant or dataslayer, you should be able to see the live event on the above button. We will talk more about those plugins at a later date.

That’s it. That should have taken you two minutes to do. Now you have time to create all the Google Analytics Events you need.

Hints and Tips

  1. Try and keep the amount of Event Tags to a minimum by grouping them together and utilising your Click Text/Class/ID variables
  2. Name your events so that anyone who views your Google Analytics account will be able to understand them
  3. Always test your tag before publishing
  4. The Social Tag in Google Tag Manager which sends information to the Social Report in Google Analytics is very similar in style and use as the Event Tag, so once you have mastered this, you should be able to setup your Social Plugins report

Conclusion

Tracking what people are doing on your site (as opposed to what pages they view) is an important part of Google Analytics and Event Tracking is at its core. Whether you are using Google Tag Manager or adding the code manually to the site, you should be using it as much as you can.

Need Some Help?

If you’d like to find out more about how to Track Events, come and join us at our Google Analytics Training and Google Tag Manager Training sessions. We also offer a wide range of Analytics services and Google Tag Manager consultancy services