Google Tag Manager - how to setup Google Analytics Events
I'm going to show you a step-by-step guide to how to use Google Tag Manager to setup Google Analytics Events.
Setting Up Events using Google Tag Manager
Okay, so to get started, head over to Google Tag Manager, sign-up for an account and install their javascript code snippet onto your website.
Then let's add some tracking to Google Analytics, as follows:
Part A. Add a Click Listener:
Step 1. Add a new Tag, name it Click Listener and give it a Tag Type of Click Listener.
Step 2. Add a Firing Rule to fire on all pages. Select conditions shown:
{{url}} matches Regex *
Regex just means "regular expression" and "*" just means any page).
Part B. Track the Actual Element to Google Analytics
Step 1. Add a new Tag, name it Google Analytics Event.
Set the Tag Type to "Universal Analytics" or "Classic Google Analytics", depending on what you use on your website.
Enter your Google Analytics Tracking ID.
Set Track Type to "Event".
Optionally you can set the parameters for the event. (I put GTM so I'd know the event was fired by GTM, and added a path {{url path}} to the Label so I'd know what page the event occurred on.)
If this seems difficult, don't worry: there's an easier way. Grab our FREE 5 Step Guide to Tracking Users below. It takes just a few seconds and you'll receive your personal copy in your inbox.
Part C. Add the Firing Rules (we'll need two).
Step 1. Add gtm.click rule:
{{event}} contains gtm.click
Step 2. Add Element Identification:
{{element id}} equals id-video
(or the id of the element you want to track)
Step 3. Publish
When you're done, click Publish.
Let me tell you something. I spent over an hour getting this wrong before I finally got it working. Maybe I'm a slow learner. Honestly the only reasons I continued was (a) to write this blog post and (b) to understand Google Tag Manager better, given that its an alternate to our own product, I want to understand better the kind of problems people may have.
Overall I have to say Google Tag Manager "looks" awesome. It's got a ton of rules and settings that makes me think I should get to grips with it. It's clearly very powerful in what it can do, but for ease of use and setting up tracking quickly I found it pretty tricky. Especially the fact that to track just this one button, I had to create 2 tags and 3 firing rules. That gives a lot of scope to get stuff wrong.
But, to track something simple, really, for me it wasn't intuitive or simple. I'm always looking for fast easy ways to do stuff, and in this case I'd really want a fast and easy way to send events to Google Anaytics. I tried to use the tool without any tutorials (this being my test for usability). If I have to read a bunch of manuals, maybe its not what I'm looking for. In the end I had to follow a tutorial before I could make it work.
Conclusion: What should you do next?
So, now that you know how to add events and track what people actually do on your website, its time to get to work! After all, your site is only useful if it serves a purpose :) If you're looking for an easier way to track user actions on your website, grab our FREE 5 Step Guide to Tracking Users below and you'll receive your personal copy in your inbox.
To get started tracking events on your own website check out our visual tracker tool.
Was this post helpful? Please let me know your thoughts in the comments section below.