# Install on Astro

> Put the tag in the shared layout every Astro page uses, so it ships with static and server-rendered routes alike.

Section: Installation guides  
Canonical page: https://statsy.co/docs/install/astro  
Last updated: 2026-09-15

Astro pages usually share one layout component. The tag goes in that layout’s head, once.

## Where it goes

Open `src/layouts/Layout.astro` (or whatever your base layout is called, often `BaseHead.astro`) and paste the tag inside `<head>`.

```html
<head>
  <meta charset="utf-8" />
  <title>{title}</title>
  <script defer data-website-id="ws_XXXXXXXX" data-domain="yourstartup.com" src="https://statsy.co/js/script.js"></script>
</head>
```

Astro leaves a plain `<script>` with a `src` alone, so there is no need for `is:inline` to stop it being bundled.

## Confirm it works

Build, deploy, open the site, and watch **Live**. View source on any page and the tag should be in the delivered HTML.

## Check every layout

The Astro gotcha is a second layout. Blog posts, documentation and landing pages often use different `.astro` layouts, and only the one you edited reports. Grep `src/layouts` for `<head>` and make sure every layout either contains the tag or imports the head component that does. With Astro’s view transitions turned on, navigation still goes through the History API, so route changes are tracked without extra code.

Previous: [Install on SvelteKit](https://statsy.co/docs/install/sveltekit)  
Next: [Install on Remix](https://statsy.co/docs/install/remix)