Update - migrating off Google Analytics, prerendering LaTeX with MathJax, and other updates.
Posted on: September 10, 2025
Updated on: September 15, 2025
Word count: 933
Some technical updates
Migrating off Google Analytics
After my recent post, detailing my various frustrations with web development, I can report with some amusement that I broke Google Analytics on my site. I have hence been unable to get any site visitor info via GA since April-ish.
This led to some introspection, and since I don’t particularly approve of Google’s dominance in the ad space (or, honestly, ads and their effect on the internet in general), I took this as a sign from the heavens to remove it altogether (I also removed Cloudflare web analytics, which worked TERRIBLY). So I’ve done that, and I’m trialling goatcounter, an open source analytics platform with a focus on privacy. So far I quite like its minimalism. I had to add Subresource Integrity for the count.js script that is loaded from goatcounter to assuage my OCD, and maintain my high HTTP Observatory score (it has actually somehow actually increased to 115/100, from 110/100 previously, LOL).
Here is an archived picture from Google Analytics. The peaks correspond to a post of mine either hitting the front page of hackernews, or being linked from Astral Codex Ten. I also made the hackernews front page with my recent post on AI and mathematics (and received some nice emails, thanks for that!), but you will note Google records no hits, since that was posted after I had broken Google Analytics. Cloudflare however notified me that I was about to run out of free worker calls (I have some cloud workers that quite uselessly inject security headers), so I guess it was a lot - presumably also quite a lot of bots, since I turned off the anti-bot stuff out of frustration at my RSS feed not being readable by a number of RSS readers.
In retrospect I think the experience of using Google Analytics might have taken more from me than it gave. I already knew when a post of mine was trending somewhere, because I’d get a few emails from people, and the only place I’ve ever personally posted a link was on hackernews, where it is obvious when it made the front page. I don’t know that it helps me to know that the average engagement time on the majority of my ‘popular’ posts was under three minutes (OCD again: I wonder what that distribution looks like?). If ten people read it thoroughly and learned something about the world, gained a new perspective, or were inspired to care about something, I value that higher than 10000 people clicking ‘like’ without reading it. Part of having your own corner of the internet is deciding how you want that corner to be; as is the case also for our various ‘corners’ in the rest of the world. Google Analytics comes with all these knobs and things you can use try to measure or maximise ‘engagement’ - but that is honestly not what I write for, and even though I didn’t use most of its ‘features’, having it running on my site felt somehow a bit icky.
One day I also hope to migrate off hosting my site on AWS S3, but honestly at the moment I can’t be bothered, and since I’ve paid them less than $3 in all the years I’ve had this site I don’t feel I am contributing excessively to their current market dominance, monopolistic practices, or general skullduggery.
MathJax and
I also got around to prerendering with MathJax. You can have a look here for the script (mathjax-prerender.mjs) that achieves this (warning: generated with assistance from an LLM). I reference it in my hakyll site.hs file as follows:
match "posts/*" $ do
route $ setExtension "html"
compile $
myPandocBiblioCompiler
>>= withItemBody (unixFilter "node" ["js/mathjax-prerender.mjs"])
>>= saveSnapshot "content"
>>= loadAndApplyTemplate "templates/post.html" (postCtxWithTags tags)
>>= loadAndApplyTemplate "templates/default.html" (postCtxWithTags tags)
>>= relativizeUrls
This means that if a page contains code it will no longer flicker after First Paint as a script translates the code into images of equations - the equations are now baked into the html that your browser renders from the get-go. This also saves me the cost of having to serve the js/load-mathjax.js file. At the moment the only page for which this is really relevant is the post on geometric algebra and classical mechanics.
Link rot
I had to replace a number of broken links. Currently they are pointing at the internet archive. If I have more time I might consider backing them up as part of my site, as Gwern does, but I already have quite lot of things distracting me.
Other
Frequent visitors will notice that the frontmatter of posts now include a (approximate) word count, and an updated field. The latter tracks git commits that touched the file. In most cases these will be corrections to typos or links that get fixed (see above).
Personal update
In other news, I started a new job a few months ago, ostensibly as a ‘Machine Learning Engineer’; in reality I am being farmed out to a large corporation doing very rudimentary programming under weird pressure, which has been challenging psychologically (the people on my team and in the broader company are however quite nice generally). I will perhaps write something about it, to the extent that I can do that without doxing myself or getting fired. But I am concerned that it will degenerate into a cynical rant about the nature of labour and capital in the 21st century, so I might not.
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.