mirror of
https://github.com/kremalicious/gatsby-plugin-matomo.git
synced 2024-12-22 17:23:23 +01:00
Merge pull request #6 from Creatiwity/global-var-removal
Scoping js variables to avoid polluting global scope
This commit is contained in:
commit
226115db02
@ -16,8 +16,10 @@ function buildTrackingCode(pluginOptions) {
|
||||
window._paq.push(['enableHeartBeatTimer']);
|
||||
window.start = new Date();
|
||||
|
||||
(function() {
|
||||
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.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')
|
||||
|
Loading…
Reference in New Issue
Block a user