Skip to content

Install with Google Tag Manager

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

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 tag

    In your container, choose Tags › New, then Custom HTML, and paste the tag.

  2. Trigger on All Pages

    Set 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.

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.

Last updated · Markdown version