react-gtm-ts
Advanced tools
Comparing version 1.0.34 to 1.0.35
@@ -33,3 +33,3 @@ "use strict"; | ||
}) => { | ||
var _a; | ||
var _a, _b, _c; | ||
if (typeof window === "undefined") | ||
@@ -39,2 +39,6 @@ return; | ||
return; | ||
if (typeof ((_b = window == null ? void 0 : window.dataLayer) == null ? void 0 : _b.push) !== "undefined") | ||
return; | ||
console.log((_c = window == null ? void 0 : window.react_gtm_ts) == null ? void 0 : _c.init); | ||
console.log(window == null ? void 0 : window.dataLayer); | ||
window.react_gtm_ts = { | ||
@@ -55,2 +59,5 @@ init: true, | ||
var GTMInit = (code) => { | ||
var _a; | ||
if (!!((_a = window == null ? void 0 : window.react_gtm_ts) == null ? void 0 : _a.init)) | ||
return; | ||
const elScript = document.createElement("script"); | ||
@@ -57,0 +64,0 @@ const script = `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','${code}');`; |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "1.0.34", | ||
"version": "1.0.35", | ||
"description": "This is a library to facilitate the implementation of Google Tag Manager.", | ||
@@ -8,0 +8,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
8750
173