@mparticle/web-google-tag-manager-kit 2.3.0 → 3.2.0
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/dist/GoogleTagManager-Kit.common.js +122 -107
- package/package.json +46 -44
|
@@ -32,7 +32,7 @@ function ConsentHandler(common) {
|
|
|
32
32
|
this.common = common || {};
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
ConsentHandler.prototype.getUserConsentState = function
|
|
35
|
+
ConsentHandler.prototype.getUserConsentState = function() {
|
|
36
36
|
var userConsentState = {};
|
|
37
37
|
|
|
38
38
|
if (mParticle.Identity && mParticle.Identity.getCurrentUser) {
|
|
@@ -42,8 +42,7 @@ ConsentHandler.prototype.getUserConsentState = function () {
|
|
|
42
42
|
return {};
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
var consentState =
|
|
46
|
-
mParticle.Identity.getCurrentUser().getConsentState();
|
|
45
|
+
var consentState = mParticle.Identity.getCurrentUser().getConsentState();
|
|
47
46
|
|
|
48
47
|
if (consentState && consentState.getGDPRConsentState) {
|
|
49
48
|
userConsentState = consentState.getGDPRConsentState();
|
|
@@ -53,7 +52,7 @@ ConsentHandler.prototype.getUserConsentState = function () {
|
|
|
53
52
|
return userConsentState;
|
|
54
53
|
};
|
|
55
54
|
|
|
56
|
-
ConsentHandler.prototype.getConsentSettings = function
|
|
55
|
+
ConsentHandler.prototype.getConsentSettings = function() {
|
|
57
56
|
var consentSettings = {};
|
|
58
57
|
|
|
59
58
|
var googleToMpConsentSettingsMapping = {
|
|
@@ -68,7 +67,7 @@ ConsentHandler.prototype.getConsentSettings = function () {
|
|
|
68
67
|
|
|
69
68
|
var settings = this.common.settings;
|
|
70
69
|
|
|
71
|
-
Object.keys(googleToMpConsentSettingsMapping).forEach(function
|
|
70
|
+
Object.keys(googleToMpConsentSettingsMapping).forEach(function(
|
|
72
71
|
googleConsentKey
|
|
73
72
|
) {
|
|
74
73
|
var mpConsentSettingKey =
|
|
@@ -84,7 +83,7 @@ ConsentHandler.prototype.getConsentSettings = function () {
|
|
|
84
83
|
return consentSettings;
|
|
85
84
|
};
|
|
86
85
|
|
|
87
|
-
ConsentHandler.prototype.generateConsentStatePayloadFromMappings = function
|
|
86
|
+
ConsentHandler.prototype.generateConsentStatePayloadFromMappings = function(
|
|
88
87
|
consentState,
|
|
89
88
|
mappings
|
|
90
89
|
) {
|
|
@@ -191,7 +190,7 @@ Common.prototype.buildConsentObject = function(event) {
|
|
|
191
190
|
}
|
|
192
191
|
|
|
193
192
|
return {
|
|
194
|
-
gdpr: gdpr
|
|
193
|
+
gdpr: gdpr,
|
|
195
194
|
};
|
|
196
195
|
};
|
|
197
196
|
|
|
@@ -208,13 +207,13 @@ Common.prototype.send = function(_attributes) {
|
|
|
208
207
|
mpid: this.buildMPID(event, user),
|
|
209
208
|
consent_state: this.buildConsentObject(event),
|
|
210
209
|
attributes: this.buildUserAttributes(event, user),
|
|
211
|
-
identities: this.buildUserIdentities(event, user)
|
|
210
|
+
identities: this.buildUserIdentities(event, user),
|
|
212
211
|
};
|
|
213
212
|
|
|
214
213
|
var mpEvent = {
|
|
215
214
|
name: eventName,
|
|
216
215
|
type: attributes.eventType || 'custom_event',
|
|
217
|
-
attributes: event.EventAttributes || {}
|
|
216
|
+
attributes: event.EventAttributes || {},
|
|
218
217
|
};
|
|
219
218
|
|
|
220
219
|
payload.event = eventName;
|
|
@@ -223,7 +222,7 @@ Common.prototype.send = function(_attributes) {
|
|
|
223
222
|
device_application_stamp:
|
|
224
223
|
event.DeviceId || mParticle.getDeviceId() || '',
|
|
225
224
|
user: mpUser,
|
|
226
|
-
event: mpEvent
|
|
225
|
+
event: mpEvent,
|
|
227
226
|
};
|
|
228
227
|
|
|
229
228
|
payload.mp_data = mpData;
|
|
@@ -239,7 +238,7 @@ Common.prototype.send = function(_attributes) {
|
|
|
239
238
|
window[this.customDataLayerName].push(payload);
|
|
240
239
|
};
|
|
241
240
|
|
|
242
|
-
Common.prototype.sendConsent = function
|
|
241
|
+
Common.prototype.sendConsent = function(type, payload) {
|
|
243
242
|
// Google Tag Manager doesn't directly use the gtag function
|
|
244
243
|
// but recommends pushing directly into the dataLayer
|
|
245
244
|
// https://developers.google.com/tag-manager/devguide
|
|
@@ -251,26 +250,25 @@ Common.prototype.sendConsent = function (type, payload) {
|
|
|
251
250
|
customDataLayer('consent', type, payload);
|
|
252
251
|
};
|
|
253
252
|
|
|
254
|
-
Common.prototype.getEventConsentState = function
|
|
253
|
+
Common.prototype.getEventConsentState = function(eventConsentState) {
|
|
255
254
|
return eventConsentState && eventConsentState.getGDPRConsentState
|
|
256
255
|
? eventConsentState.getGDPRConsentState()
|
|
257
256
|
: {};
|
|
258
257
|
};
|
|
259
258
|
|
|
260
|
-
Common.prototype.maybeSendConsentUpdateToGoogle = function
|
|
259
|
+
Common.prototype.maybeSendConsentUpdateToGoogle = function(consentState) {
|
|
261
260
|
// If consent payload is empty,
|
|
262
261
|
// we never sent an initial default consent state
|
|
263
262
|
// so we shouldn't send an update.
|
|
264
263
|
if (
|
|
265
|
-
this.consentPayloadAsString &&
|
|
266
|
-
this.consentMappings &&
|
|
264
|
+
this.consentPayloadAsString &&
|
|
265
|
+
this.consentMappings &&
|
|
267
266
|
!this.isEmpty(consentState)
|
|
268
267
|
) {
|
|
269
|
-
var updatedConsentPayload =
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
);
|
|
268
|
+
var updatedConsentPayload = this.consentHandler.generateConsentStatePayloadFromMappings(
|
|
269
|
+
consentState,
|
|
270
|
+
this.consentMappings
|
|
271
|
+
);
|
|
274
272
|
|
|
275
273
|
var eventConsentAsString = JSON.stringify(updatedConsentPayload);
|
|
276
274
|
|
|
@@ -281,15 +279,13 @@ Common.prototype.maybeSendConsentUpdateToGoogle = function (consentState) {
|
|
|
281
279
|
}
|
|
282
280
|
};
|
|
283
281
|
|
|
284
|
-
Common.prototype.sendDefaultConsentPayloadToGoogle = function
|
|
285
|
-
this.consentPayloadAsString = JSON.stringify(
|
|
286
|
-
consentPayload
|
|
287
|
-
);
|
|
282
|
+
Common.prototype.sendDefaultConsentPayloadToGoogle = function(consentPayload) {
|
|
283
|
+
this.consentPayloadAsString = JSON.stringify(consentPayload);
|
|
288
284
|
|
|
289
285
|
this.sendConsent('default', consentPayload);
|
|
290
286
|
};
|
|
291
287
|
|
|
292
|
-
Common.prototype.cloneObject = function
|
|
288
|
+
Common.prototype.cloneObject = function(obj) {
|
|
293
289
|
return JSON.parse(JSON.stringify(obj));
|
|
294
290
|
};
|
|
295
291
|
|
|
@@ -308,12 +304,12 @@ var ProductActionTypes = {
|
|
|
308
304
|
Purchase: 16,
|
|
309
305
|
Refund: 17,
|
|
310
306
|
RemoveFromCart: 11,
|
|
311
|
-
ViewDetail: 15
|
|
307
|
+
ViewDetail: 15,
|
|
312
308
|
};
|
|
313
309
|
|
|
314
310
|
var PromotionType = {
|
|
315
311
|
PromotionClick: 19,
|
|
316
|
-
PromotionView: 18
|
|
312
|
+
PromotionView: 18,
|
|
317
313
|
};
|
|
318
314
|
|
|
319
315
|
function CommerceHandler(common) {
|
|
@@ -327,10 +323,12 @@ CommerceHandler.prototype.buildAddToCart = function(event) {
|
|
|
327
323
|
ecommerce: {
|
|
328
324
|
currencyCode: event.CurrencyCode || 'USD',
|
|
329
325
|
add: {
|
|
330
|
-
products: buildProductsList(
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
326
|
+
products: buildProductsList(
|
|
327
|
+
event.ProductAction.ProductList
|
|
328
|
+
),
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
},
|
|
334
332
|
};
|
|
335
333
|
};
|
|
336
334
|
CommerceHandler.prototype.buildCheckout = function(event) {
|
|
@@ -342,12 +340,14 @@ CommerceHandler.prototype.buildCheckout = function(event) {
|
|
|
342
340
|
checkout: {
|
|
343
341
|
actionField: {
|
|
344
342
|
step: event.ProductAction.CheckoutStep,
|
|
345
|
-
option: event.ProductAction.CheckoutOptions
|
|
343
|
+
option: event.ProductAction.CheckoutOptions,
|
|
346
344
|
},
|
|
347
|
-
products: buildProductsList(
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
345
|
+
products: buildProductsList(
|
|
346
|
+
event.ProductAction.ProductList
|
|
347
|
+
),
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
351
|
};
|
|
352
352
|
};
|
|
353
353
|
CommerceHandler.prototype.buildCheckoutOption = function(event) {
|
|
@@ -359,12 +359,14 @@ CommerceHandler.prototype.buildCheckoutOption = function(event) {
|
|
|
359
359
|
checkout_option: {
|
|
360
360
|
actionField: {
|
|
361
361
|
step: event.ProductAction.CheckoutStep,
|
|
362
|
-
option: event.ProductAction.CheckoutOptions
|
|
362
|
+
option: event.ProductAction.CheckoutOptions,
|
|
363
363
|
},
|
|
364
|
-
products: buildProductsList(
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
364
|
+
products: buildProductsList(
|
|
365
|
+
event.ProductAction.ProductList
|
|
366
|
+
),
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
},
|
|
368
370
|
};
|
|
369
371
|
};
|
|
370
372
|
CommerceHandler.prototype.buildRemoveFromCart = function(event) {
|
|
@@ -375,10 +377,12 @@ CommerceHandler.prototype.buildRemoveFromCart = function(event) {
|
|
|
375
377
|
ecommerce: {
|
|
376
378
|
currencyCode: event.CurrencyCode || 'USD',
|
|
377
379
|
remove: {
|
|
378
|
-
products: buildProductsList(
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
380
|
+
products: buildProductsList(
|
|
381
|
+
event.ProductAction.ProductList
|
|
382
|
+
),
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
},
|
|
382
386
|
};
|
|
383
387
|
};
|
|
384
388
|
CommerceHandler.prototype.buildImpression = function(event, impression) {
|
|
@@ -388,9 +392,9 @@ CommerceHandler.prototype.buildImpression = function(event, impression) {
|
|
|
388
392
|
eventPayload: {
|
|
389
393
|
ecommerce: {
|
|
390
394
|
currencyCode: event.CurrencyCode || 'USD',
|
|
391
|
-
impressions: buildProductsList(impression.ProductList)
|
|
392
|
-
}
|
|
393
|
-
}
|
|
395
|
+
impressions: buildProductsList(impression.ProductList),
|
|
396
|
+
},
|
|
397
|
+
},
|
|
394
398
|
};
|
|
395
399
|
};
|
|
396
400
|
CommerceHandler.prototype.buildProductClick = function(event) {
|
|
@@ -407,10 +411,12 @@ CommerceHandler.prototype.buildProductClick = function(event) {
|
|
|
407
411
|
ecommerce: {
|
|
408
412
|
click: {
|
|
409
413
|
actionField: actionField,
|
|
410
|
-
products: buildProductsList(
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
+
products: buildProductsList(
|
|
415
|
+
event.ProductAction.ProductList
|
|
416
|
+
),
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
|
+
},
|
|
414
420
|
};
|
|
415
421
|
};
|
|
416
422
|
CommerceHandler.prototype.buildProductViewDetail = function(event) {
|
|
@@ -427,10 +433,12 @@ CommerceHandler.prototype.buildProductViewDetail = function(event) {
|
|
|
427
433
|
ecommerce: {
|
|
428
434
|
detail: {
|
|
429
435
|
actionField: actionField,
|
|
430
|
-
products: buildProductsList(
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
436
|
+
products: buildProductsList(
|
|
437
|
+
event.ProductAction.ProductList
|
|
438
|
+
),
|
|
439
|
+
},
|
|
440
|
+
},
|
|
441
|
+
},
|
|
434
442
|
};
|
|
435
443
|
};
|
|
436
444
|
CommerceHandler.prototype.buildPromoClick = function(event) {
|
|
@@ -442,10 +450,10 @@ CommerceHandler.prototype.buildPromoClick = function(event) {
|
|
|
442
450
|
promoClick: {
|
|
443
451
|
promotions: buildPromoList(
|
|
444
452
|
event.PromotionAction.PromotionList
|
|
445
|
-
)
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
}
|
|
453
|
+
),
|
|
454
|
+
},
|
|
455
|
+
},
|
|
456
|
+
},
|
|
449
457
|
};
|
|
450
458
|
};
|
|
451
459
|
CommerceHandler.prototype.buildPromoView = function(event) {
|
|
@@ -457,10 +465,10 @@ CommerceHandler.prototype.buildPromoView = function(event) {
|
|
|
457
465
|
promoView: {
|
|
458
466
|
promotions: buildPromoList(
|
|
459
467
|
event.PromotionAction.PromotionList
|
|
460
|
-
)
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
}
|
|
468
|
+
),
|
|
469
|
+
},
|
|
470
|
+
},
|
|
471
|
+
},
|
|
464
472
|
};
|
|
465
473
|
};
|
|
466
474
|
CommerceHandler.prototype.buildPurchase = function(event) {
|
|
@@ -477,12 +485,12 @@ CommerceHandler.prototype.buildPurchase = function(event) {
|
|
|
477
485
|
revenue: productAction.TotalAmount || '',
|
|
478
486
|
tax: productAction.TaxAmount || '',
|
|
479
487
|
shipping: productAction.ShippingAmount || '',
|
|
480
|
-
coupon: productAction.CouponCode || ''
|
|
488
|
+
coupon: productAction.CouponCode || '',
|
|
481
489
|
},
|
|
482
|
-
products: buildProductsList(productAction.ProductList)
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
}
|
|
490
|
+
products: buildProductsList(productAction.ProductList),
|
|
491
|
+
},
|
|
492
|
+
},
|
|
493
|
+
},
|
|
486
494
|
};
|
|
487
495
|
};
|
|
488
496
|
CommerceHandler.prototype.buildRefund = function(event) {
|
|
@@ -495,12 +503,14 @@ CommerceHandler.prototype.buildRefund = function(event) {
|
|
|
495
503
|
ecommerce: {
|
|
496
504
|
refund: {
|
|
497
505
|
actionField: {
|
|
498
|
-
id: event.ProductAction.TransactionId || ''
|
|
506
|
+
id: event.ProductAction.TransactionId || '',
|
|
499
507
|
},
|
|
500
|
-
products: buildProductsList(
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
508
|
+
products: buildProductsList(
|
|
509
|
+
event.ProductAction.ProductList
|
|
510
|
+
),
|
|
511
|
+
},
|
|
512
|
+
},
|
|
513
|
+
},
|
|
504
514
|
};
|
|
505
515
|
};
|
|
506
516
|
CommerceHandler.prototype.logCommerceEvent = function(event) {
|
|
@@ -562,12 +572,16 @@ CommerceHandler.prototype.logCommerceEvent = function(event) {
|
|
|
562
572
|
|
|
563
573
|
// Utility function
|
|
564
574
|
function toUnderscore(string) {
|
|
565
|
-
return string
|
|
575
|
+
return string
|
|
576
|
+
.split(/(?=[A-Z])/)
|
|
577
|
+
.join('_')
|
|
578
|
+
.toLowerCase();
|
|
566
579
|
}
|
|
580
|
+
|
|
567
581
|
function parseProduct(_product) {
|
|
568
582
|
var product = {};
|
|
569
583
|
|
|
570
|
-
for(var key in _product) {
|
|
584
|
+
for (var key in _product) {
|
|
571
585
|
if (key === 'Sku') {
|
|
572
586
|
product.id = _product.Sku;
|
|
573
587
|
} else {
|
|
@@ -614,7 +628,7 @@ function EventHandler(common) {
|
|
|
614
628
|
this.common = common || {};
|
|
615
629
|
}
|
|
616
630
|
|
|
617
|
-
EventHandler.prototype.logEvent = function
|
|
631
|
+
EventHandler.prototype.logEvent = function(event) {
|
|
618
632
|
var eventConsentState = this.common.getEventConsentState(
|
|
619
633
|
event.ConsentState
|
|
620
634
|
);
|
|
@@ -628,14 +642,14 @@ EventHandler.prototype.logEvent = function (event) {
|
|
|
628
642
|
|
|
629
643
|
EventHandler.prototype.logError = function() {};
|
|
630
644
|
|
|
631
|
-
EventHandler.prototype.logPageView = function
|
|
645
|
+
EventHandler.prototype.logPageView = function(event) {
|
|
632
646
|
var eventConsentState = this.common.getEventConsentState(
|
|
633
647
|
event.ConsentState
|
|
634
648
|
);
|
|
635
649
|
this.common.maybeSendConsentUpdateToGoogle(eventConsentState);
|
|
636
650
|
this.common.send({
|
|
637
651
|
event: event,
|
|
638
|
-
eventType: 'screen_view'
|
|
652
|
+
eventType: 'screen_view',
|
|
639
653
|
});
|
|
640
654
|
|
|
641
655
|
return true;
|
|
@@ -669,7 +683,7 @@ function IdentityHandler(common) {
|
|
|
669
683
|
IdentityHandler.prototype.onUserIdentified = function(mParticleUser) {
|
|
670
684
|
this.common.send({
|
|
671
685
|
event: {
|
|
672
|
-
EventName: 'User Identified'
|
|
686
|
+
EventName: 'User Identified',
|
|
673
687
|
},
|
|
674
688
|
user: mParticleUser,
|
|
675
689
|
});
|
|
@@ -680,7 +694,7 @@ IdentityHandler.prototype.onIdentifyComplete = function(
|
|
|
680
694
|
) {
|
|
681
695
|
this.common.send({
|
|
682
696
|
event: {
|
|
683
|
-
EventName: 'Identify Complete'
|
|
697
|
+
EventName: 'Identify Complete',
|
|
684
698
|
},
|
|
685
699
|
user: mParticleUser,
|
|
686
700
|
});
|
|
@@ -692,7 +706,7 @@ IdentityHandler.prototype.onLoginComplete = function(
|
|
|
692
706
|
) {
|
|
693
707
|
this.common.send({
|
|
694
708
|
event: {
|
|
695
|
-
EventName: 'Login Complete'
|
|
709
|
+
EventName: 'Login Complete',
|
|
696
710
|
},
|
|
697
711
|
user: mParticleUser,
|
|
698
712
|
});
|
|
@@ -703,7 +717,7 @@ IdentityHandler.prototype.onLogoutComplete = function(
|
|
|
703
717
|
) {
|
|
704
718
|
this.common.send({
|
|
705
719
|
event: {
|
|
706
|
-
EventName: 'Logout Complete'
|
|
720
|
+
EventName: 'Logout Complete',
|
|
707
721
|
},
|
|
708
722
|
user: mParticleUser,
|
|
709
723
|
});
|
|
@@ -714,7 +728,7 @@ IdentityHandler.prototype.onModifyComplete = function(
|
|
|
714
728
|
) {
|
|
715
729
|
this.common.send({
|
|
716
730
|
event: {
|
|
717
|
-
EventName: 'Modify Complete'
|
|
731
|
+
EventName: 'Modify Complete',
|
|
718
732
|
},
|
|
719
733
|
user: mParticleUser,
|
|
720
734
|
});
|
|
@@ -802,24 +816,26 @@ var initialization = {
|
|
|
802
816
|
);
|
|
803
817
|
}
|
|
804
818
|
|
|
805
|
-
common.consentPayloadDefaults =
|
|
806
|
-
common.consentHandler.getConsentSettings();
|
|
819
|
+
common.consentPayloadDefaults = common.consentHandler.getConsentSettings();
|
|
807
820
|
|
|
808
|
-
var defaultConsentPayload = common.cloneObject(
|
|
821
|
+
var defaultConsentPayload = common.cloneObject(
|
|
822
|
+
common.consentPayloadDefaults
|
|
823
|
+
);
|
|
809
824
|
var updatedConsentState = common.consentHandler.getUserConsentState();
|
|
810
|
-
var updatedDefaultConsentPayload =
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
);
|
|
825
|
+
var updatedDefaultConsentPayload = common.consentHandler.generateConsentStatePayloadFromMappings(
|
|
826
|
+
updatedConsentState,
|
|
827
|
+
common.consentMappings
|
|
828
|
+
);
|
|
815
829
|
|
|
816
830
|
// If a default consent payload exists (as selected in the mParticle UI), set it as the default
|
|
817
831
|
if (!common.isEmpty(defaultConsentPayload)) {
|
|
818
832
|
common.sendDefaultConsentPayloadToGoogle(defaultConsentPayload);
|
|
819
|
-
|
|
820
|
-
|
|
833
|
+
// If a default consent payload does not exist, but the user currently has updated their consent,
|
|
834
|
+
// send that as the default because a default must be sent
|
|
821
835
|
} else if (!common.isEmpty(updatedDefaultConsentPayload)) {
|
|
822
|
-
common.sendDefaultConsentPayloadToGoogle(
|
|
836
|
+
common.sendDefaultConsentPayloadToGoogle(
|
|
837
|
+
updatedDefaultConsentPayload
|
|
838
|
+
);
|
|
823
839
|
}
|
|
824
840
|
|
|
825
841
|
common.maybeSendConsentUpdateToGoogle(updatedConsentState);
|
|
@@ -910,8 +926,7 @@ function sanitizeDataLayerName(_dataLayerName) {
|
|
|
910
926
|
|
|
911
927
|
function sanitizePreviewUrl(_previewUrl) {
|
|
912
928
|
var previewUrl = _previewUrl || '';
|
|
913
|
-
var regex =
|
|
914
|
-
/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/gm;
|
|
929
|
+
var regex = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/gm;
|
|
915
930
|
return previewUrl.trim().match(regex) ? previewUrl.trim() : '';
|
|
916
931
|
}
|
|
917
932
|
|
|
@@ -923,7 +938,7 @@ var initialization_1 = initialization;
|
|
|
923
938
|
|
|
924
939
|
var sessionHandler = {
|
|
925
940
|
onSessionStart: function(event) {},
|
|
926
|
-
onSessionEnd: function(event) {}
|
|
941
|
+
onSessionEnd: function(event) {},
|
|
927
942
|
};
|
|
928
943
|
|
|
929
944
|
var sessionHandler_1 = sessionHandler;
|
|
@@ -946,11 +961,11 @@ UserAttributeHandler.prototype.onRemoveUserAttribute = function(
|
|
|
946
961
|
) {
|
|
947
962
|
this.common.send({
|
|
948
963
|
event: {
|
|
949
|
-
EventName: 'Remove User Attribute'
|
|
964
|
+
EventName: 'Remove User Attribute',
|
|
950
965
|
},
|
|
951
966
|
options: {
|
|
952
|
-
key: key
|
|
953
|
-
}
|
|
967
|
+
key: key,
|
|
968
|
+
},
|
|
954
969
|
});
|
|
955
970
|
};
|
|
956
971
|
UserAttributeHandler.prototype.onSetUserAttribute = function(
|
|
@@ -960,12 +975,12 @@ UserAttributeHandler.prototype.onSetUserAttribute = function(
|
|
|
960
975
|
) {
|
|
961
976
|
this.common.send({
|
|
962
977
|
event: {
|
|
963
|
-
EventName: 'Set User Attribute'
|
|
978
|
+
EventName: 'Set User Attribute',
|
|
964
979
|
},
|
|
965
980
|
options: {
|
|
966
981
|
key: key,
|
|
967
|
-
value: value
|
|
968
|
-
}
|
|
982
|
+
value: value,
|
|
983
|
+
},
|
|
969
984
|
});
|
|
970
985
|
};
|
|
971
986
|
UserAttributeHandler.prototype.onConsentStateUpdated = function(
|
|
@@ -975,12 +990,12 @@ UserAttributeHandler.prototype.onConsentStateUpdated = function(
|
|
|
975
990
|
) {
|
|
976
991
|
this.common.send({
|
|
977
992
|
event: {
|
|
978
|
-
EventName: 'Consent State Update'
|
|
993
|
+
EventName: 'Consent State Update',
|
|
979
994
|
},
|
|
980
995
|
options: {
|
|
981
996
|
old_state: oldState,
|
|
982
|
-
new_state: newState
|
|
983
|
-
}
|
|
997
|
+
new_state: newState,
|
|
998
|
+
},
|
|
984
999
|
});
|
|
985
1000
|
};
|
|
986
1001
|
|
package/package.json
CHANGED
|
@@ -1,46 +1,48 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
2
|
+
"name": "@mparticle/web-google-tag-manager-kit",
|
|
3
|
+
"version": "3.2.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/mParticle/mparticle-web-sdk",
|
|
7
|
+
"directory": "kits/google-tag-manager"
|
|
8
|
+
},
|
|
9
|
+
"main": "dist/GoogleTagManager-Kit.common.js",
|
|
10
|
+
"browser": "dist/GoogleTagManager-Kit.common.js",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/GoogleTagManager-Kit.common.js"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"test": "npm run build && npm run test:karma",
|
|
16
|
+
"test:karma": "node test/test-karma.js",
|
|
17
|
+
"build": "ENVIRONMENT=production rollup --config rollup.config.js",
|
|
18
|
+
"watch": "ENVIRONMENT=production rollup --config rollup.config.js -w",
|
|
19
|
+
"testEndToEnd": "browserify node_modules/@mparticle/web-kit-wrapper/end-to-end-testapp/index.js -v -o test/end-to-end-testapp/build/compilation.js && open http://localhost:8082/node_modules/@mparticle/web-kit-wrapper/end-to-end-testapp/index.html && node node_modules/@mparticle/web-kit-wrapper/end-to-end-testapp/server"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@mparticle/web-sdk": "^3.0.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@mparticle/web-kit-wrapper": "^1.0.5",
|
|
26
|
+
"@semantic-release/changelog": "^5.0.1",
|
|
27
|
+
"@semantic-release/exec": "^5.0.0",
|
|
28
|
+
"@semantic-release/git": "^9.0.0",
|
|
29
|
+
"chai": "^4.3.4",
|
|
30
|
+
"karma": "^5.1.0",
|
|
31
|
+
"karma-chai": "^0.1.0",
|
|
32
|
+
"karma-chrome-launcher": "^2.2.0",
|
|
33
|
+
"karma-edge-launcher": "^0.4.2",
|
|
34
|
+
"karma-firefox-launcher": "^1.1.0",
|
|
35
|
+
"karma-ie-launcher": "^1.0.0",
|
|
36
|
+
"karma-junit-reporter": "^1.2.0",
|
|
37
|
+
"karma-mocha": "^1.3.0",
|
|
38
|
+
"karma-safari-launcher": "^1.0.0",
|
|
39
|
+
"mocha": "^5.2.0",
|
|
40
|
+
"mparticle-sdk-javascript": "github:mparticle/mparticle-sdk-javascript",
|
|
41
|
+
"rollup": "^1.15.6",
|
|
42
|
+
"rollup-plugin-commonjs": "^10.0.0",
|
|
43
|
+
"rollup-plugin-node-resolve": "^5.0.3",
|
|
44
|
+
"shelljs": "0.8.3",
|
|
45
|
+
"should": "13.2.3",
|
|
46
|
+
"watchify": "^3.11.0"
|
|
47
|
+
}
|
|
46
48
|
}
|