New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-gtm-ts

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-gtm-ts - npm Package Compare versions

Comparing version 1.0.20 to 1.0.21

5

dist/index.d.ts
declare const ReactTagManager: {
init: (GTMCode: string) => void;
init: ({ code, debug }: {
code: string;
debug: boolean;
}) => void;
action: ({ event, ...more }: {

@@ -4,0 +7,0 @@ [key: string]: string;

18

dist/index.js

@@ -28,13 +28,17 @@ "use strict";

// src/features/init/index.ts
var init = (GTMCode) => {
var init = ({ code, debug = false }) => {
if (typeof window === "undefined")
return;
const elScript = document.createElement("script");
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','${GTMCode}');`;
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}');`;
elScript.innerHTML = script;
const elNoscript = document.createElement("noscript");
const noscript = `<iframe src="https://www.googletagmanager.com/ns.html?id=${GTMCode}" height="0" width="0" style="display:none;visibility:hidden"></iframe>`;
const noscript = `<iframe src="https://www.googletagmanager.com/ns.html?id=${code}" height="0" width="0" style="display:none;visibility:hidden"></iframe>`;
elNoscript.innerHTML = noscript;
document.head.insertBefore(elScript, document.head.childNodes[0]);
document.body.insertBefore(elNoscript, document.body.childNodes[0]);
if (debug) {
console.log(`\u{1F7E2} react-gtm-ts - init - ${code}`);
window.react_gtm_ts.debug = true;
}
};

@@ -44,3 +48,3 @@

var action = ({ event, ...more }) => {
var _a;
var _a, _b;
if (typeof ((_a = window == null ? void 0 : window.dataLayer) == null ? void 0 : _a.push) !== "undefined") {

@@ -51,2 +55,8 @@ window.dataLayer.push({

});
if ((_b = window == null ? void 0 : window.react_gtm_ts) == null ? void 0 : _b.debug) {
console.log("\u{1F7E2} react-gtm-ts - action", {
event,
...more
});
}
} else {

@@ -53,0 +63,0 @@ console.error(

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "1.0.20",
"version": "1.0.21",
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc