Visits and journeys for your site. No cookies, no storage unless you opt out, no fingerprinting.
One script of 3,068 bytes minified on the page and a 1.1 MB static binary on the
server, which as a FROM scratch image is 0.6 MB compressed, idling at 2.6 MiB of
memory, that writes what it sees as JSON lines.
- Counts visits, not pageviews. A visit is a keyed hash of the day, the address and the browser: it cannot survive the day and the address is never written.
- Knows the path a visit took. Same-site referrers chain pageviews together;
a
leavebeacon carries engaged seconds, scroll depth and whether the end was read. - Carries real-user Web Vitals, optionally, in a second script of 995 bytes.
- Yours. The collector is a static binary that runs anywhere; events come out of stdout as JSON lines and go wherever you keep logs. GPL-3.0.
Setup.
FreeOpen source
- Download
visitsfor your platform:v0.7.0, released Nov 21, 2026 · visits.min.js (3,053 B) · vitals.min.js (995 B) · release notes and checksums
- Run it:
VISITS_SECRET=$(openssl rand -hex 32) ./visits serve --origin https://example.com - Add the tag:
<script src="/visits.min.js" data-visits="https://stats.example.com/v"></script>
Or build it: cargo build --release -p visits, or the Dockerfile for the same binary in an empty image.
Each event is one JSON line on stdout. Pages on localhost or file: are not counted unless the
tag also carries data-visits-local.
Behind your site
Proxy the path so the beacon is same-origin (no CORS, fewer blockers), use data-visits="/v",
and tell the collector how many proxies sit in front: --trusted-proxies 1 behind this nginx
block. Too low and every visitor shares the proxy's address, too high and none has a visit; confirm it once with --log-ip.
location = /v {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080;
}
Running it in the cloud.
The site's host rewrites /v to the collector, the collector writes to stdout, the cloud keeps
the lines. The address stops at the collector; the logs hold only the JSON lines.
GCP: scales to zero. Behind a Firebase Hosting rewrite the depth is 2 (Hosting and Cloud Run's frontend).
BrowserPOST /vFirebase Hosting or Cloud CDNrewriteCloud Run: visits servestdoutCloud LoggingLog Analytics bucketBigQuery linked dataset
AWS: not zero at idle; the smallest Fargate task is a few dollars a month, App Runner paused bills memory only.
BrowserPOST /vCloudFrontoriginApp Runner or ECS Fargate: visits servestdoutCloudWatch LogsLogs Insights
CloudWatch LogssubscriptionS3 + Athena
Azure: scales to zero on the Container Apps consumption plan.
BrowserPOST /vFront Door or Static Web AppsrouteContainer Apps: visits servestdoutAzure MonitorLog Analytics workspace, KQL
Your own box: nginx or Caddy in front, --sink file:/var/log/visits.jsonl, and logrotate with copytruncate (the file is opened once, in append mode).
Reports from installed programs (below): the collector writes no address for them, but the platform's request log does; Cloud Run's carries the remote address of every request. Exclude the service's request-log entries for the report routes, including the 302 of a check, from the default bucket, or say on the program's disclosure page that the platform keeps the address for its retention.
Installed programs.
A program on someone's computer can report to the same collector. A report is a typed JSON object (a session summary, a crash or the daily update check) with no identifier in it, and the collector computes no visit for it and writes no address. Tell the collector which programs may post: --app arkos=https://example.com/arkos/latest.json (repeatable; VISITS_APPS, comma-separated). The redirect is where a check is sent; leave it off and a check is answered 204.
- Two routes:
POST /atakes a report andGET /a/checktakes the day's update check as a query string;--app-path(orVISITS_APP_PATH) moves them. The check answers302to the redirect, so the update itself never passes through the collector. - The
User-Agentmust be<app>/<version>and the report'sappmust be an allowed one, or the answer is403. A report from a source build (chofsource) is403and is not written. - A report may carry enumerated values, versions, counts and hashes. It may not carry free text, an identifier or any key the schema does not know: that report is refused whole with
400, not trimmed. - Uploads are off until the program's own setting turns them on;
DO_NOT_TRACK,<APP>_TELEMETRY=off,CIand a source build keep everything local, and<APP>_TELEMETRY=logprints what would be sent instead. Sessions recorded underLocalin the last seven days upload once the setting turns on; a program that wants a clean start deletesqueue/session-*at that moment (Queue::clear_sessions).
The client half is a crate, visits-app, with the report types, the journal, the queue and the consent rules; the program supplies the network and the window.
visits-app = { git = "https://github.com/csarkosh/lib-visits", tag = "v0.3.0" }
The program lists the events it records, what each may carry and the surfaces it counts time in, in a file it ships:
[events.pane_open]
kind = ["terminal", "viewer", "browser"]
[events.window_open]
[focus]
surfaces = ["terminal", "viewer", "browser"]
The program's loop (seal, queue, upload, check) is one no_run example in the crate docs, crates/visits-app/src/lib.rs; the wire format is section 6 of spec/SPEC.md.
The details.
More
- Sinks:
--sink stdout(default) or--sink file:<path>. - Single-page apps: the script counts a view when the page loads; after a route change, call
visits.page(). It sends the page before's leave and a view of the new path with the page before as its referrer (nt: "spa"), and does nothing while the path is unchanged. - Returning visitors:
--visitor(orVISITS_VISITOR=true) addss.vidbeside the daily visit, a hash keyed on the secret alone, so a browser that comes back another day is the same visitor for as long as its address and User-Agent hold. Off by default, since it links a browser's days, which the visit never does; rotating the secret ends every visitor too. - Your own visits:
--ignore-ips 203.0.113.9,2001:db8::/32(orVISITS_IGNORE_IPS) answers beacons from those addresses and writes nothing. Reports and checks from them are written with"s": {"own": true}, so your own use of your program is kept apart, not lost. - Event time: each line's
timeis the browser's clock at the event (when within five minutes of receipt), so beacons that arrive together after a cold start keep their order. - Places: build with
--features geoipand pass--geoip <file.mmdb>(orVISITS_GEOIP). A country database writess.cc; a city one (DB-IP's IP to City Lite, CC BY 4.0, or MaxMind's GeoLite2 City) writes the regions.rg, the citys.ctand the city's coordinatess.las.lo(to a tenth of a degree) too. The address is looked up and dropped, never written. The Docker image bundles DB-IP's City Lite of the month it is built in, about 130 MB, so the collector needs about 256 MB of memory. DB-IP's licence asks for "IP Geolocation by DB-IP" with a link to https://db-ip.com wherever its places are shown. - Networks: with
--asn <file.mmdb>(orVISITS_ASN; DB-IP's IP to ASN Lite, CC BY 4.0, or MaxMind's GeoLite2 ASN, with the geoip feature) each event carries the network the address is on: its numbers.an, its owners.ao(an ISP, a company, a cloud) and, for clouds, VPN carriers and relays such as iCloud Private Relay, its kinds.nk.--tor <file>(orVISITS_TOR), the Tor Project's bulk exit list, makes a beacon from an exitnktor. The address is looked up and dropped. The Docker image bundles the month's ASN Lite and the exit list as of its build. - Connections: a page that sends
Accept-CH: ECT, RTT, Downlink, Save-Datagets Chromium's network hints on its beacons, written ass.ect,s.rtt,s.dlands.sd. Other browsers send none. - Placing addresses for your other services: set
VISITS_PLACE_TOKENandPOST /placewithAuthorization: Bearer <token>and one address as the body answers its place as JSON ({"cc":"US","rg":"Illinois","ct":"Chicago"}), writing nothing (spec/SPEC.mdsection 7). - Web Vitals: add
<script src="/vitals.min.js"></script>after the core. - Behind a proxy:
--trusted-proxies N(the client is the Nth address from the right ofX-Forwarded-For; only the firstX-Forwarded-Forheader line is read); confirm once with--log-ip, then turn it off. - Opt out: load any page with
#visits-off;#visits-onundoes it. - The secret: keep it out of wherever the events go, and rotate it when you like; whoever holds both the secret and the events can test whether a given address and browser visited on a given day, and a rotation ends every visit at that moment.
- Another language:
spec/SPEC.mdis the whole contract. - Not collected, on purpose: canvas, WebGL, audio, fonts, high-entropy client hints, the query string beyond campaign parameters, anything across days.