How and When to Automate Google Analytics Event Tracking in Google Tag Manager (GTM)
Author: Jeff Sauer
Go to Source
Google Analytics makes it easy to see how many people visit your website. Sign up for GA, add some code to your website theme, and voila! You’re rolling in data.
But, of course, you’ll soon learn that this is only a small piece of the puzzle.
Google Analytics is great, but with ONLY the base GA code in place, you’ll have a hard time discovering what these people actually do on your website.
What’s missing from vanilla Google Analytics?
That base GA code doesn’t show you how far your visitors scrolled through your pages (a leading indicator that they actually read the content), if they watched your videos, or if they clicked any of your calls to action (CTAs).
Want to know if the people who visit your site download your PDFs or white papers? Or how they interact with your opt-in forms? You’ll need extra tracking code to pull it all off.
Just about anyone can add event tracking to an existing site in under 20 minutes using tag templates in Google Tag Manager (GTM), assuming you already have GTM on your site. Don’t have GTM in place? Check out our GTM Tutorial to get started.
In this guide, I’ll show you how to use GTM to set up my four favorite Google Analytics event tracking tags. Not only that, but I’ll share why these tags are critical to optimizing your website and I’ll show you a couple of shortcuts that will save you loads of time while applying these tracking upgrades to your site.
Want to skip ahead to see the Google Analytics event tracking tags in Google Tag Manager? Here are some quick links for you:
- 1) Download Tracking in GTM
- 2) External Link Clicking in GTM
- 3) Video View Tracking in GTM (Works for YouTube and Vimeo)
- 4) Scroll Tracking in GTM
What is event tracking?
Event tracking is how you tell Google Analytics to record the actions people take within the pages of your website. Event tracking goes beyond the capabilities of your standard GA tracking code and requires additional code to pull off.
These user-triggered actions are unique to each website, so Google isn’t able to track them automatically on your behalf with the base GA code. You need to tell them the actions you want to track, and this is done through an additional event tracking code library.
The events we’re going to discuss in this post include tracking downloads, link clicks, video views, and page scrolling.
Is Google Tag Manager required to track events?
No, you do not have to use GTM to track events. You can manually add the event tracking code (which can easily top 100+ unique events and manual code placements) to your website and collect the same event data if you have a solid process in place and strong attention to detail.
The process of manually adding event tracking code to a website typically takes days, if not weeks, and can cost $1,000’s in web developer time and fees. It also takes a lot of time to debug, test and maintain the code as your tracking needs evolve.
You can probably guess as to how I feel about manually adding event tracking code to your site. Yes, you can torture yourself and add event tracking tags to your website manually if you like. But as an alternative, I highly recommend you add your event tracking the easy way… using GTM.
Why should I add event tracking to my website?
Not every website needs event tracking. If you just want to see how much traffic your site gets, and where your traffic comes from, then the standard Google Analytics tracking code will take care of all your needs.
But collecting on-page visitor behavior data is the next step of analysis for a website owner who wants to excel in marketing and business growth.
Here are some marketing disciplines that can use our recommended event data to significantly improve their results.
If you run any type of paid advertising, event tracking can help you understand how people interact with your landing pages. You can use event tracking to see how far people read down your pages and where they fall off. You can also track if they watch your videos, and how they interact with your forms, and which links they click.
Blogging and content marketing
When you publish a blog post, do you know if anyone actually reads it?
You can find the answer easily if you track page scrolling and measure reader engagement with events. As you probably know, better reader engagement can lead to higher search engine rankings, as well as more conversions.
Want to track conversions you drive to affiliate sites? Tracking external link clicks can help optimize for affiliate revenue as well.
Conversion rate optimization (CRO)
Every CRO project starts with a deep dive into your current analytics. If you have set up GA to track on-page behavior with events, you’ll be able to discover what is needed to increase your conversion rates.
Have a sales campaign that isn’t working? Data from event tracking can help you optimize your product pages, and increase your sales.
You can track lead form interactions and opt-ins using event tracking. Note: I am not specifically covering form tracking in this guide because this process varies a bit depending on which type of form builder you use (and there are 100’s of from builders). That said, similar techniques can be used for from tracking.
(If you’re interested in learning more about form tracking, make sure to check out my full GTM Course. Inside my GTM Course, I have in-depth lessons on lead form tracking.)
If you do affiliate marketing, tracking outbound link clicks can help you analyze and improve the results from your product referrals. Collecting link click data to use along with your campaign and traffic reports will also help you learn how to increase your conversions.
Other on-page tracking tools
There are other on-page analytics tools, like HotJar, Crazy Egg or Sumo Tools that will create heatmaps and track button clicks. You can use these tools to create specialty reports in addition to what you will find in Google Analytics (if you’re a Data Driven member, we have discounts on these tools inside your account).
But at this time, in my opinion, the fastest and most foolproof way to gain on-page insights is to use automatic GTM event tracking to enhance your Google Analytics data.
Why? Because GTM is free, universally useful, and it’s made to work seamlessly with GA. You can use your event data to make improvements to your site and get better results in a few days.
Alright, now that we’ve covered the what and the why of event tracking, let’s delve into the how.
Event tracking in Google Tag Manager
Although GTM makes advanced tracking accessible to everyday marketers (even those with no web development experience), you still need to know how do some of the basics in GTM to get your event tracking tags in place.
If you starting from square one with GTM, you will benefit from checking out my GTM Tutorial –A Step-by-Step Guide to getting started with GTM – before you progress to event tracking.
That said, even if you are new to GTM, the rest of this rest of this guide will help you see how what’s possible once you learn the fundamentals.
Four event tracking tags that will help you optimize your marketing results
Let’s take a look at my four favorite event tracking tags to implement in GTM. These tags work for any website using GA.
If you’re offering up white papers, PDFs, or other downloadable content on your website, you probably want to know how often your visitors opt to take advantage of your content upgrades. But, Google Analytics does not track downloads by default.
You can use a GTM tag along with a regular expression to track every download that happens on your website.
Here’s how to set up download tracking
Start by creating a Universal Analytics tag in GTM, using the GA Tag template. In in the “track type” section of your tag template, choose “Event.” Then name your category, action, and label. As you can see in the screenshot below I’m using variables in my action and label fields to record the URL and text for my download events.
Download event trigger
Select a “Just links” trigger for your tag. Then to make it so that this trigger tracks all your downloads, sitewide, use a regular expression (RegEx) to fire your trigger.
I am using the expression click URL contains:
This expression includes the extensions for all the downloadable files available on my sites.
Using this RegEx in your trigger will save from having to create multiple tags and triggers to track your various types of downloads. If you use this RegEx, make sure to add or update to represent the correct file extensions for your downloads.
For a more detailed explanation, be sure to check out our article on How To Track Downloads In Google Analytics – the Complete Guide.
Want to know where your website visitors go when they leave your site? Using a GTM event tag, you can track any link clicks that take visitors off your site. Outbound link click tracking can help you understand where to place your links strategically inside your content to maximize engagement and affiliate commissions.
Here’s how to set up outbound link click tracking
Once again, start with a Univeral GA tag template. In my template, I am using variables to make my label dynamic so that this tag will report the link text and URL in Google Analytics.
Link click event trigger
Next, set up the just links trigger again. In the trigger, use a regular expression to track any clicks that don’t include your site’s domain name.
Lots of websites use videos to increase audience engagement on sales pages, product pages, and blog posts. Using GTM’s pre-built YouTube tracking triggers, you can find out exactly how much of your videos your visitors watch. You can also see which parts of your videos draw the most attention, and where your visitors stop watching.
How to set up YouTube video tracking
As with our other our event tracking tags, you want to start by creating a Universal GA event tag. I am using variables in the category, action, and label fields so that I can use this one tag to track every video on my website.
YouTube video event trigger
Next, you want to add the YouTube trigger to your tag. This trigger is super easy to set up. All you have to do use it is select which action will make it fire. I have my tag firing on all video plays (starts), completions, pausing, buffering and seeking. I also have my trigger set up to fire when a visitor makes it 10, 25, 45, 65, 75 and 100% through my video.
Using a different video platform like Vimeo and Wistia? There are libraries for tracking these videos as well. I specifically recommend DuracellTomi’s GTM for WordPress to track Vimeo videos, which we use on our Data Driven courses.
Want to know how much of your content your visitors really read? You can set up a scroll tracking tag in GTM to tell how far your visitors make down your pages. Scroll tracking can help optimize the format of your content, as well as the in-content placement of your CTA’s so that you get better visitor engagement and more conversions.
Not only that, but you can configure Scroll Tracking to reduce your bounce rate by making it an interaction event when they scroll past a certain percentage of the page.
How to set up scroll tracking
In this scroll tracking tag, I am using variables to report the scroll depth and direction of my website visits. I have also made the page path dynamic so that this tag reports the page that was scrolled in my event data.
Interaction hits and bounce rate
Additionally, I have set this tag to report an interaction hit in Google Analytics. Making this event an interaction hit means that any visitor’s session that fires this tag will not count as a bounced visit.
Why would you want page scrolling to impact bounce rate? Well, bounce rate is a metric that’s meant to represent visitor engagement. If you publish long-form content, then scrolling more than 1/2 way down a page is a strong sign of visitor engagement. That way, if someone reads more than 60% of one your pages, you don’t have to report them as a “bounced,” or disengaged visitor.
Scroll depth trigger
The scroll depth trigger is also easy to set up. You can choose to track vertical and/or horizontal scrolling. And you can fire your tag based on the percentage of the page or number of pixels scrolled.
Always test and debug your tags before you publish
Once you’ve set up your event tracking tags, it’s imperative to test and debug these tags before you publish them.
You also want to closely monitor the data your tags send into Google Analytics using your Real-Time reports. Make sure you’re happy with the labels, categories, and actions appearing in your reports before you publish these tags to your site!
That wraps up the basics of using Google Tag Manager for event tracking. As we discussed, event tracking can help you use a data-driven approach to optimize your PPC landing pages, e-commerce product pages, blog posts, lead generation campaigns, and affiliate marketing.
Which event tracking tags are critical to your marketing?
Which event tracking tags are you going to use to measure your marketing campaigns? Leave a comment below and share your favorite event tracking tags, tips and tricks.
The post How and When to Automate Google Analytics Event Tracking in Google Tag Manager (GTM) appeared first on Jeffalytics.