> For the complete documentation index, see [llms.txt](https://docs.humblytics.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.humblytics.com/how-to-get-started/astro.md).

# Astro

Add Humblytics to your Astro site in about 5 minutes.

{% hint style="info" %}
**You need:** access to your layout file and a production deploy. `npm run dev` won't verify.
{% endhint %}

## 1. Copy your tracking code

In Humblytics, open **Site settings → Install** and click **Copy tracking code**.

## 2. Add it to your layout

Open your shared layout, such as `src/layouts/Layout.astro`, and paste the snippet before `</head>`. Add `is:inline` to **both** `<script>` tags so Astro doesn't bundle or move them:

```astro
<head>
  <!-- your existing meta tags -->

  <!-- Start Humblytics Tracking Code -->
  <script is:inline>
    (function(){
      document.documentElement.style.opacity='0';
      window._hmblReveal=function(){ document.documentElement.style.opacity='1'; };
      setTimeout(window._hmblReveal, 2000);
    })();
  </script>
  <script is:inline async src="https://app.humblytics.com/hmbl.min.js?id=YOUR_ID"></script>
  <!-- End Humblytics Tracking Code -->
</head>
```

Replace `YOUR_ID` with the ID from your snippet.

* **Several layouts?** Put the snippet in a component, such as `src/components/Humblytics.astro`, and include it in each layout's `<head>`.
* **Using `<ClientRouter />` (view transitions)?** No extra code. Humblytics tracks client-side navigation on its own.

## 3. Build, deploy, and verify

1. Build and deploy to production.
2. Back in Humblytics, click **Verify install**.
3. Open your live site in a private window and click around. Your visit appears in **Observe → Analytics → Overview** under **Live Activity** within about a minute.

**Not verifying?**

* Both script tags have `is:inline`. Without it, Astro processes the script and the tracking code can break.
* Every page uses a layout that includes the snippet.

Still stuck? See [Verify & Troubleshoot Tracking](/how-to-get-started/verify-and-troubleshoot-tracking.md).
