In part 1 of this series, Master your GTM Pt 1: Auditing Your Google Tag Manager in 3 Steps, I showed you how to:
- Define a Business Objective.
- Find all the things used for analytics and tracking scripts.
- Create a Tag Management Plan that lists out each tag, trigger, and custom script in an organized, easily understandable fashion.
Now, in part 2, I’m going to show you techniques on how to use your Tag Management Plan to clean, fix, and speed up your GTM setup, while also covering a comprehensive list of GTM best practices.
Are you ready to improve your GTM like a pro? Let’s get started!
Improve your GTM using a Tag Management Plan
The keystone to our process, in this tutorial, will be using the information filled out in a Tag Management Plan. As mentioned in Part 1, a Tag Management Plan sets organizational rules and expectations by organizing tags and scripts into groups, such as this:
- Tracking:
- Google Analytics
- HotJar
- Autopilot
- Drift
- Attribution Data
- GDPR Cookie Consent Scripts
- Social
- Paid Media:
- AdWords
- Bing
- AdRoll
- Events
- Form Submissions
- Button Clicks
- Resource Downloads
Not sure how to get started? No worries.
Start with this free template.
Having a document like the Tag Management Plan is critical to the auditing (and now “improving”) process of GTM management because it lists all the things (scripts, tags, triggers, variables, etc) used on your website in a digestible manner.
We can now refer to this document and easily pick out problem areas and act upon “low-hanging fruit” items that can quickly be improved upon.
So let’s dive in.
Consolidate Tags
One of the more obvious actionable items you’ll find in the Tag Management plan, are tags that do virtually the same thing.
For example: It’s possible that there are two tags to track CTA Clicks that invoke the same event, but are triggered on different pages. An easy rule to live by is that there should only be one tag per event.
Minimizing the number of tags used on a site is the best way to improve your GTM. Using as few as tags as possible will greatly reduce the complexity of your GTM environment and improve your site speed by reducing the number of processes needed to render a page.
It’s simple:
Less tags = less scripts firing on a web page, less scripts firing = faster site speeds
Boom. Improved.
Switch custom scripts out for built-in tag templates (if applicable)
When integrating a 3rd party tool into your website, such as Adroll or AdWords, you usually receive a block of code and instructions on how to embed it. It’s very common for GTM editors to use the Custom HTML tag and embed these code snippets by copy and paste.Oftentimes, this is incorrect, and when using the Tag Management Plan, you can easily see all the cHTML tags and what their purpose is.
Tag Manager natively supports many Google and 3rd party scripts through built-in “templates” that take the code, and technical knowledge required to read, customize and debug it, out of the equation by giving the user clean, easily configurable tag options. The AdWords Remarketing Tag is a perfect example of a clean, easy to use built-in template.
So these are the types of custom scripts you’d be looking for to optimize. Not sure if there’s a template for your favorite 3rd party tool? Google has compiled a list of supported templates here, and a community gallery of custom templates here.
Don’t try and reinvent the wheel.
Boom. Improved.
Migrate marketing and all 3rd party tracking codes to GTM
Google Tag Manager is designed to be the central management hub for all your marketing tools and 3rd party scripts so your website’s code stays squeaky clean. Any 3rd party scripts hanging out in the header, footer, or other weird places just defeats the purpose.
Since our Tag Management Plan is a compiled list of ALL scripts and things on the website (not just what’s in GTM), we should be easily able to identify “outlaw” scripts and recreate them in GTM.
There are a few, rare exceptions where a script won’t play nicely in GTM, but for the most part, another easy rule to live by is that all 3rd party scripts must be deployed by GTM.
Boom. Improved.
Delete obsolete tags, triggers and variables
Ever login to GTM and just get overwhelmed with the sheer number of tags, triggers and things? Well, you’re not alone. It happens a lot. Especially, if a site’s been around for awhile.
Too many tags and triggers firing on the same pages can slow down your website, make testing and troubleshooting more difficult and create conflicts with future additions. On top of that, a lot of all that stuff (tags, triggers, variables, etc) is probably out of date, not working or not serving a purpose anymore.
In our Tag Management Plan, there’s a column for “Last Edited” and “Active,” which makes identifying unused and unwanted items a breeze. Simply remove all tags, triggers or variables not in use, and then start scrutinizing items that haven’t been touched in a while.
Haven’t edited a HotJar tag in over 2 years? Chances are, HotJar isn’t being used anymore. Remove it!
Boom. Improved.
Efficiently utilize variables
Variables in GTM are one of its facets that are oftentimes underutilized or down-right ignored, causing huge efficiency gaps in GTM containers.
Variables make it easy to hold your data during run-time, so you can pass the same value to multiple tags when and where you need it. Not only do variables make your life as a GTM editor easier, but they also allow you to make more efficient triggers, pass data to the Data Layer without complicated cHTML tags, and a slew of other possibilities.
A perfect example of a variable in GTM used efficiently is a “Constant” variable that holds a Google Analytics ID value. So instead of typing the GA ID each time you create a new tag, you can simply reference the Constant variable that holds the GA ID and call it without having to retype it or check to make sure you’re using the right property ID.
Variable deficiencies are hard to spot unless you know what you’re looking for. Knowing what to optimize and how is something you can only learn with experience.
Some key variables to look into and use wherever you can:
- Constant Variables
- Universal Analytics UA- number
- AdWords account ID
- DoubleClick
- Lookup Tables
- List of hostnames that need blocked by IP
- List of landing pages
- Data Layer Variables
- Create custom events for validated Form Submissions
- Push unique data that can then be captured by tags in gtm, such as order value on an ecommerce site
Boom. Improved.
Techniques and best practices for using GTM
Now that we’ve finished optimizing our GTM container based upon the data compiled in our Tag Management Plan, we can make further optimizations by using the following proper techniques:
Declare a naming convention
There’s a lot of moving parts when it comes to Google Tag Manager. More often than not, there’s multiple tools being used with a diverse range of purposes. The only real way to quickly make sense of it all is to name everything aptly, otherwise, you’ll look at your GTM container the same way you look at a preschooler while they write their name.
The best practice to name something in GTM is to start with the type, purpose and where it’s deployed.
Example Tag Names:
- AdWords – Conversion – Demo Request
- AdWords – Remarketing – Global
- GA Event – Internal Link Clicks – Global
- GA Event – Form Submission – Contact
- cHTML Script – Hubspot Tracking Code – Global
Pro Tip: You can even take this a step farther by adding a prefix to identify you, or your company so you easily know what items were added by you or your team.
Keep a clean workspace
Take it from me, and don’t find out the hard way; not cleaning up your Workspace will lead to misconfigured tags, site errors and other (but totally avoidable) problems within the main Workspace. Leaving unpublished work sitting on in the main Workspace for long-periods of time is a common mistake that should be avoided whenever possible.
So instead of working on something that won’t be finished in a timely manner on the main Workspace, create a new Workspace and do your changes there. This frees up the main workspace to be edited by another team while you’re working on your changes and keeps it nice and clean.
Pro Tip: Make sure you click on “abandon change” after testing or on changes that won’t be published so you don’t find yourself in a predicament where something not meant to be published goes live accidentally.
Be conservative with Publishing Access
Ever hear the phrase “too many cooks in the kitchen spoil the broth?” Well too many editors publishing changes in your main Workspace can cause unknown errors, duplication issues, and slew of other problems you don’t want. GTM may not be as coveted or mission critical as your VPN network or GIT repository, but a lot of damage can still be done in the wrong, or inept, hands.
So you should know, GTM has five levels of user access and user access can be assigned on a per-container basis. Here are the different levels of access:
- No access: the user will not see the container listed in the account.
- Read: the user will see the container listed and may browse the tags, triggers, and variables in the container, but will not have the ability to make any changes.
- Edit: the user has the rights to create workspaces and make edits but not create versions or publish.
- Approve: the user has the rights to create versions, workspaces, and make edits but not publish.
- Publish: the user has full rights to create versions, workspaces, make edits, and publish.
A rule of thumb is to make sure you’re only giving publishing access to users you trust and encourage them to follow the naming conventions and organization you have defined in the Tag Management Plan.
Pro Tip: If you use GTM long enough, it’s inevitable that it will turn messy and outdated, so take the time to schedule regular reviews where you update the Tag Management Plan so youcan stay proactive in keeping it up to date and scalable for future renditions.
Use regex to minimize the trigger conditions
You want to know what separates the Joes from the Pros? The use of Regular Expressions.
Regular Expressions, also known as RegEx, is one of the singular greatest time-saving techniques one can start using when setting up triggers and variables. Regex defines a search pattern using symbols and allows you to find matches within strings. Once you get the concept, this technique is invaluable when applied to trigger conditionals.
But you do have to get the concept, and it can be a daunting task for even the most seasoned of web developers. RegEx syntax is seemingly complicated and takes a hot-second to learn. But there’s logic to the madness, and once you invest the time to learn the ins-and-outs, before long you’ll be using RegEx everyday to vastly speed up your workflow, reduce the number of triggers you create and speed up your website in the process.
I can’t recommend learning and using RegEx enough, as it may be the single, most impactful technique you can learn and use to be better at managing GTM.
Pro Tip: Use RegEx tester: https://regex101.com/
Conclusion
So there you have it. If I’ve done my job well, not only should you be able to audit a Google Tag Manager container, but you should also be able to:
- Optimize Tags, Triggers and Variables
- Use built-in tag templates
- Use RegEx to maximize your trigger efficiency
- Utilize a concise and digestible naming convention
- And advocate Pro Techniques and best practices for GTM
If, however, you’re still unsure about how to manage your Google Tag Manager, or marketing scripts as a whole, feel free to reach out to us. We’ve got your back!