# How to add tracking with Google Tag Manager, and when not to

> Add an analytics tag through Google Tag Manager with a Custom HTML tag, pick the right trigger, send events from triggers, and know the trade-offs.

Source: https://datacenter.so/track/google-tag-manager
By the Datacenter team. Updated October 23, 2026.

Google Tag Manager is a container for other tags. If it is already on your site, adding a new analytics tool through it means no change to the site's code. If it is not, adding it just to load one tag adds a layer you do not need.

This page covers adding a tag, the trigger that matters, sending events from Tag Manager, and the trade-offs.

## Install Datacenter with Google Tag Manager

1. In Datacenter, copy your tag from **Set up your site**.
2. In Tag Manager, open your container. Click **Tags**, then **New**, and name it Datacenter.
3. Click **Tag Configuration** and pick **Custom HTML**. Paste the tag into the **HTML** box.
4. Under **Triggering**, pick **Initialization - All Pages**. Click **Save**.
5. Click **Submit**, then **Publish**. Nothing runs until the container is published.

Custom HTML is the tag type for code a vendor gives you that Tag Manager has no template for ([Google](https://support.google.com/tagmanager/answer/6107167)). Leave **Support document.write** off; the tag does not need it.

## Why the Initialization trigger

Every web container has a built-in **Initialization - All Pages** trigger. It fires before the other page view triggers, except **Consent Initialization** ([Google](https://support.google.com/tagmanager/answer/7679319)). An analytics tag should load as early as possible, so it counts visitors who leave fast and is ready before other tags send events.

**Consent Initialization** is for consent tools and consent defaults, not for analytics tags ([Google](https://support.google.com/tagmanager/answer/7679319)). Google's own GA4 troubleshooting points to the same trigger order: a Google tag that fires late is a known cause of [(not set) sources in GA4](https://datacenter.so/guides/ga4-not-set).

## Checking it works

Tag Manager adds tags after the page starts loading, so a tool that reads your page's HTML, such as a "check my site" button, cannot see a tag inside Tag Manager. Check it instead:

- with Tag Manager's **Preview** mode, which shows each tag that fired on each page, and
- by opening your site and watching the analytics tool's real-time view.

## Send events from Tag Manager triggers

Tag Manager's triggers (clicks, form submissions, element visibility, custom events from your site's data layer) can send events to any tool. For Datacenter, make another **Custom HTML** tag with one line, and fire it on the trigger:

```html
<script>datacenter('Quote sent');</script>
```

Use triggers that fire after the page has loaded, such as clicks, form submissions and data layer events, so the Datacenter tag is ready. Then make **Quote sent** a goal in Datacenter. This is the Tag Manager way to count actions the page itself does not expose; for no-code goals without Tag Manager, see [goals without a developer](https://datacenter.so/guides/goals-without-a-developer).

## Consent

If your consent tool runs in Tag Manager, it can tell other tags what the visitor chose. Datacenter's default Private mode stores nothing on the device. In 90-day tracking with **Wait for consent** on, fire a Custom HTML tag with `datacenter('consent', true)` on your consent tool's "accepted" trigger, and `datacenter('consent', false)` when the visitor declines. The legal side is in [cookieless analytics and GDPR](https://datacenter.so/guides/cookieless-analytics-gdpr).

## Trade-offs to know

- **One more request before tags run.** Tag Manager itself must load first. Pasting a tag straight into the page is simpler when you only have one or two tags.
- **Blockers.** If a visitor's blocker stops Tag Manager, every tag inside it stops with it.
- **Publishing is a step people forget.** Changes in a workspace do nothing until published.
- **Access.** Anyone with publish rights can change every tag on the site. Keep the list of publishers short.

## Common questions

### Can I add any analytics tool through Google Tag Manager?

Yes, with a Custom HTML tag, as long as the tool's tag works when added after the page starts loading. Most do.

### Which trigger should an analytics tag use?

**Initialization - All Pages**, so it loads before other page view triggers. Keep **Consent Initialization** for your consent tool.

### Why does my tag not show up after I added it in Tag Manager?

The container was not published, the trigger does not fire on that page, or a blocker stopped Tag Manager. Use Preview mode to see which.

### Should I install Google Tag Manager just to add one tag?

Usually not. Paste the tag into your site's header instead. Tag Manager pays off when you manage several tags or need its triggers.

## Sources

- Tag Manager Help: [Custom tags](https://support.google.com/tagmanager/answer/6107167), [Page view triggers](https://support.google.com/tagmanager/answer/7679319). Checked October 2026.

## Where Datacenter fits

In Tag Manager, Datacenter is one Custom HTML tag on the Initialization - All Pages trigger, and any Tag Manager trigger can send a Datacenter event with one line. More: https://datacenter.so/docs/install-google-tag-manager
