· Privacy· Engineering
How FlarePanel counts visitors without cookies
FlarePanel counts visitors from a daily salted hash of IP address, user agent and project, with no tracking cookies. Here is exactly what the code does, what it stores and where it falls short.
By FlarePanel team
FlarePanel sets no tracking cookies and writes nothing to local storage to recognise a visitor. It still reports unique visitors, sessions and bounce rate. This post explains how, based on what the code does today, including the places where the method is less exact than a cookie would be.
What the browser keeps
The web SDK keeps the device and session ids it gets back from the API in memory only. Reload the page and they are gone; the server works them out again. The one thing the SDK writes to the browser is sessionStorage, and only to hold revenue you queue with pendingRevenue until you call flushRevenue. The dashboard uses a session cookie for people signed in to it, which has nothing to do with your visitors.
The device id is a daily salted hash
When an event arrives, the server derives a device id from four inputs: the visitor’s user agent, their IP address, the project ID and the current salt. It hashes them with SHAKE256 and keeps the first 16 bytes as hex:
// packages/core/src/shared/profileId.ts
export function generateDeviceId({ salt, ua, ip, origin }) {
return createHash(`${ua}:${ip}:${origin}:${salt}`, 16);
}
// origin is the project ID; createHash is SHAKE256, 16 bytes, hexEach input matters:
- IP and user agent tell one browser from another within a day.
- The project ID means the same person gets a different id on every project, so ids cannot be joined across sites.
- The salt is 16 random bytes, replaced every day. The same browser on the same network gets a new, unrelated id the next day.
How the salt rotates
Salts live in a small salts table in D1. A scheduled job runs at 00:00 UTC every day: it creates a new random salt and, in the same batch, deletes every salt except the new one and the one before it. So at any moment there are exactly two salts, current and previous.
The previous salt exists for one reason: so a visit that crosses midnight is not cut in two. For each event, the server computes the device id with both salts and looks for a live session under either. If it finds one that has been active within the idle window (30 minutes by default), the event joins it. Otherwise the current salt’s id wins and a new session begins.
From device ids to a visitor count
Each browser event is stored with a profile_id. For an anonymous visitor that is the device id. Once you call identify with your own profileId, it is your user id.
Each project keeps one HyperLogLog sketch per day of the profile ids that started a session. The sketch is a fixed 4 KB: 4,096 registers, about 1.6% standard error, the same precision as ClickHouse’s uniqHLL12. Visitors for any date range are the daily sketches merged. Because visitors are counted from session starts, server-side and back-dated events add no visitors.
What is stored, and what is not
The IP address is read, used and dropped. During a request it is used to:
- compute the device id as above
- apply the per-IP rate limit and any IP filters on the project
- build the one-second duplicate check, whose key is a SHA-256 hash of the project, IP, origin and request body, kept in the Cache API for one second
- locate server-side events that pass the visitor’s address as
__ip.
The stored event has no IP field, and __ip is removed from the event’s properties before it is saved. The raw user agent is not stored either; the event keeps the parsed browser, OS, device, brand and model.
What an event does keep:
- the hashed device id, a session id and the profile id
- the page path, origin and referrer
- country, region, city and coordinates as Cloudflare’s
request.cfreports them for the request, or from DB-IP for server events that pass__ip - the parsed browser, OS and device
- the event name and any properties you send.
How long it is kept
- Raw events stay in the project’s Durable Object for 90 days by default, then live on in the R2 archive, which keeps everything.
- AI prompt and response text and session replays are kept 30 days. Replay is off unless you turn it on in the web SDK, and inputs and text are masked by default.
- Recent bot hits are kept 30 days.
If you self-host, all of this sits in your own Cloudflare account and the event retention is yours to set.
Where the method falls short
A salted hash is not a cookie, and the numbers behave differently:
- Shared networks. Two people behind the same IP address with an identical user agent get the same device id and count as one visitor.
- Changing networks. A phone moving from Wi-Fi to mobile data gets a new IP, so a new device id, and is counted again.
- Multi-day ranges. An anonymous visitor who comes back on another day has a different device id, so a weekly or monthly visitor count includes them once per day they visited. Identified users keep their profile id and are counted once.
- Estimates. Unique counts come from HyperLogLog, so they carry about 1.6% standard error.
For signed-in users, call identify. A server SDK can also pass its own device id, sent as __deviceId. That id is used as is and does not rotate with the salt, so only send one if you are comfortable keeping a stable identifier.
Consent is still your call
We are not going to tell you that no-cookie analytics means you never need a consent banner; that depends on where you operate and what you track. If you want to wait for consent, set disabled: true and FlarePanel queues events until you call op.ready().
Read next
See the FAQ for the short version, How FlarePanel runs on Cloudflare for where each piece lives, and Identify users for tying events to accounts. To see the counts on your own site, create a project. The first 30 days are free.