mirror of
https://github.com/kremalicious/gatsby-plugin-matomo.git
synced 2024-12-22 17:23:23 +01:00
Scoping js variables to avoid polluting global scope
This commit is contained in:
parent
a96e8ea5f8
commit
c4b21bf5ce
@ -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