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

gatsby-plugin-fathom

npm package

Gatsby plugin to add Fathom tracking to your site.

Table of contents

Install

npm install gatsby-plugin-fathom

Usage

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

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

Options

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)

License

MIT © Lars Graubner