Astro

Astro takes one snippet in your layout’s <head>. By default every Astro page is a full page load, so each visit is tracked with nothing extra.

1. Get your snippet

Each site has its own snippet with a unique script URL. Copy the exact one from your dashboard’s Install step, with your site’s ID in place of wa-XXXXXXXX.

2. Add it to your layout

Paste the snippet into the <head> of your shared layout (for example src/layouts/Layout.astro) so it loads on every page:

---
// src/layouts/Layout.astro
---
<head>
  <!-- …your existing tags… -->

  <!-- Privacy-friendly analytics by Wazlytics -->
  <script async src="https://wazlytics.com/js/wa-XXXXXXXX.js"></script>
  <script is:inline>
    window.wazlytics = window.wazlytics || function(){(wazlytics.q = wazlytics.q || []).push(arguments)};
    wazlytics.init = wazlytics.init || function(o){ wazlytics.o = o || {} };
    wazlytics.init()
  </script>
</head>

The is:inline directive tells Astro to leave the init script untouched rather than bundling it.

Heads up

Using Astro’s View Transitions (the <ClientRouter /> component)? Astro swaps pages without a full reload and its router bypasses automatic navigation detection, so in-app navigations after the first page may not be counted. Add an astro:after-swap listener in your layout to record them:
<script is:inline>
  document.addEventListener('astro:after-swap', () => window.wazlytics && window.wazlytics('pageview'))
</script>
astro:after-swap fires on each transition but not on the initial load, so your first pageview isn’t double-counted.

Verify

Build and preview (or deploy) your site, open Realtime in Wazlytics, and load a page — your visit should appear within a few seconds. If nothing shows up, the troubleshooting guide covers the usual causes.