Privacy-first web analytics platform that tracks traffic, campaigns, behavior, conversions and revenue without cookies, self-hosted or in the cloud.
benvinegar/counterscale
Self-hosted web analytics tracker and dashboard that runs on Cloudflare Workers and Workers Analytics Engine.
Open-source alternative to:Google Analytics
- Stars
- 2,177
- Forks
- 137
- Open issues
- 18
- Last commit
- last month
What is it?
Counterscale is a simple web analytics tracker and dashboard that you host yourself on Cloudflare. It is built on Cloudflare Workers and Workers Analytics Engine, and the project aims to keep operating costs near zero, even at high traffic volumes.
Deployment is handled by a CLI installer that sets up the Worker, the analytics dataset and an optional password for the dashboard. You can load the tracker as a script from your deployed URL, install it as an npm package for the browser, or call a server-side module to record pageviews from your backend.
Because Workers Analytics Engine keeps data for a maximum of 90 days, the project also writes long-term data to an R2 bucket as Apache Arrow files, which is enabled by default and can be turned off through the CLI.
Key features
- 01Tracks pageviews with a script tag, a browser npm module, or a server-side module.
- 02Runs on Cloudflare Workers with a CLI installer for deployment.
- 03Optional password protection for the analytics dashboard.
- 04Stores long-term data in R2 as Apache Arrow files beyond the 90-day retention limit.
- 05Supports manual pageview tracking and UTM parameters in the server module.
- 06Upgrades by re-running the installer without losing existing data.
Use cases
- Adding privacy-friendly, self-hosted traffic stats to a personal blog or project site.
- Tracking pageviews from a backend application where browser scripts are not used.
- Running low-cost analytics for multiple websites on a Cloudflare account.
Quick start
- 1
Sign into Cloudflare and authorize Wrangler
npx wrangler login - 2
Run the Counterscale installer and follow the prompts
npx @counterscale/cli@latest install - 3
Add the tracking script snippet to your website HTML
Things to know
- Requires a Cloudflare account and runs only on macOS or Linux per the README requirements.
- Workers Analytics Engine keeps data for a maximum of 90 days, so the dashboard shows only the last 90 days (long-term R2 storage is available).
- Local development has no test database: writes are no-ops and reads show production data.
In collections
Topics
FAQ
- What is counterscale?
- Self-hosted web analytics tracker and dashboard that runs on Cloudflare Workers and Workers Analytics Engine. Counterscale is a simple web analytics tracker and dashboard that you host yourself on Cloudflare. It is built on Cloudflare Workers and Workers Analytics Engine, and the project aims to keep operating costs near zero, even at high traffic volumes.
- Is counterscale free to use? What license does it have?
- counterscale is open source under the MIT license. Check the license terms before using it in commercial products.
- Is counterscale still maintained?
- Updated within 6 months. The last commit to counterscale was on Oct 4, 2026.
- What can I use counterscale for?
- Adding privacy-friendly, self-hosted traffic stats to a personal blog or project site. Tracking pageviews from a backend application where browser scripts are not used. Running low-cost analytics for multiple websites on a Cloudflare account.
- How do I install counterscale?
- Sign into Cloudflare and authorize Wrangler: npx wrangler login Run the Counterscale installer and follow the prompts: npx @counterscale/cli@latest install Add the tracking script snippet to your website HTML
- Where can I get counterscale?
- The source code and installation instructions are on GitHub: https://github.com/benvinegar/counterscale
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
Open-source, privacy-friendly web and product analytics that positions itself as an alternative to Google Analytics.
Self-hosted all-in-one tool combining website analytics, uptime monitoring, and server status pages in one app.
Open source, cookie-free web analytics tool positioned as a privacy-first alternative to Google Analytics, available as cloud or self-hosted.
Self-hosted, cookie-free web analytics that deploys entirely into your own Cloudflare account, with no third-party services in the data path.
Self-hosted, cookieless web analytics shipped as one Go binary, with custom tracking domains, SSO, open exports, and AI visibility reports.