What is Google Tag Manager and how does it help you set up Google Analytics?
To use web analytics systems, advertising services, and other third-party tools, you need to add their code to your site. It’s not difficult if you understand HTML and you’re using a couple of services, or if you have a full-time developer. You start facing problems when you need to make changes to installed code or add new integrations. First, it takes a lot of time. Second, by making changes to one piece of code you can accidentally break the entire site. Luckily, Google has created a great tool to help you out — Google Tag Manager, or GTM.
In this article, you’ll learn:
What is Google Tag Manager?
With Tag Manager Account, you can:
- set up data transmission to Google Analytics, Yandex.Metrica, AppsFlyer, and other analytical systems
- place Google Ads, DoubleClick, Facebook, and other remarketing tags on your site
- place custom HTML scripts on your site to display banners, conduct A/B testing, and so on
- quickly edit tags.
Who is Google Tag Manager designed for?
- Web analysts and internet marketers — to implement external services themselves, create effective end-to-end analytics systems, and track important KPIs
- Specialists in contextual advertising and SEO — for remarketing, evaluating ad campaign performance, and setting goals
- Owners of small sites — to manage web analytics without a developer’s help
- Online marketing agencies — to work quickly and effectively with client accounts
Tag Manager pros and cons
In addition to the features described above, Tag Manager has additional benefits to simplify your life and help you save time and money.
- It’s completely free.
- There are lots of ready-made integrations with other services. You can see the list of all supported 3rd party tags in the help menu.
- It improves the speed of your site by shortening code so pages load faster.
- It has a check and debug mode. You can test how tags operate before adding them to your site.
- It saves all changes in settings. You can return to a previous version at any time if you publish code with errors. You can also find out exactly who made what changes to code and precisely when.
- You can delegate different levels of access to the Tag Manager accounts of your employees or marketers from an advertising agency with whom you cooperate.
- It’s easy to verify your site ownership in Search Console.
- Tag Manager has a large community, an official forum, and a support section where you can find answers to many questions.
But there are also some disadvantages of Google Tag Manager:
- If you accidentally damage the GTM container code when making edits, then all tags deployed with it will stop working. You’ll have to look through the code to correct the error.
- GTM doesn’t offer online support or reports.
Google Tag Manager structure and terms
In Google Tag Manager, you can create multiple accounts for one Gmail address. But often one is enough unless you’re an agency that works with sites for many companies.
The next step above accounts in the GTM hierarchy is the container. A container stores all the tags for your website, mobile app, or AMP page. You can create multiple containers in your account — a separate one for each resource. On the technical side, a container is the main GTM code, which is installed on the site and allows you to run tags for other services.
A tag is a piece of code is a piece of executable code. It can transmit data to analytics systems and other third-party applications, launch remarketing campaigns, send emails to users who have abandoned their carts, change the contents of A/B tests, and so on.
You can use ready-made tag templates:
or create your own tags, if you know HTML:
A trigger is a required condition for firing a tag. It can be set for activating and blocking a tag. A trigger must contain an event: clicking on a button, loading a page, clicking on a link, etc. You can also set filters for each trigger, for example by specifying the URLs of the pages on which the tag should fire.
In Google Tag Manager, all triggers are divided into four groups:
- Page view — activate the tag when the page is just starting to load or when it has loaded completely
- Click — set a trigger for clicks on any element or link
- Interaction with users — view video, page view depth, view site elements, form submission
Triggers in Tag Manager:
A variable is a parameter and its value. You can set filters in triggers using variables. For instance, if you need to track page views of www.site.com/product, you can set up a page view trigger that will only fire when the Page URL variable takes the site.com/product value. In tags, variables are used to store and transfer data about users’ actions on the site, transactions, products, and so on.
Currently, GTM has 44 built-in variables for websites. Just tick the box to active a variable:
How to set up Google Analytics using GTM
Step 1. Create an account with Google Analytics if you don’t have one yet. We’ve described how to do this in detail in our guide to setting up your Google Analytics account.
Step 2. Install the GTM container code on your website. You can read all about this in our article on installing GTM.
Step 3. Create a page view variable. To do this, on the Workspace tab, select Variables → User variables and click Create. In the Variable type field, select the Analytics Settings option from the drop-down list, and in the Tracking ID field, enter the ID of your Google Analytics resource that you want to transfer data to.
Create a name for the variable — let’s say GUA Pageview — and save it.
Not sure where you can find your resource ID? Open Google Analytics, go to the Admin tab, select Resource Settings, and find the tracking ID:
Step 4. Create a tag that will send page view data to the Google Analytics resource. To do this, go to the Tags section, click Create, and select the Google Analytics — Universal Analytics tag type from the list. Specify Page view in the Tracking Type field, and in the Analytics Settings field, specify the variable you created in step 3. Then select the embedded trigger All Pages and name and save the tag.
Step 5. Publish the changes that you just made to your container. To do this, click the Submit button on the Workspace tab.
In the window that opens, specify the name of the new version of the container and click Publish.
Important! If you previously placed Google Analytics on your site manually, you’ll need to delete it and at the same time publish the GMT container. Otherwise, data will be duplicated.
Step 6. Check if data is being transferred to Google Analytics. To do this, log in to your Google Analytics account and open the Real-time — Overview report. This report should begin to receive data:
Possible problems when working with GTM
Problem: Tags work correctly in debug mode but data isn’t received by Google Analytics.
Reason: An invalid tracking ID was specified in your Google Analytics tag settings. Due to this, data isn’t sent to the right resource.
Solution: Enter a valid tracking ID. See step 3 for details.
Problem: When switching to Google Tag Manager, the number of sessions and users dramatically increases.
Reason: The GTM container has been published but the manually installed Google Analytics code is still on the site. Data is being transmitted to Google Analytics both through GTM and through the site code, so it’s duplicated.
Solution: Delete the Google Analytics code on your site.
Problem: You’ve made changes to the Google Tag Manager container, but you don’t see them in debug mode.
Reason: After each change, you must update the preview. Make sure you’ve done that. Or you might have several workspaces and the preview mode isn’t set for the one in which the changes were made.
Solution: Update the preview. Check which workspace is in the preview mode.
Useful links and example of tasks you can solve with Tag Manager
Google Tag Manager in conjunction with Google Analytics gives you a flexible analytics system and allows you to customize the collection of almost any data from your site. We’ve prepared a selection of articles on this topic. Find out what other problems you can solve using GTM.
- How can you handle repeat transactions in Google Analytics? — Learn the reasons for repeat transactions and read our guide on how to set up GTM to avoid duplicate data.
- Declare independence from developers with custom HTML tags in Google Tag Manager — Learn how to create custom tags for conducting A/B testing, posting new elements on the site (such as banners), and dynamically substituting phone numbers.
- The site is not enough: a guide to mobile app analytics — Read about how to track the installation of mobile applications using Google Tag Manager.
- A comprehensive guide to enhanced ecommerce tracking in Google Analytics — Set Enhanced Ecommerce in Google Analytics with the help of GTM.
- How to set up dynamic remarketing in Google AdWords via Google Tag Manager — Learn how to do this with a step-by-step guide.
We also have a webinar called Expert Tips and Techniques for Using Google Tag Manager, in which Andrey Sukhovoy, the head of our analytics department and Pavel Loba, our tech lead, clearly explain how to:
- track scroll depth to determine the effectiveness of sections and authors and to track the effectiveness of pages that take up multiple screens.
- prevent duplicate transactions in Google Analytics
- use Tag Sequencing, Workspaces, Approvals, and other useful options in GTM.
Fill out the form below and we’ll send you a recording of our webinar presentation on expert tips and techniques for using Google Tag Manager by email.