Google Analytics shows you how users move between your pages, but what about the actions they take ON each page? This article will teach you how to effectively set up event tracking in Google Analytics in under 10 minutes.
Google Analytics (GA) has become the most widely used data analysis tool on the web because it is both powerful and free.
But it’s way underutilized, even among those who think they understand it.
GA can provide you with rich insights into your website, including who is visiting, what they are looking at, where they come from and what they are clicking on.
Having this kind of information empowers you to make decisions about your website that are based on data instead of assumptions.
You can see, for example, where customers are prematurely dropping off your website and then take action to fix it.
You can see what your most popular content is, and then highlight your best offers there.
You can see which sources are bringing in the most traffic and then optimize your experience for users from those channels.
The actionable insights you can gain are literally endless.
Google Analytics is very easy to set up, but getting the most out of it is another story. It is a highly complex tool, and few people are aware of the many ways you can use it.
One particularly useful feature that is not on by default is event tracking.
Because Google Analytics tracks only pageviews (i.e. when page loads) out of the box, it cannot tell you what users are doing on a particular page.
It will tell you how many people visited the video page on your website, but it cannot tell you how many people actually clicked on or watched your video.
Any event that does not involve a new page loading will not be tracked by default. In order to do that you need to set up event tracking.
This is becoming increasingly important as more and more pages feature dynamic content that use things like AJAX to display new content without refreshing the page.
Additionally, many websites nowadays exist mainly as a single page with buttons that simply take a user further down, but not to a new URL. By default, Google Analytics will not register such events.
This post is going to tell you, step by step, how to enable event tracking in Google Analytics so that you can see every time a user performs any type of action on your site.
1. Install Google Tag Manager
Before Google Tag Manager (GTM) came around, you had to manually insert the code for every 3rd party tool that you wanted to use on every page you wanted to use it.
To install Google Analytics, you would paste a snippet of code onto all of your pages. And then you would have to repeat the process if you wanted to use another tool like Hotjar.
For many, this meant continual reliance on their developer.
Google Tag Manager is a free tool that allows you to manage all these code snippets and insert/modify/remove them without getting into the code of your site.
It does, however, require a one-time installation (so you may have to bother your developer one last time).
When you create an account in GTM (tagmanager.google.com), it will give you some code to paste into your website. Something like this:
Insert that code (or get your developer to do it), and BAM! That’s the last time you will ever have to put a code snippet onto your site. From now on GTM will be your tool for managing any 3rd party code snippets your site needs.
2. Install Google Analytics Via GTM
Note: If you already have Google Analytics installed on your website the old way, you can skip this part, or you should first remove the code. Otherwise, after installing it with GTM, you will have it firing twice… and that’s bad.
From the Workspace for the appropriate account in Google Tag Manager click on Add A New Tag.
Click on the Tag Configuration box and select the first option, Universal Analytics.
Now you will see a field called Tracking ID, and here you should paste in the Google Analytics tracking ID of your website (find it in your GA account).
Then click on the Triggering box and select the very first option, All Pages.
Give your new tag a name, and click save.
What you have just done is tell GTM to fire up your Google Analytics tracking code on every page of your website.
Easy right? Don’t forget to click Publish for the changes to take effect.
Congratulations! GA is now running on every page on which GTM is installed.
Test To Make Sure It’s Working
Go to your Google Analytics account, to the Reporting section, and click on Real Time Overview.
Now in another tab, go to your website and click refresh. You should see an active user on your site along with your location. The timeline will show you how long ago the page was loaded.
3. Choose An Event To Track
In this example, we are going to use the simplest of all events: a button or link that takes a user to another part of the page.
With this kind of setup, you usually have two elements: a section of the website where you want a user to land, and the button or link that takes them there.
The section always contains an ID and might look something like this:
<div id=“my-section”>My content</div>
The link people click on to get there will point to that ID and look something like:
<a href=“#my-section” id=“my-button”>Click Me</a>
So far this is all HTML 101. Nothing new here. When someone clicks on the “Click Me” link, the page will jump to the section with the ID “my-section”.
Because this kind of link does not refresh the page or point to a new URL, Google Analytics will not register such a click by itself. That’s where GTM comes in.
Notice how the link itself also has an ID. This makes it especially easy to track. We can tell GTM to track every time a link with this particular ID is clicked.
Note: The button or link you want to track might not always have a unique ID property specified in the HTML, in which case you will need to tell GTM to look at some other property. But for the sake of this quick tutorial, we will assume the button you want to track has one.
4. Tell GTM To Track This Event
In order to track when someone clicks on this link or button, we are going to create a new tag and a new trigger in GTM.
The trigger will tell the tag when to fire, and then Google Analytics will be able to record each time the tag is fired, giving you useful information in GA.
First we need to tell GTM to look at the right variables.
In the GTM workspace of the appropriate account, click on Variables, and then under Built-In-Variables, click Configure.
Under the Clicks section, check all the boxes so they are blue.
Now you can set up your tag and trigger.
In the GTM workspace of the appropriate account, click on Add A New Tag
Click on the Tag Configuration box and, once again, select the first option, Universal Analytics.
A new field will pop up asking for the Tracking ID. Again, you should paste your GA ID in this box.
Now change the Track Type setting from Page View to Event.
Several event tracking parameters will appear. These parameters will be passed through to GA when the event fires allowing you to track clicks in different ways. For now, let’s just worry about the Category parameter—enter “Button-Click” into this field.
Now click on the Triggering Box, and then the plus icon in the top-right corner to create a new trigger.
Click on the Trigger Configuration box and under the Click category, select All Elements.
Now change the radio button from All Click to Some Clicks, and with the drop down menus, change the condition to Click ID equals “my-button” (remember, that is the ID you gave to your link in the HTML).
Give the trigger a name and save it.
Finally, give your new tag a name, and save it too.
You have just created a new tag that will fire each time someone triggers it by clicking on any element of your site with the “ID my-button”. When fired, the tag will send the Category parameter “Button-Click” through to GA.
Don’t forget to publish your changes for them to take effect.
Test To Make Sure It’s Working
Head back over to your Google Analytics account, go back to the Real Time section, but this time go to the Events subcategory.
(Make sure you are looking at your raw data view, i.e. double check that there are no filters masking your IP.)
In another tab, refresh your page, and click on your link or button. You should now see the event show up in GA along with the category parameter we gave it, “Button-Click”.
Congratulations, Google Analytics is tracking your first click event!
Now there is one more step to turn this data into useful information in your GA reports. You have to set up goals that reflect these events in order for them to get recorded.
5. Setting Up A Goal In Google Analytics
In order to make event tracking useful in your GA reports, you need to set up goals that reflect when events are triggered.
This will allow you to see your conversion rate, how many people clicked on your button, what percentage of them were new users, what percentage of them came from certain sources, and more.
In Google Analytics, click on the Admin button, and then, for the property and view that you want, click on Goals.
Click New Goal and give it a descriptive name (e.g. Someone Clicked on My Button!).
Select the Event radio option and click continue.
Now, in the Category field, enter the value we told GTM to pass through for this event. We set it to “Button-Click”, so enter that into the field and click Save.
It will take some time for results to show up in GA, and it will only start recording goals from now on (so the clicks you’ve already made won’t appear retroactively).
When setting up goals, remember that they are only applied to the particular property and view that you set them up for.
Event tracking will make all kinds of new data available to you,
It can get quite complicated with all the names for IDs, categories, tag names, trigger names, goal names, etc. It’s important that you develop some standard naming procedures as you move forward.
This short tutorial just barely scratches the surface of what you can track using GTM and GA. There are millions of options for you to play with to gather the data you need to make informed decisions.
We do hope this was useful to you and will set you off on the right foot!
Marketing Automation | Digital Marketing | Growth Hacker
Growth Marketer with more than 7 years experience in developing business strategy with growth marketing methods, well versed with PPC, Email Marketing, SEO, and Marketing Automation.