Private, cookie-free website stats that run on your own Cloudflare account.
Free for personal and small business use, source available.
Website · Install · Releases · Report a bug · Ask a question
ReaderCount counts who reads your websites without cookies, without a consent banner and without sending anything to anyone else. It installs into your own Cloudflare account as one Worker and one D1 database, so the stats are yours and keep running on their own. Every feature is in. There's nothing to unlock.
- The stats you need on one page: visitors, views, top pages, sources, countries, devices, time on page and how far people scroll.
- Goals: sign-ups, enquiries and sales, with the pages and sources that bring them in.
- Clicks on outgoing links and downloads, including affiliate links, and affiliate earnings per post from Awin, Impact, CJ and others.
- Google Search Console searches next to your visits.
- What to fix: broken links, missing pictures, script errors, slow pages and 404s your readers hit.
- Emails: a Monday digest, traffic spikes, a monthly review and an alert when a website goes down.
- Ask Claude about your stats with the built-in connector, or read them from your own code with the API.
- Public stats pages and a media kit for the websites you choose.
- Your own brand: your name, logo, colour and support address instead of ReaderCount's.
ReaderCount is free to use for one person or organisation's own websites, up to 10 of them. You can read the code, change it and run it on your own Cloudflare account.
You need a commercial licence to go over 10 websites, to run it for clients or to offer it to others as a hosted, managed or white-label service. That includes client mode below. Get in touch about a commercial licence (choose "Work together").
There's no licence key and nothing in the code checks. Each version becomes Apache 2.0 four years after it's released. The full terms are in LICENSE (Business Source License 1.1), and they're what counts.
- A Cloudflare account. The free plan is fine for most websites.
- A domain on that account if you'd like ReaderCount on your own address, such as stats.example.com. Your free workers.dev address works too.
There are three ways. All of them install into your own Cloudflare account, and updating later keeps your stats.
You need Node.js 22 or later.
npx @mrpwob/readercount setupIt signs you in to Cloudflare in your browser, makes the database, asks for a password and deploys ReaderCount. At the end it gives you your stats address. To update later, run npx @mrpwob/readercount update in the same folder.
The button copies ReaderCount to your GitHub account, makes its database in your Cloudflare account and deploys it. It asks for one thing:
- ADMIN_PASSWORD: the password you'll sign in with. Use at least 12 characters, and replace the example: it won't work.
To update later, pull the latest code into your GitHub copy (GitHub's Sync fork) and Cloudflare deploys it again.
git clone https://github.com/pobren/readercount.git
cd readercount
npm install
npx wrangler login
npx wrangler d1 create readercount # copy the database_id it prints into wrangler.jsonc
npx wrangler secret put ADMIN_PASSWORD # at least 12 characters
npm run deploynpm test runs the tests, and npm run dev runs it on your computer (put a password in .dev.vars first, as in .dev.vars.example).
- Open your ReaderCount address and sign in with your password.
- Add your website.
- Copy the line it shows you into every page of your website, just before
</head>:
<script defer src="https://YOUR-STATS-ADDRESS/s.js" data-site="example.com"></script>Visits show within a minute. The Check button on your stats page tells you if the line is in place.
To stop counting your own visits, open any page of your website once with #readercount-ignore on the end of the address. #readercount-count undoes it.
Your own address. Ad blockers block some workers.dev addresses, so stats on your own domain count more readers. In the Cloudflare dashboard open Workers & Pages, then readercount, then Settings and Domains & Routes, and add a custom domain such as stats.example.com.
Add data-rc-goal="Name" to any button, link or form, and ReaderCount counts it as a goal with that name:
<button data-rc-goal="Newsletter sign-up">Sign up</button>Every form sent is counted too. From your own code, call readercount("Name"). Plausible's plausible("Name") and plausible-event-name= classes count as well, so a website moving from Plausible keeps its events.
Emails are off until you set them up, because they're sent from your own domain:
- Switch on Email Routing (or Email Sending) for your domain in Cloudflare.
- In
wrangler.jsonc, add"send_email": [{ "name": "EMAIL" }]and setOWNER_EMAIL(where emails go) andMAIL_FROM(an address on your domain) undervars. - Deploy again.
Then choose which emails you'd like under Emails on your stats page: the Monday digest, traffic spikes, the monthly review and website down alerts.
See the Google searches that bring readers in, next to your visits:
- In Google Cloud, make an OAuth client of the type Web application, with
https://YOUR-STATS-ADDRESS/google/callbackas its redirect address. Switch on the Google Search Console API for the project. - Add its details as secrets:
npx wrangler secret put GOOGLE_CLIENT_IDandnpx wrangler secret put GOOGLE_CLIENT_SECRET. - Press Continue with Google on your stats page.
ReaderCount only reads from Google, and keeps its Google sign-in encrypted. To encrypt with your own key rather than one made from your password, add a GOOGLE_TOKEN_KEY secret.
ReaderCount has a Claude connector built in. In Claude, open Settings, then Connectors, then Add custom connector, and paste https://YOUR-STATS-ADDRESS/mcp. Claude asks you to sign in to ReaderCount once, then you can ask things like "which posts brought in the most readers from Google last month?". Claude can only read your stats, and Disconnect on your stats page signs it out.
Make a key under API on your stats page. Each key reads one website and can't change anything. Send it in a header:
curl -H "Authorization: Bearer rc_..." "https://YOUR-STATS-ADDRESS/api/v1/overview?period=7d"| Address | What it gives |
|---|---|
GET /api/v1/overview |
Headline stats, top pages, sources and clicks (period) |
GET /api/v1/breakdown |
Views or clicks grouped by one thing (by, of, period or from and to, filters) |
GET /api/v1/google-searches |
Google Search Console figures, when connected |
GET /api/v1/check |
Whether the website's visits are arriving |
Keep keys on your server, never in a web page.
Under Branding on your stats page, set your own name, logo, colour and support address. They replace ReaderCount's on every page and email. Leave a box empty to keep ReaderCount's.
Client mode lets an agency or host offer ReaderCount to their own clients, under their own brand, with their own plans and prices. It's off until you switch it on under Clients (on your stats page). Running ReaderCount for clients needs a commercial licence: get in touch first.
- Clients sign in with a one-time link. With emails set up, they ask for one on the sign-in page. Without, press Make a sign-in link and send it yourself.
- Each client sees only their own websites. They can't see yours, each other's or your settings.
- Plans are yours: a name, how many websites and the price wording your clients see.
- Payments go straight to your own Stripe account. Make each plan's product and price in Stripe, paste its Price ID into the plan, then add two secrets:
STRIPE_SECRET_KEYandSTRIPE_WEBHOOK_SECRET. In Stripe, add a webhook tohttps://YOUR-STATS-ADDRESS/billing/webhookforcheckout.session.completed,customer.subscription.updatedandcustomer.subscription.deleted. Stripe sends the receipts, and clients change their card or cancel on Stripe's own page. - Clients who pay you another way: mark them Free and they keep their plan without Stripe.
A client whose subscription stops sees the plans page until they pick one, and their websites stop being counted.
The sign-in page can use Cloudflare Turnstile, Cloudflare's free check that a person is using the form. Most people see nothing; a few are asked to tick a box. Wrong passwords are already limited, so this is an extra layer.
- In Cloudflare, open Turnstile and add a widget. Use your ReaderCount address as its hostname and choose Managed.
- On the Worker, open Settings › Variables and Secrets and add two secrets:
TURNSTILE_SITE_KEY(the site key) andTURNSTILE_SECRET(the secret key). Add both as secrets, so updates keep them.
It switches on once both are there. Remove either one to switch it off.
ReaderCount sets no cookies and stores nothing in your readers' browsers. A visitor is counted once a day with a code made from a daily secret, so nobody can be followed from one day to the next. It never records what anyone typed, where they clicked or their IP address. Everything stays in your own Cloudflare account. Set RETENTION_DAYS in wrangler.jsonc to delete visits after that many days.
- Questions: Discussions
- Bugs: Issues
- New versions: Releases, or paulobrien.dev/readercount
Business Source License 1.1. Free for one person or organisation's own websites, up to 10. Each version becomes Apache 2.0 four years after its release.