New: Free plan is live 7 August 2026 · View changelog →
Antlytics logoAntlytics

Add Antlytics to Hugo

Prerequisites

  • An Antlytics account (sign up free)
  • Your tracking ID from Settings → Tracking Snippet in your Antlytics dashboard

Install the snippet

Step 1 — Create the partial

Create layouts/partials/antlytics.html:

<script
  defer
  src="https://www.antlytics.com/tracker.js"
  data-tracking-id="YOUR-SITE-ID"
  data-api-host="https://www.antlytics.com"
></script>

Note: Replace YOUR-SITE-ID with the tracking ID from your Antlytics dashboard.

Step 2 — Include the partial in your base template

Open layouts/_default/baseof.html (or your active theme's equivalent) and add the partial just before </head>:

<!-- layouts/_default/baseof.html -->
<head>
  <meta charset="utf-8" />
  <title>{{ .Title }}</title>
  {{- partial "head.html" . }}
  {{- partial "antlytics.html" . }}
</head>

If you use a third-party theme, override the head partial rather than editing the theme files directly so your change survives theme updates.

Verify installation

  1. Visit your site in a browser.
  2. Open your Antlytics dashboard → Overview.
  3. Your visit should appear within a few seconds.

If data does not appear after a few minutes, check the troubleshooting guide.

Optional: First-party proxy

To avoid ad blockers, set up a first-party proxy on your own domain.

Need help?

Email support@antlytics.com with your site ID and page URL.

Something missing? Get in touch and we will update these docs.