Home / Guides

How to inject a GTM container into any website

Test a container before it ships — on a client site, a staging build, or a page you do not control — without touching the codebase.

Sometimes you need a container running on a page that does not have one. A client has not deployed the snippet yet. The staging environment is missing it. You want to prove a setup works before asking a developer to ship anything. Injecting the container from the browser answers all three in about ten seconds.

Why some extensions lost this feature

Manifest V3 changed how extensions may execute code, and several well-known debugging extensions dropped their injector rather than rewrite it — Adswerve's dataLayer Inspector+ is the most-missed example. The capability is still perfectly implementable under MV3; it just needs the injection to run in the page's own execution context rather than the extension's.

Injecting a container

  1. Copy your container snippet from GTM (Admin → Install Google Tag Manager, the first block).
  2. Open Tag Master's GTM tab and paste it into the snippet box. The container ID is detected as you type.
  3. Click Inject. The container loads on the current page immediately.

The injection is stored per site, so it re-applies on every reload until you remove it. That persistence matters more than it sounds — see the Tag Assistant note below.

The GTM snippet injector in Tag Master with a container snippet pasted in, the container ID read back as detected, and options to replace an existing container or open Tag Assistant.
Paste the snippet, and the container ID is read back so you know it took. The injection survives reloads, and Tag Assistant can be opened ready to connect.

Paste each snippet once. Tag Master saves it under its container ID, so next time you pick the container from the saved list and inject with one click.

Connecting a preview session

Adding gtm_debug to the URL does not, by itself, connect anything — modern GTM preview sessions have to be initiated from tagassistant.google.com. That is why in-app "debug mode" toggles in older tools never showed as connected.

Tick "Debug via Tag Assistant" before injecting and the flow completes itself: the container is injected, persistence is registered, and Tag Assistant opens with your container and page URL prefilled. Click Connect there; Tag Assistant reloads the page, the persisted injection re-applies, and the session attaches.

What injection is good for

Limits worth knowing

Doing this in the panel →

The rest of this group: Containers and triggers

More in Containers and triggers

Try it on your own site

Tag Master is free, needs no account, and collects no data.

Add to Chrome — Free