Field guide
Seven kinds of visitor, told apart at a glance
Real fireflies are identified by their flash pattern. So are these. Each request makes its bug flash and types the path it asked for into the grid, so the field ends up written in your own traffic.
| Kind | Who it is | Flash | Movement |
|---|
How it works
A Worker in front of your site, and nothing inside it
Cloudflare already sees every request to a site it proxies. The kit adds one Worker on that path. Your app, your server and your database are untouched.
/lightning-bugs open gets each event over a WebSocket, and a bug flashes.Install
About ten minutes, if your domain is already on Cloudflare
You need three things before you start.
-
Download the kit and unzip it
It is one folder. Open a terminal inside it.
-
Put your domain in
wrangler.tomlReplace
example.comwith your domain, in both places on each line. Delete thewwwline if you don't use it.routes = [ { pattern = "example.com/*", zone_name = "example.com" }, { pattern = "www.example.com/*", zone_name = "example.com" }, ] -
Check the scanner rules against your site
Anything asking for a path your site never serves, such as
.phpor/wp-admin, is labelled a scanner. If your site really serves one of those (WordPress does), delete it from the lists at the top ofsrc/classify.js. -
Choose what to record optional
By default every request becomes a bug. The
[vars]section ofwrangler.tomlnarrows that down, for example to people only, only AI and search crawlers, or only your blog. Change it any time and deploy again.[vars] KINDS = "human,ai,search" # or "all" IGNORE_PATHS = "/api/*,/healthz" ONLY_PATHS = "" # e.g. "/blog/*" IGNORE_FILES = "images,scripts,styles,fonts"
Kinds are
human,search,ai,unfurl,monitor,scannerandscript. File groups areimages,scripts,styles,fonts,media,documentsanddata; plain extensions likepdfwork too, andallskips every static file. A path ending in*matches everything under it. Requests you leave out still reach your site as normal, and the legend only lists the kinds you record.These settings don't lower your Worker request count. The Worker still runs to decide what to skip. To save requests on a busy site, see the note below this list.
-
Log in to Cloudflare
A browser tab opens for you to approve access.
npx wrangler login
-
Deploy
This uploads the Worker, creates its Durable Object and attaches it to your domain. It takes effect immediately.
npx wrangler deploy
If the first deploy ends in an error on a
/subdomainrequest, saying "This Worker does not exist on your account" (code 10007), the upload has still worked. Cloudflare hasn't finished registering the new Worker yet. Run the same command again and it goes through. -
Open
your-domain/lightning-bugsThe badge should read live. Browse your site in another tab and watch yourself appear. To check the raw feed, open
your-domain/__traffic/snapshot.
One setting to change. The free plan allows 100,000 Worker requests a day. In the Cloudflare dashboard, set this Worker route's request limit failure mode to fail open, so that past the limit requests go straight to your site instead of failing. Cloudflare has moved this setting around, so look in either place: your domain → Workers Routes → Edit on the route, or Workers & Pages → this Worker → Settings → Domains & Routes. If neither shows it, your account may be on Workers Paid, where the daily limit doesn't apply. Worker limits ↗
What does a busy site look like?
At everyday traffic, every visitor gets a bug. Once there are more visitors than the screen can hold, the page draws a steady sample instead, and the field keeps getting busier as traffic grows without washing out. The counts in the key still include everyone, and a note there says how many are being drawn. Here is the page at about 45 requests a second, with nearly 4,000 visitors in the last ten minutes:


Busy site on the free plan? Cloudflare counts a Worker request whenever a route sends a request to the Worker, before any of the settings above run. To keep part of your site off the Worker entirely, go to your domain → Workers Routes → Add route, enter a folder such as example.com/images/* and choose Worker: None. The more specific route wins, so those requests go straight to your site and aren't counted. Static files are usually the bulk of the traffic, so this can cut your count a long way. Route patterns match folders, not file extensions, and they have to be added in the dashboard rather than in wrangler.toml. Requests you route around the Worker don't appear as bugs. Routes ↗
To remove everything, run npx wrangler delete and your site is back to how it was.
The kit
Ten small files, no dependencies
Plain JavaScript, HTML and CSS. Open any file to read it before you run it, or copy files one at a time.
Before you ship it
Private by default, and honest about its limits
The page is public: anyone who knows the address can watch. The defaults are set with that in mind.
What visitors are protected from
- IP addresses are never stored or sent to viewers.
- Visitor ids are random hashes that reset every day and can't be traced back.
- People are shown by country and region only: no city, network or referrer.
- Browsers that send Global Privacy Control are shown with no location.
- Query strings are never recorded, and nothing is kept beyond 30 minutes.
What to know going in
- The Worker sits in front of all your traffic. It is written to fail open, but test it on a site you can afford to watch for a day.
- The kinds are educated guesses from user agents, paths and network names. Cloudflare's own bot scores are not available on the free plan.
- It only sees requests that pass through Cloudflare's proxy.
- To keep the page private, put Cloudflare Access in front of
/lightning-bugs*and/__traffic/*. - If your visitors are covered by privacy laws such as GDPR, mention the page in your privacy notice. This is not legal advice.