I am a total hypocrite. On the one hand I rant about corporations collecting needless data from me while I browse the web. But I also love knowing which of my blog posts people read the most.
The easiest way to get data on visitors would be to install Google Analytics or similar product. But I really dislike the trackers and third-party analytics that infest most commercial web sites. Some of the big sites install dozens of the things, spraying information about your browsing habits far and wide to god-knows-who.
Up until now, I have been satiating my curiosity by scanning my web server's log files. But there are a lot of false positives due to constant scanning by bots and spiders, many of which try to mimic real browsing. Also, I decided that to really live up to my principles and the GDPRThe EU General Data Protection Regularion And Me (And You) that I would delete all my logs older than 24 hours.
All I really want is a simple hit counter, so I created my own. My design goals were:
- Completely stand-alone. I don't want to install databases or additional software.
- Locally hosted.
- To only store hit counts. Individual page visits are not logged, nor any identifying information such as IP address or browser version.
- Fast (or at least fast enough).
In the end I just coded up a quick server in GoI wanted an excuse to use Go in a proper project. Go is a natural fit for such a quick and dirty stand-alone service and its ability to cross-compile static binaries is really useful.
As an analytics service, visitlog kind of sucks. I don't use a proper database; everything is stored in memory and occasionally written out to a permenant json file. I imagine this would completely fall down for large sites but is fine for a few hundred pages.
However, you may click on as many articles as you want safe in the knowledge that only I will know.
You can see the results on the visitor statistics page.