Huge News!Announcing our $40M Series B led by Abstract Ventures.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.2.4 to 1.3.0

21

dist/gtm-event-tracker-beta.d.ts

@@ -8,2 +8,3 @@ /**

* @param initialProps - Properties witch will initialize the context.
* @param options - Options for customizing the Tracker Context.
* @public

@@ -17,3 +18,3 @@ * @example

*/
export declare function createTrackerContext(initialProps?: EventProperties): TrackerContext;
export declare function createTrackerContext(initialProps?: EventProperties, options?: TrackerContextOptions): TrackerContext;

@@ -51,2 +52,20 @@ /**

/**
* Options for customizing the Tracker Context.
* @public
*/
export declare type TrackerContextOptions = {
/**
* Will log every interaction with this context, such as:
* Context creation, Context updated, and Triggered events.
*/
debug?: boolean;
/**
* The name for this context.
*
* It can be helpful when you are using the Logger and your application has more than one context.
*/
name?: string;
};
/**
* Functions responsible for triggering track events.

@@ -53,0 +72,0 @@ * @public

@@ -8,2 +8,3 @@ /**

* @param initialProps - Properties witch will initialize the context.
* @param options - Options for customizing the Tracker Context.
* @public

@@ -17,3 +18,3 @@ * @example

*/
export declare function createTrackerContext(initialProps?: EventProperties): TrackerContext;
export declare function createTrackerContext(initialProps?: EventProperties, options?: TrackerContextOptions): TrackerContext;

@@ -51,2 +52,20 @@ /**

/**
* Options for customizing the Tracker Context.
* @public
*/
export declare type TrackerContextOptions = {
/**
* Will log every interaction with this context, such as:
* Context creation, Context updated, and Triggered events.
*/
debug?: boolean;
/**
* The name for this context.
*
* It can be helpful when you are using the Logger and your application has more than one context.
*/
name?: string;
};
/**
* Functions responsible for triggering track events.

@@ -53,0 +72,0 @@ * @public

@@ -8,2 +8,3 @@ /**

* @param initialProps - Properties witch will initialize the context.
* @param options - Options for customizing the Tracker Context.
* @public

@@ -17,3 +18,3 @@ * @example

*/
export declare function createTrackerContext(initialProps?: EventProperties): TrackerContext;
export declare function createTrackerContext(initialProps?: EventProperties, options?: TrackerContextOptions): TrackerContext;

@@ -51,2 +52,20 @@ /**

/**
* Options for customizing the Tracker Context.
* @public
*/
export declare type TrackerContextOptions = {
/**
* Will log every interaction with this context, such as:
* Context creation, Context updated, and Triggered events.
*/
debug?: boolean;
/**
* The name for this context.
*
* It can be helpful when you are using the Logger and your application has more than one context.
*/
name?: string;
};
/**
* Functions responsible for triggering track events.

@@ -53,0 +72,0 @@ * @public

2

dist/index.d.ts

@@ -1,3 +0,3 @@

export { createTrackerContext, TrackerContext } from './tracker-context';
export { createTrackerContext, TrackerContext, TrackerContextOptions, } from './tracker-context';
export { withTrackerContext, TrackModule, SubtractEventProperties, } from './with-tracker';
export type { EventProperties } from './data-layer';
export { createTrackerContext } from './tracker-context';
export type { TrackerContext } from './tracker-context-types';
export type { TrackerContext, TrackerContextOptions, } from './tracker-context-types';
import type { EventProperties } from '../data-layer';
/**
* Options for customizing the Tracker Context.
* @public
*/
export declare type TrackerContextOptions = {
/**
* Will log every interaction with this context, such as:
* Context creation, Context updated, and Triggered events.
*/
debug?: boolean;
/**
* The name for this context.
*
* It can be helpful when you are using the Logger and your application has more than one context.
*/
name?: string;
};
/**
* Tracker context scope.

@@ -4,0 +21,0 @@ * @public

import type { EventProperties } from '../data-layer';
import type { TrackerContext } from './tracker-context-types';
import type { TrackerContext, TrackerContextOptions } from './tracker-context-types';
/**

@@ -10,2 +10,3 @@ * Creates a context for track events.

* @param initialProps - Properties witch will initialize the context.
* @param options - Options for customizing the Tracker Context.
* @public

@@ -19,2 +20,2 @@ * @example

*/
export declare function createTrackerContext(initialProps?: EventProperties): TrackerContext;
export declare function createTrackerContext(initialProps?: EventProperties, options?: TrackerContextOptions): TrackerContext;

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

* @param initialProps - Properties witch will initialize the context.
* @param options - Options for customizing the Tracker Context.
* @public

@@ -20,4 +21,7 @@ * @example

*/
function createTrackerContext(initialProps = {}) {
const context = { value: { ...initialProps } };
function createTrackerContext(initialProps = {}, options = {}) {
const context = {
options,
value: { ...initialProps },
};
function setProps(props) {

@@ -24,0 +28,0 @@ context.value = { ...props };

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

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

@@ -8,0 +8,0 @@ "keywords": [

@@ -1,3 +0,8 @@

export { createTrackerContext, TrackerContext } from './tracker-context'
export {
createTrackerContext,
TrackerContext,
TrackerContextOptions,
} from './tracker-context'
export {
withTrackerContext,

@@ -7,2 +12,3 @@ TrackModule,

} from './with-tracker'
export type { EventProperties } from './data-layer'
export { createTrackerContext } from './tracker-context'
export type { TrackerContext } from './tracker-context-types'
export type {
TrackerContext,
TrackerContextOptions,
} from './tracker-context-types'
import type { EventProperties } from '../data-layer'
/**
* Options for customizing the Tracker Context.
* @public
*/
export type TrackerContextOptions = {
/**
* Will log every interaction with this context, such as:
* Context creation, Context updated, and Triggered events.
*/
debug?: boolean
/**
* The name for this context.
*
* It can be helpful when you are using the Logger and your application has more than one context.
*/
name?: string
}
/**
* Tracker context scope.

@@ -12,3 +31,6 @@ * @public

*/
context: { readonly value: EventProperties }
context: {
readonly value: EventProperties
readonly options: TrackerContextOptions
}

@@ -15,0 +37,0 @@ /**

import { createTrackerContext } from './tracker-context'
import { TrackerContextOptions } from './tracker-context-types'

@@ -13,5 +14,19 @@ it('should create context without error', () => {

it('should initialize context with expected properties', () => {
it('should create context with correct defaults', () => {
const trackContext = createTrackerContext()
const emptyObject = {}
expect(trackContext).toStrictEqual({
context: {
value: emptyObject,
options: emptyObject,
},
setProps: expect.any(Function),
})
})
it('should create context with expected properties', () => {
const contextProperties = { appName: 'sit-dolor', hi: 'bye' }
const trackContext = createTrackerContext(contextProperties)
const contextOptions: TrackerContextOptions = { name: 'lorem ipsum' }
const trackContext = createTrackerContext(contextProperties, contextOptions)

@@ -21,2 +36,3 @@ expect(trackContext).toStrictEqual({

value: contextProperties,
options: contextOptions,
},

@@ -34,3 +50,4 @@ setProps: expect.any(Function),

trackContext.setProps(updatedContextProps)
expect(initialContextProps).not.toEqual(updatedContextProps)
expect(trackContext.context.value).toStrictEqual(updatedContextProps)
})
import type { EventProperties } from '../data-layer'
import type { TrackerContext } from './tracker-context-types'
import type {
TrackerContext,
TrackerContextOptions,
} from './tracker-context-types'

@@ -11,2 +14,3 @@ /**

* @param initialProps - Properties witch will initialize the context.
* @param options - Options for customizing the Tracker Context.
* @public

@@ -21,5 +25,9 @@ * @example

export function createTrackerContext(
initialProps: EventProperties = {}
initialProps: EventProperties = {},
options: TrackerContextOptions = {}
): TrackerContext {
const context = { value: { ...initialProps } }
const context = {
options,
value: { ...initialProps },
}

@@ -26,0 +34,0 @@ function setProps(props: EventProperties) {

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