Ebook - Google Tag Manager For Beginners - Analytics Mania
Ebook - Google Tag Manager For Beginners - Analytics Mania
Page 2 of 44
INTRODUCTION
Google Tag Manager is an amazing tool. I have been running AnalyticsMania.com for
almost two years now and 98% of all blog posts are about GTM. It has saved me, my
colleagues and my clients so much time that I cannot even imagine how I could live now
without it.
Need to add a particular tracking pixel to a website? Not a problem! Do you want to track
submissions of a newly created form? Consider it done. All thanks to a thing called Tag
Management.
Instead of waiting (for days) for a busy developer to add those tracking codes you could
do this by yourself. Even though you will not replace developers 100% (and, in fact, you
never should), with Google Tag Manager you (and your team) will become much agiler
implementing new marketing campaigns and/or web analytics tracking.
But where should you start? GTM looks like a tank, which requires some very specific
knowledge, and your regular driver's license will not help much here. Just like any other
tool, GTM has its own learning curve. That's why I decided to create this e-book for GTM
beginners, the first step towards new knowledge and becoming more independent + have
more control over your analytics/marketing tracking codes.
I hope that you will find this e-book useful and if you need any help in that journey, feel
free to contact me at [email protected].
TABLE OF CONTENTS
THE PRE-TAG-MANAGEMENT WORLD............................................................................... 5
WHAT IS GOOGLE TAG MANAGER? ................................................................................... 6
WHY SHOULD YOU START USING GOOGLE TAG MANAGER? ........................................ 7
REASON #1. FAST DEPLOYMENT OF TRACKING CODES ............................................. 7
REASON #2. ALL TAGS ARE CONTROLLED IN ONE PLACE .......................................... 8
REASON #3. TESTING TOOLS ........................................................................................10
REASON #4. SIMPLE (KIND OF) EVENT TRACKING ......................................................10
REASON #5. TAG TEMPLATES .......................................................................................11
REASON #6. VERY ACTIVE GTM COMMUNITY ..............................................................12
REASON #7. VERSIONS ..................................................................................................13
REASON #8. GROWING POPULARITY ............................................................................13
HOW DOES GOOGLE TAG MANAGER WORK? .................................................................14
CREATE A GOOGLE TAG MANAGER ACCOUNT...............................................................17
HOW TO PROPERLY INSTALL GOOGLE TAG MANAGER? ...............................................18
CREATING YOUR FIRST TAG .............................................................................................20
TESTING WITH PREVIEW AND DEBUG MODE ..................................................................26
PUBLISHING THE CONTAINER ...........................................................................................29
SO WHAT IS NEXT? .............................................................................................................30
GOOGLE TAG MANAGER MIGRATION TIPS ......................................................................31
GOOGLE TAG MANAGER BEST PRACTICES FOR BEGINNERS ......................................33
#1. NAMING CONVENTION ..............................................................................................33
#2. GIVE GTM CONTROL ONLY TO THE RIGHT PEOPLE..............................................34
#3. LEVERAGE WORKSPACES .......................................................................................34
#4. CONSULT WITH DEVELOPERS PRIOR TO USING UNKNOWN JAVASCRIPT ........35
#5. TAKE ADVANTAGE OF THE DATA LAYER ................................................................35
#6. ALWAYS TEST BEFORE PUBLISHING ......................................................................35
#7. ASK A DEVELOPER TO ADD VISITOR’S IP ADDRESS TO DATA LAYER ................36
#8. SEARCH FOR READY-MADE CUSTOM AUTO-EVENT LISTENERS ........................36
#9. ASK DEVELOPER TO ADD IDS TO IMPORTANT WEBSITE ELEMENTS .................37
WHICH GTM TOPICS SHOULD YOU LEARN NEXT? ..........................................................37
Page 4 of 44
WHAT OTHER THINGS CAN YOU DO WITH GOOGLE TAG MANAGER? .........................38
A FASTER WAY TO LEARN GOOGLE TAG MANAGER ......................................................39
FREQUENTLY ASKED QUESTIONS....................................................................................40
FINAL WORDS .....................................................................................................................43
That is a long Google Tag Manager e-book waiting for you ahead :) You know what? This
is just a beginning; there are many more GTM topics to learn. However, I am not trying to
scare you off. Definitely not. Google Tag Manager is an amazing tool that I am in love
with, the only problem here is that it takes a lot of time to put all the puzzle pieces together
and become a skillful GTM user.
Luckily, I have a fast-track solution for you. A Google Tag Manager course for
beginners that I have been polishing for a while.
It can be Hotjar, Google Analytics, or some other tool, but they all ask you to add their
code to your site. When a visitor lands on your website, that tracking code is also loaded,
therefore, a visitor is tracked.
Adding that one tracking code to a site is not big of a deal. You just ask a developer and
he does that (sometimes on the same day, sometimes over the course of several days,
but still reasonable because this has to be done only once).
However, not everything is so perfect. Out of the box, GA offers plenty of metrics but to
make really good and thoughtful decisions you need to track much more: interactions
(e.g. clicks, form submissions), sales, etc.
This means more tracking codes must be added to a website. And usually, this is not just
a "one-time project". You need to constantly add new tracking codes and modify/remove
the current ones.
That is where the developer becomes a bottleneck. Since he is working on his own
tasks/projects, marketing/analytics tasks often are a B priority; therefore, you and your
team have to wait. And wait a bit more. And more. If there was a way to add those codes
faster...
Page 6 of 44
That is where the Google Tag Manager (or any other tag management system) saves the
day.
Imagine that Google Tag Manager is a toolbox, where you keep all your tools: a
ruler (Google Analytics), a hammer (Google Ads), etc.
Google Tag Manager also lets you test your tags to make sure they are triggered
when you load a page or click a particular button. Another great benefit: you can change
your tags and the way they work without actually changing the source code of your
website (which you may not be able to do because of slow release cycles or busy
schedule of developers) - instead you just edit tags in GTM user interface and publish
changes with a click of a button.
Many beginners confuse Google Analytics with Google Tag Manager by asking which
one should they use now. The answer is actually both. These two tools do not replace
each other, they work together. Google Analytics is a tool that collects visitor data and
displays it in various reports, while Google Tag Manager is a data transportation method.
It catches website interactions and sends the data over to Google Analytics or any other
tracking tool.
Page 7 of 44
To sum up, Google Tag Manager lets you manage various JavaScript
tracking codes (a.k.a. Tags) on your website. Google Analytics tracking
code is one of those tags.
If you still feel confused about the relationship between Google Analytics and GTM, read
this guide: GA vs GTM - what is the difference?
As I have mentioned before, Google Analytics is not the only tag compatible with Google
Tag Manager. Other examples include:
Once again, let us remember the classic way of how tracking codes are managed:
In many cases, Google Tag Manager gets rid of this hassle and allows making the
process much more effective.
Google Tag Manager speeds up many processes. Changes and new tags (read: "tracking
codes") can be created rapidly and a lot of them do not require code changes to the
website. This is great for marketers because it can really speed up launch time by testing
each change themselves and deploying when ready.
In fact, Lunametrics have published a short case study where their client experienced
a 600% improvement in tag implementation time.
In the past, all tracking codes were coded directly in website's/app's source code. The
worst part, those little pieces of JavaScript code snippets were scattered across different
Page 9 of 44
website's files. So if you need to do a change, the developer most likely needs to: (1) find
all those codes, (2) update them.
I've seen many cases when due to a human error some codes were missed, therefore
this caused inaccuracy in data collection.
Thanks to GTM, this process is made easier: all tags are controlled in one place.
Page 10 of 44
Troubleshooting and correcting tag errors is simplified via Google Tag Manager’s Preview
and Debug mode that shows which tags are fired on a page and which are not. It also
includes information about triggers that fire tags and data contained within tracking tags.
Why is it important? With GTM debugging solutions, you are making sure that your tags
work before you publish them to the live site. Also, let us not forget other useful browser
extensions such as Tag Assistant, Data Layer Inspector, etc. I have listed a lot more of
them in a blog post called Top Google Tag Manager Extensions for Chrome.
Still not convinced? Continue reading this e-book and I'll show you the Pandora's chest.
As I have mentioned before, event tracking involves custom JavaScript codes that a
developer has to add to a website to track events like clicks, form submissions, etc. To
make things easier, Google Tag Manager comes with a feature called auto-event
tracking.
Once you enable a certain trigger in GTM, it will start automatically listening to particular
website interactions. There is still some setup required, but it is relatively straightforward
to do. You can use those interactions to fire tracking codes, e.g. Google Analytics Event
Tag.
Page 11 of 44
Basic events that you can track (by default) in GTM are based on:
Clicks
Link clicks
Form submissions
Time spent on a page, etc.
But wait, there's more! Thanks to the growing community of GTM users and enthusiasts,
the number of auto-event tracking functions constantly increases. You can also add
custom features that record things such as intentions to leave a page, new
comments, video players and much more.
Why is this important? Well, it enables you to gain insight into what actions users take on
your website. Are they engaging with the content? Are they filling out your forms? You
can then use these events to create goals specific to your business in Google Analytics
(or any other tool of your choice, of course).
Just keep in mind, that events that are more complex still might require a
developer's input. Although GTM gives you some super powers, it does not make you
almighty.
GTM comes with a number of important built-in tags for classic and Universal Analytics,
Google Ads conversions, remarketing, and more. This allows a marketer with little or no
coding knowledge to customize tags, without implementing a complicated code or asking
for a developer's help.
Page 12 of 44
Currently, there is a whole bunch of templates at your disposal and the number is
expected to grow in the future.
If you still have some doubts about whether you should start using Google Tag Manager,
here are some additional posts tailored to you:
If you get stuck and can't figure out why one thing or another does not work in GTM, join
our community on Facebook to get help. I have founded this group in January 2018
and there already are more than 3300 members (in August 2018). The group is very
active and constantly growing. So do not be shy and feel free to ask all things GTM. I,
Simo Ahava, or anyone else will definitely try helping you.
Page 13 of 44
Every time you publish a change to a container (where your tracking codes are stored),
GTM creates a new version. If at any time you need to restore to a previous (or any other
existing) version, you can do easily.
Accidentally published changes to a live site although some tags were still incomplete?
Not a problem. Just head over to Versions page and publish a previous version. That is
an easy way to solve all Ooops… situations.
Google is known for launching and killing many products, like Google Glasses, RSS
Reader, etc. But it looks like Google Tag Manager’s future is bright: its popularity is
growing, more and more people are using as their work tool, the number of free and paid
GTM resources is also constantly increasing.
But don’t trust my word. Here is what the data says (taken from Google Trends). Although
the growth has slowed down, let us see where this leads us in the future.
Page 14 of 44
What does it mean? Well, the more people are using GTM, the more blog posts, tutorials
and other types of content will be available. To name a few:
A tag is a piece of code that fires on a website under certain circumstances. It can be a
tracking code, some piece of code that changes the text or a particular website element,
or even a code which changes the color of the browser's address bar, you name it. When
you create a tag, you basically instruct Google Tag Manager to "do this", "do that", "track
page views of this visitor", "track this click and send to Google Analytics" etc.
A trigger is a condition when a tag must fire. Should a tag fire on all page views? Or
maybe on certain clicks? How about successful form submissions? All these examples
Page 15 of 44
are triggers. When a particular condition (or a set of conditions) is met, a trigger is
activated and all the tags (linked to it) are dispatched.
A variable is the final member of this trinity. Variables are little helpers that can be used
in tags, triggers, or even in other variables. A variable can:
Hold a single piece of data (like page URL, website domain, product ID, text of a link,
etc.)
Hold a set of data/settings (Google Analytics settings variable contains multiple settings
related to GA, like Tracking ID, Display Advertising settings, etc.)
Be a complex function (but this one is too advanced for beginners, therefore, let's skip
it, at least for now), etc.
The best way to understand the relationship among tags, triggers, and variables in Google
Tag Manager is to look at an example (see the image below).
Page 16 of 44
Google Ads Conversion Tag is a tag. With it, you instruct the Google Tag Manager to
do what? Track a conversion.
When must this tag fire? The answer is On a Thank You Page (a.k.a. order
confirmation page). This condition is our trigger.
Now, we need to use some additional information in order to send data that is more
precise to Google Ads and to make our trigger actually work.
With Google Ads conversion tag, we can send Order Total which is a variable.
Whenever a successful purchase is complete, Google Ads tag will fetch the value of
the variable Order Total and send it over to Google's servers. Variables are things,
which makes GTM tracking dynamic.
In the trigger, we need to precisely instruct GTM, when to fire. Saying on a Thank
You page is comprehensible for a human. But in GTM, we need to be more specific.
What is a Thank You page? The answer: it is the page of which Page URL contains
"/purchase-successful/" (P.S. this is just an example). In this case, Page URL is a
variable and we have instructed GTM to constantly check Page URL when the page
loads. If a variable (URL) contains "/purchase-successful/", the trigger will be
activated.
So as you can see, variables can be used in both Tags and Triggers. You can also use
them in other variables but you will learn that in the future (not in this guide).
Page 17 of 44
Just like with any other Google's product, you will use the same Google account for GTM.
So if you're already on Gmail (Google Ads, Google Analytics, etc.) you will be
automatically logged in to Google Tag Manager. If not, create a Google account first (I
will not show that procedure, so you're on your own here :) ).
Once you log in, you will be asked to create a new GTM account and a new container.
Page 18 of 44
GTM account works the same as Google Analytics account, usually it's for a
company/business/client, while a container is usually for a website or application. A single
container can contain many tags, triggers, and variables.
However, if there are several websites which belong to a single business and their
structure is very similar (and their tracking implementation is similar), feel free to use one
container on multiple websites.
Thanks to this code (implemented on a page), all the tags will be fired when they are
configured to do so.
If you want to learn more about the proper installation, read this guide on how to install
Google Tag Manager on a website.
If you're using a popular content management system, like Wordpress, chances are that
there is a ready-made GTM plugin which eases the installation process + adds some
additional benefits.
For example, in Wordpress, there is an awesome plugin GTM4WP (by Duracell Tomi).
Not only will it help you easily install GTM, but also you can get some additional data from
it, like page author, page tags, etc. Later, this data can be turned into GTM variables and
used in tags and triggers.
Page 20 of 44
In this case, we'll add Google Analytics tracking to all pages with help of Google Tag
Manager.
A window will slide in from the right. It consists of two parts, Tag Configuration and
Triggering. Click anywhere on Tag Configuration block and choose Google Analytics
- Universal Analytics tag type.
Page 22 of 44
Leave Page view as a Track Type and then in Google Analytics Settings Variable drop-
down choose New Variable. You are about to create your first variable.
Google Analytics Settings Variable is a great time-saver. What you will learn in the future
is that in each Google Analytics tag you will need to separately set various settings, like
GA tracking ID (UA-XXXXXX-XX), cross-domain settings, custom dimensions, etc.
The more GA tags you have, the more inconvenience it will cause. Imagine a situation
when you suddenly have to do a single change in 40 tags, that's 40 manual changes!
Thanks to GA Settings Variable, you can assign it to multiple tags and when you need to
change some configuration, you need to do this only once (because all the tags are using
the settings variable).
Anyway, back to our GA Settings Variable. For starters, we need to insert the tracking ID
of our Google Analytics account (because GTM must know to which GA account should
it send the data).
Page 23 of 44
Go to your Google Analytics account > Admin > Tracking Info (on a Property level)
> Tracking Code and then copy the Tracking ID. Not the entire code, but just the ID.
Go back to the Google Tag Manager interface and paste the ID in a Google Analytics
Settings Variable. Since GDPR is already present, we also need to anonymize visitor's IP
Page 24 of 44
In GA settings variable, go to More Settings > Fields to Set and enter anonymizeIp, set
it to true. This parameter will change the last digit of the IP address to 0 (e.g.
123.233.212.12 -> 123.233.212.0).
P.S. Do not forget to update your GA filters (which exclude internal traffic) accordingly.
Save the variable and you will be brought back to editing mode of the Google Analytics
Tag.
Tag configuration part is complete, now let us set the trigger. In the Triggering section,
click anywhere on that white block and choose the trigger, All Pages.
Page 25 of 44
This condition means that Google Analytics Page View tag will fire on all pages where
Google Tag Manager container code is installed.
That's it! Save the tag. This is all you need to do with basic GA implementation. If
someone asks you to install the standard tracking with Google Analytics, that is all you
need to do, create a Page View tag. It is an equivalent of adding that GA tracking code
(which is provided in the Admin section of GA property) to website's source code.
Google Tag Manager Preview and Debug (P&D) mode allows you to browse a site on
which your GTM container code is implemented. Sites with preview mode enabled will
display a debugger pane (a.k.a. console) at the bottom of your browser screen so that
you can inspect which tags fired and when.
To enable Google Tag Manager Debug mode, click Preview button in the top right corner
of your GTM interface (near Submit button).
After you enable P&D mode, a large orange notification banner will appear.
Page 27 of 44
Now, navigate to the site where the Google Tag Manager container code is implemented,
refresh the page and a debug console window will appear at the bottom of your browser,
showing detailed information about your tags, including their firing status and what data
is being processed.
This console window will appear only on your computer as you preview the site, and is
not visible to your other website visitors. So calm down, if something breaks in the
container, nobody is affected (until you publish all the changes to the live environment)
P.S. If you are having difficulties seeing with Preview and Debug mode, read the guide
on how to fix it. Also, if you want to learn more about the P&D mode, check this blog post
out.
Back to our Google Analytics Page View tag. Once the Preview and Debug
console appears on your website, click Page View event (on the left side of the console)
and see if your GA tag has successfully fired.
Page 28 of 44
Great! Before we start celebrating your first tag, we need to check whether that page view
actually reached Google Analytics (Because the fact that tag fired does not mean that
data was actually sent. For example, a tag may be incorrectly configured and send page
views to the wrong GA account).
The best way to check if the data was actually sent to GA is Real-time (RT) reports. In
Google Analytics, go to Real-time > Overview. Navigate through various pages of your
website and see if all those page views are displayed in RT reports.
If the GA tag is firing but no interactions are displayed in RT reports, read this
troubleshooting guide.
Another useful tool which you should definitely try (if you haven't used it yet) is Google
Tag Assistant. It is a Chrome extension which reports on various Google tracking scripts
and checks if they are properly configured (like Google Ads, Google Analytics, Google
Optimize, etc.).
Page 29 of 44
In the top right corner of the Google Tag Manager interface, click blue the SUBMIT button.
Publish all changes live to your website visitors (and automatically create a version)
Or just create a version. Changes won't go live to the website visitors but you will have
a saved checkpoint to which you can later restore the container (if something bad
happens).
This time, we will choose to Publish and Create Version. Although Version
Name and Version Description fields are not required, it is highly recommended to fill
them out. Once your version history grows to 10, 20 or more versions, those names, and
descriptions will become very useful (when you will try to find out when a certain change
was implemented).
Once you hit the PUBLISH button in the top right corner, your changes will go live and
you will start tracking page views of visitors.
By the way, here is yet another reminder about the GDPR (General Data Protection
Regulation). Even though it was simple to implement GA tracking, you need to do
additional configurations if you receive a lot of traffic from the European Union countries.
First, you need to implement a Cookie Consent banner. And once you get a consent from
a visitor to use his/her personal data (because various tracking IDs are also considered
Page 30 of 44
as PII), then you can fire your tags (like Google Ads tags, Facebook Pixel, etc.). On a
brighter side, it looks like in the nearest future we will not have to ask a permission to set
cookies for analytics purposes).
This is a pretty tough topic (GDPR cookie consent + GTM + your tracking tools) but I
cover it in my Google Tag Manager course, so if you want a fast-track, join it.
SO WHAT IS NEXT?
My suggestion: start using GTM on all new projects. The size does not matter, it might be
a simple website or it might be a larger e-commerce business. Even if you don't plan to
track various events and just need the basic page view tracking, still use GTM. Google
Tag Manager first, then Google Analytics Page View tag. Because you never know,
maybe one day you will suddenly need to track something that X project and you'll be
able to do that in no time (because GTM will be already implemented there).
But what about those projects/websites which already have some Google Analytics or
other tracking tools implemented (not via GTM)?
The most recommended: migrate all the hardcoded tracking scripts from the
website's source code to Google Tag Manager. This process is not easy and will
require both your and developer's input but in the long run, it will definitely pay off. Just
think about how long marketing campaigns were delayed because the developer was
busy on other projects/tasks. With GTM, you could implement tracking much faster and
you/your team would become much agiler.
You can implement new tags with GTM while old tags are still hardcoded (P.S. in this
contest, "hardcoded" means that tracking scripts are added directly to the website's
source code). Just make sure that you are not tracking the same interactions with both
hardcoded script and GTM (otherwise, your data in reports will be duplicated).
Do nothing. I do not like this one :(
Page 31 of 44
Audit all current tracking scripts hardcoded on a website (you will need a developer's
input as well).
Prepare a migration plan (which tracking codes and which tools must be migrated,
what are the priorities). If the project is large, I would suggest migrating one tool at a
time (nobody likes big bangs).
Replicate all that tags in GTM, which should replace the hardcoded scripts.
Publish all the changes in the container. A developer (at the same time) must remove
hardcoded scripts.
Start monitoring results and keep looking for anomalies (sudden increase or
decrease in page views, users, bounce rate, transactions, etc.)
If possible, have a verification period (usually, applicable to Google Analytics). It is a
technique when you have both hardcoded GA and GA (via GTM) on the same
website. Hardcoded GA continues sending data to the current (original) GA property
while GTM + GA are sending data to a test property.
Page 32 of 44
This technique is also described in Lunametrics guide. After a while, you then check
both properties and see if the data is similar. If no, dig deeper with a developer and
try to identify the causes of those discrepancies. Once you reach the point when both
properties have similar data in their reports, ask a developer to remove hardcoded
tracking (while you change the tracking ID in GTM) and start sending data via GTM
to the original Google Analytics property.
To avoid losing some data while you and developer try to "flip the switch" (when you
publish the container and a developer removes the hardcoded scripts), you can try
using a "blocking trigger" technique (which, again, is also described at the end of
Lunametrics guide). That method is a bit more advanced if you're very new to GTM,
but once you get your hands on the Data Layer and Data Layer Variable, the ice will
be broken.
By the way, this topic is also explained in greater detail in my Google Tag Manager
course (including my personal GTM migration checklist). Feel free to join and learn
GTM faster.
Page 33 of 44
I just can’t emphasize enough how important to me this Google Tag Manager best
practice is.
If you have used GTM for real, then you may have found that the number of tags, triggers
and variables can grow very quickly into a hard to manage the mess. Therefore, you
should use clear naming guidelines that will help you to manage your GTM
implementation far easier. Easier for you and your teammates. Easier = less risk, less
time, and less money wasted on tagging. Otherwise, this will happen:
Unfortunately, I could not find the original author of the meme above. I just remember that I saw it a long time ago on GTM Google+
community and then recreated.
Page 34 of 44
Include track type if you are creating Google Analytics Tags. For example, you can
have Pageview, Event, or Social in the tag name. For AdWords Tags, you can have
the Tag Type, such as Conversion or Remarketing, in the name.
Include specific pages. If a tag should fire on a specific page or a set of pages (like
a subdirectory), then include the page/subdirectory in the tag name. Examples:
GA Pageview – Contact Form.
AW Remarketing – Thank You Page.
For more naming convention tips read the following resources:
Naming conventions by Lunametrics.
Naming conventions and setup tips by Google.
Google tag manager is a very powerful tool and if used irresponsibility or without proper
thought, planning and testing, can break your website functionality. So you should limit
the access to this tool to only those who are actually involved in tag deployment.
GTM allows you to delegate access to other users at the Account and Container level.
Users can be granted the ability to view or administer other users at the Account level
and can be granted read, edit, approve, or publish rights at the Container level.
This Google Tag Manager best practice is especially useful for larger teams. In GTM,
workspaces enable you to create multiple and differing sets of changes to your container.
Different users and teams can work on these sets of changes in separate workspaces at
the same time to independently develop and test tag configurations. Learn more
Page 35 of 44
If you spot online some custom Javascript code published by top influencers in Tag
Management industry or Digital Analytics in general (e.g. Simo Ahava or Stéphane
Hamel), then feel free to use their codes without a doubt in your GTM containers. At least
I would do so. They are respected and well-known professionals, and it is very unlikely
that they will publish some low-quality material.
However, if you do find a possibly useful code published by the lesser-known author, I
highly recommend consulting with a developer (if possible) prior to using it. Although I
always talk with my devs about posting Javascript codes in my blog posts and GTM
containers, it does not mean that everyone does.
This topic is more advanced (you will learn it in the future). However, you should definitely
not postpone learning about it.
Google Tag Manager Data Layer is incredibly helpful when it comes to custom data and
triggers. Although it is a pretty difficult concept to master for beginners, it is one of the key
parts of tag management. So whether you like it or not, you will have to understand it.
If you want to track certain parts/features of your website and default GTM auto-event
listeners do not catch any interactions, my recommendation would be utilizing Data Layer.
Just ask your developers to put the data you want into Data Layer, then Google Tag
Manager will easily access it and use it in triggers, tags or variables.
This seems like a no-brainer, but sometimes we are still doing this (when the change is
minor and we are in a hurry). There should be no excuse for this!
Page 36 of 44
Regardless of what change was committed in GTM container, it always must be tested.
GTM offers a great Preview and Debug mode, there are other debugging tools out there
(e.g. Tag Manager Assistant) which help you test and rapidly spot bugs. Use them!
If you are following Google Analytics best practices, you are already filtering out your
company’s internal traffic. But this affects only Google Analytics reports.
An auto-event listener is a Javascript function(s) which fires a Google Tag Manager event
(a.k.a. Data Layer event) when a particular interaction occurs on a webpage. That event
can be used as a trigger to fire tags. GTM offers a bunch of built-in auto-event listeners,
such as Click, Form listeners.
But the list of auto-event listeners does not end here – there are plenty of custom listeners
online that you can make use of, e.g. this Extended Library of GTM Recipes.
So if you want to track a specific element/action on your website, check whether a ready-
made auto-event listener is publicly available.
Page 37 of 44
This tip is useful when you have several call-to-action buttons on the same page but in
different locations. They all have the same CSS class and target URL. You want to track
them separately in Google Analytics. What should you do here?
Then in GTM enable built-in variable “Click ID”. After a click, in Preview and Debug
console’s Variables tab you’ll see that Click ID equals to either “menu-button” or “footer-
button” ID. You probably have no clue what I'm talking here about. Google how to track
button or link clicks and you will catch my drift.
This list of best practices is definitely not complete. If you want to read more, look at this
blog post.
Link click tracking (the guide is visually a bit outdated but the principle of configuration
works even today)
Button click tracking
How to insert variables in Google Tag Manager?
Scroll tracking
Video tracking
Page 38 of 44
Data Layer
Custom event trigger
Google Ads Conversion Tracking
Facebook Pixel with Google Tag Manager
Google Analytics Ecommerce Tracking
This list is far from complete but you should notice a significant increase in your Google
Tag Manager knowledge.
Just like any other tool of such complexity, Google Tag Manager has its learning curve,
which in some cases might look very challenging. To save you a lot of time and explain
everything in a clear manner, I have created a Google Tag Manager online
course (polished for a long time). By enrolling to it, you will learn ins and outs that a GTM
beginner should definitely be aware of.
With many practical tasks, 9 hours of video material, downloadable resources and my
personal checklists/workflows you will cut many corners and avoid a lot of mistakes that
I've made in the past. Instead of spending months or years trying to figure everything out
by yourself, you will be fully ready much quicker.
Lifetime access, free updates, and course completion certificates are also included. You
can find out more here or click the image below.
Page 40 of 44
#1. Who should use Google Tag Manager? Anyone who wants to add/remove/edit
various tracking codes on their (or their client's) website. This usually includes digital
marketers, web analysts, SEOs, PPC specialists, owners of e-commerce businesses,
etc. With Google Tag Manager you'll be much more in control of what's being
tracked/measured on a website/app.
#2. Does GTM work only with Google Products? No. Google Tag Manager plays well
with a lot of platforms/tools. It offers a wide range of predefined tag templates (like Google
Analytics, HotJar, Twitter Universal Tag, etc.) and, additionally, you can add custom
codes with help of Custom HTML tag.
#3. Is Google Tag Manager free? GTM has both Free and Premium plan. A free plan
is more than enough to small and medium businesses. Large enterprises can benefit
from a paid Google Tag Manager 360 option. You can compare both pricing plans here.
#4. What if my content management system does not allow to place GTM code in
the <head>? Don't worry, this is not the end of the world. Actually, GTM <script> code
can be placed anywhere on the website. The higher you put it in the website's source
code, the sooner it will load, therefore your web tracking will be more precise. But if your
CMS allows placing all codes only at in the <body> tag, that is still fine. The most
important thing is that you must not place the <noscript> code in the <head> of a website.
All other variations are allowed (e.g. both codes can be placed right after the opening
<body> tag or both codes before the closing </body> tag).
As for the 1st option, go to your WordPress Admin panel, navigate to Appearance >
Editor and edit the Header.php file. Lunametrics have published a guide how to do that.
Page 41 of 44
Personally, I recommend the second option, using a plugin. But not just any plugin,
the GTM4WP plugin, also known as GTM plugin by DuracellTomi.
After you have successfully installed and enabled the plugin, go to Settings > Google
Tag Manager, enter your Google Tag Manager container ID and set up other options.
The reason why I like this plugin is that it also gives me additional options and data that
can be easily available for web tracking, e.g. Post author, Post Category, Post Tags, etc.
#6. Do I need to learn to code in order to use Google Tag Manager? No, but
JavaScript, HTML, CSS, Regular Expression, DOM knowledge will be super useful and
will open an entirely new horizon of possibilities for you in web tracking with GTM. But
even without these skills, you can achieve some great results.
#7. Do I still need developers after I start using Google Tag Manager? It depends on
what your goals are. Even though a lot of new opportunities open to digital marketers
after they start using GTM, sometimes a developer's help is still necessary. Such
interactions as video player actions, scroll tracking, element's appearance on the screen,
etc. will be easy for you to track (as you get more experienced with GTM). But if you need
Page 42 of 44
some server-side data (which is not accessible by Google Tag Manager), for
example, user ID, user's pricing plan, you'll need to cooperate with the developer.
#8. Can I use the same GA Tracking ID in multiple GTM containers? Yes, you can.
This is common for digital marketers because you or your client might have several
different websites that are different regarding their structure, CSS/HTML, etc. So it might
make sense to create several GTM containers with their own set of triggers, variables,
etc. and to create Google Analytics tags with the same tracking ID. This means that all
this data from different Google Tag Manager containers will be sent to the same Google
Analytics property.
Google Tag Manager Community on Facebook (recommended and the most active)
Google Tag Manager Community on Google+
Google Tag Manager Forums
Stack Overflow
#10. Can I break a website with GTM? Yes, you can. With great power comes great
responsibility. Using poorly tested or unknown/suspicious scripts found online can break
some functionality on your website. A rule of thumb would be to consult with developers
before deploying custom JavaScript. On the other hand, it's much harder to break
something with built-in triggers and variables. Actually, I cannot think of a situation where
this might happen (but that does not mean it's impossible). Therefore, built-in GTM
tracking functionality should always be a priority.
#11. Does Google Tag Manager store any data about visitors? #GDPR. Google Tag
Manager does not store any data about the visitor; it's just a system that helps you
transport the data to third party tools. That transportation occurs only client-side, i.e. on
his/her browser.
#12. What is a Google Tag Manager recipe? I am not sure about the origin of this term
but I give the attribution to Lunametrics. GTM recipe is a read-made Tag Manager
container template which can be easily imported into your GTM container. As a result, it
automatically creates a set of tags, triggers, and variables that are already configured. All
you need to do is enter your tracking IDs or other settings (depends on a recipe and its
instructions) and you are good to go. I have collected a large library of free GTM Recipes,
which is at your service.
Page 43 of 44
FINAL WORDS
GTM is one of my all-time favorite tools that has saved me a lot of time, helped become
agiler, and marketing/web analytics. In this Google Tag Manager e-book for
beginners, you have learned that GTM is like a middleman between a website/app and
3rd party tools (e.g. Google Analytics, Google Ads, Facebook pixel).
Back in the old days (which are continuing until this moment), all tracking codes were
controlled by developers who had to add them to the website's source code. This workflow
caused several problems. To name a couple of them:
Developers were too busy; therefore, marketers/web analysts had to wait days or even
weeks to have their tracking codes implemented.
Multiple tracking codes meant that they were scattered across different places of the
website that meant more difficulties in the maintenance of the code.
Thanks to tag management systems (like Google Tag Manager), adding, editing and
removing tracking codes have become much easier. In a single interface, marketers can
control codes (read: tags) of various tools, like GA, FB Pixel, etc. To make things much
easier, most popular tools can be controlled with help of tag templates, which do not
require coding knowledge.
Also in this e-book, I've explained what tags, trigger, and variables are in Google Tag
Manager, what is their role and how are they connected with each other.
Tags are various pieces of code (or templates) which are activated under certain
circumstances. Triggers are those conditions that activate tags. And variables are little
helpers which can hold data (or some useful settings/functions) and can be inserted in
tags, triggers, and even other variables.
There is still a lot for you to learn about GTM but I hope that this e-book helped you take
the first step towards new possibilities in your marketing/analytics.
Page 44 of 44