measuremy.site

How to add analytics to your Hugo site

This adds measuremy.site, cookieless website analytics, to a Hugo site. It is one script tag of under 1 KB: no cookies, no npm package, no consent banner for the tracker. The free plan covers 5,000 pageviews a month.

The quickest way: ask your coding agent

Paste this into Claude Code, Cursor or Codex
Add measuremy.site analytics to this project: connect the measuremy.site MCP server at https://a.measuremy.site/mcp (it signs in with OAuth, no key), then tell me how to sign in. Details: measuremy.site/llms.txt

The agent connects to measuremy.site, you sign in through your browser, and it adds the tag below to the right file for you. To do it by hand, follow the steps.

1. Get your site key

Create a free account and add your domain. The Setup tab shows your snippet with your site key filled in. The key is public and can only record visits, so it is safe in your source code.

2. Add the script tag

Add the tag to the partial that renders <head>, often layouts/partials/head.html. If it comes from a theme, don't edit the theme: copy the file to the same path under your site's own layouts/ folder, because Hugo uses your project's files before the theme's. Many themes also offer an empty hook such as layouts/partials/extend_head.html or head/custom.html for exactly this.

{{/* layouts/partials/head.html */}}
<script defer src="https://a.measuremy.site/t.js" data-key="YOUR_SITE_KEY"></script>

To keep it out of local previews, wrap it in {{ if hugo.IsProduction }} and {{ end }}. Visits from localhost aren't counted either way.

3. Check it works

Publish the change, then open your live site. The first visit from your own domain verifies it and the visit shows up on the dashboard within seconds. Visits from localhost aren't counted, so test on the deployed site.

4. Track signups and other conversions

Hugo sites are static, so the simplest way is the HTML attribute on the element: <a href="/signup" data-measuremysite-event="signup_click">. For a form handled by a third-party service, add data-measuremysite-event="contact_submit" to the <form>.

Any event counts as a conversion for the channel the visitor came from.

Other platforms, and funnels and campaign links, are in the install guide.

Try it on your site

Free for 5,000 pageviews a month, no card. Paste one sentence into your coding agent, or add one script tag yourself.

Start free See the live demo

Add measuremy.site analytics to this project: connect the measuremy.site MCP server at https://a.measuremy.site/mcp (it signs in with OAuth, no key), then tell me how to sign in. Details: measuremy.site/llms.txt

More guides