Home
/
Blog
/
Technical

Tag manager security

A container is a supported, audited, well-documented way to run arbitrary JavaScript on your payment page without a code review. Secure it accordingly.
TL;DR
Tag manager security
THE CORE ISSUE
A tag manager exists to inject arbitrary JavaScript without a deploy. Access to it is equivalent to the ability to ship code, without the review real deploys get.
WHERE IT GOES WRONG
Over-permissioned accounts, no MFA, no publish review, and containers nobody audits because marketing owns them and security does not look.
WHAT TO DO
Least privilege, MFA, a publish approval workflow, and monitoring what the container actually publishes rather than what it is configured to publish.
Short on time? The person who can publish a container can put a script on your checkout.

Why is a tag manager a security risk?

A tag manager is a system whose purpose is to inject arbitrary JavaScript into your pages without a code deployment, so anyone who can publish a container can run code on your checkout. This is not a flaw, it is the product working as designed, and it is why tag managers are useful. The risk comes from the governance gap around them: the container is usually owned by marketing, the publishing permissions are often broader than anyone realises, there is frequently no approval step, and the security team may not know the container exists. A compromised tag manager account is equivalent to compromised deploy access, with none of the review that a real deploy would attract.
Vendors, GTM containers tab: two approved Google Tag Manager containers, one blocked, and a warning that an unapproved container is injecting tags on pay.northwind.com
Blocks match a script URL, a host or a domain, and blocking a vendor stops everything it serves, on every domain in your team.

How it is abused

Two patterns. The first is credential compromise: an attacker phishes an account with publish rights and adds a tag. The second is an over-permissioned insider or agency account, where someone who should have been able to edit a single tag can publish the whole container.
In both cases the injected script arrives through a legitimate channel. It loads from the tag manager's own domain, which is on every allowlist and in every CSP, so nothing about the delivery looks wrong. Attackers also copy the look of a tag manager: the HexMage skimmer hides in a fake Google Tag Manager snippet that never loads a real container. See how the fake GTM skimmer works.

Who can publish to your container

Access tends to grow quietly. Marketing agencies are given publish rights so they can move quickly, contractors keep them after a project ends, and the security processes and staff turnover on their side are outside your view. Each of those accounts can put JavaScript on your payment page.
What gets published is rarely one script. A tag loads a vendor script, which loads its own dependencies, which can load more again. The container shows the first link in that chain; the browser runs all of it.

Hardening the container

1
Enforce MFA
On every account with any access, without exception. This is the single highest value change and it is usually available in the platform already.
2
Least privilege
Most users need read or edit, not publish. Publish rights should be a short list of named people.
3
Approval workflow
Require a second person to approve a publish. Available in the enterprise tiers of the major platforms, and worth the upgrade for a container on a payment page.
4
Audit accounts quarterly
Agencies, contractors and former staff accumulate. The list is almost always longer than expected.
5
Separate containers by risk
A container that fires on the checkout should not be the same container marketing uses for campaign experimentation.
6
Restrict custom HTML tags
Custom HTML is the mechanism that allows arbitrary script. Limiting who may create one narrows the blast radius considerably.
A container shows what is configured. The page shows what actually ran.

Platform specifics

Platform
What to check
Google Tag Manager
User permissions at account and container level, MFA on the Google accounts, environment separation, approval workflow where available, and who may create Custom HTML tags
Adobe tag manager (Adobe Experience Platform Tags, formerly Launch and DTM)
Rights in the Admin Console, publishing workflow and approvals, and which extensions are installed and by whom
Tealium iQ
Publish permissions per profile, the approval workflow, and which extensions can execute arbitrary JavaScript
The specifics differ and the questions are the same: who can publish, is there an approval step, is MFA enforced, and who reviews the list of people with access.

Monitor what is published, not what is configured

Container configuration and page reality diverge. A container shows the tags configured in it; it does not show what those tags loaded afterwards, and it does not show anything injected by another route. Monitoring the page itself catches both, and it catches a malicious container publish regardless of how the attacker obtained access.
This is also what PCI DSS 6.4.3 requires: the inventory covers every script that executes on the payment page, including everything a container introduced.
In the docs
How to do this in Script Monitoring: GTM containers shows how to approve the Google Tag Manager containers your site may load, so any other container is blocked before it runs.
Sources and methodology
PCI DSS requirement text is quoted from PCI DSS v4.0.1 (June 2024), published by the PCI Security Standards Council, which is the current version at the time of writing. Requirements 6.4.3 & 11.6.1 became mandatory on 31 March 2025. Where we describe a competitor, we describe publicly available information and say so when something should be verified with the vendor. We publish this product and that is a bias worth knowing about while you read.
ASK AN AI
Don’t just take our word for it
Ask your assistant what to look for in a tool for PCI DSS 6.4.3 & 11.6.1.

Frequently asked questions

Yes, if the container fires on the payment page. Publish access allows arbitrary JavaScript on that page, and JavaScript on a page can read any input on it. That is why publish rights on a container that touches checkout should be treated like production deploy rights.
Partly, and it is a real trade-off. The safest position is no container on the checkout, which many organizations find operationally impossible. The workable middle ground is a separate, tightly controlled container for payment pages with a short publish list and an approval step.
Partly, and less than you would hope. A CSP can restrict which origins the container may load scripts from. In practice policies are often written permissively to accommodate the container, which is exactly the loophole an attacker with container access would use.
Two passes. Review the access list and remove everyone who does not need publish rights. Then compare what the container claims to publish against what actually executes on the page, because the two diverge more often than teams expect.
This is the main mechanism: Custom HTML permits arbitrary script. Most legitimate tags do not need it, so restricting who can create one narrows the risk substantially without much friction.
Yes, generally in enterprise tiers. Requiring a second person to approve a publish is one of the most effective controls available, and for a container on a payment page it is usually worth the upgrade.
They are a common gap. Agency accounts frequently retain publish rights long after an engagement ends. Quarterly access review usually finds several.
Partly, from the container's own version history, which is useful if the attacker did not also have the ability to alter it. Monitoring the page is the more reliable answer, because it observes the outcome regardless of how it was introduced.
Yes, as a platform. The risk is not in the platform's security, it is in how it is configured and who has access. The same is true of Adobe and Tealium.
Yes. 6.4.3 covers all scripts loaded and executed in the consumer's browser on a payment page, regardless of the mechanism that introduced them. Everything your container loads belongs in the inventory.

Watch the short answer

Is Google Tag Manager Safe on Payment Pages?

Google Tag Manager is secure as a platform. On a payment page, the risk is who can publish to the container, because publish access lets anyone run JavaScript on your checkout without a code review. This video covers how containers are abused (phished accounts, over-permissioned agencies), why a container shows only the first link of what it loads, the six hardening steps (MFA, least privilege, approval workflow, quarterly access audits, a separate checkout container, restricted Custom HTML tags), why PCI DSS 6.4.3 covers every script a container introduces, and the GTM container allowlist on Script Monitoring Pro.

Read the transcript

Google Tag Manager is secure as a platform. The risk on a payment page is who can publish to it, because anyone who can publish a container can run code on your checkout. Script Monitoring is one tag, first in the head, that records every script your container actually loads, in every session. A tag manager exists to inject JavaScript without a deploy. That's the product working as designed. So publish access is the ability to ship code to your checkout, with none of the review a real deploy gets. It's abused two ways: a phished account with publish rights, or an over-permissioned agency or insider account. Either way the script loads from the tag manager's own domain, which is on every allowlist and in every CSP. And what gets published is rarely one script. A tag loads a vendor script, which loads its own dependencies, which can load more. The container shows the first link. The browser runs all of it. So the container is a list of intentions, not a record of what ran. Monitor the page itself. And for 6.4.3, everything your container loads belongs in the inventory. Harden it. Enforce MFA on every account. Keep publish rights to a short list of named people. Require a second person to approve a publish. Audit accounts quarterly. Separate the checkout container. And restrict Custom HTML tags. The safest position is no container on the checkout. If that's not workable, use a separate payment-page container, with a short publish list and an approval step. Agencies keep publish rights long after an engagement ends, so check. An attacker doesn't need your container. A different one, loaded as a sub-request, still reads as Google. On Pro, the GTM container allowlist approves the containers your site may load, and blocks any other before it runs. Script Monitoring is free for 1,000 page views a month, with 6.4.3 & 11.6.1 included. Pro, with the GTM container allowlist, starts at $99 a month. Start for free at scriptmonitoring.com.

Video page with transcriptWatch on YouTube

See every script on your own checkout.

Install the tag, mark your payment pages, and watch the inventory fill in. Free forever on 1,000 page views a month, no credit card.

Free forever plan. No credit card.