mirror of
https://github.com/kremalicious/gatsby-plugin-matomo.git
synced 2024-12-22 09:13:19 +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._paq.push(['enableHeartBeatTimer']);
|
||||||
window.start = new Date();
|
window.start = new Date();
|
||||||
|
|
||||||
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
(function() {
|
||||||
g.defer=true; g.async=true; g.src='${script}'; s.parentNode.insertBefore(g,s);
|
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) {
|
if (window.dev === true) {
|
||||||
console.log('[Matomo] Tracking initialized')
|
console.log('[Matomo] Tracking initialized')
|
||||||
|
Loading…
Reference in New Issue
Block a user