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

gtm-event-tracker

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gtm-event-tracker - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

dist/tracker-context/tracker-context-logs.d.ts

28

dist/tracker-context/tracker-context.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createTrackerContext = void 0;
const tracker_context_logs_1 = require("./tracker-context-logs");
/**

@@ -22,11 +23,32 @@ * Creates a context for track events.

const context = {
options,
options: { ...options },
value: { ...initialProps },
};
function getProps() {
return context.value;
}
function setProps(props) {
context.value = { ...props };
const updatedProps = { ...props };
context.value = updatedProps;
}
return { context, setProps };
function handleSetProps(props) {
const currentProps = getProps();
const newPropsCopy = { ...props };
(0, tracker_context_logs_1.logContextUpdated)({
contextName: context.options.name,
currentProps: currentProps,
newProps: newPropsCopy,
});
setProps(newPropsCopy);
}
(0, tracker_context_logs_1.logContextCreated)({
contextName: context.options.name,
properties: getProps(),
});
return {
context,
setProps: handleSetProps,
};
}
exports.createTrackerContext = createTrackerContext;
//# sourceMappingURL=tracker-context.js.map

5

dist/with-tracker/with-tracker.js

@@ -5,2 +5,3 @@ "use strict";

const data_layer_1 = require("../data-layer");
const with_tracker_logs_1 = require("./with-tracker-logs");
/**

@@ -30,4 +31,6 @@ * Accepts a context object returned from `createTrackerContext` function,

function trackEvent(eventProps) {
const eventProperties = { ...context.value, ...eventProps };
data_layer_1.dataLayer.assertIsAvailable();
data_layer_1.dataLayer.addEvent({ ...context.value, ...eventProps });
data_layer_1.dataLayer.addEvent(eventProperties);
(0, with_tracker_logs_1.logEvent)(eventProperties);
}

@@ -34,0 +37,0 @@ function setRepeatedProps(defaultProps) {

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

"license": "MIT",
"version": "1.4.0",
"version": "1.5.0",
"description": "A type-safe, reusable, and flexible way for triggering Google Tag Manager track events.",

@@ -18,4 +18,3 @@ "keywords": [

"files": [
"dist",
"src"
"/dist"
],

@@ -28,3 +27,3 @@ "scripts": {

"build:ts": "tsc --project tsconfig.build.json",
"lint": "eslint src --ext js,ts --fix",
"lint": "eslint . --ext js,ts --fix",
"test": "npm-run-all test:unit test:api-report",

@@ -31,0 +30,0 @@ "test:unit": "jest",

Sorry, the diff of this file is not supported yet

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