All notes

2026-10-04 · 3 min

Cookie-free analytics in a small PHP file

We count pageviews, sections reached and a handful of actions without cookies, IP addresses or third-party scripts.

We wanted to know which parts of our site people actually reach, without adding a tracking banner. So the counter is one small PHP endpoint on our own server.

What it stores

  • A count per page path, per day, and an all-time total.
  • A count per home page section reached (services, work, process, studio).
  • A count per action: opened the project form, sent an inquiry, clicked WhatsApp or email.

What it never stores

No cookies, no IP addresses, no user agent beyond a quick bot check, and no identifiers that link two visits together. Each browser tab reports a given page or section at most once, using sessionStorage.

How it stays safe

  • Section and action names must be short lowercase slugs; anything else is rejected.
  • Known bots and the admin area are skipped.
  • Writes take a file lock, and daily detail is trimmed to the last 90 days.
  • Reading the numbers needs the admin login.

It will not replace a full analytics suite, but it answers the question we care about: do visitors get as far as the work, and do they reach out?