mirror of
https://github.com/kremalicious/gatsby-plugin-matomo.git
synced 2024-12-22 17:23:23 +01:00
Add default for matomoPhpScript and update README
This commit is contained in:
parent
12a4ebed8d
commit
e9d1569c78
@ -70,6 +70,8 @@ _NOTE: By default, this plugin only generates output when run in production mode
|
||||
| `siteId` | Your Matomo site ID configured in your Matomo installation. |
|
||||
| `matomoUrl` | The url of your Matomo installation. |
|
||||
| `siteUrl` | The url of your site, usually the same as `siteMetadata.siteUrl`. Only used for generating the url for `noscript` image tracking fallback. |
|
||||
| `matomoPhpScript`| (optional) The name of your Matomo PHP script. Defaults to `piwik.php` |
|
||||
| `matomoJsScript` | (optional) The name of your Matomo JS script. Defaults to `piwik.js` |
|
||||
| `exclude` | (optional) Specify an array of pathnames where tracking code will be excluded. The pathname `/offline-plugin-app-shell-fallback/` is excluded by default. |
|
||||
| `requireConsent` | (optional) If true, tracking will be disabled until you call `window._paq.push(['setConsentGiven']);`. |
|
||||
| `disableCookies` | (optional) If true, no cookie will be used by Matomo. |
|
||||
@ -86,6 +88,8 @@ plugins: [
|
||||
matomoUrl: 'https://YOUR_MATOMO_URL.COM',
|
||||
siteUrl: 'https://YOUR_LIVE_SITE_URL.COM',
|
||||
// All the optional settings
|
||||
matomoPhpScript: 'piwik.php',
|
||||
mataomoJsScript: 'piwik.js',
|
||||
exclude: ['/offline-plugin-app-shell-fallback/'],
|
||||
requireConsent: false,
|
||||
disableCookies: false,
|
||||
|
@ -53,7 +53,7 @@ function buildTrackingCode(pluginOptions) {
|
||||
}
|
||||
|
||||
function buildTrackingCodeNoJs(pluginOptions, pathname) {
|
||||
const { matomoUrl, siteId, siteUrl } = pluginOptions
|
||||
const { matomoUrl, matomoPhpScript = 'piwik.php', siteId, siteUrl } = pluginOptions
|
||||
const html = `<img src="${matomoUrl}/${matomoPhpScript}?idsite=${siteId}&rec=1&url=${siteUrl +
|
||||
pathname}" style="border:0" alt="tracker" />`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user