# Install Foresite on Astro

Paste your Foresite line into the `<head>` of the layout every page uses, often `src/layouts/Layout.astro`, and add `is:inline` so Astro leaves it as it is:

```astro
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>{title}</title>
    <script is:inline defer src="https://t.foresite.dev/s/YOUR_SITE_ID.js"></script>
  </head>
  <body>
    <slot />
  </body>
</html>
```

Use the address from your own Foresite line (**Settings → Install**).

If you use view transitions (`<ClientRouter />`), Foresite counts each page change as a pageview automatically. Astro runs a script from the same address only once per visit, so pages are never counted twice.

Visits to `localhost` aren't counted, so test on your deployed site: the **Installation Check** in **Settings → Install** turns green with the first pageview.

Using Starlight for documentation? See the [Starlight guide](https://foresite.dev/docs/starlight).
