Cookie-Free Analytics for Astro
Astro ships zero JavaScript by default. Adding GhostlyX keeps your analytics footprint minimal: a single deferred script that does not block rendering or inflate your bundle.
Installation guide
Add the script to your base layout
Open your base layout file (commonly src/layouts/Layout.astro) and add the GhostlyX script inside the <head> element.
---
// Layout.astro
---
<html lang="en">
<head>
<meta charset="utf-8" />
<script defer src="https://cdn.ghostlyx.com/gx.js" data-site-id="YOUR_SITE_ID"><\/script>
</head>
<body>
<slot />
</body>
</html>
Confirm it is working
Run astro dev and open your site. Check your GhostlyX real-time dashboard to confirm the visit is being recorded.
Why Astro users choose GhostlyX
Astro sites are often content-heavy with a focus on speed. GhostlyX tracks blog posts, documentation pages, and marketing pages equally well. Because Astro's architecture sends minimal JavaScript to the browser, using cookie-free analytics avoids negating those performance gains with a heavy analytics library.
Cookie-free tracking
No consent banner required under GDPR or PECR
Under 1.5 kB script
Negligible impact on page speed and Core Web Vitals
Real-time dashboard
See visitors as they arrive, updated every few seconds
Free plan available
Start tracking without a credit card
Replacing Google Analytics on Astro?
See how GhostlyX compares feature by feature, including script size, GDPR compliance, and pricing.
Related integrations
Ready to add GhostlyX to Astro?
Free plan available. Setup takes 3 minutes. No cookie consent banner required.
Get started free