diff --git a/package.json b/package.json
index 9590652..0f3079a 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,9 @@
"url": "https://github.com/kremalicious/gatsby-plugin-matomo/issues"
},
"dependencies": {
- "babel-runtime": "^6.26.0"
+ "babel-runtime": "^6.26.0",
+ "react": "^16.4.1",
+ "react-hot-loader": "^4.3.3"
},
"devDependencies": {
"babel-cli": "^6.26.0",
@@ -28,7 +30,7 @@
"license": "MIT",
"main": "index.js",
"peerDependencies": {
- "gatsby": "^1.9.0"
+ "gatsby": ">=1.9.0"
},
"repository": "github:kremalicious/gatsby-plugin-matomo",
"scripts": {
diff --git a/src/gatsby-ssr.js b/src/gatsby-ssr.js
index f50f658..e642505 100644
--- a/src/gatsby-ssr.js
+++ b/src/gatsby-ssr.js
@@ -1,13 +1,17 @@
import React from 'react'
function buildTrackingCode(pluginOptions) {
- const script = pluginOptions.localScript ? pluginOptions.localScript : `${pluginOptions.matomoUrl}/piwik.js`
+ const script = pluginOptions.localScript
+ ? pluginOptions.localScript
+ : `${pluginOptions.matomoUrl}/piwik.js`
const html = `
window.dev = ${pluginOptions.dev}
if (window.dev === true || !(navigator.doNotTrack == '1' || window.doNotTrack == '1')) {
window._paq = window._paq || [];
- window._paq.push(['setTrackerUrl', '${pluginOptions.matomoUrl}/piwik.php']);
+ window._paq.push(['setTrackerUrl', '${
+ pluginOptions.matomoUrl
+ }/piwik.php']);
window._paq.push(['setSiteId', '${pluginOptions.siteId}']);
window._paq.push(['enableLinkTracking']);
window._paq.push(['trackPageView']);
@@ -15,7 +19,9 @@ function buildTrackingCode(pluginOptions) {
window.start = new Date();
if (window.dev === true) {
console.log('[Matomo] Tracking initialized')
- console.log('[Matomo] matomoUrl: ${pluginOptions.matomoUrl}, siteId: ${pluginOptions.siteId}')
+ console.log('[Matomo] matomoUrl: ${pluginOptions.matomoUrl}, siteId: ${
+ pluginOptions.siteId
+ }')
}
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.defer=true; g.async=true; g.src='${script}'; s.parentNode.insertBefore(g,s);
@@ -31,7 +37,10 @@ function buildTrackingCode(pluginOptions) {
}
function buildTrackingCodeNoJs(pluginOptions, pathname) {
- const html = ``
+ const html = ``
return (