profile

Corey O'Donnell

Software Engineer

Fathom Analytics: Privacy-Focused Website Analytics

Affiliate links may earn commissions.

The Rise of Privacy

Stop stealing your visitors' personal information. Recently, there has been a growing trend of people starting to take their privacy more serious. They realize that they are being tracked across the entire web of internet. Imagine someone following you all day watching every little thing you do without you knowing. They watch you while you are working, reading, and playing. Tools such as Google Analytics make it easier for you to have more insight on your website but this comes at the expense of invading your user's privacy. Countries are adding laws where website need to be more transparent on their tracking or will be fined. Great news is there are tools that are privacy oriented to help keep your visitors' privacy intact while still collecting valuable metrics.

Introducing Fathom Analytics

Fathom Banner

I have been using Fathom Analytics for my blog and side projects for the past couple months. It has been a great tool to collect metrics without invading my visitors' privacy.

Some great benefits using Fathom:

  • You don't need to display cookie notices as they do not use cookies, nor track invasive data.
  • No personal information is collected from my visitors. Privacy is their number one focus.
  • Ability to use a custom domain for tracking to prevent ad-blockers from blocking the script from loading.
  • Extremely light-weight script to keep load time minimal.
  • Add unlimited websites to my account.
  • Add monitoring for uptime on my websites with multiple forms of notification.
  • The dashboard is simple and easy to use. It displays everything I need with a clean chart and tables.
  • Their support has always been quick to respond and always helpful.
  • They also pledge 2% of their revenues to green initiatives.

Usage

Using Fathom is extremely simple. All you need to do is add a new site in your Fathom settings. This will generate a Site ID and provide you with fathom script to be added to your HTML.

<!-- Fathom - beautiful, simple website analytics -->
<script src="https://cdn.usefathom.com/script.js" site="SITE_ID" defer></script>
<!-- / Fathom -->

They also have JavaScript package fathom-client to make it easy to add it to your JavaScript Frameworks. I use the client inside my Next.js projects.

Example Use in Next.js:

import { useEffect } from 'react';
import { useRouter } from 'next/router';
import * as Fathom from 'fathom-client';

export default function App({ Component, pageProps }) {
  const router = useRouter();

  useEffect(() => {
    // Initialize Fathom when the app loads
    Fathom.load('SITE_ID', {
      includedDomains: ['YOUR_SITE_URL']
    });

    function onRouteChangeComplete() {
      Fathom.trackPageview();
    }
    // Record a pageview when route changes
    router.events.on('routeChangeComplete', onRouteChangeComplete);

    // Unassign event listener
    return () => {
      router.events.off('routeChangeComplete', onRouteChangeComplete);
    };
  }, []);

  return <Component {...pageProps} />;
}

Be a part of the growing privacy movement

Be a part of the growing movement of improving privacy. I know privacy is important for me. Ditch the invasive tracking tools such as Google Analytics. Switch to something that still gives you metrics awhile still providing privacy. Try Fathom Analytics!.


  • Follow me on Twitter for random posts about tech, programming, and working from home.
Edit this page on GitHub