The‌ ‌best‌ ‌practices‌ ‌for‌ ‌using‌ ‌Google‌ ‌Tag‌ ‌Manager‌ ‌ (GTM)‌

01 Apr 2021

How is your website’s analytics tracking going? You can always make it better! In our previous blog post, we discussed the fundamentals of Google Tag Manager (GTM) — a helpful tool that enables you to manage all tracking codes from all services (Google Analytics, Google AdWords, Quora Pixel, etc.) in the same container where every detail is configurable via a user-friendly web interface.

Like all other advanced digital tools, Google Tag Manager has its own secrets and best practices. Following these will help you make your analytics tracking as efficient and smooth as possible. Let’s begin getting acquainted with some of GTM best practices right now.

Google Tag Manager best practices

Order in your GTM account

Your Google Tag Manager account can hold multiple containers. A container, in its turn, can hold multiple tags. This is actually the key principle of GTM’s work: that you create your tags in the dashboard and they shape your container — a JavaScript code snippet that you then publish to live.

According to Google’s recommendation, the best practice is to only use strictly one GTM container per website (or application) and one account per company. Having multiple containers per website and multiple accounts per company may result in tracking issues that are not always easy to diagnose.

Following the naming conventions

Similar to your account, your Google Tag Manager components (tags, variables, and triggers) need perfect order and consistency. Establish naming conventions for them so you do not end up having a mess. This is especially true for teams where multiple people work with the same GTM container.
All tags are sorted alphabetically, so it is a good idea to start every tag name with the service name (for example, “AdWords — Remarketing”). Whenever there are specific pages involved, include them in the naming (for example, “AdWords Remarketing — Thank You page”). Use descriptive, detailed names for your events (e.g. “Click on the Subscription button from the blog page”). Make sure the naming is consistent throughout all your tags, especially if you have multiple team members working with the container.

Organizing tags into folders

The best practices of using Google Tag Manager also encourage you to leverage the GTM folder functionality. This will enable you to quickly find the necessary tags every time you need them. There can be many ideas for GTM tag grouping — you can organize them by department (e.g. Marketing, Sales, Design, etc.), by type (e.g. third-party services, social media, paid search, etc.), by section of the website, by project, or in any other way that works best for your company.

Using workspaces

Another good practice, especially for large or multiple teams working on the same container, is to use GTM’s workspaces functionality. Every workspace is a place to work on your changes that becomes a separate container version so that later all changes can be synchronized. It allows multiple users to work simultaneously in different workspaces without overwriting each other’s changes or accidentally publishing each other’s unfinished changes. It is also possible to revert to the previously made configuration version.

Some of the best practices of Google Tag Manager workspace management include having teams or individuals work in separate workspaces, using descriptive and consistent naming practices to indicate what has changed in a version, keeping sets of changes small, utilizing workspaces to group common changes, and more.

Taking care of access and permissions

The next item on the list of Google Tag Manager best practices is to make sure you grant your GTM container permissions to the people you trust and who know what they are doing. Based on the permission level, they need to be well familiar with your website’s analytics tracking, have knowledge of Google Tag Manager, and follow your GTM naming conventions.

GTM has four levels of permissions per container that you can configure on the “User Management” tab for every user or user group. These levels are “Read,” “Edit,” “Approve,” and “Publish,” with “Publish” being the most responsible one. Permissions can be inherited (like from a group of users or through admin privileges) or directly granted. Directly granted permissions override the inherited ones.

Using helpful built-in variable types

GTM has plenty of variable types ready out-of-the-box. Using the optimal ones is part of Google Tag Manager best practices and can greatly facilitate your GTM management. For example, instead of adding the Google Analytics tracking ID in every single GA-related tag, you can use the special Google Analytics Settings variable type to configure your GA settings across multiple tags once and for all.

Previewing all tags before publishing

Thanks to the Preview and Debug mode in Google Tag Manager, you are protected against the risk that your tags fail. There can be lots of reasons why tags may refuse to fire — for example, incorrect settings. So one of the incredibly important GTM best practices is to remember to check every single tag you add before publishing your Google Tag Manager container. You can additionally equip yourself with debugging tools for GTM that come as Chrome extensions such as Tag Assistant Legacy, Dataslayer, GTM/GA Debug, and others.

Utilizing a data layer

When discussing the Google Tag Manager best practices, we surely need to mention data layer usage and this topic deserves a little more attention. Google Tag Manager data layer is a smart feature for tech-savvy users, incredibly helpful for tracking specific parts or features of your website. When the standard GTM functionality does not catch the necessary events, Data Layer will always be able to cope with it. According to Google, Google Tag Manager works at its best with a data layer and has the maximum levels of flexibility, portability, and ease of implementation.

A data layer, or a virtual layer, is a JavaScript array that contains the data you want to pass to Google Tag Manager. GTM will reference this data in the data layer and use it in its triggers, tags, and variables. To use a data layer, you will need to add the following snippet to the head of the page above the GTM container code (and further populate it with data):

<script>
dataLayer = [];
</script>

When developers need to add or update the data in the data layer, they use the dataLayer.push method. There is a special “event” variable in the Google Tag Manager data layer that helps GTM fire specific tags when users interact with specific interface elements.

Using tools like dataLayer Inspector+

Since working with a data layer is complicated, extra data layer management tools can be very helpful. One of them is the dataLayer Inspector+ extension for Chrome. It is responsible for easy monitoring and debugging of the data layer while tracking the Google Analytics activity.

DataLayer Inspector+ helps you add your Google Tag Manager container to your website, keeps track of what data is pushed to the data layer and when, as well as what data is sent to Google Analytics. DataLayer Inspector+ also checks if there are any data layer issues. Among some other interesting features are simulations of data pushes, the ability to work with the containers not published on the site, hiding particular events, and more.

Respecting privacy: GTM and GDPR

The General Data Protection Regulation (GDPR) that came into effect in May 2018 established new privacy rules for websites getting visitors from the European Union. If your website uses any mechanisms that identify users and send their data to third-party services for processing, you must get users’ explicit consent. Google Tag Manager manages tags for marketing and analytics tracking services so you will need a GDPR aware setup for it.

Google Tag Manager should be configured to only fire the tracking tags after user consent has been collected through the cookie consent banner displayed on your website. A user will accept or decline the tracking or configure more specific details of their consent by clicking the special banner option and going to the tracking settings.

The information about the user’s consent has to be sent to GTM so it knows when to activate the tags. The best practice is to push this information directly to the Google Tag Manager data layer as variables. There are specially developed add-on plugins that take care both of the banner and the Google Tag Manager data push.

Let’s take your marketing and analytics tracking to a new level

We would love to help you follow the best Google Tag Manager practices and get the most of this great tool. You can reach out to our team to have your tag management set up properly or if you want us to review and optimize the configuration of your GTM containers.

Following the best practices in everything,

your Golems

Comments

An
Anonymous
11 + 4 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.