Using Fathom for Site Analytics

Published at May 14, 2019 ·  3 min read

Share on:

Fathom is an opensource website analytics application that you can self-host or pay for managed hosting. It provides enough information to allow you understand key metrics about the traffic flowing to your website.

Some features you might expect, like IP addresses of visitors, geo-location, and user-agent strings, are not available because it’s a privacy focused analytics system. But that’s not a defect, it’s a feature, especially in an online world where privacy is becoming more important to users.

Fathom provides simple analytics and is privacy focused.

Fathom provides simple analytics and is privacy focused.

Fathom can be setup using Docker or built from source. Using the containerized method of deployment is by far the easiest. In this article we’re going to setup Fathon using a container on our own equipment and setup some websites to flow some traffic. We’ll be using Packetriot as an example since we use Fathom to collect our analytics for packetriot.com and our blog.

docker run -d --restart always -p 8000:80 --name packetriot-fathom usefathom/fathom:latest 

docker ps

Now that Fathom is running we’ll create some new sites and copy the javascript tracking code. For my example I’m going to create a tracker for packetriot.com and blog.packetriot.com. You can paste the tracker code into your websites and it’ll start collecting data on visits.

Next we need to expose the Fathom container to the Internet so that the site tracker code in my two websites can actually reach the server running inside the container. To do this I’m going to add a new rule to pktriot client configuration. I want my metrics to be encrypted, so we’ll be enabling LetsEncrypt and secure redirect. Once we finish adding the rule just start up the client.

pktriot tunnel http add --domain stats.packetriot.com --destination 127.0.0.1 --http 8000 --letsencrypt 

pktriot tunnel http ls

pktriot start

With our tunnel up we’ll need to visit the sites we built trackers for and give Fathom some time to receive the data and make its determinations. It may take some time for data-points to begin to accumulate. One of the reasons that I’ve found this to be the case is not that it’s slow to update, but rather that many users use Do Not Track (DNT) in their browser, which Fathom respects. If you want to test Fathom on your own, be sure to turn off DNT or just make an exception for your websites.

Site metrics for packetriot.com

Site metrics for packetriot.com

For those that want to collect traffic metrics for the sites you run and host the data on their own, check out Fathom. I’ve been using Fathom for several months now and really enjoy it. It’s easy to setup, opensource, respects your users’ privacy and can be integrated into your site with ease.

The folks at Fathom provide plans for managed service if you don’t want to worry about hosting or updating your software. Exposing Fathom to the Internet is easy to do with Packetriot. You can host many websites with a single tunnel and collect site metrics for all of them using Fathom.

Hope you enjoyed this article and found it helpful. Have any feedback or comments? Please tweet or DM on Twitter. Or just contact us via email.

Cheers!

The Packetriot team