Google Tag Manager (GTM) is the buffer that keeps marketers and your IT or development departments happy. It’s used for conversion tracking, retargeting, analytics, and more.
GTM is basically a container which houses all the tracking scripts (or tags) for your site. Because they’re all in one container, it makes it easy to keep track and manage your tags in one place.
GTM launched by Google on October 1, 2012 as a way to help marketers understand the behaviors and gain insights into how audiences are performing. While we’ve had tools at our disposal before, many have required someone with coding experience to add “tags” to our website.
Why You Should Care
GTM has many great features to help you manage your tagging needs:
- It’s Free.
That’s right! There are no monthly or yearly fees to use GTM.
Before GTM, if your marketing team didn’t know how to add in Javascript to a site, you would have asked your IT department for their help with the install. Most of the developers that I know are pretty expensive and charge hourly, so adding that bit of code to the site can end up costing a lot for that developers time.
- It Gives You Back Control.
- Better organization
- Quicker implementation or adjustments.
It may not initially seem like carrying out tag management tasks yourself is beneficial. After all, it puts more work on your plate. That being said, there are two main benefits:
Really, these two benefits go hand in hand. If you’re more organized, you may also be more efficient or “speedy” as a result.
Organizational Hub.
If you’re using many different marketing automation services and have multiple sites (with multiple tags), GTM provides an easy-to-use interface to add, remove, enable and disable tags. It also allows you to control when and where a tag gets fired, and what happens after it does get fired. Staying organized helps prevent data loss.
Super Quick.
One of the biggest hurdles marketers face is getting the development team to have the same sense of urgency as they do. Tag implementation and adjustments may seem mundane or not “challenging” enough for a developer, which means the task may take a backseat to other priorities. On the other hand, if you have a highly complex and large website, it may be more cumbersome and take more time in general for a developer.
Whether due to disorganization or waiting on a developer, you can avoid unnecessary push back on campaign launch dates as well as clients breathing down your neck, wondering why things are taking so long.
This is a DIY project marketers can do. It’s not like those Pinterest baking projects where you want to make that super cute cake for the party and then it flops.
- Faster Loading.
- Increased User Time on Site.
- Improved SEO Performance.
Piggybacking off the value of speed, it not only applies to manpower hours but also load time of a website. With GTM, the code is streamlined, which means that tags will no longer bog down and slow your pages from loading. This plays directly into conversions in the following ways:
Javascript may be a marketer’s worst enemy when it comes to page load times. Basically Javascript is the diva, not letting anything else load until it loads, which means that visitors may get tired of the page loading, bounce, and you lose that potential conversion.
Typically, the sections of the page will load in an order waiting for other sections to load, which is called synchronous. But GTM comes to the rescue. Because GTM loads tags as soon as they’re ready and not in a sequence to other tags, tags fire on the page asynchronously and simultaneously, and saves you a whole bunch of time.
Because of increased user time on site impacting user experience, it’s factored into SEO ranking considerations.
Saving a couple seconds off the load time of a page may not seem like a big deal in the grand scheme of things. I mean, not much can happen in a few seconds, right? Wrong.
Amazon calculated that it can cost as much as $1.6 billion in sales each year with a slow down of just one second. Google has calculated that they can lose 8 million searches per day with just four tenths of a second of slow down.
- Multiple Users & Permissions.
- No Access: User can’t see the container in the account.
- Read: User can see the container, the tags, triggers, and variables in the container, but unable to make any changes in the account.
- Edit: User can create workspaces and make edits, but is unable to create versions or publish.
- Approve: User can create workspaces, versions, and make edits in the account, but can’t publish.
- Publish: User is able to create workspaces, versions, edits, and publish it.
GTM provides the ability to add in multiple users and for these users to have specific permissions, much like Google Analytics. You can control who has the ability to create and edit tags, triggers, and Variables.
Access should be granted in each container, and the types of user access options are as follows:
Creating a user is simple. We’ll go over the complete build out of GTM in the upcoming “How to Set it Up” section…
So, why are users and permissions important? There may be some sections in GTM that you just don’t want other people touching, and potentially messing things up.
With the ability to add and edit tags, triggers, and variables, in the wrong hands, it can lead to losing data, losing conversions and websites going down.
But don’t worry, luckily there are some fail safe features in place:
- Workspaces
- Previews
- Versions
- Third-Party Tags
These can help you prevent and make up for any mistakes you might potentially make.
Workspaces.
If you have multiple users working in GTM, Workspaces makes it easy to work on something without even touching what other users are working on. Workspaces are great for companies with multiple departments working on different projects and for companies working with agencies.
Preview Your Work.
As a PPC-er, I think we’ve all made that mistake of publishing an ad only to realize that there’s a misspelling in the ad copy. Yikes! With GTM’s preview feature, you can see in real-time–on the page where your tag should be firing–if it actually has fired.
Once you do that, visit the landing page where that tag should fire from.
From there, you can determine what’s working and what’s not before you publish your new tags.
Versions.
A version is created each time you publish a change to the container. This will help a user create a history of the changes in GTM, when those changes were made, and by whom. Imagine you notice that something has gone horribly wrong and a tag is broken somewhere. You can simply republish one of the previous versions of GTM.
When you visit the Versions section of GTM, you’ll be able to see when the last Version was created and published, by who and the Version items such as tags, triggers, and variables.
Built-In 3rd Party Tags.
If you’re new to GTM then their built-in 3rd party tags will be like a party for you.
It requires very little coding experience, and allows the less technical users to be more active it GTM, making it easier to deploy tags quickly and making errors less likely to occur.
The built-in tags include the Google properties like Google AdWords, Google Analytics, and Google Remarketing. GTM also offers some more popular tags like AdRoll, HotJar, LinkedIn, Bing UET, and many more.
How to Set It Up
There are the three main parts to GTM:
- Tag: A snippet or small piece of code (usually JavaScript) that’s pasted into pages of your site.
- Triggers: Defines when and where tags are executed.
- Variables: Used to receive or store information to be used by tags and triggers.
Create a GTM Account & Container Snippet
So, now you’re ready to get started!
To create an account, go to https://tagmanager.google.com, and sign in with the login email address that you want to use. You’ll be prompted to Add a New Account if there isn’t already one listed under your email address.
Once you name your company, you’ll set up the Container with the website that you want to manage. Go ahead and name your container after the website (www.mysite.com), and choose where you want to use the container (Web, iOS, Android, or AMP).
You’ll be asked to accept the GTM’s Terms of Service Agreement, and then you’re set! You’ve created the account and your container and ready to start adding in the tags, triggers, and variables you’ll need to start tracking!
Plan Your Tags For Your Site
Before you start implementing any tags, take time to review your site. Take a step back and think from your visitor’s point of view. How will they navigate the site? What buttons will they click on? What tags do you need on which page? Some tags you’ll want to add to every step of the site (Google Remarketing), and some tags only on specific pages (Conversion Tracking).
Install the GTM Container Snippet
Yay! Now it’s time to plant that snippet of code onto every page of your website. You should see a window with two pieces of code, one prompting you to place in the
of the page, and the other after the opening tag.Components of GTM
Once you have your account created, the next step is to set up the Container, Tags, Triggers, Variables, and Folders.
Containers
Once a GTM account is created, you’ll create a container. If you’re familiar with The Container Store, it’s a similar idea. The purpose of The Container Store is to provide solutions for people storing tons of “junk” into one space. This is essentially what a GTM Container is. It’s a place where you store all your tags, triggers, variables and folders. It provides the functionality to run and deploy tags, and makes it easy to manage them all in one place.
If you only have one website, you’ll only need one container. When you’ve placed the code/snippet onto the site, you’ve successfully added GTM!
The three components of Containers are tags, triggers, and variables, aka the bread and butter of GTM. This is basically the heart of the entire system.
Tags
To put it simply, a tag is a snippet of JavaScript code that’s to be placed on the website to fire when it’s triggered.
Here are examples of what these tags capture:
- Visitor acquisition – how the visitor ended up on the site, what channels they used to get there.
- Visitor behavior – what pages they’re viewing, how many pages and how much time they’re spending on the site.
- Visitor conversions – form submissions, transactions.
Tags need triggers and variables to define their functions. Think of Kronk’s spinach puffs. The puff needs the ingredients and the baker to be whole. Otherwise, it’s just a nice yummy thought. We’ll get to triggers and variables in just a bit.
Basically, tags can record any behavior or event on a site, and send that data to Google and 3rd party tags. Without Google Tag Manager, the code needs to be placed directly on the site using source files that a developer will need to set up.
One thing to keep in mind regarding tags is that they can have more than one trigger. For example, you might have a tag that fires each time a page loads and when a click happens on that page.
The First Tag You’ll Implement:
Most likely, the first tag that you’ll created with GTM is Google Analytics (GA). There are two types of GA tags that you can add. One is the Universal Analytics and the other is Classic Google Analytics. Depending on which you’re using, you’ll choose between the two. If you’re currently using Classic GA, now may be the opportune time to upgrade to Universal!
To create the new tag, go to the dashboard and click on Add A New Tag.
Name your tag in the upper left corner to something like “Google Analytics – Page Views,” so that you know that it’s tracking page views. In the Track Type, choose Page Views, which will track every time a visitor loads a page on your site. There are other options like Event, Transaction, Social, etc. But for now, pageviews will be where you can start.
You’ll want to configure the tag by adding in your GA ID.
GA HTML Tag Implementation:
While adding GA to GTM with a generic HTML tag is a more complicated and much more involved process than adding it in through the standard tag implementation, it might be a better solution for your more complex implementations. It allows you to customize the code to your needs, and hopefully, ensure a smooth process.
Keep in mind though, this is where developers or IT might need to assist. That being said, hopefully, the implementation is a one-time task — and any adjustments are more manageable by the marketing team, after the fact.
Triggers
A tag is only fired if it has a trigger (formerly known as a “rule”). You can add all the tags that you want to the site, but without someone pulling the trigger nothing is going to happen. This defines which tag is fired, and when.
Once you’ve created a tag, you’ll be prompted to create a trigger. So, after you have created the Google Analytics tag mentioned above, you’ll move on to create the trigger. Choose “All Pages” which is for any sort of basic Google Analytics. This means that every time a page is loaded, the tag will fire.
In this example, we’ve created a tag for AdRoll, so now we need to tell GTM when to fire that tag. Click on the Triggering box to open up the Trigger options:
When you come to the triggers, you might have ones already created for other tags that you can choose from or you can create a new trigger. To create a new trigger, click on the plus button.
Name your trigger and click on the Trigger Configuration box. From here, you can choose the trigger (e.g. page view, click, form submission, custom event, etc.).
Say you create a trigger, “All Page Views,” the tag will fire anytime someone opens a page on the website.
Say you want to create a trigger for when someone visits a thank you page, here are the steps you’ll take: Click on Page View from the Trigger Type.
Rename the trigger to “Thank You Page” or another term to easily identify what the trigger is. You might use it for different campaigns, or you might have different thank you pages.
Choose Some Page Views, so that it doesn’t trigger on all pages. That’s a sure way to inflate your conversions without meaning to.
Below that, you’ll choose the conditions when the event occurs. The first dropdown has a number of variables to choose from.
The 3rd field is where we define the URL.
Variables
Variables are any value assigned, and are used in both tags and triggers. In tags, a variable captures the dynamic values such as a transaction amount when an item is purchased. In triggers, a variable defines a filter when that trigger is fired–so when someone reaches the /thank-you page, the url variable is /thank-you.
GTM provides some Built-In Variables, which are some of the more commonly used ones. They’re segmented into Pages, Utilities, Errors, Clicks, Forms, and History.
You can also create a User-Defined Variable, which is simply a custom variable that you can create. In some of the examples later in the blog, we’ll use user-defined variables.
Folders
Need a break from us defining tags, trigger and variables? Insert Folders, probably the simplest of all these sections of containers to understand. It’s exactly what you think it is, a folder.
If you’ve used Google Drive, you’re probably familiar with this concept. In Google Drive folders, you can keep track of the spreadsheets, docs, and presentations that you’ve put together. In GTM, folders are used to easily organize your tags, triggers, and variables. It makes it easier when you have multiple people working in GTM and organizing the folders by team members, by projects or type of tags.
To create a folder, click on the Folder tab in the left hand column.
When you’ve defined which items you want to move into the folder, check them in the Unfiled Items:
Click on the Move button at the top of the Folder page and choose the folder that you want to put those items into.
Preview & Test Your Work
Once you’ve created your tags, triggers, variables and grouped them into the folders you want, it’s almost time to launch! We talked about previewing your work back in the Why You Should Care section above. Before you launch, go through the testing process and ensure everything is working correctly.
Mess something up? As you’re testing, you may realize that something happened and you need to remove a tag. No worries. Take a look at your Workspace changes in the Workspace dashboard. Click on the three dots to bring up the options to Abandon Change or View Change.
Launch Your Tags
Yay! You’ve come to the best part of the whole creation process…when all the work that you did to create the tags will come to fruition.
On the next screen, you’ll see the option to create a new version for these changes, to add a version name and any description–so you can easily identify the version, if you need to find it later.
Below that, you’ll see the Workspace changes that you made, the type, when it was edited and by which member of the GTM team.
Verify everything looks good.
Congrats, and happy tracking.
Tag Manager Hacks & Best Practices
Okay, so you’ve created a GTM account, created some new tags, but now we’ve come to the fun part with some GTM hacks and best practices to make it even better for you.
Container Creation
A best practice is to set up an account per company and one container per website. Many companies will not need more than one container. Remember, the key is to consolidate.
Event Tracking
Event tracking is an example of where GTM can be utilized best. Before GTM, if you wanted to track events such as button clicks and video plays, you would have a developer add the tracking code for each. GTM’s value is really seen when you have a bulk amount of codes to add.
Event tracking is super awesome! Has a client ever asked you how many times a visitor has clicked on a link, video, or multiple buttons, and you just weren’t sure? If yes, event tracking is going to be your new bff.
Before you start implementing it, you’ll want to be sure to configure the Built-In Variables: Pages, Clicks, and Forms. This just makes it easy for when you start creating more tags and triggers down the line.
Scrolling, Scrolling, Scrolling
Do you ever wonder if all that content you created on the page, and especially below the fold, is getting any eyeballs on it? You can use tools such as HotJar, which can provide the heat maps, but this is GTM and it has a solution.
Rob Flaherty from Parsnip.io created a plugin that uses jQuery to measure how far a visitor is scrolling down a page.
To get started on this, create a trigger and name it something like DOM Ready, which just means that the scroll depth tag will fire when the DOM is ready.
DOM stands for Document Object Model–but for our purposes, think of it as a whole HTML page. And every time an HTML page (or DOM) finishes loading, the browser will fire a trigger called DOM Ready. Using Javascript, we can hook into this DOM Ready trigger, so that our code also runs every time a browser loads a new page.
Because you want this to fire on all pages when loaded, you’ll choose Pageviews as your event, and to fire on All Pageviews.
Once this trigger is created, move on to creating your tag.
Next, we’ll set up the Variables that we need to make sure this is fired correctly. They’re split into 4 different ones called Category, Action, Label, and Value.
For each of the variables, you’ll create a Data Layer Variable in the Page Variable Types.
The four variables will look like the screenshots below:
Once your variables are created, you’ll want to send that data that’s tracking to the data layer. You’ll create another Google Analytics Tag, and specific to scroll depth.
Add in the variables that you just created to the forms below.
The field titles Non-Interaction Hit, if you have it set to True, means the events will not affect the site’s bounce rate.
Finally, you’ll want to create a trigger to fire when the “event equals ScrollDepth”. The trigger type that you’ll choose is the Custom Event.
Name your trigger, add the event name and save your work. Test your version to make sure everything looks good, and publish your work.
Track Onsite File Downloads
While conversions are important, don’t underestimate the power of micro-conversions. These can come in handy before the conversion or even after the conversion.
For example, we have a client who, after their visitor downloaded the white paper, were given the option to download other PDFs. We wanted to track this to see what visitors’ interests are, so we can offer something different at another time.
To do this, you’ll go into your Triggers and create a new one.
- Choose the Trigger type.
- Click “All Elements”.
- From “This trigger fires on,” choose Some Clicks.
- Change the first dropdown to Click URL.
- Change the second dropdown to matches RegEx (ignore case). It’ll match a regular expression of text string, ignoring the case.
- In the form field, add in the fire on condition. If you want to track a PDF, PPT, PNG, you’ll want to use \.(pdf|ppt|png)$
There may be other types of documents that you want to track, and you can make that change in the form field.
Once your trigger is created, you’ll just need to add it to the tag that will send the data to GA where you can see the downloads. In addition, you can set up a goal, so that you can track this simply in GA.
Track File Downloads Offsite
Cool. So, we can track visitors downloading on our pages, but what if we send that traffic to a link in a social media post or an email? With those other channels, we’re unable to add GTM, but we can hack our way through it.
What we’ll need to do is create a bridge between our site, where our link is coming from, to the place where the visitor ends up.
Set up two tags, one being a GA tag and the other a custom HTML tag, which we showed how to do in the Scroll Depth instructions above.
Cross-Domain Tracking
Tracking traffic across different domains and subdomains can be a pain.
If, for example, you have a client who has a domain on one website, but checkout on another, this section will be helpful for you.
To get started, you’ll want to create a few user-defined variables. Go to the Variable section in GTM, and click to create a new User-Defined Variable.
The first variable that we’ll create is the gaProperty one, which is simply the fastest way to add the GA Tracking ID to all new tags that you’ll create. In the value field, enter in your GA ID, which will look like UA-XXXXXXXX-X (replace the X’s with your numbers).
The second variable that you’ll set up is the gaDomain. This variable is to make sure that the website domain is always set to auto.
The third variable that you’ll set up is the gaCrossDomains, which you’ll set up if you have traffic going from one domain to another.
Now that you have those variables set up, it’s going to make it easier for you to do the cross-domain tracking.
Go into your Universal Analytics tag.
The field name will autofill as you type in. For allowLinker, type in true for the Value. Do the same for cookieDomain. Because you created the gaDomain variable, you can choose that easily here.
Next, under More Settings, click on the Cross Domain Tracking dropdown. Because in the earlier steps, we added all the domains that we want to track in the gaCrossDomains variable, just choose this as the Auto Link Domains. Choose False and False for the Use Hash as Delimiter and Decorate Forms fields.
Make sure you test, debug and publish, and now you’ll be tracking cross domain traffic.
Track Time On Site With Timer Triggers
While GA measures time on site, doing it through Google Tag Manager can measure the visitors with a bit more accuracy.
With Google Analytics, a visitor can spend one minute on one page and GA tracks that. Then, say, he or she goes to the Pricing Page and read a bunch of info. there. Next, he or she closes the tab. That time isn’t counted. It’s really tracking the time on site between two hits versus the amount of time spent on two pages. That’s where Trigger Timers come to the rescue.
Set an interval in the field, and keep in mind that 30 seconds equals 30,000 milliseconds. Limit the trigger to fire only once.
Now that that Timer Trigger is created, you’ll want to create a tag which will push this event to GA. Create a new tag for Timer Trigger GA and it’s going to be an Event Track Type. Add in the variables into Category, Action, and Label to define the tag. Finally, you’ll choose the trigger that we just created, save, test and publish.
Tag Sequencing
Not all tags are created equal, and you may want certain tags to fire before others. If you have a specific order for which you want your tags to fire, Tag Sequencing will allow you to specify if you want the tag to fire before or after another tag.
If you’re looking to establish dependencies then Tag Sequencing can be really helpful. It’s a complex feature offered by GTM. It’s actually a lesson in itself. To learn more about it, read this by Google.
Exclude Internal Traffic
It’s important to block internal traffic from your GA, because this traffic can mess with visitor behavior by skewing time on site and page views–and because internal traffic is not likely to convert, it can show a less than flattering conversion rate.
To do this, go and create a variable and name it IP Address. Choose Data Layer Variable as the Variable type.
Name the Data Layer Variable, and save.
This post first appeared on KlientBoost - PPC Management And CRO Experts, please read the originial post: here