# Install with Google Tag Manager

> A Custom HTML tag on the All Pages trigger, submitted and published, puts the script on every page.

Section: Installation guides  
Canonical page: https://statsy.co/docs/install/gtm  
Last updated: 2026-09-15

If Tag Manager is already on every page, it can carry the Statsy tag too. If it is not, pasting the tag directly into your template is simpler and one network hop shorter.

## Where it goes

1. New Custom HTML tagIn your container, choose **Tags › New**, then **Custom HTML**, and paste the tag.
2. Trigger on All PagesSet the trigger to **All Pages**, save, then **Submit** to publish the container version.

```html
<script defer data-website-id="ws_XXXXXXXX" data-domain="yourstartup.com" src="https://statsy.co/js/script.js"></script>
```

## Confirm it works

Use Tag Manager’s preview to check the tag fires, then open the real site and watch **Live**. Remember that the container must be published before visitors get the tag.

## Do not add a history-change trigger

The usual mistake is adding a second trigger for history changes so single-page navigation is counted. Statsy already patches `history.pushState` and `replaceState` itself, so a history trigger loads the script a second time and doubles everything. All Pages on its own is correct. See [Single-page apps and route changes](https://statsy.co/docs/tracking-script/spa).

> **Watch out.** Ad blockers that block Tag Manager block everything inside it. If measurement accuracy matters more than convenience, install the tag directly and point it at a [first-party proxy host](https://statsy.co/docs/tracking-script/first-party-domain).

Previous: [Install on Framer](https://statsy.co/docs/install/framer)  
Next: [Install on Squarespace](https://statsy.co/docs/install/squarespace)