Install Analytise on Astro

One line in your base layout covers every page on the site.

Add it to your layout

  1. Open your shared layout (e.g. src/layouts/BaseLayout.astro).
  2. Paste the snippet inside the <head>.
  3. Run astro build and deploy.
src/layouts/BaseLayout.astro
---
// src/layouts/BaseLayout.astro
---
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>{Astro.props.title}</title>
    <script
      defer
      data-domain="yourwebsite.com"
      data-site-id="YOUR_SITE_ID"
      src="https://www.analytise.com/js/tracker.js">
    </script>
  </head>
  <body>
    <slot />
  </body>
</html>

Verify it works

  1. Open your website in a new tab.
  2. The dashboard shows your visit under online within a few seconds (live visitors update every ~15s).
  3. Nothing showing? See Troubleshooting.

Next guide

Vue.js