Taking a different approach to website analytics

While the number analytics tools honouring your visitors' privacy grows, how could I take it all into my own hands?

Week 170 was posted by Charanjit Chana on 2021-01-25.

All I've ever wanted to know for any personal projects is how many visitors I have over the course of a month. Or perhaps a day, a week or a year. But nothing more than that.

Google Analytics has always been the default but there's just so much information to hand that I never know what to make of it all. I briefly used Plausible while it was in beta, and it's a great tool that's evolved nicely over the past year. I'm trying to run my side projects on the smallest budget possible so tools like Plausible and Fathom are not really in the equation at the moment.

Back to the 90s

I genuinely only ever look at page views so over the course of the last couple of years it's been ticking away at the back of my mind as something I should look at changing to be more privacy-focused. In a perfect world I would be the beginning and end of the journey. However, I have no desire to be a data processor or responsible for anyone's personal information.

Long before Google Analytics, a lot of websites featured hit counters which were brilliant ways to showcase the popularity of your site. I'm not advocating for bringing that back, but on a page by page basis that's how I want to see analytics implemented.

Half way through 2020, I started building a very (very very) basic pixel tracking tool. Like the good old days, I load a fake pixel which is just an end point that captures a few details. The referring page, the date and time. I recently added the ability to capture dimensions of the browser to help me better understand what screen sizes I should be targeting. It's something I'm actually thinking of removing but it was a great exercise in seeing what was possible and how easy it was to fit into what I already had. While I'd like to know more about referring pages and maybe even location... I won't be acting on that any time soon until I'm sure I can store that information anonymously.

My approach was touched upon over on dev.to and I joined in in the comments.

Having recently switched from Chrome to Brave as my secondary browser, I became more aware of anti-tracking tools and they were actually interfering with my own implementation. I really don't feel like I'm tracking anyone, but for good measure I'm currently hiding behind the doNotTrack browser functionality. I'll see how things change over the course of the year but I may step out from behind that flag as I'm literally counting page views and the date and time is just to help me understand spikes and trends.

I don't have nearly enough data to be able to start making any real analysis but what I have has been enough to figure out the most relevant content to share as part of my newsletter. (Yes, I'm a month behind but I'll catch up starting in February)

The future

I'm not in a position to share my analytics project at the moment. Mainly because it's very basic and I haven't adopted Tailwind CSS like everyone seems to have! Again, over the course of 2021 see if other features and metrics are worth adding and then it might be something that I think about publishing as a public GitHub repo. Ideally I want it to be self hosted, and it could fit in really nicely with Digital Ocean's App Platform. It would require a paid plan, but it would mean you're in total control and depending on your config it would auto-deploy as new features were made available.

The bit I'm really toying with the most is how best to store and process data. I'm using a file based system rather than a database so while it's very fast I'm not entirely sure what's most practical.

I need to spend time benchmarking and I may even run the two options side by side. I'm just not sure when.

Tags: analytics, development, analytics, development

Tweet WhatsApp Keep Upvote Digg Tumblr Pin Blogger LinkedIn Skype LiveJournal Like