Best Practice Naming Conventions for Google Tag Manager

Best Practice Naming Conventions for Google Tag Manager

How to find things in Google Tag Manager 

You need a naming convention and then you need to stick to it - otherwise, you’ll never know where anything is. Here’s a guide about naming conventions in Google Tag Manager written by HJ Data Lead and Co-founder, Jacob Moran.

The structure of your Google Tag Manager account is exactly like a folder on your hard drive. If you only have a few things in it, you can set it up however you want and it won’t really matter. If, however, it has grown with an insufficient structure it quickly becomes impossible to find anything and you end up considering burning the entire thing down to the ground.

Consequently, it is vital that you structure your account correctly, and how you name things is an essential part of this.

Below we have outlined some things to do when naming items in your Google Tag Manager account.

Tag Naming Conventions

Tags are the most visible parts of your GTM account so it’s very important that you pick a good naming strategy for them. Here at HammaJack, we use the following convention for tags.

“{{Tag Type ID}} - {{Tag Descriptor}} - {{Optional ID}}”

Each of these three are used to provide a unique ID for the tag and are ordered from universal to more specific (i.e. {{Optional ID}} is the most specific descriptor of the tag).

Tag Type ID

Describes what kind of tag it is. For Google Analytics this would be “GA” or “UA”, whereas Facebook tags would all start with “FB”. It doesn’t overly matter whether you use the full name or an ID, the only thing that is important is that it makes sense to your organisation.

Tag Descriptor

Describes what the tag is tracking or the action taken. This could be something like “Universal” (for a tag fired on all pages) or could be something more specific such as “Contact Us Form Submission”.

Optional ID

The Optional ID is utilised if you have a number of tags that are very similar but, for whatever reason, can’t be combined. I generally feel that Optional IDs should be avoided unless they are absolutely necessary. Usually these kind of tags are ripe for improvements (usually using a variable like a lookup table).

As an example, if you wanted to fire a Google Analytics tag every time a user got a quote for “Singles Travel Insurance” the tag name could look like this;

“UA - Travel Insurance Quote Completion - Singles”

A Facebook tag tracking the same thing should look like this;

“FB - Travel Insurance Quote Completion - Singles”

The important thing to note here is that the nothing changed aside from the Tag Type ID. This makes searching and readability a lot better.

Trigger Naming Conventions

Considering naming conventions are about uniformity it should come as no surprise that triggers should follow a similar pattern to tags.

Here at HammaJack, we use the following convention for triggers.

“{{Trigger Type Optional}} - {{Trigger Descriptor}} - {{Optional ID}}”

Look familiar? That’s because it pretty much is. The only difference is that we’ve made the Trigger Type Optional as well. This is done because it’s not always needed. They can be helpful for larger accounts to discern what variable the trigger is being validated against (i.e. does the trigger look at the Hostname, DataLayer, Page URL etc.), however, for most use cases it is overkill.

For the previous example the trigger could look like this;

“Page URL - Travel Insurance Quote Completion - Singles”

Or, if you did not include the Trigger Type it could look like this;

“Travel Insurance Quote Completion - Singles”

The second option is usually sufficient, however, for those of us who want things to be crystal clear the first option can give more clarity.

Variable Naming Conventions

Variables are the exception to the rule. This is because Variables tend to be universal and can be referenced by a diverse number of tags and triggers.

Luckily GTM has built-in variables with their own naming convention that can be used as a guide. We follow this default GTM convention.

“{{Variable Descriptor}} - {{Variable Type  Optional}}”

For the previous example a variable could look like this;

“Quote Values - Lookup Table”

Version Naming Conventions

Versions are always the first thing to suffer from bad naming conventions. However, they can also be the simplest.

We have used several conventions for versions and it really depends on what the container looks like. Below are some of our favourites.

  • {{Folder Changed}} - {{Tag or Trigger Changed Overview}} (i.e. “Customer Portal - AD - Adwords Remarketing Universal”)

  • {{Tag or Trigger Changed Overview}} (i.e. AD - Adwords Remarketing Universal)

  • {{JIRA Or Other Ticket ID that the change was made for}} (i.e. “JIR-1234”)

  • {{Tag Changed Overview}} - {{Trigger Changed Overview}} (i.e. “AD - Adwords Remarketing Universal - Page URL - All Customer Portal”)

It is important to note that you can also expand on these version names with a nice version description as well.

Folders

Folders, while not strictly a naming convention, are a feature of Google Tag Manager that allows users to group similar tags, triggers and variables. You can see their official documentation here, however, we’ve used folders to group items based on;

  • Tag Type (i.e. folders for Google Analytics, Facebook, DoubleClick etc.)

  • Section of the site (i.e. folders for the Customer Portal, Quote pages, Blog etc.)

  • Team (i.e. who the tag, trigger or variable belongs to)

Most Importantly

If you only take one thing away from this article make it this:

You need a naming convention and then you need to stick to it - otherwise, you’ll never know where anything is.

Good luck! If you need any help deciphering this, or setting it up yourself, get in touch.

What are Goal Values in Google Analytics, and Why They Are So Important?

What are Goal Values in Google Analytics, and Why They Are So Important?

Using Categories and Tags in your Content Strategy

Using Categories and Tags in your Content Strategy