Matomo plugin for Gatsby

Plugin for Gatsby to add tracking with the open-source analytics platform Matomo (formerly Piwik) onto a site, prioritizing user experience & privacy with sensible defaults.

#Features

  • include tracking code in all server-side rendered routes
  • track all route views as custom events
  • load tracking scripts at end of body tag
  • use image tracking fallback for <noscript>
  • don’t load anything when visitor has Do Not Track enabled
  • don’t load anything in non-production environments
  • consent mode for privacy
  • allow loading tracking script locally
  • define paths to be excluded from tracking
  • dev mode for local development

#Usage

First, install the plugin from your project’s root:

cd yourproject/
npm i gatsby-plugin-matomo

Then load the plugin from your gatsby-config.js and set the required variables:

plugins: [
  {
    resolve: 'gatsby-plugin-matomo',
    options: {
      siteId: 'YOUR_SITE_ID',
      matomoUrl: 'https://YOUR_MATOMO_URL.COM',
      siteUrl: 'https://YOUR_LIVE_SITE_URL.COM'
    }
  }
]

#Check out & contribute

Head over to GitHub for more documentation, take a peek into the code, or to report some bugs.

GitHub

Changelog

sourced from kremalicious/gatsby-plugin-matomo:CHANGELOG.md

Changelog

All notable changes to this project will be documented in this file. Dates are displayed in UTC.

Generated by auto-changelog.

v0.8.3

6 April 2020

  • Make load tracking configurable #25
  • onRouteUpdate test tweaks 5871f66
  • package updates 86258f8

v0.8.2

22 March 2020

  • Add support for custom JS and PHP script names #24
  • package updates aeeffda
  • Make PHP and JS script names configurable 12a4ebe
  • disable GitHub packsge registry publishing 777be77

v0.8.1

24 February 2020

  • switch test run to GitHub Actions #23
  • add cookieDomain setting #22
  • Release 0.8.1 e899e37
  • package updates 9703688

v0.8.0

15 February 2020

  • Updates, cleanup, and testing #21
  • Add trackAllContentImpressions to record/enable content tracking #19
  • setup testing 8103a64
  • switch to auto-changelog 92f3749
  • updates and cleanup c0269c7

v0.7.2

13 June 2019

  • Fix missing tracking code in rendered HTML #18
  • update changelog 57092e5
  • Release 0.7.2 31cabd6

v0.7.1

10 June 2019

  • preconnect to configured Matomo host url #17
  • Add prettier #16
  • add prettier 858fc2e
  • new release-it setup bbb5f19
  • bump packages e3479f6

0.7.0

30 March 2019

  • Page tracking improvements #15
  • capture and send custom page title #11
  • better page url & referrer url tracking 04b8ba1
  • update changelog 24f57da
  • Release 0.7.0 4c36d9c

0.6.1

30 March 2019

  • package updates #14
  • Update release-it to the latest version 🚀 #12
  • Update release-it to the latest version 🚀 #10
  • run changelog before release 5da11a4
  • Release 0.6.1 f62c5bf
  • chore(package): update release-it to version 10.0.0 d56c6c3

v0.6.0

5 December 2018

  • Path exclusion #9
  • add changelog 2b268a1
  • allow exclusion of paths 9464d47
  • make release-it work with conventional-changelog 2dcd5a7

v0.5.1

21 November 2018

  • Update release-it to the latest version 🚀 #8
  • bump packages cb26a40
  • new Matomo logo 64dd425
  • Release 0.5.1 c442282

v0.5.0

6 August 2018

  • Add consent mode #7
  • Scoping js variables to avoid polluting global scope #6
  • bump packages b08b4a5
  • add codeclimate config a96e8ea
  • Add disableCookies option ff9a2c7

v0.4.1

28 June 2018

  • Update eslint to the latest version 🚀 #5
  • improvements for SPA tracking 7d653d5
  • package updates 347f951
  • Release 0.4.1 b254c13

v0.4.0

19 June 2018

v0.3.2

23 May 2018

v0.3.1

14 May 2018

v0.3.0

10 May 2018

v0.2.0

8 May 2018

v0.1.3

8 May 2018

v0.1.2

8 May 2018

  • Add Greenkeeper badge 🌴 #1
  • do nothing on route updates when piwik isn't loaded and in development 6c0a840
  • move greenskeeper badge b361eef
  • Release 0.1.2 370025f

v0.1.1

7 May 2018

v0.1.0

7 May 2018

  • initial commit 🍹 49bffd3
  • add Travis, add badges, add semi-auto releases fe823b7
  • Release 0.1.0 09739a7
Ledger Nano X: Keep your crypto secure, everywhere.