@shopgate/tracking-core 7.30.0-alpha.7 → 7.30.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/AppHandler.js +121 -19
- package/core/Core.js +337 -82
- package/helpers/events.js +46 -7
- package/helpers/formatHelpers.js +324 -49
- package/helpers/helper.js +247 -36
- package/helpers/optOut.js +114 -13
- package/helpers/urlMapping.js +110 -14
- package/package.json +3 -3
- package/plugins/Base.js +94 -17
- package/plugins/trackers/FbPixel.js +186 -17
- package/plugins/trackers/GaBase.js +250 -31
- package/plugins/trackers/GaClassic.js +93 -13
- package/plugins/trackers/GaUniversal.js +162 -16
- package/plugins/trackers/Unified.js +67 -11
- package/typedef.js +51 -17
package/core/Core.js
CHANGED
|
@@ -1,87 +1,229 @@
|
|
|
1
|
-
|
|
1
|
+
import { logger } from '@shopgate/pwa-core/helpers';
|
|
2
|
+
import errorManager from '@shopgate/pwa-core/classes/ErrorManager';
|
|
3
|
+
import { SOURCE_TRACKING, CODE_TRACKING } from '@shopgate/pwa-core/constants/ErrorManager';
|
|
4
|
+
import { optOut, isOptOut } from "../helpers/optOut";
|
|
5
|
+
import trackingEvents, { REMOVE_TRACKER, ADD_TRACKER, scannerEvents } from "../helpers/events";
|
|
6
|
+
|
|
7
|
+
/**
|
|
2
8
|
* Core for our tracking system. Plugins can use the core to register for events. Pub/sub pattern.
|
|
3
|
-
*/
|
|
9
|
+
*/
|
|
10
|
+
class Core {
|
|
11
|
+
/**
|
|
4
12
|
* Constructor
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
window.
|
|
39
|
-
|
|
40
|
-
|
|
13
|
+
*/
|
|
14
|
+
constructor() {
|
|
15
|
+
/**
|
|
16
|
+
* Check if the opt-out state is set
|
|
17
|
+
*
|
|
18
|
+
* @returns {boolean} Information about the opt out state
|
|
19
|
+
*/
|
|
20
|
+
this.isOptOut = () => isOptOut();
|
|
21
|
+
/**
|
|
22
|
+
* Returns scanner (adscanner and QR) event action constants.
|
|
23
|
+
*
|
|
24
|
+
* @returns {Object} Scanner events
|
|
25
|
+
*/
|
|
26
|
+
this.getScannerEvents = () => scannerEvents;
|
|
27
|
+
/**
|
|
28
|
+
* Helper function to create ad scanner opt_label from pageTitle and pageId
|
|
29
|
+
*
|
|
30
|
+
* @param {string} pageTitle Name of the Page
|
|
31
|
+
* @param {string} id ID of the ad
|
|
32
|
+
* @returns {string} String from pageTitle and pageId
|
|
33
|
+
*/
|
|
34
|
+
this.buildAdImageIdentifierName = (pageTitle, id) => {
|
|
35
|
+
const name = pageTitle ? `${pageTitle} ` : '';
|
|
36
|
+
return `${name}(id: ${id})`;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* This function will handle the cross domain tracking, depending on which sdks are there
|
|
40
|
+
* @param {string} originalUrl url of the link
|
|
41
|
+
* @param {HTMLFormElement} [formElement] Form element if we do a POST
|
|
42
|
+
* @returns {boolean|string} Tells if the function executed the steps that are necessary
|
|
43
|
+
* for domain transitions via tracking plugins. In a sg cloud app it returns the new url.
|
|
44
|
+
*/
|
|
45
|
+
this.crossDomainTracking = (originalUrl, formElement) => {
|
|
46
|
+
if (window.sgData && window.sgData.device.access === 'App') {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
let newUrl = originalUrl;
|
|
50
|
+
|
|
51
|
+
// Add econda params
|
|
52
|
+
if (typeof window.getEmosCrossUrlParams === 'function') {
|
|
53
|
+
newUrl += (!newUrl.includes('?') ? '?' : '&') + window.getEmosCrossUrlParams();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// If there is no sgData, we are in sg cloud app and have to return the new url
|
|
57
|
+
if (!window.sgData) {
|
|
58
|
+
return newUrl;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Universal
|
|
62
|
+
try {
|
|
63
|
+
window.ga(() => {
|
|
64
|
+
const tracker = window.ga.getByName('shopgate');
|
|
65
|
+
const linker = new window.gaplugins.Linker(tracker);
|
|
66
|
+
// Add ?_ga parameter to the url
|
|
67
|
+
newUrl = linker.decorate(newUrl);
|
|
68
|
+
});
|
|
69
|
+
} catch (e) {
|
|
70
|
+
// Ignore errors
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Check if there is the classic sdk
|
|
74
|
+
if (typeof _gaq === 'undefined') {
|
|
75
|
+
// No classic sdk
|
|
76
|
+
|
|
77
|
+
if (formElement) {
|
|
78
|
+
/**
|
|
79
|
+
* The no-param-reassign rule is deactivated on purpose,
|
|
80
|
+
* since the form action has to be replaced in this situation
|
|
81
|
+
*/
|
|
82
|
+
// eslint-disable-next-line no-param-reassign
|
|
83
|
+
formElement.action = newUrl;
|
|
84
|
+
} else {
|
|
85
|
+
window.location.href = newUrl;
|
|
86
|
+
}
|
|
87
|
+
} else if (formElement) {
|
|
88
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
89
|
+
window._gaq.push(['merchant_._linkByPost', formElement]);
|
|
90
|
+
} else {
|
|
91
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
92
|
+
window._gaq.push(['merchant_._link', newUrl]);
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
};
|
|
96
|
+
// Store for the registered events
|
|
97
|
+
this.events = {};
|
|
98
|
+
|
|
99
|
+
// Store for all triggered events
|
|
100
|
+
this.triggeredEvents = [];
|
|
101
|
+
this.registerFinish = false;
|
|
102
|
+
|
|
103
|
+
/**
|
|
41
104
|
* Storage for functions to register tracking event callbacks
|
|
42
105
|
* @type {Object}
|
|
43
|
-
*/
|
|
44
|
-
|
|
106
|
+
*/
|
|
107
|
+
this.register = {};
|
|
108
|
+
|
|
109
|
+
// Create the register functions for every available event
|
|
110
|
+
trackingEvents.forEach(event => {
|
|
111
|
+
/**
|
|
45
112
|
* Register for event
|
|
46
113
|
* @param {Function} callback Function that is called if the event occurs
|
|
47
114
|
* @param {Object} options Additional options
|
|
48
115
|
* @returns {RemoveListener} Function to remove the listener
|
|
49
|
-
*/
|
|
116
|
+
*/
|
|
117
|
+
this.register[event] = (callback, options) => this.registerHelper(callback, event, options);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
/**
|
|
50
121
|
* Storage for functions that trigger tracking events
|
|
51
122
|
* @type {Object}
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
|
|
123
|
+
*/
|
|
124
|
+
this.track = {};
|
|
125
|
+
|
|
126
|
+
// Create the track functions for every available event
|
|
127
|
+
trackingEvents.forEach(event => {
|
|
128
|
+
// Don't create track functions for those events
|
|
129
|
+
if ([REMOVE_TRACKER, ADD_TRACKER].indexOf(event) !== -1) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
55
134
|
* Track event
|
|
56
135
|
* @param {Object} rawData Raw data from sgData Object
|
|
57
136
|
* @param {string} [page] Identifier of the page
|
|
58
137
|
* @param {Object} [scope] Scope for the event
|
|
59
138
|
* @param {Object} [state] The redux state
|
|
60
139
|
* @returns {Core} Instance of Core
|
|
61
|
-
*/
|
|
140
|
+
*/
|
|
141
|
+
this.track[event] = (rawData, page, scope, state) => this.notifyPlugins({
|
|
142
|
+
...rawData
|
|
143
|
+
}, event, page, scope, state);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
62
148
|
* Returns and creates event store if needed
|
|
63
149
|
*
|
|
64
150
|
* @param {string} eventName Name of the event
|
|
65
151
|
* @param {string} [page] Identifier of the page
|
|
66
152
|
* @returns {Object} The event store for the given eventName and page
|
|
67
|
-
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
153
|
+
*/
|
|
154
|
+
getEventStore(eventName, page) {
|
|
155
|
+
if (!this.events.hasOwnProperty(eventName)) {
|
|
156
|
+
// Create a new event store entry for the current event name, if no one is already present
|
|
157
|
+
this.events[eventName] = {
|
|
158
|
+
// Events for every page
|
|
159
|
+
global: [],
|
|
160
|
+
// Events only for specific pages
|
|
161
|
+
specific: {}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Get the global events for the current event name
|
|
166
|
+
let eventStore = this.events[eventName].global;
|
|
167
|
+
if (page) {
|
|
168
|
+
// A page name was provided, which means that we have to use the page specific sub store
|
|
169
|
+
eventStore = this.events[eventName].specific;
|
|
170
|
+
if (!eventStore.hasOwnProperty(page)) {
|
|
171
|
+
// There is no entry for the current page, so we initialize it
|
|
172
|
+
eventStore[page] = [];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Prepare the specific event store for the provided page as return value
|
|
176
|
+
eventStore = eventStore[page];
|
|
177
|
+
}
|
|
178
|
+
return eventStore;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
75
182
|
* Register a tracking event callback for a plugin
|
|
76
183
|
*
|
|
77
184
|
* @param {Function} callback Function that is called if the event occurs
|
|
78
185
|
* @param {string} eventName Name of the event
|
|
79
186
|
* @param {Object} options Additional options
|
|
80
187
|
* @returns {RemoveListener} Function to remove the listener
|
|
81
|
-
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
188
|
+
*/
|
|
189
|
+
registerHelper(callback, eventName, options = {}) {
|
|
190
|
+
const defaults = {
|
|
191
|
+
trackerName: '',
|
|
192
|
+
page: null,
|
|
193
|
+
merchant: true,
|
|
194
|
+
shopgate: true,
|
|
195
|
+
options: {}
|
|
196
|
+
};
|
|
197
|
+
const pluginOptions = {
|
|
198
|
+
...defaults,
|
|
199
|
+
...options
|
|
200
|
+
};
|
|
201
|
+
if (!pluginOptions.trackerName) {
|
|
202
|
+
logger.warn(`'SgTrackingCore': Attempt to register for event "${eventName}" by a nameless tracker`);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Get the correct store
|
|
206
|
+
const store = this.getEventStore(eventName, pluginOptions.page);
|
|
207
|
+
|
|
208
|
+
// Add the callback to queue
|
|
209
|
+
const index = store.push({
|
|
210
|
+
callback,
|
|
211
|
+
trackerName: pluginOptions.trackerName,
|
|
212
|
+
useNativeSdk: pluginOptions.options.useNativeSdk,
|
|
213
|
+
overrideUnified: pluginOptions.options.overrideUnified,
|
|
214
|
+
merchant: pluginOptions.merchant,
|
|
215
|
+
shopgate: pluginOptions.shopgate
|
|
216
|
+
}) - 1;
|
|
217
|
+
|
|
218
|
+
// Provide handle back for removal of event
|
|
219
|
+
return {
|
|
220
|
+
remove() {
|
|
221
|
+
delete store[index];
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
85
227
|
* Notify plugins helper
|
|
86
228
|
*
|
|
87
229
|
* @param {Object} rawData Object with tracking data for the event
|
|
@@ -90,24 +232,83 @@ return{remove:function remove(){delete store[index];}};}/**
|
|
|
90
232
|
* @param {Object} [scope] Scope of the event
|
|
91
233
|
* @param {Object} [state] The redux state
|
|
92
234
|
* @returns {void}
|
|
93
|
-
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
235
|
+
*/
|
|
236
|
+
notifyHelper(rawData, eventName, page, scope = {}, state) {
|
|
237
|
+
// Exit if the user opt out. But not for the explicit add or remove tracker events
|
|
238
|
+
if ([REMOVE_TRACKER, ADD_TRACKER].indexOf(eventName) === -1 && isOptOut()) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Default scope
|
|
243
|
+
const scopeOptions = {
|
|
244
|
+
shopgate: true,
|
|
245
|
+
merchant: true,
|
|
246
|
+
...scope
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// Get the global list of registered callbacks for the event name
|
|
250
|
+
const storeGlobal = this.getEventStore(eventName);
|
|
251
|
+
|
|
252
|
+
// Get the page specific list of registered callbacks
|
|
253
|
+
const storePage = page ? this.getEventStore(eventName, page) : [];
|
|
254
|
+
|
|
255
|
+
// Initialize the event payload
|
|
256
|
+
const eventData = typeof rawData !== 'undefined' ? rawData : {};
|
|
257
|
+
|
|
258
|
+
// Merge the global with the page specific callbacks
|
|
259
|
+
const combinedStorage = storeGlobal.concat(storePage);
|
|
260
|
+
const blacklist = [];
|
|
261
|
+
let useBlacklist = false;
|
|
262
|
+
|
|
263
|
+
/**
|
|
100
264
|
* Loop through the queue and check if there is a unified and other plugins.
|
|
101
265
|
* Registered callbacks of plugins not equal to the unified one, have to be added to a
|
|
102
266
|
* blacklist, so that the app does not propagate the unified data, but the custom one
|
|
103
267
|
* to the related trackers.
|
|
104
|
-
*/
|
|
105
|
-
|
|
106
|
-
if(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
268
|
+
*/
|
|
269
|
+
combinedStorage.forEach(entry => {
|
|
270
|
+
if (entry.trackerName !== 'unified' && entry.useNativeSdk) {
|
|
271
|
+
blacklist.push(entry.trackerName.slice(0));
|
|
272
|
+
} else {
|
|
273
|
+
// If there is a unified plugin registered for this event -> use the blacklist
|
|
274
|
+
useBlacklist = true;
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
// Only use the blacklist if it contains elements
|
|
279
|
+
if (useBlacklist) {
|
|
280
|
+
useBlacklist = !!blacklist.length;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// Cycle through events queue, fire!
|
|
284
|
+
combinedStorage.forEach(entry => {
|
|
285
|
+
// Merchant only command
|
|
286
|
+
if (scopeOptions.merchant && !scopeOptions.shopgate && !entry.merchant) {
|
|
287
|
+
return;
|
|
288
|
+
|
|
289
|
+
// Shopgate only command
|
|
290
|
+
}
|
|
291
|
+
if (!scopeOptions.merchant && scopeOptions.shopgate && !entry.shopgate) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
const params = [eventData, scopeOptions, undefined, state];
|
|
295
|
+
if (entry.trackerName === 'unified' && useBlacklist) {
|
|
296
|
+
// Pass the unifiedBlacklist to the plugin if the plugin is the unified one
|
|
297
|
+
params[2] = blacklist;
|
|
298
|
+
}
|
|
299
|
+
try {
|
|
300
|
+
entry.callback.apply(this, params);
|
|
301
|
+
} catch (err) {
|
|
302
|
+
logger.error(`'SgTrackingCore': Error in plugin [${entry.trackerName}]`, err);
|
|
303
|
+
err.code = CODE_TRACKING;
|
|
304
|
+
err.source = SOURCE_TRACKING;
|
|
305
|
+
err.context = entry.trackerName;
|
|
306
|
+
errorManager.queue(err);
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
111
312
|
* Notify plugins
|
|
112
313
|
*
|
|
113
314
|
* @param {Object} rawData Object with tracking data for the event
|
|
@@ -116,23 +317,77 @@ params[2]=blacklist;}try{entry.callback.apply(_this2,params);}catch(err){logger.
|
|
|
116
317
|
* @param {Object} [scope] Scope of the event
|
|
117
318
|
* @param {Object} [state] The redux state
|
|
118
319
|
* @returns {Core} Instance of the core instance
|
|
119
|
-
*/
|
|
120
|
-
|
|
121
|
-
|
|
320
|
+
*/
|
|
321
|
+
notifyPlugins(rawData, eventName, page, scope, state) {
|
|
322
|
+
// If registration is finished
|
|
323
|
+
if (this.registerFinish) {
|
|
324
|
+
this.notifyHelper(rawData, eventName, page, scope, state);
|
|
325
|
+
} else {
|
|
326
|
+
// Store the event if not
|
|
327
|
+
this.triggeredEvents.push({
|
|
328
|
+
function: this.notifyHelper,
|
|
329
|
+
params: [rawData, eventName, page, scope, state]
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
return this;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
122
336
|
* Opt out mechanism for all tracking tools
|
|
123
337
|
*
|
|
124
338
|
* @param {boolean} [optOutParam = true] If false -> revert the opt out (enable tracking)
|
|
125
339
|
* @returns {boolean|null} State which was set
|
|
126
|
-
*/
|
|
127
|
-
|
|
128
|
-
|
|
340
|
+
*/
|
|
341
|
+
optOut(optOutParam) {
|
|
342
|
+
let out = optOutParam;
|
|
343
|
+
if (typeof optOutParam === 'undefined') {
|
|
344
|
+
out = true;
|
|
345
|
+
}
|
|
346
|
+
if (out) {
|
|
347
|
+
// Notify Plugins about the removal.
|
|
348
|
+
this.notifyPlugins(null, REMOVE_TRACKER);
|
|
349
|
+
} else {
|
|
350
|
+
// Notify Plugins about the adding
|
|
351
|
+
this.notifyPlugins(null, ADD_TRACKER);
|
|
352
|
+
}
|
|
353
|
+
return optOut(out);
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
129
356
|
* Called from the outside when all plugins are registered
|
|
130
357
|
* @return {Core}
|
|
131
|
-
*/
|
|
132
|
-
|
|
133
|
-
this.
|
|
358
|
+
*/
|
|
359
|
+
registerFinished() {
|
|
360
|
+
if (this.registerFinish) {
|
|
361
|
+
return this;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// Trigger all events that happened till now
|
|
365
|
+
this.triggeredEvents.forEach(entry => {
|
|
366
|
+
entry.function.apply(this, entry.params);
|
|
367
|
+
});
|
|
368
|
+
this.registerFinish = true;
|
|
369
|
+
|
|
370
|
+
// Reset the event store
|
|
371
|
+
this.triggeredEvents = [];
|
|
372
|
+
return this;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
134
376
|
* Remove all registered callbacks. Only used and needed for unit tests
|
|
135
377
|
* @returns {Core}
|
|
136
|
-
*/
|
|
378
|
+
*/
|
|
379
|
+
reset() {
|
|
380
|
+
this.events = {};
|
|
381
|
+
this.triggeredEvents = [];
|
|
382
|
+
this.registerFinish = false;
|
|
383
|
+
return this;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
137
388
|
* Fix to prevent multiple instances of this class caused by two node_modules folders
|
|
138
|
-
*/
|
|
389
|
+
*/
|
|
390
|
+
if (!window.SgTrackingCore) {
|
|
391
|
+
window.SgTrackingCore = new Core();
|
|
392
|
+
}
|
|
393
|
+
export default window.SgTrackingCore;
|
package/helpers/events.js
CHANGED
|
@@ -1,8 +1,47 @@
|
|
|
1
1
|
// List of available tracking events
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
export const TRACK_PAGEVIEW = 'pageview';
|
|
3
|
+
export const TRACK_VARIANT_SELECTED = 'variantSelected';
|
|
4
|
+
export const TRACK_VIEW_CONTENT = 'viewContent';
|
|
5
|
+
export const TRACK_PURCHASE = 'purchase';
|
|
6
|
+
export const TRACK_ADD_TO_CART = 'addToCart';
|
|
7
|
+
export const TRACK_ADD_TO_WISHLIST = 'addToWishlist';
|
|
8
|
+
export const TRACK_INITIATED_CHECKOUT = 'initiatedCheckout';
|
|
9
|
+
export const TRACK_COMPLETED_REGISTRATION = 'completedRegistration';
|
|
10
|
+
export const TRACK_SEARCH = 'search';
|
|
11
|
+
export const TRACK_SCROLL_TOP = 'scrollTop';
|
|
12
|
+
export const TRACK_ADDED_PAYMENT_INFO = 'addedPaymentInfo';
|
|
13
|
+
export const TRACK_SELECTED_PAYMENT_INFO = 'selectedPaymentInfo';
|
|
14
|
+
export const TRACK_SMARTBANNER = 'smartbanner';
|
|
15
|
+
export const TRACK_FILTER_LIVE_SUGGEST = 'filterLiveSuggest';
|
|
16
|
+
export const TRACK_QR_SCANNER = 'qrScanner';
|
|
17
|
+
export const TRACK_AD_SCANNER = 'adScanner';
|
|
18
|
+
export const TRACK_CC_SCANNER = 'ccScanner';
|
|
19
|
+
export const TRACK_OPEN_DEEP_LINK = 'openDeepLink';
|
|
20
|
+
export const TRACK_OPEN_UNIVERSAL_LINK = 'openUniversalLink';
|
|
21
|
+
export const TRACK_OPEN_DEFERRED_DEEP_LINK = 'openDeferredDeepLink';
|
|
22
|
+
export const TRACK_OPEN_SMART_APP_DOWNLOAD_LINK = 'openSmartAppDownloadLink';
|
|
23
|
+
export const TRACK_OPEN_PUSH_NOTIFICATION = 'openPushNotification';
|
|
24
|
+
export const TRACK_APP_REVIEW_PROMPT = 'appReviewPrompt';
|
|
25
|
+
export const TRACK_SET_CAMPAIGN_WITH_URL = 'setCampaignWithUrl';
|
|
26
|
+
export const TRACK_LOGIN_SUCCESS = 'loginSuccess';
|
|
27
|
+
export const TRACK_LOGIN_FAILED = 'loginFailed';
|
|
28
|
+
export const TRACK_CUSTOM_EVENT = 'customEvent';
|
|
29
|
+
export const REMOVE_TRACKER = 'removeTracker';
|
|
30
|
+
export const ADD_TRACKER = 'addTracker';
|
|
31
|
+
export const COOKIE_CONSENT_UPDATED = 'cookieConsentUpdated';
|
|
32
|
+
export const scannerEvents = {
|
|
33
|
+
// Scan type is activated
|
|
34
|
+
SCAN_ACTIVATED: 'scan_activated',
|
|
35
|
+
// The actual scan stated (for QR scanner same as activated)
|
|
36
|
+
SCAN_STARTED: 'scan_started',
|
|
37
|
+
// Scanning process cancelled
|
|
38
|
+
SCAN_CANCELED: 'scan_canceled',
|
|
39
|
+
// Scan ended with success
|
|
40
|
+
SCAN_SUCCESS: 'scan_success',
|
|
41
|
+
// Scan ended with no result
|
|
42
|
+
SCAN_FAIL: 'scan_fail',
|
|
43
|
+
// User interact with scanning result (click on link)
|
|
44
|
+
SCAN_USER_LINK_INTERACTION: 'scan_user_link_interaction'
|
|
45
|
+
};
|
|
46
|
+
export const customEvents = [TRACK_SMARTBANNER, TRACK_FILTER_LIVE_SUGGEST, TRACK_QR_SCANNER, TRACK_AD_SCANNER, TRACK_CC_SCANNER, TRACK_SCROLL_TOP, TRACK_OPEN_DEEP_LINK, TRACK_OPEN_UNIVERSAL_LINK, TRACK_OPEN_DEFERRED_DEEP_LINK, TRACK_OPEN_SMART_APP_DOWNLOAD_LINK, TRACK_OPEN_PUSH_NOTIFICATION, TRACK_APP_REVIEW_PROMPT, TRACK_CUSTOM_EVENT];
|
|
47
|
+
export default [TRACK_PAGEVIEW, TRACK_VIEW_CONTENT, TRACK_VARIANT_SELECTED, TRACK_PURCHASE, TRACK_ADD_TO_CART, TRACK_ADD_TO_WISHLIST, TRACK_INITIATED_CHECKOUT, TRACK_COMPLETED_REGISTRATION, TRACK_SEARCH, TRACK_SCROLL_TOP, TRACK_ADDED_PAYMENT_INFO, TRACK_SELECTED_PAYMENT_INFO, TRACK_SMARTBANNER, TRACK_FILTER_LIVE_SUGGEST, TRACK_QR_SCANNER, TRACK_AD_SCANNER, TRACK_CC_SCANNER, TRACK_OPEN_DEEP_LINK, TRACK_OPEN_UNIVERSAL_LINK, TRACK_OPEN_DEFERRED_DEEP_LINK, TRACK_OPEN_SMART_APP_DOWNLOAD_LINK, TRACK_OPEN_PUSH_NOTIFICATION, TRACK_APP_REVIEW_PROMPT, TRACK_SET_CAMPAIGN_WITH_URL, REMOVE_TRACKER, ADD_TRACKER, TRACK_LOGIN_SUCCESS, TRACK_LOGIN_FAILED, TRACK_CUSTOM_EVENT, COOKIE_CONSENT_UPDATED];
|