Google Tag Manager (GTM) is probably the single most useful tool that your team can use to collect data and inform smart marketing decisions.
Understanding the benefits of GTM and how to properly utilize it can be a challenge, so we’ve put together this guide as a reference point.
After reading this post, you’ll know how to set up your own account and get the most out of it (or upskill with a Google Tag Manager course).
Table of contents
Solving analytics problems with tags
Tags are snippets of JavaScript code added to a webpage to collect data and information. They help you monitor website or app visitor activity so you can optimize your site based on behaviors.
Most websites need several tags in order to track different behaviors and user flows, like form submissions or page clicks. The more tags a website has, the more difficult it can be to manage.
GTM doesn’t store information or offer reports, it just collects the data. This is its biggest difference with Google Analytics, which allows you to analyze the data and look at reports.
(from our Google Tag Manager course)
Enter Google Tag Manager.
GTM is not the only tag management tool available, but it is the most accessible. It’s designed to work exclusively with Google Analytics, which is why we’re focusing on it. Here are a few others:
GTM helps marketers get the customer data they need without habitually relying on a developer as the middle person. Here’s how:
Stay organized
Without a tag manager, a developer will need to manually add tags to your site, and configure rules for each instance. Once in place, they’ll have to manually monitor activity, troubleshoot issues, discard expired code when new code is added, avoid conflicts, and so on.
This can be time-consuming and costly. Tag management streamlines the entire process.
With GTM, you can set up individual tags for all the platforms from which you want to extract information regarding certain events (for example, purchase events on Google Ads).
(from our Google Tag Manager course)
Tag managers minimize the amount of hardcoded code you need to deploy across your website and allow you to house all code snippets in one central hub, keeping all of your tracking data neat and organized. And, it’s user-friendly—you don’t need to be a developer to make code implementations or changes.
Think of tag management as a managing editor that oversees your content marketing operation. You can collate your publishing schedule, assignments, tasks, and documents in one place, and even automate activities, but without someone monitoring the workflow, the system will likely crumble.
So while you don’t need a developer to monitor a tag manager, you do need personnel to keep an eye on it and implement more complex tasks like advanced tracking setups, custom JavaScript variables, or dataLayer configurations. That said, don’t cut IT out completely. Complex tagging tasks may still need to be implemented via a rule-driven, graphical interface.
Keep technology costs down
Bugs and barriers are inevitable, but while GTM does simplify tracking management, it does not eliminate the need for proper implementation. Debugging still requires understanding dataLayer structure, triggers, and tag firing logic.
A faster launch means your team has more time to work on other tasks, maximizing valuable resources. GTM is also completely free, so your team doesn’t need to allocate any of their budget towards another marketing software.
*Note: Google Tag Manager 360 (enterprise users) comes at a cost.
Still, mistakes can and do happen. To keep costs down and avoid doubling back to fix user error, follow these best practices:
- Define your goals and track what you actually need to measure, rather than casting a wide net to capture data you don’t need and won’t analyze;
- Avoid piling too many tags on every page, as that will slow page load down;
- Make sure to discard or disable unused tags, especially after running a test, and deciding not to proceed past trial;
- Properly test and validate custom HTML tags in Preview Mode before publishing;
- Ensure you set up analytics alerts and consistently QA new implementations to detect buried issues;
- Retain publish rights to personnel who are familiar with the system, as giving account privileges to unqualified team members could jeopardize activity.
Increase the value of your analytics
Google Tag Manager doesn’t have built-in reporting and analytics capabilities. Rather, it helps deploy tracking scripts (tags) that send valuable information it collects to Google Analytics 4 for analysis.
Setting up GTM
(from our Google Tag Manager course)
While GA4 provides essential insights—like real-time pageviews, traffic sources, and top-performing pages—GTM allows for deeper tracking, like button clicks, form submissions, and user journey analysis, helping you better understand user behavior.
Your basic analytics tool can find things like:
- Real-time pageviews
- Location and device information of site visitors
- Traffic sources
- Top landing pages/blog posts
But tags help you go deeper to discover things like:
- How users navigate your site
- Which pages generate the most conversions
- Where website visitors are most likely to leave your site
How to set up Google Tag Manager
To get your Tag Manager account set up, follow these steps:
1. Start with your goals
Determine your tracking goals to decide which types of tags you need to create.
You can create tags for
- Google Ads tracking (remarketing, conversion tracking);
- Monitoring form submissions or button clicks, and
- third-party integrations that you can connect to track information from sites like Hotjar, Oktopost, or Pinterest.
Create a tracking strategy first before heading over to Google Tag Manager and creating your account so you know which tags to set up.
2. Set up an account
You create a Google Tag Manager account through your Google email, so choose an admin or owner of the GTM account first. After that, you can share permissions with others on your team who need to access it.
Log in with your Google account, then click Create Account on the main dashboard to start setting up shop:
From here, you’ll need to name your account. Best practices dictate naming it after your business to keep your tag management straightforward.
Next, set up your container. A container is where all of your tags will live, so you should name this after your site or URL.
Choose the type of platform your site or app lives on before clicking Create. This could be the web, an iOS or Android mobile app, AMP use, or server use:
Your next step is to install the container snippet onto your website. This is a snippet of JavaScript that needs to live on every page in order for the tags to properly track activity.
There are two parts to this snippet:
- The first needs to live in the <head> section of your website;
- The second should be pasted in the <body> section.
The main three labels that you’ll see in the sidebar of your GTM dashboard are tags, triggers, and variables:
- Tags are tracking codes that collect data from a website or app;
- Triggers set conditions that tell a tag when to fire;
- Variables define when triggers should tell tags to fire.
3. Install the Google Analytics 4 tag
If you’re using Google Analytics 4, you need to set up a GA4 Configuration tag. Keep in mind that if you do this through GTM, you’ll need to delete any Google Analytics tracking information you’ve previously placed on your website or you’ll end up with duplicate data.
Click Add a new tag on your dashboard to get started, like GA Pageviews:
Next, configure your tag. Click the top box to see a long list of the 50+ tag types:
Click the: Google Analytics: GA4 Configuration option.
Under the Tracking Type dropdown that appears, click Page Views:
4. Set up the property variable
You have two options when setting up your variable. First, you can check Enable overriding settings in this tag and paste your GA4 Measurement ID in the Tag Configuration field:
Or, you can create a custom variable. While this takes some more initial setup, it’ll make things easier for you in the long run because it keeps your GA4 Measurement ID stored, rather than needing to paste it in for every tag you create.
GTM offers two different types of variables:
- Built-in variables; or
- User-defined variables.
Built-in variables are automatically defined by GTM based on elements detected in the code snippet. They offer several common variable types, making it easy to create basic tags.
Click Configure to set up each of the variables you’ll need in the future. You can always come back to this and add more:
User-defined variables are custom, based on the values you set. So you can create a constant variable that stores your Google Analytics Tracking ID:
To do this, click New under the User-Defined Variables section. Then under variable types, scroll down until you find Google Analytics Settings:
Paste your Tracking ID into the field, then save:
Now, when you create your Google Analytics tag, you don’t have to check Enable overriding settings in this tag. Instead, simply open the dropdown and select your new variable:
5. Configure your trigger
The final step in deploying your first tag is choosing a trigger that will make the tag fire:
Click on the Triggering box and select All Pages from the available options:
Then click save. To get your tracking officially started, click Submit on your workspace changes. You’ll likely have two: one new variable and one new tag:
6. Set up cross-domain tracking
If your customer journey leads users to different domains, cross-domain tracking helps ensure your tracking code counts them as one, rather than inflating your data and counting them for each domain they land on.
This isn’t necessary for subdomains; only if you have two entirely different domains that work together.
- Go to Google Analytics > Admin > Data Streams.
- Click your GA4 Web Data Stream.
- Under Configure Tag Settings, click Show More Settings.
- Click Configure Domains and enter your domains (e.g., example.com, examplepayments.com).
- Click Save.
Note: There’s no need to enable “overriding settings” in GTM for cross-domain tracking—GA4 handles this automatically.
7. Understand the data layer
The data layer is a JavaScript code snippet that stores data from your website before sending it to GTM. It acts as an additional layer between your site’s HTML, which is constantly changing, and your tags, triggers, and variables.
Having a data layer helps make your data collection process smoother. For most tags, you don’t need to do anything extra—the data layer is automatically initiated by the initial GTM code snippet you placed on your website.
However, if you want to collect custom data, like product data or transaction data for eCommerce tracking, you’ll need to set up a separate data layer.
To do this, you need to create a data layer variable. This will allow GTM to read additional values from your website and pass it through to your deployed tags.
Your development team will have to assist with creating and implementing data layer code snippets for each page you want to track additional information for. These must be done on a page-by-page basis, and the script will look like this example from Google’s developer tools.
In this instance, there are two data layer keys: page category and visitor type. Depending on what you need to track, you might have one or you could have several keys.
Once your developer has implemented this code on each relevant page, you’ll need to create a new data layer variable for each key. Head to the Variables tab, then click New to create a new user-defined variable. Select Data Layer Variable from the list of options:
In the Data Layer Variable Name field, you need to enter the key name the exact same way it was written in the code. So from the example above, you’d create two data layer variables. One would be written pageCategory and the other would be visitorType:
8. Plan for user management
You can add and remove users or user groups from your GTM depending on who needs access. Head over to the Admin tab, then click the User Management option:
You’ll get a bird’s eye view of all current users and their level of permissions. There are two options:
- Admin: Can create and remove containers, as well as manage user permissions;
- User: Can view basic account information and access specified containers.
You can also set user permissions at the container level, whether you want them to have no access to certain containers, view only, make edits, approve edits, or publish edits.
Best practice: Limit admin access to only those who need it to prevent accidental tag deployments. Take the time to add each member of your team and set their permissions based on how qualified they are to make changes and deploy new tags.
Using Google Tag Manager to track behavior effectively
Here are a few tips to help you use GTM effectively.
Make sure GTM’s base code is present on every page
You don’t want to implement a complex tracking campaign, then realize after the fact that your GTM base code isn’t present on some of your most important pages. This is why it’s key to ensure the code has been properly inserted into your site’s HTML.
There are a few ways that you can do this, but the most basic is simply to check your website’s page source.
Go to the page you want to check, right click, then select View Page Source. Search the page (using a quick CTRL+F/CMND+F command) for gtm.js to check for the base code:
Instead of only checking manually, you can also use tools like Google Tag Assistant or Chrome DevTools’ “Network” tab to confirm GTM is firing properly.
You can also click the Preview button on the top right corner of your GTM dashboard and type in your website URL to see if the correct container has been connected to your website:
Anytime you create a new container, double-check that the code was properly implemented.
Best Practice: Place the GTM base code in the <head> section and the noscript iframe version in <body> for optimal performance.
Track events
Google Tag Manager combined with Google Analytics is great for tracking events that happen on your site.
These events might be:
- Form submissions
- Button clicks
- Sign-ups
- Scrolls
- Video views
To do this, you’ll create another Google Analytics: GA4 tag, but this time the Track Type will be Event.
You can create a number of different event tracking tags to analyze customer behavior, but don’t overwhelm yourself with data that doesn’t necessarily affect your bottom line.
Best Practice: Use Google’s recommended event names for GA4 to ensure compatibility with automated reports. Reference the GA4 event naming guide.
Debug your tags
Monitor your tags so you know they’re working and that your data remains accurate. To do this, use the Preview and Debug Mode.
Similar to ensuring your base code is installed, click Preview and ensure that Include debug signal in the URL is checked. Insert your website’s URL and click Connect. A preview window will open with a badge in the bottom right corner:
Go back to the Tag Assistant page to make sure everything is properly connected:
From here, you can check out each of the options to see if anything is broken:
Best Practice: Regularly audit your tags to ensure tracking remains accurate, especially after site updates.
Create constant variables
We covered how to create a constant variable for your Google Analytics Tracking ID. But if you’re working on retargeting campaigns with digital ads, you likely have other pixels installed on your website.
You can also create constant variables for those pixels so you don’t have to locate the proper pixel each time you create a new tag, and instead can select it from the dropdown.
Head to Variables and create a New User-Defined Variable. Select Constant from the list and paste in your Tracking ID (e.g., GA4 Measurement ID, Meta Pixel ID) into the Value field before saving.
Be sure to name your variables so that you can easily figure out which pixel you need to add to which tags.
Best Practice: Name your variables clearly, e.g., “GA4 Measurement ID” or “Meta Pixel ID”, for easy reference.
Install extensions
There are a number of Google Chrome extensions for Google Tag Manager that can make your life easier:
- Google Tag Assistant has its own extension that allows you to check for tags on your website as you navigate through it.
- Tag Manager Injector is a useful extension for debugging and testing newly deployed tags.
- DataLayer Inspector+ helps your team understand what is being pushed to the data layer and if there are any issues.
Best Practice: Use GA DebugView alongside these extensions for a complete debugging workflow.
Create a tag naming process
Get with your team to create a process or format for naming all of your tags so that everyone understands what each tag is tracking. Put a document together that explains how these names were created so the team knows what each tag does at a glance.
For example, you can have the tag type followed by what it’s tracking followed by the specified trigger. Come up with abbreviations or shorthand that your team follows to stay organized.
Best Practice: Maintain a shared GTM documentation file to track tag names, triggers, and variables.
The limitations of GTM
Google Tag Manager does have some technical limitations, most of which relate to quota and account limits.
These won’t be of concern for most small and medium businesses. Large enterprises and agencies, however, may find some of these limits restrictive.
Google Tag Manager limitations include:
Container (size) limits
Each Google Tag Manager account is allowed a maximum of 500 containers. The maximum size of each container is 200KB.
The more tags, triggers, and variables you add to a container, the larger its file size. These restrictions put an upper limit on the amount of code you can add to a site using Tag Manager.
Account and workspace limits
You’re allowed a maximum of 400 Tag Manager accounts under a single Google account. In most cases, this is plenty.
In the free version of Google Tag Manager, you can have up to three workspaces. The paid version, Google Tag Manager 360, offers unlimited workspaces.
General quota limits
Tag Manager imposes a number of other limits on file sizes, code lengths, and API requests.
- Max recipe (readymade containers) file size: 10MB.
- Max length of Constant Variable: 1024 characters.
- Max symbols/characters in a custom HTML tag: 102,400.
- Max API requests: 10,000 per project, per day. Max 0.25 queries per second.
If you want to use GTM effectively, follow these 7 tips
Implement these seven best practices when setting up Google Tag Manager to improve efficiency, reduce error, and take advantage of its full feature set.
1. Create a plan for your tracking
Before adding tags for everything you could track, define your business goals, the metrics you’ll use to measure success, and the customer actions that influence those actions.
Take these three common business objectives:
- Grow revenue;
- Convert new customers;
- Increase website engagement.
Now, define the metrics you’ll use to measure them. For “grow revenue,” three examples are:
- Monthly recurring revenue;
- New revenue closed;
- Average revenue per customer.
Lastly, map out the events that take place in order to influence those metrics. For example:
- Google Ads click;
- CTA click;
- Form fill.
All of those events are trackable with a tag in Google Tag Manager. Follow this process to ensure the data you’re collecting and analyzing is relevant to business goals.
2. Always hit preview before publishing
Before you publish a new tag or amendment, always use preview mode.
Preview mode runs a test of all the tags on a page. This allows you to see:
- Which tags did and didn’t fire;
- Reasons why tags did or didn’t fire;
- The variables that were available on the page;
- How the data layer was changing while various interactions occurred.
If the tag you’ve just created doesn’t work (or it creates issues for existing code), you’ll have a chance to fix the issue before you go live with the change, avoiding any user experience issues.
Google Tag Manager now includes Tag Diagnostics to help identify and fix issues with your tags before they go live. These include:
- Tag has stopped sending data: Appears when the Google tag hasn’t sent data in the last 48 hours. You can use Tag Assistant to check the installation.
- Tag found too low on page: Indicates that tags are placed too far down the page, potentially causing loading delays or errors in data collection.
- No recent data: Alerts you when no data has been detected from the tag for 48 hours.
These tools will enhance your testing process and help ensure the accuracy and reliability of the data collected via your tags. Make sure to use them alongside Preview Mode for the most thorough checks before publishing.
3. Use variables and data layers
Google Tag Manager Data Layer is a JavaScript code snippet that acts as an additional layer between your site’s HTML and your tags, triggers, and variables to make the data collection process smoother.
Default tags automatically initiate the data layer, but if you want to track customer events, you’ll need to manually create a data layer variable.
For example, use the data layer when passing ecommerce transaction data to Google Analytics, or when default Google Tag Manager form triggers don’t catch form submissions.
This is an instance where you’ll need your development team for help. Ask them to create and add data layer code to each page you wish to capture additional information from.
Then, head to the Variables tab in Google Tag Manager, click New and then select Data Layer Variable.
You’ll be asked to provide a Data Layer Variable Name. Enter the key name as written in the code by your developer.
This is one of the more technical applications of Tag Manager. If you’re new to Google Tag Manager, stick to the default tags available, or have your developer confirm the changes you’ve made before going live.
4. Don’t go overboard with the amount of data you’re tracking
Each tag you create adds more code to your website, slowing down page load speed.
Best practice is to use as few tags as you require. Don’t go overboard and track everything just because you can. Stick to the data you need to measure success as defined in your marketing strategy.
Be sure to delete unused tags when you no longer need them, such as when you’ve run a trial and decided not to proceed.
Additionally, proper tag placement is a critical factor in ensuring your website’s speed and performance. If tags are placed too low on a page, they may not fire correctly, and their execution could be delayed, leading to slower page load times and potential issues with data accuracy.
Google Tag Manager’s new diagnostic tool now highlights when a tag is placed too far down the page, potentially impacting its performance.
To avoid performance issues:
- Place your tags higher on the page to ensure they fire before the content loads fully. This will help with better measurement and faster load times.
- Test your tag placement using GTM’s Preview Mode or Tag Assistant to confirm that your tags are firing as expected.
- Ensure that tag performance does not slow down your site by limiting the number of tags you deploy and tracking only the essential events (as defined in your tracking plan).
To further improve your GTM performance, it’s important to consider the recent update where Google tag now uses service workers, when available, to send data to server-side Tag Manager. This update directly enhances performance by improving the speed and reliability of data transmission.
Be sure to check your Content Security Policy (CSP) guidelines to ensure compatibility with service workers and maximize the performance benefits.
5. Use extensions to fully support your Google Tag Manager
If you’re using Chrome, there are a number of plugin extensions available to help speed up your workflows:
- Google Tag Assistant is an extension from Google that lets you check for active tags as you browse your site.
- dataLayer Inspector+ is helpful for understanding what information is being pushed to the data layer and for identifying any issues.
- Da Vinci Tools helps you test and debug new tags.
6. Use first-party mode for better privacy and tracking accuracy
With increasing concerns around data privacy and third-party cookies, Google Tag Manager has integrated new privacy features, such as the first-party mode.
This mode helps ensure better data reliability by using first-party cookies to track user behavior, aligning with privacy regulations like GDPR and CCPA.
First-party tracking enhances accuracy and improves measurement reliability, while reducing potential issues related to cross-domain or third-party tracking.
You can now set up first-party mode automatically via Cloudflare, making it easier to implement this privacy-centric solution.
7. Leverage workspaces for bigger teams
If you have several team members working on tag deployment for the same website, use the workspaces feature in Tag Manager.
Workspaces allow multiple team members to work in the same container simultaneously, without overwriting the changes each other is making.
Once everyone is finished, changes made in all of the workspaces can be merged into one.
Compatibility and browser support
As of July 15, 2024, Google Tag and Google Tag Manager will no longer support Microsoft Internet Explorer (IE). While the tags may still function in IE, Google will no longer actively test or fix any issues that arise in this browser, following Microsoft’s official decision to end support for IE on June 15, 2022.
Why This Matters:
As businesses increasingly transition to modern browsers, it’s important to ensure that your Google Tag Manager setup is compatible with the latest browser technologies. Internet Explorer, being outdated, may not provide the same level of performance, security, and support as newer browsers. This change highlights the importance of keeping your GTM implementation up to date and ensuring that it works seamlessly across supported browsers for optimal performance and reliable data collection.
What You Should Do:
To ensure your tags are functioning properly, it’s highly recommended that you transition away from using Internet Explorer.
Test your Google Tag Manager setup on more modern, supported browsers like Google Chrome, Firefox, or Microsoft Edge. This will help guarantee that your analytics tools are performing efficiently and your data collection processes remain reliable.
Privacy and consent management
Ensuring compliance with privacy laws such as GDPR and CCPA is critical in today’s data-driven world. Google Tag Manager (GTM) provides several tools to help you manage consent and privacy requirements, including:
- Consent Mode: GTM allows you to configure consent mode, which controls how Google tags behave based on user consent.
- Set Consent Mode Override (New Update): With the latest GTM update, you can now use the “Set consent mode override” setting to override the default consent settings for specific regions. This allows you to set the default consent state (e.g., “denied”) for regions with strict privacy laws. This feature gives you more control over tracking behavior and helps ensure compliance in jurisdictions like Europe or California, where user consent is crucial before any data collection.
This setting is especially useful when integrating with a Consent Management Platform (CMP), making it easier to align with user preferences while still leveraging the power of GTM for marketing and analytics.
Conclusion
It’s time to take everything you’ve learned here and start tracking your own website activity and events. Start with the insights that mean the most to your business and go from there. To become an even greater Google Tag Manager expert, check out our online course.