Founder pricing — only 4 of 50 seats left at $49/yrthen $149Claim yours

Integration Guide

How to Connect Astro

Deploy ultra-fast, cookieless analytics to your performance-first Astro site.

Astro is the modern web framework built for speed, delivering zero-JavaScript layouts by default. Adding heavy tracking code to an Astro site defeats the purpose of optimization.

TrackWhy is the ideal analytics companion for Astro. At 1.7 KB, it respects Astro's zero-JS philosophy. It loads asynchronously, tracks transitions, and gathers deep insights without injecting unnecessary script runtimes.

Get complete analytics — from traffic sources to conversion paths — on your static and dynamic Astro routes while maintaining a perfect PageSpeed score.

Start free trialNo credit card required.

Step-by-step

Setup guide in 5 simple steps.

  1. 1Register your Astro site in your TrackWhy dashboard.
  2. 2Copy your unique tracking snippet.
  3. 3Open your main Astro layout file (e.g., Layout.astro) and paste the script inside the <head> element.
  4. 4If using Astro's view transitions, ensure the script is set to run on page swap events.
  5. 5Build and deploy your Astro project. Traffic will begin recording immediately.

Capabilities

What this integration unlocks.

Zero-JS framework harmony

TrackWhy’s tiny script matches Astro’s design goals, ensuring your site remains lightning-fast.

Static & SSR support

Works perfectly whether you compile Astro to static HTML (SSG) or render dynamically on the server (SSR).

Clean privacy metrics

No cookies or PII collected, matching the clean developer ethos of the Astro community.

FAQ

Astro + TrackWhy — FAQ.

Does TrackWhy support Astro View Transitions?
Yes. TrackWhy handles view transitions smoothly. Simply place the script tag in the root layout, and it will capture page views correctly during Astro's dynamic navigations.