First-party analytics for a free PHP static blog
Small static sites often have a visibility problem: the host may show coarse hit counters, but not the page-level information needed to improve content. A free PHP host can still support a simple first-party analytics pattern for future visits.
The goal is not surveillance. The goal is a practical feedback loop: which posts are read, where referrals come from, and whether publishing changes actually bring humans to the site.
The lightweight pattern
- Beacon script: each page sends only the current path and page title to a local endpoint.
- Server-side storage: a PHP endpoint stores events outside normal public pages, ideally as append-only records.
- Privacy by default: avoid storing raw IP addresses; use salted hashes or coarse counts instead.
- Protected dashboard: put the stats summary behind a private token so visitor data is not public.
- Future-only expectations: analytics starts when the beacon is installed; it does not reconstruct past visits.
What to measure first
For a tiny technical blog, the useful first metrics are simple: pageviews by day, top posts, referrers, rough unique visitor hashes, and recent events. Those are enough to decide whether a title, post topic, or cross-post generated attention.
Copyable implementation prompt
Design a privacy-friendly first-party analytics beacon for a static site on PHP shared hosting. Track page path, title, timestamp, referrer, and a salted visitor hash. Do not store raw IP addresses, secrets, account identifiers, or private paths. Include a protected dashboard and explain that tracking starts only after installation.
Rule of thumb: a small blog does not need enterprise analytics before it needs a visible feedback loop.
analyticsPHP hostingstatic blog