Counterscale
An analytics application that uses Cloudflare Workers, Workers Analytics Engine, and R2.
- Stars
- 2,202
- Forks
- 141
- License
- MIT
- Category
- Analytics
- Latest push
- Published
- Refreshed
- Published
Review
What hosted analytics costs
Plausible, the usual privacy-friendly choice, starts at $9 a month for its hosted plan and climbs with traffic, so a handful of side projects quickly becomes a decision about which sites deserve to be measured. Self-hosting Plausible removes the bill but adds a server, a Postgres database and a ClickHouse cluster to keep alive. For a pageview counter, that’s a lot of machinery.
What Cloudflare already gives you, and what’s missing
Cloudflare has the hard part sitting in every account: Workers Analytics Engine, a time-series store built for this kind of workload, with nothing to provision. What it doesn’t have is everything around it: something has to put a script on your pages, receive the hits and draw the charts, and whatever it stores ages out after 90 days.
What Counterscale packages up
Counterscale supplies those parts, deployed into your own account by one command (npx @counterscale/cli@latest install). Per its wrangler.json, a single Worker serves the tracker script, the /collect endpoint and the dashboard, and writes every hit to an Analytics Engine dataset (WEB_COUNTER_AE). A nightly cron (0 2 * * *) then rolls each day up into Apache Arrow files in an R2 bucket (DAILY_ROLLUPS), which is how the data outlives the 90-day limit.
The dashboard covers what most sites actually look at: views and visitors over time, bounce rate, top paths, referrers, countries, browsers, devices, and full UTM breakdowns. You can track from the browser with a script tag or the @counterscale/tracker npm package, or from the server with @counterscale/tracker/server, which matters if you’d rather not ship any JavaScript to visitors. A single CLI command adds a password to the dashboard.
The README estimates that Cloudflare’s free tier handles around 100,000 hits a day, so a small site can run it without paying anything.
Who’s behind it
Counterscale is Ben Vinegar’s project. He co-wrote Third-Party JavaScript, a book about writing embeddable scripts like this tracker, spent years at Sentry, and now runs Modem, which sponsors the project. He talked through how he built it on Syntax episode 761 in April 2024.
Since December 2023 it has picked up 2,165 stars and 135 forks, 22 people have contributed code, and the MIT-licensed repo was still taking commits in October 2026, with v3.4.1 as the latest release. Early versions of the README warned against production use; the current README has dropped the warning, and Echobind runs a public dashboard on it. The Hugo community has a thread on wiring it into static sites.
Where it falls short
- Pageviews, not events. There’s no custom-event tracking, so signups, clicks and funnels need something else.
- Cloudflare-only by design. Move your sites off Cloudflare and the analytics have to move too.
- The charts stop at 90 days. The dashboard queries Analytics Engine, which keeps 90 days. The R2 rollups preserve older data, but as Arrow files for you to query, not as history you can browse.
- Setup has one manual step. Before the installer works, you enable Analytics Engine in the Cloudflare dashboard and mint an API token.
Verdict
If you run several small sites on Cloudflare and want accurate pageview counts without another subscription or another server, install Counterscale. If your analytics need to answer “who clicked buy”, keep paying for something with events.
Research and source context
This profile is compiled from public repository data. Repository details were captured and the profile was last researched .
More in Analytics
UptimeFlare
An open-source uptime monitoring and status page application that runs scheduled HTTP, HTTPS, and TCP checks on Cloudflare Workers, stores history in D1, and serves a customizable status page with notifications, deployable in a visitor's own Cloudflare account.
cf-workers-status-page
A self-hosted status page that monitors websites and APIs on a schedule, records daily uptime history, and sends Slack, Discord, or Telegram alerts. It runs as a Cloudflare Worker using CRON Triggers and Workers KV, deployable to the visitor's own Cloudflare account with Wrangler or a deploy button.
InsightFlare
An analytics application with a one-click Cloudflare deployment route and one year of default traffic retention.