January 7, 2022
Google Tag Manager Firing Twice? Here’s a solution
Here’s a situation. You are using a Google Tag Assistant (legacy) Chrome extension and you get a “Multiple installations of Google Tag Manager” warning.
You ask your developer to make sure that Google Tag Manager is really installed once and he/she confirms that. So why is Tag Assistant saying that Google Tag Manager is firing twice? In this quick blog post, I will explain that.
There are two possible reasons for this. Well, actually, three. But the first two are “false positives”.
Reason #1. You are working with a single page application
If you’re seeing that warning in Tag Assistant and the IDs of both containers are actually the same, I have a hunch that you’re working on a Single Page Application.
If yes, then most likely, there is nothing to worry about (but just to double-check, continue reading).
Unfortunately, Tag Assistant does not play well with Single Page Applications. Even though only one GTM container is installed, Tag Assistant may display multiple container instances as the app loads or a visitor continues to browse. This does not happen on ALL single-page applications but is quite often nonetheless.
Solution for Reason #1
What should you do about it? Most likely, ignore the warning. But you can double-check if this is the real reason.
To verify whether you actually have multiple installations of Google Tag Manager, check network requests in browser’s developer tools. In this demo (and as always), I’ll be using Google Chrome.
In the top right corner, click 3 dots, then go to More tools > Developer Tools.
Switch to Network tab and in the search field enter “gtm.js” (without quotation marks), keep All selected, and refresh the page.
After the page has reloaded, take a look at how many gtm.js do you see?
If one, you’re good to go. Just ignore Tag Assistant’s warning about multiple installations.
Seeing two requests? Continue reading.
Reason #2. You have enabled preview mode of Google Tag Manager
If you still see Google Tag Manager firing twice, another reason might be GTM’s preview mode.
When Preview and debug mode is enabled, it sends two requests to Google Tag Manager:
- one to load gtm.js
- and another one to load gtm.js (but the URL contains more parameters, like gtm_debug=x).
If that is your case, don’t worry. This is expected. Once you disable the preview and debug mode, you will once again start seeing a single request to gtm.js.
Also, this 2nd request does not interfere with your testing, you will not be getting duplicate page views or something like that. Thus, ignore this.
None of the tips worked?
If none of these tips worked and you still continue seeing two or more requests to gtm.js in your browser’s developer tools, then I think you indeed have multiple containers (or a single container installed multiple times).
Have a discussion about that with someone who might know the project/website you’re currently working on. Even though it isn’t optimal to use multiple GTM containers, it is possible. You can learn more about this here.
If nobody intended to have multiple containers on the same site, just remove the one that shouldn’t be there (or ask someone to do that).