Skip to Content

Astro

In Astro, the right place for a site-wide script is the <head> of your base layout. Most Astro projects have one at src/layouts/Layout.astro (the name may differ; look for the .astro file that wraps every page).

Open that file and paste the snippet inside the <head>:

--- // src/layouts/Layout.astro --- <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>My Site</title> <script defer src="https://api.snowanalytics.app/sa.js" data-site="YOUR_SITE_ID"></script> </head> <body> <slot /> </body> </html>

This works for both static output and SSR mode.

View transitions / client-side routing

If your site uses Astro’s View Transitions  or any client-side router, Snow still tracks each navigation automatically: it hooks the browser History API and listens for popstate. No extra code is needed. See Single-page apps.

Verify

Build and preview your site (astro build && astro preview) or open it in a browser, then check the Live view in the Snow dashboard. See Troubleshooting if nothing appears.