DEV Community

Cover image for Fathom Analytics: Privacy-Focused Website Analytics
Corey O'Donnell
Corey O'Donnell

Posted on • Edited on • Originally published at codebycorey.com

Fathom Analytics: Privacy-Focused Website Analytics

The Rise of Privacy

Stop stealing your users 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 Introduction

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.
  • Ability to share dashboard to others protected by a password.
  • 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 -->
Enter fullscreen mode Exit fullscreen mode

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} />
}
Enter fullscreen mode Exit fullscreen mode

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.

Top comments (2)

Collapse
 
rahni profile image
Rahni • Edited

I agree, it's becoming more and more important to switch to privacy-focused solutions and to move away from invasive tools that collect so much personal data. Another great privacy-focused analytics tool is getinsights.io. If you have a web app, getinsights.io allows you to track custom events. It also works well with Google Analytics because if you have an accept/reject cookie banner and the user clicks reject, Insights can still obtain their aggregated data whereas GA cannot.

Collapse
 
codebycorey profile image
Corey O'Donnell

Fathom also has custom events. They call them goals, but you could use them as events also.