Skip to content

On Website Analytics

Measuring performance, privacy-focused analytics with Plausible, and contributing to open source

  • code

There’s a cliché: “What gets measured, gets managed.” I’d argue that “what gets measured, gets measured” is more accurate, and it’s what I’m after here.

Setting the right goals

As I’ve written before, this site is built using the Grav CMS. Grav’s nifty admin plugin includes a simple dashboard that includes basic page view statistics; I thought I might be interested in having:

Over time, knowing that will guide (to some extent) what I write, and (to a greater extent) what sorts of technical changes I might implement.

Client-side tracking with JavaScript

There are plenty of solutions available to get this sort of information: Google Analytics is the most famous and widely used of these, and it’s “free”. That is, there’s no credit card required or no signup fee to get started, and no monthly billing… at least up to ten million visits/month. (I might get 10 monthly visitors for the foreseeable future, so no worries there.)

Honestly, Google Analytics is very good at what it does. If you’re strongly invested in Google’s Marketing Platform, it makes good sense to serve Google Analytics and enjoy the tight integration. There’s a reason it’s the largest player by far in the web analytics sector, and the price tag isn’t the only reason. A product that isn’t any good—whatever the price point—doesn’t get that kind of market share.

Outside of my day job, I’m not heavily invested in Google’s offerings. (Fun fact: The City of Edmonton was the first major municipal government in Canada to switch to Google Apps G Suite Google Workspace.)https://cloud.googleblog.com/2012/04/edmonton-is-first-major-canadian-city.html Rather, it’s the size (in two respects) of Google Analytics that was my primary reason for seeking out an alternative:

  1. Its feature set is way larger than I need or care about.
  2. (Therefore) the size of its tracking script is way larger than I need, and it is much larger than I’d like to ship.

Regarding 1): I don’t have sales funnels. I have no desire to bring additional datasets into my website analytics tool. The demographics of my readership is not something I’m especially interested in, at least not to end of making a profit. I don’t have a strong monetary interest in my readers. I’ve been through Google’s own training on Google Analytics (I’m certified, in fact); it’s a complicated tool with hundreds (literally hundreds) of reports and metrics. I’d rather tinker with other things. I’m not keen to monetize this site in any major wayI have some availability from October 2021. If you’d like to hire me or pick my brain, ping me., but I would like to keep an eye on what content here gets the largest share of my paltry traffic.

Regarding 2): client-side JavaScript is expensive, especially in terms of downloading and CPU execution time. (See Addy Osmani’s 2018 essay and 2019 essay/conference talk, or Tim Kadlec’s 2020 post for details.) Google’s analytics.js script weighs in at 49.4kB; its Tag Manager script (part of Google’s recommended setup) gtag.js is another 87.3kB. The analytics.js script would more roughly double the size of this page.

Privacy concerns about Google Analytics have both moral and technical ramifications. Google’s reliance on cookies means that Google can identify individual users across browser sessions and to track a user’s history and interactions with a given website over time. By using Google Analytics, you’re on the hook for putting into place (and keeping up to date) consent forms, disclosure notices, and a pretty extensive privacy policy. I have yet to meet a person who enjoys clicking on and configuring cookie preferences, so I’m not keen to subject anyone to any of that without a really good reason. Failure to do so is a liability, and I’m not keen to expose myself to undue risk, either.

Alternatives

Of the “plenty” of solutions mentioned above, a subset of “privacy-focused analytics” tools and services have been growing in popularity in the last few years. They tend to be cookieless, and are considerably smaller in both script size and feature set. A search (yes, even in Google) will bring up a number of alternatives. To save you some searching:

I’ve gone with Plausible Analytics. Their script is just 1.4kB in size, while the platform gives me all of the features I’m interested in, with a much tidier interface than Google’s. Sure, some people use adblockers, and some disable JavaScript entirely. That’s fine. I’m interested in ballpark metrics over time; server-side analytics almost certainly overreport.

Plausible is open source, which is a plus in my books. I don’t mind paying a couple of bucks a month to support the service and enjoy the relatively hassle-free experience of dropping a script tag on the site, although it’s nice to have the option to self-host.

Contributing to open source

As for the process of inserting the script tag on a site, I went ahead and wrote a plugin to handle configuring the Grav-Plausible integration from within the Grav admin panel. Check that out on GitHub if you like.

That project represents my first couple of GitHub stars. Only three, at the time of writing, but it surely feels nice to build something useful and helpful to others. There couple of enhancements yet to go, although it’s perfectly functional as it is. Putting it together was a great learning experience, and has given me an idea for another plugin and a bit of a short-term content strategy…

Stay well; stay tuned.