Fathom Analytics Compatibility

If you haven’t heard about Fathom Analytics, then you should check them out. They’re a privacy-focused web analytics alternative to Google Analytics. I’ve been using them since 2018. Last July I upgraded to their paid service which is fully integrated into the Anchor Hosting dashboard. If you’re a customer, check out the Stats tab.

Bundled Fathom Analytics are hidden by default with an option to turn on public share link

I recently discovered unintended consequences of bundling in Fathom Analytics. My paid Fathom Analytics tracker was in conflict with other paying Fathom Analytics trackers. I’m happy to report that the issue was quickly identified and is fully resolved. Any customer Anchor Hosting should be able to pay for and use Fathom Analytics as they wish.

Digging into the Javascript tracker conflict

Read on if you want a peek at the technical issue. Otherwise, you should bail now and check out Fathom Analytics for yourself :). The source of the conflict happens when a website attempts to load many Fathom Analytics trackers. That is fixable by putting each tracker under a different global JS function name. The official Fathom Analytics tracker uses window.fathom as shown below.

Localized tracker script and renamed for compatibility

In order to make changes to the Fathom Analytics tracker,s I decided it would be best to serve a modified local version. I changed then changed references from window.fathom to window.fathom_anchorhost and updated the trackerUrl to use one of my custom Fathom Analytics domains.

Lastly, I just need to roll out my improvement embed method to all existing customers using a one-liner from my toolkit captaincore stats-deploy @all.