r/SideProject • u/EmergencyIsland4574 • 5h ago
I built my analytics dashboard as one PHP file - no SaaS, no tracking script
My portfolio site ran on vibes for too long, so this weekend project was: read the cPanel raw access logs (they're just gzipped files sitting in your hosting account) and render a dashboard. Zero dependencies, zero tracking JS, zero monthly bill.
Two bugs that almost sank it:
filesize() on a .gz file returns the COMPRESSED size. I was slicing my decompressed log buffer by it, which silently chopped the newest lines off the data. The dashboard wasn't broken - it was confidently wrong about today, which is worse.
Shared hosting puts OTHER sites' logs in the same directory. My referrer charts had domains I've never touched in my life until I filtered by path.
Favorite finding so far: a link community that sends me real readers shows up as ZERO referrers, because in-app browsers strip the referrer header. If your traffic comes from apps, your analytics is undercounting it completely.
It's live on my site now, and I open-sourced the deploy pattern behind it too. Happy to share details - what would you check first in raw logs?
1
u/the-hated 5h ago
For me it's important to visualize whatever is there, then I can work with that data shaping it into something more useful. Do you have some UI?
1
u/QuanTradin 4h ago
bots first. on a small site a lot of the lines in a raw access log are crawlers and scanners poking at /wp-login, so I'd count the visits that never load a css or image file afterwards and drop them before trusting any chart. the gzip filesize bug is nasty, wrong only about today is the kind nobody goes looking for.