Google Tag Manager

5 Common Google Tag Manager Problems and How to Fix Them

Whenever implementing tags via Google Tag Manager, it is of utmost importance to always test your implementations. While we all hope for testing to go smoothly and for all our tags to fire as expected, it is only a matter of time before a tag does not behave as intended.

This blog post looks at five common factors that cause tags to fire incorrectly, and possible solutions to these problems.

1. Why is my tag firing incorrectly?

Sometimes a tag is not firing where it should because of multiple triggers or multiple rules within a trigger.

The Solution:

As all tags fire as a result of trigger configurations, this is normally the best place to start when tags are not firing as intended.

Start by double checking your trigger settings. When doing so, remember that adding multiple triggers to a tag will fire the tag when the set of rules for ANY trigger are met. This is in contrast to adding multiple rules to a single trigger, whereby ALL rules need to be met in order for the trigger to fire. This is explained by means of an example below:

The below image shows the tag setup for a tag that fires either on a link click that contains an email address, or a link click that contains “mailto:”. Only one of these conditions needs to be met in order for the tag to fire.

Multiple Triggers for one Tag

When there are two rules specified within the same trigger however, both rules need to be met in order for the trigger to fire. The below example shows how you would set up a trigger that only fires if the clicked link contains both an email address and “mailto:”.

Multiple Conditions for one Trigger

2. Why is my  Click Tag not firing on click?

You have implemented a click trigger based on the click element’s id, class or a custom attribute, but it is not firing when clicking on the targeted element.

The Solution:

When implementing click triggers, it is important to ascertain which element the click is registered on. When you have an element nested within other elements, it is possible that the click can register on one of multiple elements.

In the example below, it is possible for clicks to register on the image, the span, the “generic_class” div or the “track_me” div (depending on the layout). If you are trying to track any click within the “track_me” div, it is important to account for clicks on any of its children (any element within the div).

<div id=”track_me”>
   <div class=”generic_class”>
      <img src=”images/blog_pic.jpeg”>
      <span>Some Text</span>
   </div>
</div>

To do this, you need to broaden the conditions associated with the click to also include the elements inside the “track_me” div. This can be achieved by using the following CSS selector in your rule set. The “*” matches all elements within the “track_me” div.

Matches CSS Selector Example

3. Why are my Data Layer variables incorrect?

Sometimes variables that have been declared in the Data Layer are not being populated on page load, or a Data Layer event is not firing the appropriate trigger in GTM.

The Solution:

If you are implementing any tags that rely on Data Layer variables, start off by making sure that the Data Layer has been correctly implemented. In order for the Data Layer to be available for page load tags, it has to be declared and all variables need to be populated before the GTM container loads. If the Data Layer is not populated before the GTM container loads none of your Data Layer variables will be defined.

In order to check for this, enable debug mode in GTM and examine the Data Layer for the Page View event. The image below shows what this looks like when a Data Layer has not been populated on the page, or has been populated after the GTM container loaded.

Debugging when no Data Layer has been set

Data Layer events on the other hand need to be pushed to GTM only after the GTM container has loaded. If the container has not loaded and you try to push an event to the Data Layer, it will not be recoded in GTM. If you have not implemented a Data Layer on your website, you will also see a JavaScript error in your developer tools console informing you that dataLayer is not defined.

Error when firing a dataLayer event without a Data Layer

4. Why are my changes not visible?

You have made changes in your GTM container, but these are not being reflected in your debugging efforts.

The Solution:

While this is not a very technical implementation issue, unpublished versions of a GTM container will result in tags not firing. This may not be a common problem where only one person is working within the GTM container. However, with multiple people working on the same container it is necessary to keep track of what is live.

Luckily this is very easy to do with the Versions Tab in GTM. Simply click on the Versions Tab in the header and you can easily check which version is live. This does rely on you and your team using a logical and easy to follow naming convention for your versions.

Versioning in Google Tag Manager

5. Why are my tags not being registered in Google Analytics?

Imagine that your tags are firing correctly in GTM, but you are not seeing any data in your analytics tool.

The Solution:

The final issue deals with the final step in the testing process, namely checking the data as a result of your tagging in your analytics tool. This is particularly easy in Google Analytics, where you can easily check data in the Real Time report. If all your tags are firing correctly within GTM, but data is not being recorded in GA, it is probably a good idea to check your GA Property ID (UA-XXXXX-X).

As this is a variable that needs to be entered into every GA Tag, there is the possibility that the wrong ID has been entered. To mitigate this risk, we suggest creating a custom content variable that holds the GA Property ID.

Creating a Google Analytics ID Variable

This allows you to reference the variable using the {{variable name}} syntax whenever you use it in your tags.

Using a Google Analytics ID Variable

If you have any questions on these problems and solutions, please send me an email.

Don't miss our GTM Articles.

Check out our Analytics services.