Skip to content

Analytics

📖 2 min read community
Site analytics setup and usage guide - privacy-first tracking with Cloudflare Web Analytics.

The AI Playbook uses Cloudflare Web Analytics - a privacy-first analytics platform that doesn’t use cookies or collect personal data. No consent banner needed.


Setup

  1. Go to Cloudflare Dashboard → Web Analytics
  2. Click Add a site and enter your domain
  3. Copy the provided token
  4. In astro.config.mjs, find the commented analytics block in the head section
  5. Uncomment it and replace YOUR_TOKEN with your token:
{
tag: 'script',
attrs: {
defer: true,
src: 'https://static.cloudflareinsights.com/beacon.min.js',
'data-cf-beacon': '{"token": "YOUR_TOKEN"}',
},
},
  1. Deploy to Cloudflare Pages

What Gets Tracked

  • Page views (URL, referrer, browser, device type)
  • Visit duration
  • Bounce rate
  • Geographic region (country-level, not city)

Not tracked: Cookies, personal data, scroll depth, mouse movements, keystrokes.


Dashboard

Your analytics dashboard is at Cloudflare Web Analytics. Key metrics to watch:

MetricWhat It Tells YouGood Sign
Page viewsWhich content is most popularTop pages match what you prioritize
Visit durationAre people reading or bouncingAvg >2 minutes
ReferrersWhere traffic comes fromGitHub, direct, search
DevicesDesktop vs mobile<40% mobile (this is a reference site)

Weekly Review

Add this to your weekly maintenance routine:

  1. Check top 10 pages - do they reflect what’s most useful?
  2. Check referrers - any new sources of traffic?
  3. Check mobile percentage - optimize if >50%
  4. Compare week-over-week - any sudden drops?