Skip to content

Google Tag Manager

Use this when the site already runs Tag Manager and nobody can edit its templates. Tag Manager loads the script; the component’s tag still has to be on the page, so this guide covers the loader only.

  1. In your container, create a Custom HTML tag.
  2. Paste the snippet:
index.html
<script async src="https://cdn.taggorcdn.com/s/<site-key>.js"></script>
  1. Trigger it on All Pages (or on the pages that hold components), preview in Tag Manager’s preview mode, then publish the container.

Tag Manager asks that JavaScript sit inside script tags and turns document.write off by default (Custom HTML tag, https://support.google.com/tagmanager/answer/6107167, read 2026-11-10). The snippet needs neither document.write nor anything else switched on. The page says nothing about loading an external script or about when the tag fires; the second part we tested, below.

Write the tag in the page’s own HTML, as in Install the snippet; Tag Manager does not place it for you.

  • Tag Manager adds the script when its trigger fires, so the component appears later than with a snippet in the page. The tag must have a fallback inside it (Fallback content).
  • A consent tool that blocks Tag Manager until the visitor accepts also blocks the component. The component then stays as the page wrote it.
  • Tag Manager minifies Custom HTML and may turn single quotes into double quotes. Harmless for the snippet.
  • The component appears a moment after the page. Expected with a late trigger: reserve its size with :not(:defined) so the page does not jump.
  • Nothing happens in preview. The trigger did not fire on that page, or an ad blocker blocks Tag Manager; the page stays intact either way.

The fixture platform-gtm adds the script element after the page’s load event, the way Tag Manager adds a script, and the tags already on the page mount when it arrives, in Chromium, Firefox, WebKit and two mobile emulations. Not checked: no Tag Manager container was used.