Logo kremalicious

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.

Matomo plugin for Gatsby

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:

Terminal window
cd yourproject/
npm i gatsby-plugin-matomo

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

gatsby-config.js
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/kremalicious/gatsby-plugin-matomo:CHANGELOG.md

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

Generated by auto-changelog.

v0.16.1

v0.16.0

8 July 2023

  • Bump eslint from 8.38.0 to 8.44.0 #437
  • switch default script names #233
  • package updates 8e84c78
  • remove eslint-plugin-prettier 98103c8
  • Release 0.16.0 28ad591

v0.15.2

27 April 2023

  • Bump babel-preset-gatsby-package from 3.8.0 to 3.9.0 #418
  • Bump vm2 from 3.9.16 to 3.9.17 #417
  • Bump vm2 from 3.9.15 to 3.9.16 #416
  • Release 0.15.2 d6ad15c
  • dependency security fix 3974169

v0.15.1

12 April 2023

  • Bump prettier from 2.8.4 to 2.8.7 #407
  • Bump jest-environment-jsdom from 29.4.3 to 29.5.0 #406
  • Bump release-it from 15.9.0 to 15.10.0 #411
  • Bump eslint-config-prettier from 8.6.0 to 8.8.0 #408
  • Bump babel-preset-gatsby-package from 3.7.0 to 3.8.0 #409
  • Bump vm2 from 3.9.11 to 3.9.15 #412
  • dependency updates 3d087e4
  • Release 0.15.1 42a3320

v0.15.0

23 March 2023

  • Bump prettier from 2.8.3 to 2.8.4 #391
  • Bump eslint from 8.33.0 to 8.36.0 #401
  • Bump release-it from 15.6.0 to 15.9.0 #405
  • Bump webpack from 5.75.0 to 5.76.1 #404
  • Bump @babel/cli from 7.20.7 to 7.21.0 #399
  • Bump babel-preset-gatsby-package from 3.6.0 to 3.7.0 #397
  • add additionalTrackers to set multiple trackers #403
  • Bump babel-preset-gatsby-package from 3.5.0 to 3.6.0 #390
  • Bump jest-environment-jsdom from 29.4.1 to 29.4.3 #395
  • Bump jest from 29.4.1 to 29.4.3 #396
  • Bump http-cache-semantics from 4.1.0 to 4.1.1 #389
  • Bump eslint from 8.32.0 to 8.33.0 #387
  • Bump babel-preset-gatsby-package from 3.4.0 to 3.5.0 #386
  • Bump jest from 29.3.1 to 29.4.1 #385
  • Bump jest-environment-jsdom from 29.3.1 to 29.4.1 #388
  • Bump ua-parser-js from 0.7.32 to 0.7.33 #384
  • Bump prettier from 2.8.2 to 2.8.3 #382
  • Bump babel-preset-gatsby-package from 3.3.0 to 3.4.0 #383
  • Bump engine.io and gatsby #381
  • Bump jest from 29.3.0 to 29.3.1 #364
  • Bump @babel/cli from 7.19.3 to 7.20.7 #380
  • Bump eslint-config-prettier from 8.5.0 to 8.6.0 #379
  • Bump release-it from 15.5.0 to 15.6.0 #377
  • Bump eslint from 8.31.0 to 8.32.0 #378
  • Bump jest-environment-jsdom from 29.3.0 to 29.3.1 #363
  • Bump babel-preset-gatsby-package from 3.0.0 to 3.3.0 #372
  • Bump prettier from 2.7.1 to 2.8.2 #376
  • Bump eslint from 8.27.0 to 8.31.0 #374
  • Bump json5 from 1.0.1 to 1.0.2 #375
  • Bump decode-uri-component from 0.2.0 to 0.2.2 #370
  • Bump loader-utils from 1.4.1 to 1.4.2 #365
  • Release 0.15.0 6919fc6

v0.14.0

8 November 2022

  • Bump loader-utils from 1.4.0 to 1.4.1 #362
  • Bump release-it from 15.4.2 to 15.5.0 #361
  • Bump eslint from 8.26.0 to 8.27.0 #360
  • Bump ws from 7.4.5 to 7.4.6 #359
  • Bump ansi-html and gatsby #358
  • Bump node-forge and gatsby #357
  • Bump parse-url and gatsby-telemetry #356
  • Bump cross-fetch and graphql-config #355
  • Bump vm2 from 3.9.9 to 3.9.11 #346
  • Bump eslint from 8.23.1 to 8.26.0 #352
  • Bump babel-preset-gatsby-package from 2.23.0 to 2.24.0 #348
  • Bump @babel/cli from 7.18.10 to 7.19.3 #349
  • Bump eslint from 8.23.0 to 8.23.1 #343
  • Bump babel-preset-gatsby-package from 2.21.0 to 2.23.0 #344
  • Bump release-it from 15.1.1 to 15.4.2 #342
  • Bump @babel/cli from 7.18.6 to 7.18.10 #334
  • Bump eslint from 8.22.0 to 8.23.0 #337
  • Bump shell-quote from 1.7.2 to 1.7.3 #336
  • Bump babel-preset-gatsby-package from 2.17.0 to 2.21.0 #333
  • Bump eslint-plugin-prettier from 4.0.0 to 4.2.1 #323
  • Bump prettier from 2.6.2 to 2.7.1 #321
  • Bump file-type from 16.5.3 to 16.5.4 #328
  • Bump eslint from 8.19.0 to 8.22.0 #332
  • Bump terser from 5.12.1 to 5.14.2 #327
  • Bump moment from 2.29.2 to 2.29.4 #320
  • Bump eventsource from 1.1.0 to 1.1.1 #306
  • Bump devcert from 1.2.0 to 1.2.1 #308
  • Bump eslint from 8.15.0 to 8.19.0 #315
  • Bump release-it from 14.14.1 to 15.1.1 #317
  • Bump sharp from 0.30.3 to 0.30.6 #307
  • Bump @babel/cli from 7.17.6 to 7.18.6 #316
  • Bump parse-url from 6.0.0 to 6.0.2 #319
  • Bump babel-preset-gatsby-package from 2.14.0 to 2.17.0 #314
  • Bump eslint from 8.13.0 to 8.15.0 #303
  • Bump babel-preset-gatsby-package from 2.11.0 to 2.14.0 #302
  • Gatsby v5 support d02b3dd
  • Release 0.14.0 469302a

v0.13.0

10 April 2022

  • Bump prettier from 2.6.1 to 2.6.2 #291
  • Bump moment from 2.29.1 to 2.29.2 #293
  • Bump release-it from 14.13.1 to 14.14.0 #292
  • Bump babel-preset-gatsby-package from 2.10.0 to 2.11.0 #290
  • Bump eslint from 8.11.0 to 8.12.0 #289
  • Bump prettier from 2.6.0 to 2.6.1 #288
  • Bump minimist from 1.2.5 to 1.2.6 #287
  • Bump babel-preset-gatsby-package from 2.9.0 to 2.10.0 #286
  • Bump prettier from 2.5.1 to 2.6.0 #285
  • Bump release-it from 14.12.5 to 14.13.1 #284
  • Bump eslint from 8.10.0 to 8.11.0 #283
  • default to Gatsby v4 peer dependency ac8dd7d
  • package updates 3565e9a
  • Release 0.13.0 5bda1a1

v0.12.0

10 April 2022

v0.11.1

11 March 2022

  • Bump eslint-config-prettier from 8.4.0 to 8.5.0 #282
  • Bump release-it from 14.12.4 to 14.12.5 #278
  • Bump @babel/cli from 7.17.3 to 7.17.6 #277
  • Bump eslint from 8.9.0 to 8.10.0 #279
  • Bump url-parse from 1.5.7 to 1.5.10 #280
  • Bump babel-preset-gatsby-package from 2.7.0 to 2.9.0 #281
  • Bump eslint-config-prettier from 8.3.0 to 8.4.0 #274
  • Bump @babel/cli from 7.17.0 to 7.17.3 #275
  • Bump url-parse from 1.5.3 to 1.5.7 #273
  • Bump follow-redirects from 1.14.1 to 1.14.8 #272
  • Bump engine.io from 4.1.1 to 4.1.2 #271
  • Bump babel-preset-gatsby-package from 2.6.0 to 2.7.0 #270
  • Bump eslint from 8.8.0 to 8.9.0 #269
  • Bump jest from 27.5.0 to 27.5.1 #268
  • Bump @babel/cli from 7.16.8 to 7.17.0 #265
  • Bump auto-changelog from 2.3.0 to 2.4.0 #266
  • Bump jest from 27.4.7 to 27.5.0 #267
  • Bump babel-preset-gatsby-package from 2.5.0 to 2.6.0 #263
  • Bump nanoid from 3.1.30 to 3.2.0 #264
  • Bump eslint from 8.7.0 to 8.8.0 #262
  • Bump release-it from 14.12.3 to 14.12.4 #261
  • Bump babel-preset-gatsby-package from 2.4.0 to 2.5.0 #257
  • Bump release-it from 14.12.1 to 14.12.3 #258
  • Bump eslint from 8.6.0 to 8.7.0 #259
  • Bump @babel/cli from 7.16.7 to 7.16.8 #260
  • Bump release-it from 14.11.8 to 14.12.1 #255
  • Bump jest from 27.4.5 to 27.4.7 #256
  • Bump @babel/cli from 7.16.0 to 7.16.7 #254
  • Bump eslint from 8.5.0 to 8.6.0 #253
  • Bump eslint from 8.4.1 to 8.5.0 #250
  • Bump babel-preset-gatsby-package from 2.3.0 to 2.4.0 #252
  • Bump eslint from 8.4.0 to 8.4.1 #248
  • Bump eslint from 8.3.0 to 8.4.0 #247
  • Bump babel-preset-gatsby-package from 2.2.0 to 2.3.0 #246
  • Bump prettier from 2.5.0 to 2.5.1 #244
  • package updates b6d51f7
  • more package updates b4efe1d
  • Create codeql-analysis.yml 8bfa9d3

v0.11.0

28 November 2021

  • Bump release-it from 14.6.2 to 14.7.0 #192
  • Bump babel-preset-gatsby-package from 1.5.0 to 1.6.0 #193
  • Bump auto-changelog from 2.2.1 to 2.3.0 #191
  • support for Gatsby v4 #234
  • package updates 842c343
  • Release 0.11.0 628dfb2
  • readme update b9f0d3d

v0.10.0

23 May 2021

  • Add support for error tracking [Fixes #168] #169
  • Add cookie consent option #102
  • feat: add respectDnt option #129
  • fix: Set correct gatsby peer dep #176
  • Bump @babel/cli from 7.12.10 to 7.12.16 #151
  • Bump eslint from 7.19.0 to 7.20.0 #150
  • Bump release-it from 14.2.2 to 14.4.0 #149
  • Bump @babel/eslint-parser from 7.12.1 to 7.12.16 #147
  • Bump @babel/runtime from 7.12.5 to 7.12.13 #146
  • Bump @babel/core from 7.12.10 to 7.12.16 #148
  • Bump babel-preset-gatsby-package from 0.11.0 to 0.12.0 #142
  • Add support for error tracking [Fixes #168] (#169) #168 #168
  • package updates 4858deb
  • Release 0.10.0 af31666

v0.9.0

1 February 2021

  • CI tweaks & package updates #141
  • Bump auto-changelog from 2.2.0 to 2.2.1 #79
  • Bump jest from 26.1.0 to 26.5.3 #87
  • Bump release-it from 13.6.5 to 14.2.0 #95
  • Bump prettier from 2.0.5 to 2.1.2 #78
  • Bump eslint-config-prettier from 6.11.0 to 6.13.0 #96
  • Bump node-fetch from 2.6.0 to 2.6.1 #75
  • Bump eslint from 7.5.0 to 7.11.0 #86
  • Bump @babel/runtime from 7.10.5 to 7.12.1 #92
  • Bump @babel/core from 7.10.5 to 7.12.3 #94
  • Bump @babel/cli from 7.10.5 to 7.12.1 #91
  • Bump lodash from 4.17.15 to 4.17.19 #44
  • Bump release-it from 13.6.4 to 13.6.5 #38
  • Bump babel-preset-gatsby-package from 0.5.1 to 0.5.2 #39
  • Bump @babel/cli from 7.10.4 to 7.10.5 #42
  • Bump @babel/core from 7.10.4 to 7.10.5 #41
  • Bump @babel/runtime from 7.10.4 to 7.10.5 #40
  • Bump eslint from 7.4.0 to 7.5.0 #43
  • Bump auto-changelog from 2.1.0 to 2.2.0 #37
  • Bump eslint from 7.3.1 to 7.4.0 #36
  • Bump babel-preset-gatsby-package from 0.4.6 to 0.5.0 #33
  • Create Dependabot config file #31
  • Bump eslint from 6.8.0 to 7.0.0 #30
  • Bump babel-preset-gatsby-package from 0.3.2 to 0.4.1 #29
  • Bump jest from 25.5.4 to 26.0.1 #28
  • Bump auto-changelog from 1.16.4 to 2.0.0 #27
  • package updates 12093c3
  • package updates b3a6700
  • CI tweaks 8e62075

v0.8.3

6 April 2020

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

11 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
Mastodon

Have a comment?

Hit me up @krema@mas.to

Bitcoin

Found something useful?

Say thanks with BTC or ETH

Github

Edit on GitHub

Contribute to this post