Install on Hugo
Add the tag to the head partial of your Hugo theme so every generated page carries it.
Hugo builds every page from one base template. Put the tag in the head partial and the whole site is covered on the next build.
Where it goes
Create or edit layouts/partials/head.html in your project (not in the theme folder, so theme updates keep it) and paste the tag. If your theme has no head partial, edit layouts/_default/baseof.html instead.
<script defer data-website-id="ws_XXXXXXXX" data-domain="yourstartup.com" src="https://statsy.co/js/script.js"></script>To keep the site key out of templates, put it in hugo.toml under params and print it with {{ .Site.Params.statsyId }}. It is a public key either way.
Confirm it works
Build and deploy, then open the site and check Live. Look in public/ after a build: the tag should appear in every generated HTML file.
Overriding a theme partial
Hugo’s lookup order means a file in your project’s layouts/ replaces the theme’s version entirely. If you copy the theme’s head.html to override it, copy the whole file, not just the tag, or you will silently lose the theme’s stylesheets. Local previews from hugo server run on localhost and are not counted in production.
Last updated · Markdown version