What is Cloudflare Analytics?

  • No cookies required
  • Privacy-friendly measurement
  • May be automatically enabled if you are using Cloudflare Pages

Setup Steps

  1. Go to the Cloudflare dashboard → “Analytics & Logs” → “Web Analytics”
  2. Click “Add a site” → enter your URL
  3. Copy the generated script tag

Paste it just before the </body> closing tag in your Astro layout file.

<script defer src='https://static.cloudflareinsights.com/beacon.min.js'
  data-cf-beacon='{"token": "YOUR_TOKEN"}'></script>

Data Available

  • Page views and unique visitors
  • Top pages and referrers
  • Traffic by country

Gotchas

  • Data may take a few hours to appear
  • Because no cookies are used, the script is less likely to be blocked by ad blockers

While setting up Analytics, also configure SEO meta tags in Astro to complete your site’s measurement foundation.

  • Fiverr - Find freelance developers and tech experts