@mparticle/web-adwords-kit 2.3.0 → 2.3.2
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.
|
@@ -85,24 +85,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
85
85
|
// If consent payload is empty,
|
|
86
86
|
// we never sent an initial default consent state
|
|
87
87
|
// so we shouldn't send an update.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (!isEmpty(eventConsentState)) {
|
|
92
|
-
var updatedConsentPayload = generateConsentStatePayloadFromMappings(
|
|
93
|
-
eventConsentState,
|
|
94
|
-
consentMappings,
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
var eventConsentAsString =
|
|
98
|
-
JSON.stringify(updatedConsentPayload);
|
|
99
|
-
|
|
100
|
-
if (eventConsentAsString !== consentPayloadAsString) {
|
|
101
|
-
sendGtagConsentUpdate(updatedConsentPayload);
|
|
102
|
-
consentPayloadAsString = eventConsentAsString;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
88
|
+
var eventConsentState = getEventConsentState(event.ConsentState);
|
|
89
|
+
maybeSendConsentUpdateToGoogle(eventConsentState);
|
|
106
90
|
|
|
107
91
|
if (
|
|
108
92
|
forwarderSettings.enableEnhancedConversions ===
|
|
@@ -359,8 +343,33 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
359
343
|
return true;
|
|
360
344
|
}
|
|
361
345
|
|
|
346
|
+
function maybeSendConsentUpdateToGoogle(consentState) {
|
|
347
|
+
if (
|
|
348
|
+
consentPayloadAsString &&
|
|
349
|
+
forwarderSettings.consentMappingWeb &&
|
|
350
|
+
!isEmpty(consentState)
|
|
351
|
+
) {
|
|
352
|
+
var updatedConsentPayload = generateConsentStatePayloadFromMappings(
|
|
353
|
+
consentState,
|
|
354
|
+
consentMappings,
|
|
355
|
+
);
|
|
356
|
+
|
|
357
|
+
var eventConsentAsString =
|
|
358
|
+
JSON.stringify(updatedConsentPayload);
|
|
359
|
+
|
|
360
|
+
if (eventConsentAsString !== consentPayloadAsString) {
|
|
361
|
+
sendGtagConsentUpdate(updatedConsentPayload);
|
|
362
|
+
consentPayloadAsString = eventConsentAsString;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
362
367
|
function sendGtagConsentDefaults(payload) {
|
|
363
368
|
// https://go.mparticle.com/work/SQDSDKS-6165
|
|
369
|
+
consentPayloadAsString = JSON.stringify(
|
|
370
|
+
payload
|
|
371
|
+
);
|
|
372
|
+
|
|
364
373
|
try {
|
|
365
374
|
gtag('consent', 'default', payload);
|
|
366
375
|
} catch (e) {
|
|
@@ -398,7 +407,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
398
407
|
|
|
399
408
|
for (var i = 0; i <= mappings.length - 1; i++) {
|
|
400
409
|
var mappingEntry = mappings[i];
|
|
401
|
-
|
|
410
|
+
// Although consent purposes can be inputted into the UI in any casing
|
|
411
|
+
// the SDK will automatically lowercase them to prevent pseudo-duplicate
|
|
412
|
+
// consent purposes, so we call `toLowerCase` on the consentMapping purposes here
|
|
413
|
+
var mpMappedConsentName = mappingEntry.map.toLowerCase();
|
|
414
|
+
// var mpMappedConsentName = mappingEntry.map;
|
|
402
415
|
var googleMappedConsentName = mappingEntry.value;
|
|
403
416
|
|
|
404
417
|
if (
|
|
@@ -553,21 +566,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
553
566
|
}
|
|
554
567
|
|
|
555
568
|
consentPayloadDefaults = getConsentSettings();
|
|
556
|
-
var
|
|
557
|
-
|
|
558
|
-
var
|
|
569
|
+
var defaultConsentPayload = cloneObject(consentPayloadDefaults);
|
|
570
|
+
var updatedConsentState = getUserConsentState();
|
|
571
|
+
var updatedDefaultConsentPayload =
|
|
559
572
|
generateConsentStatePayloadFromMappings(
|
|
560
|
-
|
|
573
|
+
updatedConsentState,
|
|
561
574
|
consentMappings
|
|
562
575
|
);
|
|
563
576
|
|
|
564
|
-
if(!isEmpty(defaultConsentPayload)) {
|
|
565
|
-
consentPayloadAsString = JSON.stringify(
|
|
566
|
-
defaultConsentPayload
|
|
567
|
-
);
|
|
568
|
-
|
|
577
|
+
if (!isEmpty(defaultConsentPayload)) {
|
|
569
578
|
sendGtagConsentDefaults(defaultConsentPayload);
|
|
579
|
+
} else if (!isEmpty(updatedDefaultConsentPayload)) {
|
|
580
|
+
sendGtagConsentDefaults(updatedDefaultConsentPayload);
|
|
570
581
|
}
|
|
582
|
+
|
|
583
|
+
maybeSendConsentUpdateToGoogle(updatedConsentState);
|
|
584
|
+
|
|
571
585
|
}
|
|
572
586
|
|
|
573
587
|
forwarderSettings.remarketingOnly = forwarderSettings.remarketingOnly == 'True';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mparticle/web-adwords-kit",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"author": "mParticle Developers <developers@mparticle.com> (https://www.mparticle.com)",
|
|
5
5
|
"description": "mParticle integration sdk for Google Adwords",
|
|
6
6
|
"main": "dist/GoogleAdWordsEventForwarder.common.js",
|