Google Tag Manager Guide
Google Tag Manager Guide
Overview 2
Extra Resources 10
Wrap Up 10
Copyright © 2021 Loves Data Pty Limited www.lovesdata.com Version: February 2021 Page 1
Google Tag Manager Guide by Benjamin Mangold
Overview
Google Tag Manager allows you to streamline your analytics implementation by allowing you to
manage your tracking and advertising tags centrally. And you can also add additional tags without
needing to touch the code of your website.
Although Google Tag Manager does make for a cleaner implementation, it doesn’t necessarily
remove the need for technical expertise. In some cases, you will still need help from your web
developer to implement more complex tracking requirements.
Anybody who has more than one tracking tag on their website is likely to benefit from setting up
Google Tag Manager. Apart from managing your tags centrally, most custom interactions can be
tracked with Google Tag Manager, without requiring website changes. For example, if you want to
track the number of people clicking on a particular website promotion, form completions, or
embedded videos, these can generally be configured directly within the tool.
Copyright © 2021 Loves Data Pty Limited www.lovesdata.com Version: February 2021 Page 2
Google Tag Manager Guide by Benjamin Mangold
Think of your Google Tag Manager account like your Google Analytics account: each account
should only be used to track websites for one company. If you're looking after tracking for
multiple, unrelated companies (for example, if you work at an advertising agency), then you
should create a separate Google Tag Manager account for each of your clients.
Container
Within your Google Tag Manager account, you can set up separate containers (these are like
profiles within Google Analytics). Creating a new container will give you a unique piece of
JavaScript that will need to be installed on your website. If you’re using Google Tag Manager to
deploy Google Analytics, you should install only this JavaScript piece and remove your separate
Google Analytics tracking code.
Copyright © 2021 Loves Data Pty Limited www.lovesdata.com Version: February 2021 Page 3
Google Tag Manager Guide by Benjamin Mangold
Data Layer
Using a data layer provides additional flexibility when implementing Google Tag Manager on your
website. Using a data layer is a way of consolidating the data you need for your various tags in a
way that is easy to access and pass to Google Tag Manager. You can use the data within tags, or
even to create conditions that trigger certain tags.
You can set up a custom data layer within your website’s code to pass details through to Google
Tag Manager. This does require implementation within your website and should be dynamic
based on the particular data you are passing. For example, if you want to measure ecommerce
transactions, then you can feed these details into your custom data layer based on the particular
purchase that has occurred.
Tags
Tags are the various snippets of code on your website which typically perform tracking and other
analytic functions. For example, you might have Google Analytics tags, Google Ads tags and other
third-party tracking tags. These can all be deployed through Google Tag Manager instead of being
installed directly in your website’s code.
Copyright © 2021 Loves Data Pty Limited www.lovesdata.com Version: February 2021 Page 4
Google Tag Manager Guide by Benjamin Mangold
Triggers
Triggers allow you to decide when to fire a particular tag. For example, let’s say you want to fire a
tag only on the ‘thank you’ page of the website – perhaps a conversion tracking tag or a Google
Analytics ecommerce tag. You could simply define a trigger for pageviews where the URL path
matches your thank you page, then attach that trigger to your tag.
Variables
Variables act as placeholders for data that you can reuse in your Google Tag Manager tags,
triggers and even within other variables. For example, we can create a Google Analytics settings
variable that stores our Google Analytics tracking ID. This makes it easy if you have multiple
Google Analytics tags and ever want to change the tracking ID. You could also feed the value of a
transaction into a variable and then use that variable to decide when to fire a Google Ads tag.
Copyright © 2021 Loves Data Pty Limited www.lovesdata.com Version: February 2021 Page 5
Google Tag Manager Guide by Benjamin Mangold
● Google Ads
● Google Optimize
● Facebook
● Any other tags (including custom JavaScript tags)
Copyright © 2021 Loves Data Pty Limited www.lovesdata.com Version: February 2021 Page 6
Google Tag Manager Guide by Benjamin Mangold
Log into Google Tag Manager and create your account and your first container.
Step 2
Install the Google Tag Manager code on all the pages of your website as high up in the <head> tag
as possible. And install the Google Tag Manager <noscript> fallback code immediately after the
opening <body> tag.
Copyright © 2021 Loves Data Pty Limited www.lovesdata.com Version: February 2021 Page 7
Google Tag Manager Guide by Benjamin Mangold
Step 3
If you want to use Google Tag Manager to implement Google Analytics on your website, then start
by checking which version (or versions) of Google Analytics you currently have implemented on
your website.
If you’re using Universal Analytics, then you will need to create a Google Analytics tag for Universal
Analytics in your container and add your Google Analytics tracking ID (for example UA-123456-1).
If you’re using Google Analytics 4 (GA4), then you will need to create a GA4 Configuration tag for
Google Analytics and add your measurement ID (for example G-A1B2C3).
Or if you’re using both types of Google Analytics tags on your website, you will need to create both
in Google Tag Manager.
You can then specify when you want to trigger the Google Analytics tag (or tags) to fire – selecting
the default option of ‘All Pages’ will mean that the tag will load and send data to Google Analytics
on every page that has the Google Tag Manager code installed.
Step 4
Test your tags work correctly on your website by using the ‘Preview’ option within Google Tag
Manager. To do this click on the drop-down arrow to the right of ‘Publish’. Now open a new
browser tab and navigate to your website. A panel will load at the bottom of your browser and will
allow you to see which tag(s) fire on particular pages.
Step 5
Now it’s time to publish your container which will make all of your tags live on your website. To do
this click the ‘Publish’ button and confirm that you would like to send your container live. When
you do this it’s important to ensure you’ve removed any Google Analytics tracking code (or other
tags) that were hardcoded in your website. If you publish the same tag and have it hardcoded, you
will have the same tag firing twice on each of your pages (or interactions) which can cause havoc
to your data.
Copyright © 2021 Loves Data Pty Limited www.lovesdata.com Version: February 2021 Page 8
Google Tag Manager Guide by Benjamin Mangold
1 Create a list of all the tags on your website and the page(s) they are
implemented.
4 Add the Google Tag Manager container code to all of the pages of
your website.
6 Optional: Work with your web developer to add a custom data layer.
This is generally required if you’re using an ecommerce platform that
does not provide a Google Tag Manager integration.
7 Check that variables have been enabled (or created) for any
information you want to use in your tags and triggers.
10 Test all of your tags using the ‘Preview’ mode in Google Tag Manager.
11 When you’re sure that all of your tags are firing correctly
– simultaneously publish your container inside Google Tag Manager
and remove all of your hard coded tags and customizations from
your website.
Copyright © 2021 Loves Data Pty Limited www.lovesdata.com Version: February 2021 Page 9
Google Tag Manager Guide by Benjamin Mangold
Extra Resources
● Getting started: https://lovesdata.co/InQnJ
● Using triggers: https://lovesdata.co/bnjRJ
● Event tracking: https://lovesdata.co/dfOJG
● Scroll-depth tracking: https://lovesdata.co/RvS52
● Tracking YouTube videos: https://lovesdata.co/Gw0LG
● Using the visibility trigger: https://lovesdata.co/a7wEc
● Cross-domain tracking: https://lovesdata.co/8JKkP
● Site search tracking: https://lovesdata.co/GkElk
● Tracking forms: https://lovesdata.co/9kOme
● Pausing tags: https://lovesdata.co/Grz9d
● How to test your tags: https://lovesdata.co/ibiya
● Using environments: https://lovesdata.co/50bpc
Wrap Up
– Benjamin
Copyright © 2021 Loves Data Pty Limited www.lovesdata.com Version: February 2021 Page 10