> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openrevenue.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Astro installation

> Install OpenRevenue analytics in Astro through a layout, head tag, or reusable component.

## Via layout

Add the script to your base layout file (e.g. `src/layouts/Layout.astro`):

```astro src/layouts/Layout.astro theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
---
// Layout.astro
---

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <slot name="head" />
  </head>
  <body>
    <slot />

    <script
      is:inline
      src="https://api.openrevenue.com/tracker.js"
      data-site="your-project-id"
      defer
    ></script>
  </body>
</html>
```

> [!TIP]
>
> Use `is:inline` to prevent Astro from bundling the tracker; it should load as a plain external script.

## Via Head tag

If you use Astro's `<head>` directly in pages, add the script there:

```astro src/pages/index.astro theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
---
// index.astro
---

<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <script
      is:inline
      src="https://api.openrevenue.com/tracker.js"
      data-site="your-project-id"
      defer
    ></script>
  </head>
  <body>
    <h1>Hello Astro</h1>
  </body>
</html>
```

## Verify

Deploy and open your site in a browser. Your [OpenRevenue dashboard](https://www.openrevenue.com/dashboard) should show a pageview within seconds.

> [!NOTE]
>
> OpenRevenue ignores `localhost` automatically. Test on your deployed URL.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.