Docs

Astro

Add the tag once to your shared layout and every page is covered. Takes about two minutes.

Add the snippet

Add the script to the <head> of your shared layout (often src/layouts/Layout.astro):

<script is:inline defer src="http://localhost:3000/analytics.js" data-website-id="YOUR_TRACKING_ID"></script>

Use is:inline so Astro leaves the tag as written instead of bundling it.

Client-side routing

Nothing else to do. Astro's client-side navigations and hashes are tracked automatically.

Track custom events

Call the global function from any script or island:

window.lumen?.("Signup", { plan: "pro" });

Verify

Reload your site and open the site's real-time view in your dashboard. The pageview should appear within seconds. If not, see Troubleshooting.