A text editor with binary code

Fathom Analytics

Heads up! This article was published over 45 months ago.

The following is not entirely a step-by-step tutorial on how to get up and running with Fathom. Instead, this is an overview of my setup and how I went about getting a Fathom server up and capturing data.


Fathom is an privacy focused data collection system that replaces the need for using intrusive and overreaching platforms like Google or Adobe analytics. Of course companies or individuals that require a great deal of data filtering, conversions, filters, etc, will probably not be able to replace their platforms of choice with Fathom. The greatest "weakness" of Fathom is also its greatest strength, simplicity. Instead of tracking tons of data that you really will never use, much less how to use, Fathom just gives you the data you're really looking for - visitors and top pages.

It took me a few hours to get the Fathom server up and running using an Amazon Web Services EC2 instance. This is mostly due to my inexperience with managing servers on AWS and less to do with Fathom as an application. I first attempted to run the Fathom docker image using Amazon's ECS platform, but those efforts proved futile. In the end I decided to say fuck it and just boot up an Ubuntu image and install Fathom manually.

This is how I went about it.

Launching EC2 Instance

  1. Create an EC2 instance, with Ubuntu
  2. Create an Elastic IP and associate it with the EC2 instance
  3. SSH into the instance
  4. Run the following commands


# Download the release
curl -o fathom.tar.gz -L https://github.com/usefathom/fathom/releases/download/v1.2.1/fathom_1.2.1_linux_amd64.tar.gz

# Extract it
sudo tar -C /usr/local/bin -xzf fathom.tar.gz

# Change the permissions
sudo chmod +x /usr/local/bin/fathom

# Check that it installed correctly
fathom --version

Configuring Fathom

  1. Create an .env file with the following


  1. Create a service file


sudo touch /etc/systemd/system/fathom.service
  1. Add the following to the file


Description=Starts the fathom server

ExecStart=/usr/local/bin/fathom server

  1. Reload the daemon, enable fathom, and start it.


sudo systemctl daemon-reload
sudo systemctl enable fathom
sudo systemctl start fathom

Configuring a Custom Domain

  1. Create a new Hosted Zone in AWS Route 53
  2. Supply your domain name and leave the type as Public Hosted Zone
  3. Once created, make two new Record Set by clicking on the Create Record Set button
  4. Add A type with a blank Name. Paste the address of your Elastic IP as the value
  5. Add A type with a name of www. Paste the Public DNS of the EC2 as the value
  6. SSH back into the EC2 instance
  7. Enable mod_proxy via the commands


sudo a2enmod proxy
sudo a2enmod proxy_balancer
sudo a2enmod proxy_http
  1. Edit the Apache2.conf


sudo vim /etc/apache2/apache2.conf

# Add the following to the file
ProxyPass "/" "http://keytar.co:8080/"
ProxyPassReverse "/" "http://keytar.co:8080/"
  1. Restart Apache sudo systemctl restart apache2

Now the requests to http://keytar.co should route to http://keytar.co:8080 behind the scenes. That way users don't have to know to use the :8080 port and makes passing the URL as a configuration much easier.

Content Security Policy

Fathom uses embedded data in images as a way of capturing data instead of ajax. Because of this, my content security policy was preventing the images from being created, as it sets the source of the image to be my tracking url for Fathom, in my case https://keytar.co (a domain I had sitting around doing nothing).

Modifying the CSP header in my gatsby-config.js was easy enough. I just had to pass https://keytar.co as an additional value.


Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' https://keytar.co; connect-src 'self'; img-src https://*.ocular-rhythm.io https://keytar.co data:; style-src 'self' 'unsafe-inline';

The last step is to throw the tracking code Fathom gives you when you create a new site.


Previous PostAzure Devops Pipeline Build with Shopify
Next PostImportance of Perception