
Analytics that never leave your server
2026年8月5日
Most sites answer the question "is anyone reading this" by embedding a third party on every page. That is a strange trade when you think about it: to find out how your own visitors behave, you hand each of them to a company they did not choose, on the page where you can least justify it.
Phlo ships visitor tracking as a resource. It runs on your machine, writes to your database, and nothing about a visitor reaches anyone else.
Measuring attention when there are no page loads
Classic analytics counts page loads. A Phlo app is a single page application by default, so after the first request there are no more loads to count, only DOM patches. The honest signal left is a heartbeat, and the interesting question is what it should measure.
Not wall-clock time, because a tab open overnight is not attention. The heartbeat counts seconds while the page is visible and pauses when the tab is hidden, deliberately keyed on visibility rather than focus: someone reading with the window slightly behind another is still reading.
Two details make the numbers trustworthy. A beat fires on every navigation as well as on its own interval, and the closing seconds of the page you just left travel with the beat that opens the next one, so time lands on the page it belonged to. And the final beat goes out on pagehide with keepalive set, because an ordinary request at that moment is one the browser is free to cancel.
What it records, and what it does not
A session is keyed per browser window rather than to a long-lived cookie, so a visit means what a reader would think it means rather than tracking a person across days. Writes go through a single atomic upsert, so two beats arriving at once cannot race into duplicate rows.
Untracked visitors, the ones who declined, are excluded from the breakdowns rather than bucketed as unknown. That sounds obvious and is easy to get wrong: the visitors you deliberately do not follow are exactly the ones that pollute a chart if you leave them in, showing up as a phantom country or a browser named after a hash.
The consent banner in front of it is DOM/cookiewall, which translates itself through the language system if your app has one, so a site serving three languages does not need three hand-written notices.
The fleet view
Per app this is a page of statistics. Across a fleet it is one table, because each node reports into the Phlo Dashboard alongside its errors, metrics and backup status. Pages, durations, countries and browsers for every site you run, in one place, without a per-site account anywhere.
The wider point is that first-party analytics stopped being hard. You need a heartbeat, a table and some care about what counts. That is a smaller amount of work than integrating and then living with someone else's script.
Where to read more
The visitors resource is documented in the manual, the consent banner in the DOM section beside it, and the fleet side in the Dashboard handbook.