Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub
Simple Analytics logo

Gatsby Plugin

Simple Analytics is a clean, simple, and privacy friendly analytics tool. Actionable data in a beautiful dashboard. It does not use cookies and you can bypass ad blockers. Make sure to signup to get most value out of this plugin.

Install

Run the following command:

npm install gatsby-plugin-simple-analytics --save-dev

What does it do

It tracks page views with support for pushState navigation. It sends the data to Simple Analytics and it will be available in your dashboard. You need to have a paid subscription for it to work.

How to use

  1. Add our plugin to gatsby-config.js

    plugins: [    
      {
        resolve: 'gatsby-plugin-simple-analytics',
        options: {
          trackPageViews: true
        }
      }
    ]
  2. If you want to set a custom domain, use this config:

     plugins: [    
       {
         resolve: 'gatsby-plugin-simple-analytics',
         options: {
           eventsGlobal: 'sa',
           events: true,
           trackPageViews: true,
           ignorePages: ['pathname']
         }
       }
     ]

    Read our docs on the custom domain feature.

Use with Confirmic

Confirmic provides a privacy-by-design API to ethically manage your users’ data. It’s pretty cool.

If you want to use it with Confirmic’s data-micropolicy use this config:

plugins: [
  {
    resolve: 'gatsby-plugin-simple-analytics',
    options: {
      metomic: 'POLICY-SLUG'
    }
  }
]

It will result in something like this:

<script src="https://scripts.simpleanalyticscdn.com/latest.js" async="" defer="" type="text/x-metomic" data-micropolicy="POLICY-SLUG">

Contribute

If you know how to improve this plugin, please submit a PR, we are usually fast with merging it.

© 2024 Gatsby, Inc.