Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
save some lines
Browse files Browse the repository at this point in the history
  • Loading branch information
kremalicious committed May 22, 2018
1 parent f9050ce commit 5034a3b
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ function buildTrackingCode(pluginOptions) {

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']);
Expand All @@ -14,23 +13,18 @@ function buildTrackingCode(pluginOptions) {
window._paq.push(['trackPageView']);
window._paq.push(['enableHeartBeatTimer']);
window.start = new Date();
if (window.dev === true) {
console.log('[Matomo] Tracking initialized')
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);
g.defer=true; g.async=true; g.src='${script}'; s.parentNode.insertBefore(g,s);
}
`

return (
<script
key={'gatsby-plugin-matomo'}
type="text/javascript"
dangerouslySetInnerHTML={{ __html: html }}
/>
)
Expand Down

0 comments on commit 5034a3b

Please sign in to comment.