Fathom Analytics for Drupal 8 (and 9)

This post includes affiliate links. Register with Fathom and get $10 off of your first invoice.

I recently replaced Google Analytics (GA) on my blog with Fathom Analytics, a simple, privacy-focused alternative to GA. It doesn't use cookies to track users, you can bypass ad-blockers with custom domains, and the dashboard has all the info you really need for a simple blog.

Image
Fathom Analytics

Since my blog is built on Drupal I thought it would be cool to build a module where you can enter your Site ID and the Fathom script magically appears on your page. I also added an option to add a custom domain, and to exclude (or include) certain paths and roles from tracking.

Image
Fathom Analytics for Drupal 8 (and 9)

You can get it here, or via command line (if you installed your Drupal site with composer):

composer require drupal/fathom_analytics
drush en fathom_analytics