Fixed
Project:
Google Tag
Version:
2.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Feb 2023 at 19:32 UTC
Updated:
21 Nov 2026 at 06:02 UTC
Jump to comment: Most recent
Google Tag Manager is migrating from 'whitelist' and 'blacklist' to 'allowlist' and 'blocklist' as seen here.
Change the code to reflect the new preferred terms instead of the old ones.
Discuss solution, create patch & commit
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
japerryThis will likely not happen in the 8.x-1.x version, but has been changed as part of the upcoming 2.0 version. According to Google, they won't be removing the old parameters so there isn't a technical need to move away from it in a minor release.
Comment #3
westlinnsamething commentedUpdate: I would advise others not to install the Google Tag Module. Google Analytics was fully functional for only 2 months in 2024, and those two months came before we installed this Module.
The Module creators have repeatedly released bug-riddled versions to the public, causing financial losses and confusion. They have violated security principles by allowing code to silently override administrative settings in GA4 without login credentials, ie the consent mode activation switch mislabeled as "Enforce Privacy Settings".
They have released code that make other changes to the dataLayer without user's knowledge or permission. The changes appear to originate from a GA migration file, or a file of settings for testing purposes that somehow gets included in Prod. To see these config changes, go to the github codebase and search for 'allowlist', which will bring you to the files which mention this variable.
Although the project is supported by Google and Acquia, it's clear from the lack of oversight and mission creep that they are absentee supporters and were used for their names.
Some of the information Google has supposedly given to this Module is false and unreliable, and is different than information Google have given to other sources. The Google contact this Module relies on is either second string talent, clueless, or both.
There are few, if any, alternatives to this Module. Drupal users are faced with a difficult choice: place the GTM script directly themselves, or deal with the problems here
*********
Latest Problem/Original Post: Tags in Google Tag Manager (except for GA4 config tag) stop working at a certain point as a page is being rendered.
This bug took a long time to find because all the metrics native to GA4 (enhanced measurement) are working fine...it's only the additional metrics created in GTM (like internal link click tracking) that are not.
Details: While examining each step in GTM's preview mode as a page loads, we noticed that tags stop working, all variables become undefined, and the dataLayer looks like it is wiped out when certain GTAG command is sent to the datalayer which involves the command involves the allowlist and blocklist.
CAVEAT: It could be coincidence that tags stop working on every page load, month after month, after this command is sent. However, we have not authorized any allowlist/blocklist to be sent, nor is there any option to do so in the admin settings of the Tag Module.
The puzzling thing is that both appear to be empty strings, Therefore, they shouldn't have any effect.
dataLayer.push({gtm.allowlist: [""], gtm.blocklist: [""]})
Data Layer values after this Message:
1 {
2 event: "gtm.js",
3 gtm: {
4 uniqueEventId: 1,
5 allowlist: [""],
6 blocklist: [""],
7 priorityId: 1,
8 start: 1736756796385
9 },
*Also puzzling is that I saw reference to a whitelist and blacklist at some time, but i don't see it right now. Whitelist and blacklist were the previous names for allowlist and blocklist.
*Also puzzling is that nobody else has experienced this problem. For this reason, I have refrained from using most profanity in this post due to a slight doubt that the Google Tag Module is responsible.
*Perhaps related, perhaps not: I see a console error by system that says "unable to parse", but in true Googlecrap fashion, it gives no additional details or information. The error is not visible in the Google Developer Tools Console.
We suffered a 5 month Google Analytics outage last year due to the Consent Mode bug that silently activated consent mode without our knowledge or permission,
(Who's the dolt who thought it would be a good idea to give a Drupal Module the ability to override administrative settings in GA4 without notifications or GA4 credentials or, anyways? Violations on so many levels: this should have never been allowed)
And again, like last time, there have been many months of investigatation with cross functional teams from our IT dept and the group that manages our website, as well as Acquia. And again, the evidence is pointing to this module.
Because the variables are all undefined (and never recover), Tags can't operate.
I spent about 8 months in 2024 trying to resolve Google Analytics problems as a result of the Google Tag Module. This is ridiculous, and Acquia and Google are absent, clueless supporters.
Comment #5
japerryThe rename was done in 2.0.x (`allowlist_classes`/`blocklist_classes`, pushed as `gtm.allowlist`/`gtm.blocklist`), and the upgrade path maps the 1.x keys across.
@westlinnsamething, #3 is a real 2.x regression though. With "Add classes to the data layer" checked, an empty "Allowed classes" field is pushed as `gtm.allowlist: [""]`, so GTM allows no tag types while GA4 through gtag.js keeps working. Until this is released, uncheck "Add classes to the data layer" in the container's advanced GTM settings unless you rely on the lists.
MR !159 fixes it:
Retitled the issue to match the remaining bug.
Comment #8
westlinnsamething commented@japerry, Thank you for the time you spent resolving this issue.
The functionality behind Google's allowlist and blocklist is not well known or understood by many. I'm not an expert, but my understanding is that Content Security Policies somewhat do the same thing, or at least offer some of the same protections, and are more commonly used.
Could I ask a couple questions for the benefit of other who might find this?
1) Is it true that Google changed allowlist and blocklist to have gtm. in front of both of those? Is this basically a naming convention change?
2) is it fair to say that the key takeaway here is that most people should uncheck "Add classes to the data layer" in the container's advanced GTM settings, unless you know what you're doing and can configure allowlist//blocklist correctly?
3) And is it correct to say that checking add classes to the data layer without defining those classes causes problems?
4) Finally, does unchecking "add classes to data Layer" affect anything else?
Again, thank you for your diligence in resolving this tricky issue.
Comment #9
japerryYup.. Google renamed gtm.whitelist/gtm.blacklist to gtm.allowlist/gtm.blocklist a while back (2020?), and they behave the same way. 1.x pushed the old names. 2.x pushes the new ones, and the 1.x to 2.x upgrade copies your lists across.
For the most part, yes. "Add classes to the data layer" is off by default, and it should stay off unless you need GTM's allowlist/blocklist. The bug fixed here only hit sites that had it checked and left "Allowed classes" empty.
3) On 2.0.9 and earlier, yup. With the box checked and "Allowed classes" empty, the module pushed `gtm.allowlist: [""]`, and GTM then refuses to run any tag. An empty "Blocked classes" list did no harm. The fix in this issue is committed to 2.0.x and will be in the next release. From then on, empty lists aren't pushed at all.
A filled-in list still does exactly what it says. With an allowlist, only those tag types run, and a blocklist overrides the allowlist. Sites upgraded from 1.x may still have the old default blocklist (customScripts, customPixels), which blocks Custom HTML and Custom Image tags if the box is checked.
No. The checkbox only controls whether those two lists are pushed to the data layer. Events, the data layer name, environments and consent mode are not affected.
Regarding CSP: the two complement each other rather than overlap. CSP controls which origins the browser will load and run scripts from. The GTM allowlist/blocklist controls which kinds of tags GTM will run from your container, which limits what someone with publish access to the container can put on the site.
Hope that helps!
Comment #10
westlinnsamething commented@japerry; thank you for taking the time to explain each of those items, as well as the clarification around the CSP versus allowlist/blocklist.
Much appreciated!