Skip to main content
View plugin on GitHub
See starters using this


npm package

Gatsby plugin to add Fathom tracking to your site.

Table of contents


npm install gatsby-plugin-fathom


// gatsby-config.js
module.exports = {
  plugins: [
      resolve: 'gatsby-plugin-fathom',
      options: {
        // Fathom server URL. Defaults to ``
        trackingUrl: '',
        // Unique site id
        siteId: 'FATHOM_SITE_ID',
        // Domain whitelist
        whitelistHostnames: [

By default, this plugin only generates output when run in production mode. To test your tracking code, run gatsby build && gatsby serve.


Option Explanation
trackingUrl Your Fathom instance URL (optional; only necessary if self-hosting Fathom)
siteId Unique site id (required when using the hosted version of Fathom or self-hosting Fathom v1.1.0+)
whitelistHostnames List of hostnames to enable tracking for (optional; if not provided tracking will be enabled on all domains)


MIT © Lars Graubner