@schibsted/niche-tracking
Advanced tools
Comparing version 4.6.8 to 4.6.9
@@ -41,3 +41,3 @@ import { eventTarget } from '@schibsted/niche-utils'; | ||
this._lastPageViewEventData[tracker.name] = trackerOptions; | ||
if (this._initialized) { | ||
if (this.initialized) { | ||
try { | ||
@@ -83,3 +83,3 @@ tracker.pageView(trackerOptions); | ||
const eventArgs = hasOptions ? trackerOptions : [trackerOptions]; | ||
if (this._initialized) { | ||
if (this.initialized) { | ||
try { | ||
@@ -122,3 +122,3 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
const eventArgs = hasOptions ? trackerOptions : [trackerOptions]; | ||
if (this._initialized) { | ||
if (this.initialized) { | ||
try { | ||
@@ -142,7 +142,7 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
this.initialize = ({ userId, experiments }) => { | ||
if (this._initialized) { | ||
if (this.initialized) { | ||
throw new Error('Already initialized'); | ||
} | ||
if (!this._enabled) { | ||
this._initialized = true; | ||
this.initialized = true; | ||
return Promise.resolve(); | ||
@@ -181,3 +181,3 @@ } | ||
} | ||
if (this._initialized) { | ||
if (this.initialized) { | ||
this._pageLeaveTrackingActive = { | ||
@@ -220,3 +220,3 @@ type, | ||
this._pageLeaveQueue = null; | ||
if (this._initialized) { | ||
if (this.initialized) { | ||
this._trackers | ||
@@ -260,3 +260,3 @@ .filter((tracker) => tracker.trackActivePageLeave) | ||
var _a; | ||
if (this._initialized) { | ||
if (this.initialized) { | ||
try { | ||
@@ -263,0 +263,0 @@ (_a = tracker.setUserId) === null || _a === void 0 ? void 0 : _a.call(tracker, userId); |
{ | ||
"name": "@schibsted/niche-tracking", | ||
"version": "4.6.8", | ||
"version": "4.6.9", | ||
"description": "Package containing tracking logic reused between multiple Schibsted niche sites", | ||
@@ -26,3 +26,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "14eeb683631c309d243151af24e55eda749a54ad" | ||
"gitHead": "3ec7a2376961132c7bca25adaa397e72a3f8cc32" | ||
} |
@@ -101,3 +101,3 @@ import { eventTarget } from '@schibsted/niche-utils'; | ||
this._lastPageViewEventData[tracker.name] = trackerOptions; | ||
if (this._initialized) { | ||
if (this.initialized) { | ||
try { | ||
@@ -145,3 +145,3 @@ tracker.pageView(trackerOptions); | ||
if (this._initialized) { | ||
if (this.initialized) { | ||
try { | ||
@@ -183,3 +183,3 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
if (this._initialized) { | ||
if (this.initialized) { | ||
try { | ||
@@ -202,3 +202,3 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
initialize = ({ userId, experiments }: { userId: number | undefined; experiments: Experiment[] }) => { | ||
if (this._initialized) { | ||
if (this.initialized) { | ||
throw new Error('Already initialized'); | ||
@@ -208,3 +208,3 @@ } | ||
if (!this._enabled) { | ||
this._initialized = true; | ||
this.initialized = true; | ||
@@ -256,3 +256,3 @@ return Promise.resolve(); | ||
this._trackers.forEach((tracker) => { | ||
if (this._initialized) { | ||
if (this.initialized) { | ||
try { | ||
@@ -278,3 +278,3 @@ tracker.setUserId?.(userId); | ||
if (this._initialized) { | ||
if (this.initialized) { | ||
this._pageLeaveTrackingActive = { | ||
@@ -316,3 +316,3 @@ type, | ||
if (this._initialized) { | ||
if (this.initialized) { | ||
this._trackers | ||
@@ -319,0 +319,0 @@ .filter((tracker) => tracker.trackActivePageLeave) |
69236