Skip to content

Install Statsdot with Google Tag Manager

Updated October 16, 2026

If you can edit the <head> of your site, paste the snippet there as in the general guide. With Tag Manager the browser has to load GTM before it loads Statsdot, and if a consent tool holds GTM back, Statsdot waits too. Use GTM when it is the only place where you can add code.

1. Create the tag

  1. In Tag Manager, open your container and go to Tags → New.
  2. Click Tag Configuration and choose Custom HTML.
  3. Paste your snippet:
<script defer data-domain="yoursite.com" src="https://statsdot.com/js/script.js"></script>
  1. Under Triggering, choose Initialization - All Pages. All Pages also works and fires a moment later.
  2. Save the tag, then Submit and Publish the container. Visitors only get the tag once the container is published.

data-domain must be the domain you added in Statsdot, without https:// or www.

Load it once per page

Statsdot follows navigation through the browser's history API on its own. Do not add a History Change trigger to the tag: every navigation would load another copy of the script and count pages twice. For the same reason, do not keep the snippet in the head and in GTM at the same time.

Events from Tag Manager

To count something GTM already detects, such as a click or a form submission, create another Custom HTML tag:

<script>
  window.statsdot && window.statsdot.track('Signup');
</script>

Give it the trigger for that action: a click trigger, a form submission trigger or a custom event from your data layer. The check on window.statsdot keeps the tag from throwing an error if the script has not loaded. Then add Signup as a goal in the site's Settings (the cog next to the dates). More in Events and goals.

If you can edit the HTML, the data-statsdot-event attribute does the same without a tag.

Consent tools

Statsdot sets no cookies and stores no personal data. If your consent tool blocks the whole GTM container until the visitor answers, Statsdot only counts the visitors who accept, and your numbers will be lower than your real traffic. Whether you need consent depends on your country and on what else your site loads: see Do I need a cookie banner for website analytics?.

Check that it works

Use GTM's Preview mode to confirm that the tag fires. Then open your site in a normal browser window and look at the dashboard: within a few seconds you appear among the visitors on the site right now. Visits from localhost are ignored.