Skip to content

Commit

Permalink
fix(configuration): make targetProperty a function
Browse files Browse the repository at this point in the history
  • Loading branch information
emkis committed Jun 1, 2022
1 parent eb2b816 commit c832bc9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .api-report/gtm-event-tracker.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type EventProperties = Record<string, string | number>;

// @public
export type EventsConfigurations = {
targetProperty: EventProperties[];
targetProperty: () => EventProperties[];
};

// @public
Expand Down
2 changes: 1 addition & 1 deletion src/configuration/configuration-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type LoggerConfigurations = {
* @public
*/
export type EventsConfigurations = {
targetProperty: EventProperties[]
targetProperty: () => EventProperties[]
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function createConfiguration() {
debugContext: false,
},
events: {
targetProperty: window.dataLayer,
targetProperty: () => window.dataLayer,
},
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/shared/data-layer/data-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function createDataLayer(options: DataLayerOptions = {}): DataLayer {

function getTargetProperty() {
const configurations = getConfiguration()
return configurations.events.targetProperty
return configurations.events.targetProperty()
}

function addEvent(payload: EventProperties) {
Expand Down

0 comments on commit c832bc9

Please sign in to comment.