Google Tag Manager Tutorial and How to Get Started

Peter Sharkey on 8th of Dec 2016
Google Tag Manager Tutorial

Google Tag Manager Tutorial

In combination with Google Analytics, it’s your one-stop tracking and triggering shop for nearly every event that happens on your website. What does that mean for your marketing automation, and for your website marketing in general? Plenty.

What are the benefits of Google Tag Manager?

Here are just a few:

  • No more waiting for developers to implement new tracking codes or automated marketing actions—do it on your own with just a few clicks.
  • There’s completely independent coding for your tracking events and your website itself. Now you can change one without breaking the other.
  • GTM’s built-in auto-event listeners let you catch and take action on simple events like link clicks, form submissions, JavaScript errors, and more.
  • Access and version control lets you allow multiple users to tweak your tracking while giving you the power to rollback any changes if something goes wrong.

Unlike other tools, you won’t have to generate code for every single event you want to track, put that code on the right spot in your HTML, make sure it works, then log into a different dashboard to get insight into every event.

Google Tag Manager eliminates the need for the above coding skills—mostly—and lets you look at everything you’re tracking right from your Google Analytics dashboard.

Google Tag Manager components

Google Tag Manager is made up of containers, tags, triggers, and variables.


The container (create one on Google’s site) is where you’ll put all of your “tags,” which gets rid of the need to add code snippets to your site for each individual tracking task. The container is a code snippet…er, two code snippets, actually, but they’re the last code snippets you’ll ever need to add to your site. One goes in the header and one goes after the opening

tag on each of your site’s pages, like so…

Google Tag Manager container snippet

There are plenty of ways to automate adding this code to new pages as they’re created: WordPress plugins and other CMS tools abound; a quick search for “[your CMS name] add Google Tag Manager” should turn up plenty of resources.

Once the container code is on your site, you’ll be able to add, adjust and remove all of your tracking events through Google Tag Manager, without the help of a developer and without needing to dip into your site’s code at all.


Tags are made up of the same code snippets used to track things directly on your site.

Whether it’s your Autopilot tracking code, a download tracker, a heat map, a scrolling depth indicator, or any other tool that records how visitors interact with your site, you’ll be given a code snippet to make it work. Instead of adding that snippet to your site, though, you’ll add it as a tag to Google Tag Manager, which will then auto-populate it on your website’s pages. Not only is the process easier and less prone to error, but Google Tag Manager’s automatic error checking feature will also let you know if there’s a problem implementing the code or getting your tracking to function properly.

Google Tag Manager error checking

Google Tag Manager also has many tags preloaded and ready to go. AdWords, Doubleclick, and plenty of other Google products and partners come fully integrated, meaning you might not have to touch a code snippet at all to put a tag in place. You can also create tags using codes for pixels and other tracking elements from Facebook, Comscore, Marin, AdRoll, ClickTale, and literally hundreds if not thousands of other tools and services.

Google Tag Manager containers

As I like to say: Build out the tags, and the automation is in the bag.


Triggers are the events that cause your tags to “fire.” Say you want to track the number of people who click a specific outbound link. The tag would be a code snippet that sends click information to your Google analytics account; the trigger is the click itself.

Every tag you use in Google Tag Manager needs to be associated with at least one trigger to be useful (a tag without triggers will never fire, and thus never do anything).

You can apply multiple triggers, filters, and trigger blockers to your tags so you can track exactly what you want to track, when you want to track it, and keep all of your data neatly segregated and easy to interpret. Common trigger examples include:

  • Clicks
  • Page views
  • Downloads
  • Scrolling
  • Form submissions
  • Purchases

But there’s virtually no end to the types of events you can use to trigger your tracking tags.


Variables are what Google Tag Manager uses to determine when a trigger’s conditions have been met, and thus when to fire a tag. They can also be used in tags to transmit dynamic (i.e. visitor- and visit-specific) information.

Google Tag Manager variables

For the most basic tags—like trying to track all clicks on your site—you won’t need to specify a variable; just create a trigger that fires for “All Link Clicks” and Google Tag Manager keeps all of the potential variable values open. Any click at all will satisfy the variables, the trigger conditions will be read as “true,” and the tag will fire. If you only want to track specific clicks—clicks to a specific URL, or clicks made after users have visited certain pages on your site—you’ll need to specify values for one or more variables.

Variables in triggers

That’s variables in triggers. In tags, variables are used to capture and transmit data from the user or user session:

  • Purchase amount
  • Scroll speed
  • Time on page

And whatever else you can think of that varies from user to user and session to session.

Variables in tags

If you set up the right tags and triggers, you can even get JavaScript error reporting right on your Google Analytics dashboard if something goes wrong with your Tag Manager enabled forms and scripts.

Your first eight steps with Google Tag Manager

I know you’re just itching to jump into Google Tag Manager and start tracking anything and everything your visitors do. Here’s your roadmap to give you a solid feel for the tool and create a foundation from which you can build as high as you want.

Step 1. Come up with a naming convention for your tags, triggers, variables, and containers

Set this up in an easy-to-access doc or spreadsheet somewhere, and refer to it often as you build out your kickass Google Tag Manager tracking. Take it from someone who learned the hard way: the time you invest in this now will pay off a hundred times over down the line.

Google Tag Manager naming convention

Step 2. Enable all the built-in variables you need

Like I said, Google Tag Manager has a lot of tags pre-loaded and ready to go. It also has a lot of variables built-in right from the outset. Check them out, activate the ones you know you’ll be using, and set appropriate values for URLs, buttons, downloadable media, chat windows, and any other variable items you already have data for. Starting with this will make implementing your first tags a whole lot faster.

Step 3. Add DOM ready and window loaded triggers

A lot of the things you’ll want to track will need to wait until your web pages and/or scripts are fully loaded and ready to interact with. Creating basic triggers for when a piece of JavaScript is DOM Ready and for when a web page has fully loaded makes creating specific triggers for individual scripts and pages that much easier. All you’ll need to do is define variables—script names and specific page URLs—to trigger tags on the pages you’re tracking.

DOM ready

Step 4. Add other basic variables to begin effective tracking

There are bound to be some basic variables you use again and again as you build out your Google Tag Manager capabilities. The beauty of the system is that you can build out these variable lists independent of any tags and triggers, then plug them in whenever you need. Things like your Google Analytics property ID(s), URLs for other domains to enable cross-domain tracking, the title of downloadable resources you offer, names for the products you sell, etc. Set up the variables before you start building specific tags and the process gets way more efficient.

Step 5. Create your first tracking tags

Now that you have some triggers and variables in place, build out your first basic tracking tags. I’ve mentioned most of the common events several times here, but for ease of reference here are a few of the events you should be tracking with your Google Tags:

  • Clicks on outbound links
  • Clicks on your contact links (i.e. email address and phone number links)
  • Form submissions
  • Downloads of your resources/media
  • Purchases (you’ll need a CMS that supports this)
  • JavaScript interruptions and errors

Step 6. Create an umbrella tag to capture all events

OK, this might not actually be the sixth thing you do with GTM, but once you’ve played around with it for a bit and have a feel for how Tag Manager works—especially using the data layer to capture and use dynamic variables—this is something you’ll want to set up ASAP to save yourself from sifting through a lot of redundant data.

Instead of repeatedly collecting a lot of the same data with each of your event tags, a generic event tag will capture the same data but keep it organized according to which specific events, categories, labels, etc. are assigned to each event. You can check out this lengthier explanation to see exactly how to implement your generic event tag—trust me, once you have some Google Tag Manager experience, it will make perfect sense.

Step 7. Add scroll depth tracking to your important content pages

Landing pages, sales pages, and blogs that are central to your sales all need to be read to be effective. If your visitors aren’t scrolling down, your message isn’t being delivered, and all of your content efforts are in vain. Adding scroll depth tracking to your important content pages will tell you if you’re holding visitors’ attention long enough to turn them into customers. If you’re not, it’s time to tweak that copy.

Step 8. Implement 100% site speed sample rate

By default, Google Analytics only provides a site speed sample rate of 1%. Adding a tag with the “siteSpeedSampleRate” field set to 100% gives you much better idea of how well your site (and your hosting plan) are performing, and ensures you aren’t turning away potential revenue due to simple technical slowdowns—slowdowns that can be devastating to your bottom line.

Google will stop counting after 10k samples per day, so if you have a high traffic site you might want to drop your percentage from 100%, but as long as your traffic doesn’t exceed the daily tracking limit you’ll be fine.

Automating all your tracking is a breeze

I won’t tell you Google Tag Manager takes all the work out of your site’s tracking and marketing. If that tool is ever invented, a lot of us would be out of work. But Google Tag Manager does make it a whole lot easier to track everything you want, making everything from implementation to analysis more efficient.

With a bit of experience, you can use Google Tag Manager to build responsive, automated, cost-effective, and high-ROI ad campaigns, content plans, and sales funnels. You’ll still need to design the pitch, but Google Tag Manager can handle almost every aspect of delivering it and following through.

What follow up questions do you have about Google Tag Manager? Any insights you’d like to add from your experience? Let us know in the comments.

marketing automation templates

Try Autopilot today Start a free 30 day trial.

Signup for free
comments powered by Disqus