react-gtm-ts
Advanced tools
Comparing version 1.0.44 to 1.0.45
@@ -1,1 +0,6 @@ | ||
"use strict";var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var w=(t,e)=>{for(var n in e)s(t,n,{get:e[n],enumerable:!0})},u=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of l(e))!p.call(t,o)&&o!==n&&s(t,o,{get:()=>e[o],enumerable:!(i=g(e,o))||i.enumerable});return t};var f=t=>u(s({},"__esModule",{value:!0}),t);var h={};w(h,{ReactTagManager:()=>m});module.exports=f(h);var d=({code:t,debug:e=!1,performance:n=!1})=>{var i;typeof window>"u"||(i=window==null?void 0:window.react_gtm_ts)!=null&&i.init||(window.react_gtm_ts={debug:e,performance:n},n?(document.addEventListener("scroll",()=>{r(t)}),document.addEventListener("mousemove",()=>{r(t)}),document.addEventListener("touchstart",()=>{r(t)})):r(t))},r=t=>{var a;if(typeof window>"u"||(a=window==null?void 0:window.react_gtm_ts)!=null&&a.init)return;window.react_gtm_ts.init=!0;let e=document.createElement("script"),n=`(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','${t}');`;e.innerHTML=n;let i=document.createElement("noscript"),o=`<iframe src="https://www.googletagmanager.com/ns.html?id=${t}" height="0" width="0" style="display:none;visibility:hidden"></iframe>`;i.innerHTML=o,document.head.insertBefore(e,document.head.childNodes[0]),document.body.insertBefore(i,document.body.childNodes[0]),window.react_gtm_ts.debug&&console.log(`\u{1F7E2} react-gtm-ts - init - ${t}`)};var c=({event:t,...e})=>{var n,i;typeof((n=window==null?void 0:window.dataLayer)==null?void 0:n.push)<"u"?(window.dataLayer.push({event:t,...e}),(i=window==null?void 0:window.react_gtm_ts)!=null&&i.debug&&console.log("\u{1F7E2} react-gtm-ts - action - ",{event:t,...e})):console.error("\u{1F6D1} react-gtm-ts - Add ReactTagManager.init passing GTM code in app or _app (nextjs), see more in the documentation https://github.com/jr-duarte/react-gtm-ts")};var m={init:d,action:c};0&&(module.exports={ReactTagManager}); | ||
"use strict";var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var w=(t,e)=>{for(var n in e)s(t,n,{get:e[n],enumerable:!0})},u=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of l(e))!p.call(t,o)&&o!==n&&s(t,o,{get:()=>e[o],enumerable:!(i=g(e,o))||i.enumerable});return t};var f=t=>u(s({},"__esModule",{value:!0}),t);var h={};w(h,{ReactTagManager:()=>m});module.exports=f(h);var d=({code:t,debug:e=!1,performance:n=!1})=>{var i;typeof window>"u"||(i=window==null?void 0:window.react_gtm_ts)!=null&&i.init||(window.react_gtm_ts={debug:e,performance:n},n?(document.addEventListener("scroll",()=>{r(t)}),document.addEventListener("mousemove",()=>{r(t)}),document.addEventListener("touchstart",()=>{r(t)})):r(t))},r=t=>{var a;if(typeof window>"u"||(a=window==null?void 0:window.react_gtm_ts)!=null&&a.init)return;window.react_gtm_ts.init=!0;let e=document.createElement("script"),n=`(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','${t}');`;e.innerHTML=n;let i=document.createElement("noscript"),o=`<iframe src="https://www.googletagmanager.com/ns.html?id=${t}" | ||
height="0" width="0" style="display:none;visibility:hidden"></iframe>`;i.innerHTML=o,document.head.insertBefore(e,document.head.childNodes[0]),document.body.insertBefore(i,document.body.childNodes[0]),window.react_gtm_ts.debug&&console.log(`\u{1F7E2} react-gtm-ts - init - ${t}`)};var c=({event:t,...e})=>{var n,i;typeof((n=window==null?void 0:window.dataLayer)==null?void 0:n.push)<"u"?(window.dataLayer.push({event:t,...e}),(i=window==null?void 0:window.react_gtm_ts)!=null&&i.debug&&console.log("\u{1F7E2} react-gtm-ts - action - ",{event:t,...e})):console.error("\u{1F6D1} react-gtm-ts - Add ReactTagManager.init passing GTM code in app or _app (nextjs), see more in the documentation https://github.com/jr-duarte/react-gtm-ts")};var m={init:d,action:c};0&&(module.exports={ReactTagManager}); |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "1.0.44", | ||
"version": "1.0.45", | ||
"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
7128
33