Skip to content

Commit

Permalink
Scoping js variables to avoid polluting global scope
Browse files Browse the repository at this point in the history
  • Loading branch information
julien1619 committed Jul 29, 2018
1 parent a96e8ea commit c4b21bf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit c4b21bf

Please sign in to comment.