Skip to content

Commit

Permalink
package updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kremalicious committed Mar 22, 2020
1 parent 30a5836 commit aeeffda
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
"dependencies": {},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.4",
"@babel/runtime": "^7.8.4",
"@babel/core": "^7.9.0",
"@babel/runtime": "^7.9.2",
"auto-changelog": "^1.16.2",
"babel-preset-gatsby-package": "^0.2.16",
"cross-env": "^7.0.0",
"babel-preset-gatsby-package": "^0.2.18",
"cross-env": "^7.0.2",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-prettier": "^3.1.2",
"jest": "^25.1.0",
"prettier": "^1.19.1",
"react": "^16.12.0",
"release-it": "^12.6.1"
"prettier": "^2.0.1",
"react": "^16.13.1",
"release-it": "^13.1.2"
},
"homepage": "https://kremalicious.com/gatsby-plugin-matomo",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('gatsby-plugin-google-analytics', () => {
process.env.NODE_ENV = env
})

const setup = options => {
const setup = (options) => {
const setHeadComponents = jest.fn()
const setPostBodyComponents = jest.fn()

Expand Down
24 changes: 15 additions & 9 deletions src/gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ function buildTrackingCode(pluginOptions) {
${requireConsent ? "window._paq.push(['requireConsent']);" : ''}
${disableCookies ? "window._paq.push(['disableCookies']);" : ''}
${
cookieDomain
? `window._paq.push(['setCookieDomain', '${cookieDomain}']);`
: ''
}
cookieDomain
? `window._paq.push(['setCookieDomain', '${cookieDomain}']);`
: ''
}
window._paq.push(['setTrackerUrl', '${matomoUrl}/${matomoPhpScript}']);
window._paq.push(['setSiteId', '${siteId}']);
window._paq.push(['enableHeartBeatTimer']);
Expand All @@ -53,9 +53,15 @@ function buildTrackingCode(pluginOptions) {
}

function buildTrackingCodeNoJs(pluginOptions, pathname) {
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" />`
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" />`

return (
<noscript
Expand Down Expand Up @@ -83,12 +89,12 @@ export const onRenderBody = (
let excludePaths = ['/offline-plugin-app-shell-fallback/']

if (pluginOptions && typeof pluginOptions.exclude !== 'undefined') {
pluginOptions.exclude.map(exclude => {
pluginOptions.exclude.map((exclude) => {
excludePaths.push(exclude)
})
}

const isPathExcluded = excludePaths.some(path => pathname === path)
const isPathExcluded = excludePaths.some((path) => pathname === path)

if (
(isProduction || (pluginOptions && pluginOptions.dev === true)) &&
Expand Down

0 comments on commit aeeffda

Please sign in to comment.