Paulo Coelho Alves

Analytics: the good parts

A while ago, I wrote about disabling analytics and generally rejecting numbers as a measure of online "connection":

I find it exceedingly easy to get lost in those numbers. To get to tracking them several times a day, anxiously waiting for them to go up, for things to trend in the right direction. Validation for my thoughts, my opinions, my self. It's plain bad for my mental wellbeing.

I've since completely disabled analytics for this website, and reached out to Herman Martinus to delete previously stored values.

However, there's one bit of data I do care about and want to actively track: the HTTP referer:

In the most common situation, this means that when a user clicks a hyperlink in a web browser, causing the browser to send a request to the server holding the destination web page, the request may include the Referer field, which indicates the last page the user was on (the one where they clicked the link).

I don't care about how many people have visited my site, but I am curious to know where they're coming from, how they came across it in the first place.

Because I couldn't find a tool that did this, and (mainly) because I wanted an excuse to build something, I went ahead and built it.

Enter the awkwardly named referalytics. It's dead simple but it does exactly what I want. If you head on over to https://analytics.pcalv.es/ you can see it in action. Anytime someone finds their way into my blog through a hyperlink, it'll store the referrer.

I haven't bothered to clean up the database, so you can see some cases where the tool recorded my going from the "analytics" page into the website. This is no longer the case: when either https://analytics.pcalv.es or https://pcalv.es are the referrer, they simply won't be logged. Additionally, referrers are only stored once per link.

The app is built and deployed using Deno because:

  1. I was looking for an excuse to try it out
  2. It's very easy to deploy and comes with a key-value database that serves me just fine for the kind of data I want to store
  3. It has a generous free plan that should be more than enough for my use case

Deno is pretty cool in that it comes with a lot of things out of the box, like TypeScript support, linters, formatters and so on. Anything that lets me cut back on dependencies is a welcome change of pace from my day job.

If you're interested, head on over to the repository on GitHub. I tried to make the documentation easy to follow, but if you're trying to install it on your own site and run across any issues, I'm more than happy to help, just reach out by email.

✍️ Reply by email

#post