lapis / stats
Cookie-free visitor statistics for Lapis CMS: page views, visitors and referrers in a toolbar panel
Requires
- php: ^8.5
- lapis/cms: ^1.0
Requires (Dev)
- carthage-software/mago: ^1.62
- pestphp/pest: ^5.3
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Simple visitor statistics for Lapis CMS, without cookies: page views, visitors and the sites they came from, in the toolbar (More → Statistics), for the last 7 or 30 days day by day, or the last 12 months or all time month by month.
composer require lapis/stats
Nothing to set up: counting starts with the next visit.
How it counts
Every page a visitor sees gets a tiny script (about 300 bytes) before </body>. Once the page has loaded, it sends the path and the referring site to /lapis-stats/hit. That way pages served from the page cache are counted too, and most bots are not, as they run no scripts. Browsers driven by a program (navigator.webdriver) send nothing, and neither do signed-in editors, who get no script.
A path is only counted when it is a page of the site, since anyone can send one. The query string is not stored.
Without cookies, without IP addresses
A visitor is a keyed hash of the day, the IP address and the browser (with SIGNING_KEY), so the same visitor counts once a day. The hash is kept only for that day and deleted on the next, and the address itself is never stored. The plugin sets no cookie and stores nothing in the browser, so it needs no consent and does not belong in the cookie notice.
The same person on two days is two visitors, and two people behind one address with the same browser are one.
What is stored
| Table | What |
|---|---|
stats_days |
views and visitors per day |
stats_pages |
views per page and day |
stats_referrers |
views per referring site and day (the host only, e.g. google.com) |
stats_seen |
the day's visitor hashes, deleted the next day |
The counts per day are kept for good (they are small), so every period can be shown later: the panel adds them up per day or per month. They come from a Tempest migration, on SQLite, MySQL and PostgreSQL.
The texts are under stats.* (English and Hungarian included); a site changes them in its own app/localization.<locale>.yml.