> ## Documentation Index
> Fetch the complete documentation index at: https://docs.allgoodhq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Install with Google Tag Manager

> Load the allGood tag through a GTM container, using the template allGood generates for your account.

For teams whose only route onto the website is Google Tag Manager. The result is identical to pasting the script tag — the container just does the pasting.

<Tip>
  Just need the settings-level version? [Set up Web Tracking on your site](/mk/settings/web-edge/tracking-setup) covers installing with GTM in plain terms, without the template internals.
</Tip>

**Where:** Settings → Web Tracking → **Install with Google Tag Manager**.

<Frame caption="The Google Tag Manager install drawer, with the template download and your pre-filled domain and key.">
  <img src="https://mintcdn.com/allgoodtechnologyinc/bf1LRHwyriZvgDxT/images/mk/web-edge/integrate-gtm-drawer.png?fit=max&auto=format&n=bf1LRHwyriZvgDxT&q=85&s=e7d3ee56b20db660f71a56f99dbc4911" alt="The Google Tag Manager install drawer, with the template download and your pre-filled domain and key" width="1080" height="900" data-path="images/mk/web-edge/integrate-gtm-drawer.png" />
</Frame>

## Why the template is generated for you

GTM requires a template to name the exact host it may load a script from, and it won't accept a wildcard. A one-size-fits-all template would force every customer to hand-edit the permissions, and anyone who didn't would get an install that fails for no obvious reason.

So allGood generates the template against **your** domain, with both fields already filled in. Download it again whenever your domain changes — that's the only reason to re-import.

<Steps>
  <Step id="import-the-template" title="Import the template">
    Click **Download allgood.tpl**.

    In GTM: **Templates → New → ⋮ → Import**, choose the file, then **Save**.
  </Step>

  <Step id="add-the-tag" title="Add the tag">
    **Tags → New → allGood Web Tracking → Triggering → All Pages → Submit.**

    Both fields arrive pre-filled. Fire it on **All Pages** — that's what page-view tracking needs. The script only loads once even if the tag fires on several events.
  </Step>

  <Step id="check-it-works" title="Check it works">
    The drawer has a **Container id** field and an **Open test page** button. Enter your `GTM-XXXXXXX` id and open the page.

    <Frame caption="Step three of the drawer, where you enter your container id and open the test page.">
      <img src="https://mintcdn.com/allgoodtechnologyinc/bf1LRHwyriZvgDxT/images/mk/web-edge/integrate-gtm-drawer-test.png?fit=max&auto=format&n=bf1LRHwyriZvgDxT&q=85&s=81e48ee6a59bb2c53a921dd2d84c23cc" alt="Step three of the drawer, where you enter your container id and open the test page" width="1080" height="900" data-path="images/mk/web-edge/integrate-gtm-drawer-test.png" />
    </Frame>

    On that page: point GTM's preview at the URL, confirm the tag fires once and succeeds, and check the browser console shows the script is ready.

    In GTM mode the test page deliberately stops loading the script itself and lets your container do it — so what you're testing is your tag, not a second install path that happens to work.
  </Step>
</Steps>

<Note>
  The test page link is signed with your container id. You can't append a different id to an existing link — the page builds a script address from it, so an id anyone could add would be a way to make an allGood page load a container of their choosing.
</Note>

## If the tag reports a failure

The host it tried to load from doesn't match the template's permission. Download the template again from the drawer — it's generated against your current domain.

This fails loudly rather than quietly: the tag reports a failure and GTM's preview shows it, rather than silently doing nothing.

## The template editor's Run button is not this test

<Warning>
  Pressing **Run** in GTM's template editor executes the template on Google's own sandbox page. The console then warns that `tagmanager.googleusercontent.com` isn't an allowed origin — which is correct, and actually means the tag loaded and reached allGood.

  **Do not add that origin to your allowed list.** It's shared by every GTM template author in the world, so anyone's sandbox could then send events into your account. Test on a page whose origin you control instead.
</Warning>

## Consent in GTM

Two options, and they compose:

* **Let allGood handle it.** Keep **No tracking before opt-in** on and make sure your consent platform writes its signal on every page. The tag holds and releases events on its own. This is simpler, and it works whether or not GTM knows about consent.
* **Let GTM handle it.** Use GTM's own consent triggers so the allGood tag doesn't fire until analytics consent is granted. The allGood gate then has nothing to hold.

Don't use GTM consent triggers *and* switch off allGood's own gate — that leaves GTM as the only control.

## Forms through GTM

Form capture works exactly the same way: the injected script binds any form on the page marked for allGood. The container's job ends at loading the script.

## What the tag decides

Nothing. It loads the script and reports back. Which events are captured, whether consent allows them, what a form's fields are, whether a bot check is required — all of that is read at runtime from your allGood settings, so a settings change never means re-importing the template.
