public/index.html or your framework root layout <head> · open source (MIT) · ask in plain English

Add analytics to Cloudflare Pages.

smolanalytics is open-source analytics for sites deployed on Cloudflare Pages. Pages serves your built static output, so the two script tags go in your root HTML head, index.html or your framework's root layout before it builds. It autocaptures pageviews, clicks, engagement, scroll and JS errors with zero code, cookieless by default.

public/index.html or your framework root layout <head>
<!-- In your root HTML <head>, before the build that Pages serves -->
<script src="https://YOUR-INSTANCE/sdk.js"></script>
<script>smolanalytics.init("WRITE_KEY", { host: "https://YOUR-INSTANCE" })</script>

Cloudflare Pages has no built-in snippet field, so add the tags to your source head. For advanced setups you could inject via a Pages Function or Worker HTMLRewriter, but the head is simpler.

how do I add analytics to cloudflare pages?

smolanalytics is open-source analytics for sites deployed on Cloudflare Pages. Pages serves your built static output, so the two script tags go in your root HTML head, index.html or your framework's root layout before it builds. It autocaptures pageviews, clicks, engagement, scroll and JS errors with zero code, cookieless by default.

Cloudflare Pages just serves whatever your build outputs, so there's no dashboard injection point, the smolanalytics tags belong in your source HTML head or your framework's root layout. After the next deploy, autocapture starts recording pageviews and clicks across every route with no further wiring.

Running it here pairs well with Cloudflare's edge: your pages stay fast, and analytics is a lightweight script plus your own instance holding the raw events. It's cookieless so you avoid a consent banner, and answers are deterministic computed reports, not an AI guessing over your data. Self-host the Go binary free or use hosted from $29/mo. Track custom events with smolanalytics.track("signup", { plan: "pro" }).

Honest pricing: 14-day full trial, no credit card. Then Solo $29/mo, never metered on seats or sites. Overage is $5/million with an emailed receipt, the dashboard never locks, and self-hosting the single Go binary is free forever (MIT).

Add analytics to Cloudflare Pages tonight.

One snippet, or one endpoint. Tomorrow morning the verdict tells you which part of the funnel to fix.

questions

How do I add analytics to Cloudflare Pages?
smolanalytics is open-source analytics for sites deployed on Cloudflare Pages. Pages serves your built static output, so the two script tags go in your root HTML head, index.html or your framework's root layout before it builds. It autocaptures pageviews, clicks, engagement, scroll and JS errors with zero code, cookieless by default.
Do I need a cookie banner?
Not in cookieless mode. smolanalytics can run without storing anything on the device, so there is no consent banner to add. You still get visitors, referrers, funnels, retention, and paths, and AI-assistant referrals (chatgpt.com, claude.ai, perplexity.ai) show up as their own channel.
Is it enough for a real product, or just page counts?
It does funnels, retention, paths, cohorts, and a daily verdict on what to fix, from the same events, and you ask it in plain English. It deliberately skips session replay, feature flags, and experiments. If you want a straight answer on what to fix, that you own and can self-host free, it fits.

keep reading