Google Tag Manager naming convention guide
Joakim Johansson
Analytics SpecialistWhen working with Google Tag Manager, or any other tag management solution, a well thought out naming convention is a must. Naming your tags, triggers and variables in a structured, easy to read and informative way really is key, and will be super beneficial for anyone working in your GTM container. In this article, we will look into how you should name your assets (tags, triggers and variables), but first, we will go over the benefits of adhering to a good naming convention.
Benefits of a naming convention
Huge time saver
If the assets in your container are properly named it will save anyone working in it a lot of time. Basically you can glance over the names of the tags, triggers and variables in the container and by that alone get quite a good understanding of the setup you are dealing with. Properly named assets also improves the searchability within GTM. This all means you will find whatever you need quickly, you will not waste time creating duplicate assets by mistake, and when looking into a Custom JavaScript variable that references other variables, you will have a much easier time understanding the code and what the output will be. The list goes on and on!
Mistakes will be reduced
When assets are named well and the setup is easy to understand the people working in the container will make fewer mistakes. Of course, one should always preview and debug before publishing a workspace but there will generally be fewer iterations before getting it correct and being able to publish.
Improved experience when implementing tags
This one is hard to measure like the ones above (saving time and fewer mistakes made) but still worth mentioning. Basically it’s a much nicer experience working in an organized container with a proper naming convention compared to the opposite. It’s night and day! And of course, we all want to enjoy our work!
How to name your tags, triggers and variables
So, it’s time for looking into how you should name your tags, triggers and variables in GTM. Let’s start with some general guidelines.
General
When naming your assets make sure to be;
- consistent
- informative
- and make the names of the assets easy to read
Consistent
Be consistent in how you name the different types of tags, triggers and variables in GTM. For example, if you start out your Google Analytics event tags with “UA – Event” then always do that. This will ensure that those tags are grouped together in the tags view when tags are sorted by name. When having a few tags it might not make a big difference, but when the container grows that is super beneficial. Other than that, consistency will make sure people working in the container will interpret the assets correctly. Let’s say you usually end your triggers with the market/domain they fire on (for instance “SE”) then it’s key that you always do so, to make sure people can quickly understand what is what.
Informative
You should strive to include the most relevant information in the names of your GTM assets to make sure anyone working in the container knows the purpose of a particular asset. For example, include tag type, grouping and action (example: “UA – Event – Newsletter signup”) in your tag names to make sure that anyone can understand what kind of tag it is and what it does.
Easy to read
Make sure the names of the assets are easy to read. A tip would be to use Proper Case and dash (“-”) as the delimiter for each part of the name. An example would be “GAds – Remarketing – Add To Cart”. Also, try to keep the names short and sweet to prevent them from breaking into a new line, which will make the container less friendly to your eyes (but do not omit relevant information for the sake of a short name).
Precis approved naming convention
Tags
A good way of structuring your tag names is by tag type, grouping and action. This will ensure that the most important information regarding your tags is included in their names. A few examples:
- GAds – Remarketing – Checkout
- UA – Event – EEC – Purchase
- Custom HTML – Hotjar
Let’s dissect the first tag above to understand how the tag names are constructed. GAds (Google Ads) is the tag type, then we have Remarketing which is the grouping (could be either Remarketing or Conversion for Google Ads) and lastly we have the action which is Checkout. This all means that the tag is intended to send data to Google Ads, the data will be used for remarketing purposes and the tracked event is checkout.
If we look at the second tag (which has the tag type Universal Analytics) it also includes a sub group which is EEC (Enhanced Ecommerce). This gives us additional information about the tag and tells us that it’s used to send in Ecommerce data to Google Analytics. Make sure to include a sub group whenever it makes sense.
Lastly we have the tag “Custom HTML – Hotjar”. This one is missing the action label since there usually is only one Hotjar tag in each container and then there is no need to differentiate with the action label.
Triggers
Make sure to include the trigger type and the user action in your trigger names. Also, include the scope of the trigger when that makes sense. The scope could be what domain(s) the trigger fires on. For instance, it might just fire on the domain www.mywebsite.se but not on the other country specific domains that your GTM container also might be added to. Let’s look at a few trigger name examples to get a better picture:
- Page View – Order Confirmation
- Event – Purchase
- Scroll – 75 % – SE
We can see that the first trigger has the type Page View and the user action is Order Confirmation. In other words, a tag that has this trigger attached to it is intended to fire when a user lands on the order confirmation page.
The second trigger has the type Custom Event and the user action is Purchase. This trigger is intended to fire when a custom purchase event is pushed to the datalayer.
The last trigger has the suffix “SE” which tells us that this trigger is probably only firing when a user scrolls 75% of a page on the Swedish domain/market.
Variables
User-Defined Variables named to perfection.
When naming your variables it’s a good idea to include variable type and description. In some cases a subtype could be added to make things even more clear. Let’s look at a few examples of variable names:
- GA Settings – Standard
- URL – Query – Gclid
- DLV – ecommerce.purchase.actionField.revenue
The first variable has the variable type GA Settings and the description Standard. This variable is intended to be added to Google Analytics tags which are not supposed to send in Ecommerce data to GA (that variable is often named something like “GA Settings – EEC”).
The second variable has three parts to it, type, subtype and then description. The type (URL) tells us that the variable is a so-called URL variable, the subtype (Query) that we are dealing with the query string of the URL, and lastly, the description (Gclid) tells us that the variable is supposed to hold the value of the query parameter called “gclid”.
Lastly we have a variable with the type Data Layer and the description: ecommerce.purchase.actionField.revenue. This means that this variable should hold the total revenue (which is found in the data layer) of the transactions that occur on the site(s). The description is not Proper Case that was recommended earlier in this article but it’s a common practice to name Data Layer variables like this. However, you could also name the variable something like “DLV – Ecommerce – Purchase – Revenue” which is quite informative as well.
Summary
By now you should be quite familiar with how to name tags, triggers and variables in GTM to ensure your container is efficient and easy to work in, and also that time-consuming mistakes are kept to a minimum. Last but not least, no naming convention will be a perfect fit no matter what, so make sure to adapt the suggestions in this guide to suit your specific container. Use this guide as a starting point!