GTM naming conventions best practice and why you should care
By Rhian Barber|1 May 2024
Analytics and data | 7 MIN READ
As your organisation becomes more data-savvy, your Google Tag Manager container grows. The more tags, triggers, and variables you have in your container and the more people actively make changes to it, the more crucial clear naming conventions become. Doing so is good housekeeping, ensures efficiency, and reduces duplication and mistakes..
Getting GTM naming under control
In this guide, we share our formulae for clear and consistent naming conventions to help you tidy up your container and introduce some management governance.
We do not claim this to be the only or best way of doing it, but it's a starting point for you to sort your ship out and put your naming conventions on paper.
Background
As your organisation matures, so too will your website and analytics setup. You might add and shelve different marketing campaigns, change critical functions on your website (e.g., changing that email newsletter sign-up from one provider to another), or migrate from Universal Analytics to GA4, to name a few examples.
Naturally, your tracking will get more complicated as part of this process. These variables can make it challenging to track which tags and triggers are in operation, what they do, and when to remove any redundant legacy tracking.
Why is this important?
- A build-up of legacy tracking in your container increases its overall size. This bloat affects your website load time, with your users loading a large amount of possibly redundant tracking each time they move across your website pages. This bloat can have a knock-on effect on user experience and potentially cause issues (especially if data is being captured at all).
- You might be doubling up on data for specific events! For instance, you might send page views to GA4 on all page views and send page views when people look at your donation form. These problems become more immediately apparent when consistent naming conventions are in place. If you know what you're looking for in the title of your tags, triggers, etc., you know what to filter by and how to spot when something has been duplicated.
- It makes GTM easier to understand. Clear, consistent naming conventions can help you keep track of your GTM setup and, over time, understand how it works, what may be causing problems, etc.
Below are our recommendations for naming conventions, but most importantly, keep an eye on consistent capitalisation and use of semantic, digestible language. Remember to set these up with your most scrambled self in mind! After all, you might need to revisit these tags on a chaotic day when there's an urgent issue that needs fixing and be able to quickly find the element you're looking for without having to filter through too much noise to find it.
Recommended Naming Conventions
Containers
Your GTM container will be a subfolder within your Tag Manager account. For example, within our CharityWise account, a container holds all the tracking for the CharityWise website.
Recommended naming convention for GTM containers:
- [Company/Website Name] - [environment]
- For example:
- CharityWise - Production
- CharityWise - Staging
- For example:
Workspaces
You can set up workspaces in your container. This function helps multiple people work on different changes to your tracking setup while minimising conflicts.
TIP! You can create up to three workspaces on the free version of GTM and unlimited workspaces in GTM 360.
Recommended naming convention for workspaces:
- [Agency/Name] – [what is being worked on]
- For example:
- Fresh Egg – checkout funnel stages
- Fresh Egg – consent mode rollout
- For example:
Folders
Within your container workspace, there is a tab for folders. You can use this to further organise your tags, triggers, and variables for easier oversight and future review.
Recommended naming convention for folders:
- [Environment] - [description]
- For example:
- Staging - ecommerce
- Production – GA4 events
- For example:
GA4 Google Tag
Recommended naming convention for Google Tags:
- GA4 – Google Tag
The Logic:
This element is the most important to identify. If incorrectly set up here, it will impact other tracking areas. Including the hyphen ("-") in this tag ensures that when you look in the GTM interface, it'll sit at the top of the list of your GA4 tags.
GA4 Event Tags
The recommended format for GA4 event tags is as follows:
- GA4 {{GA4 event name}}
- For example:
- GA4 form_submit
- GA4 click_cta
- GA4 view_item
- For example:
The Logic:
Excluding hyphens ensures these tags show beneath the Google Tag. Keeping the event names the same as in GA4 and as simple as possible helps reduce the cognitive load when looking at your GTM interface.
Marketing Pixel Tags
Recommended naming convention for marketing pixel tags:
- [Agency] – [platform] – [pixel type] – [marketing] – [retirement date]
- For example:
- Fresh Egg – Facebook – base pixel – 8.24
- Rotten Egg – Instagram – conversion pixel – 1.25
The Logic:
Marketing pixels require more information. This element is one area of tracking you'll want to keep a firm grip on, as out of any, these are the tags on your site with a straightforward, designated shelf life. They are usually set up by your team or third parties to track key marketing campaigns and should be deleted shortly after to prevent build-up in your container. Slow site load times will negatively impact your quality score, which is one of the key metrics Google uses to determine the cost to run your ads. Allowing these tags to linger will not only impact the quality of your website but will potentially cost you money in the long run.
Agency Explained
The name of the agency (where applicable) that has set up the relevant marketing pixel.
Platform Explained
The social media platform this is run through.
- For example:
- Snapchat
Pixel Type Explained
The type of pixel.
- For example:
- Base pixel
- Event pixel
- Conversion pixel
Retirement Date
The point at which the tag can be removed. This information could always be available in each tag's 'notes' section. However, cleaning up the account will require you to review each marketing pixel tag individually to check retirement dates (which costs valuable time).
Other Tags
Recommended naming convention for other tags:
- [Platform] - [page/action] - [desc]
- For example:
- FB – conversion – purchase
- For example:
Tracking Type Explained
Use a short abbreviation for the type of tracking the tag is doing.
- For example:
- Ads - Ads Conversion Tracking
- FB - Meta Pixel
- LI - LinkedIn Insight Tag
Page/Action Explained
Describe the page or event the tag is firing on.
- For example:
- all pages
- homepage
- checkout
- form submit
- [subdomain name]
Description Explained
Describe the detail of what the tag is firing on.
- For example:
- click phone
- add details
- form submit
Details Explained
Add any additional details needed for the tag.
- For example:
- enhanced ecommerce
- standard events
- custom parameters
Triggers
Recommended naming convention for most triggers:
- [trigger type] - [page/action] - [details]
- for example:
- ct - button - submit form
- page view - blog posts
- for example:
Trigger Type Explained
The type of trigger.
- For example:
- page view
- click
- scroll depth
Page/Action Explained
Describe the page or action the trigger is firing on.
- For example:
- add to cart
- thank you page
- all pages
- nav bar
Details Explained
Add any additional details needed for the trigger.
- For example:
- form id
- element id/class
- scroll depth percentage
Custom Event Triggers
Recommended naming convention for custom events:
- E {{data layer event name}}
- For example:
- E click_button
- E form_submit
- For example:
The Logic:
This practice is a commonly used format for custom events, making it more accessible should you have different industry professionals working with your GTM container.
Variables
We recommend keeping all variables in lowercase. This convention makes it more easily distinguishable from other parameters. Recommended naming convention for variables:
- [Variable Type] - [details]
- For example:
- js - custom html id
- url - path
- dom - click target url
- dlv – data layer variable
- For example:
These elements are broken down further below:
Variable Type Explained
Use a short abbreviation for the type of variable.
- For example:
- js - custom javascript
- url - url variable
- dom - dom element
Details Explained
Add any additional details needed for the variable.
- For example:
- custom html id
- query parameter
- click target url
Summary
So, we've taken you through our recommendations for GTM naming conventions and why they're essential, and we've broken down some different conventions for different tags, triggers, and variables.
Did you find this helpful, or was anything unclear? Need more help? Contact us to chat with the team.