1
0
mirror of https://github.com/kremalicious/gatsby-plugin-matomo.git synced 2024-12-22 09:13:19 +01:00

package updates

This commit is contained in:
Matthias Kretschmann 2020-03-22 16:06:09 +01:00
parent 30a58365bf
commit aeeffda980
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 24 additions and 18 deletions

View File

@ -16,18 +16,18 @@
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.8.4", "@babel/cli": "^7.8.4",
"@babel/core": "^7.8.4", "@babel/core": "^7.9.0",
"@babel/runtime": "^7.8.4", "@babel/runtime": "^7.9.2",
"auto-changelog": "^1.16.2", "auto-changelog": "^1.16.2",
"babel-preset-gatsby-package": "^0.2.16", "babel-preset-gatsby-package": "^0.2.18",
"cross-env": "^7.0.0", "cross-env": "^7.0.2",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0", "eslint-config-prettier": "^6.10.1",
"eslint-plugin-prettier": "^3.1.2", "eslint-plugin-prettier": "^3.1.2",
"jest": "^25.1.0", "jest": "^25.1.0",
"prettier": "^1.19.1", "prettier": "^2.0.1",
"react": "^16.12.0", "react": "^16.13.1",
"release-it": "^12.6.1" "release-it": "^13.1.2"
}, },
"homepage": "https://kremalicious.com/gatsby-plugin-matomo", "homepage": "https://kremalicious.com/gatsby-plugin-matomo",
"keywords": [ "keywords": [

View File

@ -23,7 +23,7 @@ describe('gatsby-plugin-google-analytics', () => {
process.env.NODE_ENV = env process.env.NODE_ENV = env
}) })
const setup = options => { const setup = (options) => {
const setHeadComponents = jest.fn() const setHeadComponents = jest.fn()
const setPostBodyComponents = jest.fn() const setPostBodyComponents = jest.fn()

View File

@ -23,10 +23,10 @@ function buildTrackingCode(pluginOptions) {
${requireConsent ? "window._paq.push(['requireConsent']);" : ''} ${requireConsent ? "window._paq.push(['requireConsent']);" : ''}
${disableCookies ? "window._paq.push(['disableCookies']);" : ''} ${disableCookies ? "window._paq.push(['disableCookies']);" : ''}
${ ${
cookieDomain cookieDomain
? `window._paq.push(['setCookieDomain', '${cookieDomain}']);` ? `window._paq.push(['setCookieDomain', '${cookieDomain}']);`
: '' : ''
} }
window._paq.push(['setTrackerUrl', '${matomoUrl}/${matomoPhpScript}']); window._paq.push(['setTrackerUrl', '${matomoUrl}/${matomoPhpScript}']);
window._paq.push(['setSiteId', '${siteId}']); window._paq.push(['setSiteId', '${siteId}']);
window._paq.push(['enableHeartBeatTimer']); window._paq.push(['enableHeartBeatTimer']);
@ -53,9 +53,15 @@ function buildTrackingCode(pluginOptions) {
} }
function buildTrackingCodeNoJs(pluginOptions, pathname) { function buildTrackingCodeNoJs(pluginOptions, pathname) {
const { matomoUrl, matomoPhpScript = 'piwik.php', siteId, siteUrl } = pluginOptions const {
const html = `<img src="${matomoUrl}/${matomoPhpScript}?idsite=${siteId}&rec=1&url=${siteUrl + matomoUrl,
pathname}" style="border:0" alt="tracker" />` matomoPhpScript = 'piwik.php',
siteId,
siteUrl
} = pluginOptions
const html = `<img src="${matomoUrl}/${matomoPhpScript}?idsite=${siteId}&rec=1&url=${
siteUrl + pathname
}" style="border:0" alt="tracker" />`
return ( return (
<noscript <noscript
@ -83,12 +89,12 @@ export const onRenderBody = (
let excludePaths = ['/offline-plugin-app-shell-fallback/'] let excludePaths = ['/offline-plugin-app-shell-fallback/']
if (pluginOptions && typeof pluginOptions.exclude !== 'undefined') { if (pluginOptions && typeof pluginOptions.exclude !== 'undefined') {
pluginOptions.exclude.map(exclude => { pluginOptions.exclude.map((exclude) => {
excludePaths.push(exclude) excludePaths.push(exclude)
}) })
} }
const isPathExcluded = excludePaths.some(path => pathname === path) const isPathExcluded = excludePaths.some((path) => pathname === path)
if ( if (
(isProduction || (pluginOptions && pluginOptions.dev === true)) && (isProduction || (pluginOptions && pluginOptions.dev === true)) &&