Tuesday, November 28, 2023
HomeManagementThe only variable I always create in Google Tag Manager!

The only variable I always create in Google Tag Manager!

In the previous article, I wrote that “GTM containers with a small number of variables compared to the number of tags and triggers have poor maintainability”. 

In this article, in order to think about “how to use variables”, first of all, in all Google Tag Manager containers, there is one “variable” that is always created by itself, and that variable is generally It seems that it is not well known, so I would like to introduce it.

Common GTM situations

There are basically two points I look at when I’m newly checking Google Tag Manager that other people have set up.

that is,

  • “Based on the version history of the container, how often is it updated (and how many users are doing it?”)
  • “The number and ratio of tags, triggers, and variables”


I will explain each in detail.

Version update frequency and number of users updating

This is checked to see if there is a strong need to keep the container clean. For example, even if the inside of the Google Tag Manager container is dirty, if the update frequency is about once a year, there is little need to spend a large amount of money to clean it up. . Also, even in cases where only one specific person is in charge of updating, the urgency is low as long as the person in charge understands the contents of the container properly and configures it. (Because it is a problem that it depends on a specific individual, it is positioned as high importance but low urgency).

On the other hand, in cases where the frequency of version updates is high and multiple people are involved in the settings, it can be said that problems in the settings of Google Tag Manager are more likely to be exposed. Therefore, in such a case, it can be said that “it is highly necessary to maintain the container in a clean state” (however, at this point, it is irrelevant whether the container is already in a clean state).

Number and ratio of tags, triggers and variables

This is a check to see if the state of the container is healthy. If the container is small (low number of these settings), it doesn’t really matter. However, when the total number of each number exceeds 100, it is necessary to pay attention to the shape of the ratio.

The state of a container that is considered to have the worst maintainability is a state in which the number of tags and triggers is almost the same and there are dozens of them, but almost no variables are set. This case means that tags and triggers are created in a one-to-one relationship and that variables are not fully utilized.

Conversely, a container with a lot of variables set is basically in a clean state (although it depends on the contents of the variables) It is thought that

In the previous blog post, ” Google Tag Manager Usage Status for 44 Months Summary “, I introduced the figure below. In this scatter diagram, roughly speaking, the container located in the lower right is considered to be low maintainability, and the container located in the upper left is considered to be high maintainability. .

The only variable I always create is “Page Type”

What is the Page Type variable

Although I didn’t create it before, I basically created a variable called “Page Type” in the Google Tag Manager I implemented over the past year or so. This variable is created these days in a “table of regular expressions” and is often based on Page Path to allow you to get the logical role of that page. For example, a certain blog site has the following settings.

Before the Regular Expression Tables feature was launched, there was a similar feature called “Lookup Tables”, but the conditional had to be created with an exact match, which wasn’t possible. Therefore, in those days, it was implemented using custom JavaScript variables, but now the “regular expression table” makes it easier to implement.

Usage scene of Page Type variable

There are various usage scenes for this variable. The important thing is not the kind of variables “used to be used in tags” or “used to be used in triggers”, but whether they are tags or triggers or other variables. The point is that the variables are designed so that they can be reused even when creating

Use for content groups

The first is to use this value as is in the Google Analytics “Content Group” setting. The Content Groups feature is a useful but underused feature. However, once you have created the “Page Type” variable, it is easy to use content groups, so I highly recommend giving it a try.

Used to condition triggers

The second uses this “Page Type” value to condition the trigger. For example, instead of directly specifying “Page Path” as a condition for triggering a tag that you want to deliver only to “Blog article page”, use the “Page Type” variable to specify “Page Type is a blog article page”. be”. By specifying like this, when “URL condition of blog post page is added”, the only component that should be changed is “Page Type” variable. You don’t have to worry about missing changes because you only have to change one.

Used for dynamic remarketing page types

The third is similar to the first example, but is used to set the page type in the dynamic remarketing tag of the ad. Dynamic remarketing tags are becoming necessary for various advertising media such as Google Ads, Yahoo Ads, Facebook Ads, and Criteo. The current situation is that the setting value of the page type that appears in the tag when implementing these differs depending on the advertising medium. Use the “Page Type” value for the page type value used in this dynamic remarketing tag. However, the ‘Page Type’ variable itself does not need to be optimized for dynamic remarketing tag implementations, and should be categorized as meaningfully as possible. On top of that, as another variable, use a “lookup table” to separate “Page Type – Google Ads for dynamic remarketing” and “Page Type – Yahoo Ads for dynamic remarketing” etc. to create.


Google Tag Manager does not require complicated settings in most cases if you simply set it up to fire a specific tag. Even when you want to fire the tag only on a specific URL, you can flexibly set the conditions with the trigger. Also, even when you want to measure click events, you can easily do it if you pay attention to how to identify “which element was clicked”.

However, when it comes to the step of using various web marketing tools to measure more information, it becomes difficult to modify the container while keeping it simple and easy to maintain. will be

By all means, please refer to this article and aim for a Google Tag Manager with high maintainability.


What is UI/UX?

What is LTV?

Leave a reply

Please enter your comment!
Please enter your name here

Recent Posts

Popular Posts

Most Popular

Recent Comments