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 mostly 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 about 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.
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 a 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.
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.
RockBoost Is On Facebook!
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.
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.
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.
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.
Like what you're reading? Get regular growth hacking tips sent straight to your inbox!
Sign Me Up!
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.
Now you can set up your tag and trigger.
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.
Head back over to your Google Analytics account, go back to the Real Time section, but this time go to the Events sub category.
(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.
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.
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!
Like what you're reading? Get notified about new value packed blog posts!
Sign Me Up!