Permalink
Browse files

Scoping js variables to avoid polluting global scope

  • Loading branch information...
julien1619 committed Jul 29, 2018
1 parent a96e8ea commit c4b21bf5ce856e42429f78ea4d6124a3674f7d94
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/gatsby-ssr.js
@@ -16,8 +16,10 @@ function buildTrackingCode(pluginOptions) {
window._paq.push(['enableHeartBeatTimer']);
window.start = new Date();
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);
(function() {
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src='${script}'; s.parentNode.insertBefore(g,s);
})();
if (window.dev === true) {
console.log('[Matomo] Tracking initialized')

0 comments on commit c4b21bf

Please sign in to comment.