Add my site

Install on Astro

One line in your base layout's head covers every page Astro renders.

Takes about two minutes

Where the tag goes

Copy the exact snippet from your dashboard; the data-site-id identifies the installation. Complete the separate DNS or homepage meta-tag check described in Get started to verify domain ownership.

This snippet starts measuring on load. Where consent is required, add data-require-consent before loading and wire acceptance and withdrawal to your consent manager. The consent guide includes the calls and pre-load queue.

Paste the tag into your layout's <head>, e.g. src/layouts/Layout.astro:

<script defer src="https://app.datastated.com/ds.js?v=2026-09-10-consent"
  data-site="acme.com" data-site-id="dst_YOUR_SITE_ID"></script>

Astro's is:inline is not needed: the tag is an external script with attributes, which Astro leaves alone by default. If you use view transitions, navigations still count: the tag follows the History API.

Verify it worked

Open your live site in a normal browser window and click around. The installation step on your dashboard detects the first recorded pageview. Domain verification is a separate step. Nothing arriving? Walk the troubleshooting list, and remember your own ad blocker or privacy flags silence the tag.

Questions? Email us at hello@datastated.com.