Adding Analytics to this blog

Now that my blog is up and running I want to add some basic fatures, mainly Analytics and Comments.

Analytics

I'd like to have some basic metrics on this website; like how many visitors it gets, from where, what pages did they visited and so on ...

My ideal analytics service must give me useful metrics while being:

  • simple to set-up
  • hosted
  • privacy frendly
  • open-source
  • free of charge

Given those requirements I started looking around. I had already heard of Plausible and I discovered: Counter, Rybbit and GoatCounter.

I excluded Plausible because it has no free plan and GoatCounter because of it's old school UI. It's quit outdated and doesn't look as good as the others. So I ended up with Counter and Rybbit. The second one seems much more professional, has a nicer UI and more starts on GitHub (7.3K vs 956). But in the end I decided for the first one because it offers more features compared to the free plan of Rybbit.

Counter

Getting started it's really easy: make an account (no email required) and you'll get the javascript snippet to include in your web pages.

<script
  src="https://cdn.counter.dev/script.js"
  data-id="<hex-id>"
  data-utcoffset="0"
></script>

I added it to the /head.html template, so that it gets automatically included in all the pages. This is the patch that I applied to the default PaperMod theme templates.

diff --git a/blog/themes/papermod/templates/partials/head.html b/blog/themes/papermod/templates/partials/head.html
index 02d69de..1f8e0d7 100644
--- a/blog/themes/papermod/templates/partials/head.html
+++ b/blog/themes/papermod/templates/partials/head.html
@@ -4,6 +4,8 @@
 <meta name="robots" content="index, follow">
 <title>{% if page.title %}{{ page.title }}{% else %}{{ config.title }}{% endif %}</title>

+<script src="https://cdn.counter.dev/script.js" data-id=""<hex-id>" data-utcoffset="0"></script>
+
 {% if page.keywords %}
 <meta name="keywords" content="{{ page.keywords | join(sep=', ') }}">
 {% else %}

As soon as the new version of this website has been deployed I tested it. But nothing was showing in my Counter dashboard. At first I was a disappointed, but then I realized that maybe my default browser configuration was a little to restrictive and disabled the tracker 😅.

After some minutes I realized that Counter won't record users like me, because of our strict no-tracking policies 😅. So I gave a try to Rybbit to see it it can record more users.

Rybbit

The setup was as simple as the other one: register (this time they want an email) and include the script in the template.

For now I want to have both analytics' systems at the same time. I'll test them for some months and then decide which one to keep. This is the new patch:

diff --git a/blog/themes/papermod/templates/partials/head.html b/blog/themes/papermod/templates/partials/head.html
index 02d69de..2e3239d 100644
--- a/blog/themes/papermod/templates/partials/head.html
+++ b/blog/themes/papermod/templates/partials/head.html
@@ -4,6 +4,14 @@
 <meta name="robots" content="index, follow">
 <title>{% if page.title %}{{ page.title }}{% else %}{{ config.title }}{% endif %}</title>

+<script src="https://cdn.counter.dev/script.js" data-id="<hex-id>" data-utcoffset="0"></script>
+
+<script
+    src="https://app.rybbit.io/api/script.js"
+    data-site-id="<id>"
+    defer
+></script>
+
 {% if page.keywords %}
 <meta name="keywords" content="{{ page.keywords | join(sep=', ') }}">
 {% else %}

After few days of regularly checking both of them I can state that Rybbit records far more users then Counter.

Final considerations

As much as I prefer Counter: more privacy focused, no email required, more user respectful; I'm considering switching to Rybbit because it can log more users. And as an analytics system that's exactlly what I want 😁. Rybbit, on the other hand, has some big limitations in its free plan. Like the 3000 events/month limit and all the cool features blocked. I can only access the main dashboard 😞.

For now I'll use both and later on I'll update this post with my final choice considerations.