From 260ebcaa5c185f7e2a7447ac8e39286723c91c65 Mon Sep 17 00:00:00 2001 From: Alexander Sapountzis Date: Wed, 28 Feb 2024 10:51:48 -0500 Subject: [PATCH] Update consent mappings in GA4Client --- packages/GA4Client/src/consent.js | 6 ++--- packages/GA4Client/src/initialization.js | 4 ++-- packages/GA4Client/test/src/tests.js | 28 ++++++++++++------------ 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/packages/GA4Client/src/consent.js b/packages/GA4Client/src/consent.js index 379e678..a6c5639 100644 --- a/packages/GA4Client/src/consent.js +++ b/packages/GA4Client/src/consent.js @@ -56,10 +56,8 @@ ConsentHandler.prototype.getConsentSettings = function () { var consentSettings = {}; var googleToMpConsentSettingsMapping = { - // Inherited from S2S Integration Settings - ad_user_data: 'adUserDataConsent', - ad_personalization: 'adPersonalizationConsent', - + ad_user_data: 'adUserDataConsentSDK', + ad_personalization: 'adPersonalizationConsentSDK', ad_storage: 'adStorageConsentSDK', analytics_storage: 'analyticsStorageConsentSDK', }; diff --git a/packages/GA4Client/src/initialization.js b/packages/GA4Client/src/initialization.js index 8fda394..c263b39 100644 --- a/packages/GA4Client/src/initialization.js +++ b/packages/GA4Client/src/initialization.js @@ -41,9 +41,9 @@ var initialization = { send_page_view: forwarderSettings.enablePageView === 'True', }; - if (forwarderSettings.consentMapping) { + if (forwarderSettings.consentMappingSDK) { common.consentMappings = parseSettingsString( - forwarderSettings.consentMapping + forwarderSettings.consentMappingSDK ); } else { // Ensures consent mappings is an empty array diff --git a/packages/GA4Client/test/src/tests.js b/packages/GA4Client/test/src/tests.js index ef69668..7f9ad2e 100644 --- a/packages/GA4Client/test/src/tests.js +++ b/packages/GA4Client/test/src/tests.js @@ -2340,7 +2340,7 @@ describe('Google Analytics 4 Event', function () { mParticle.forwarder.init( { conversionId: 'AW-123123123', - consentMapping: + consentMappingSDK: '[{"jsmap":null,"map":"some_consent","maptype":"ConsentPurposes","value":"ad_user_data"},{"jsmap":null,"map":"storage_consent","maptype":"ConsentPurposes","value":"analytics_storage"},{"jsmap":null,"map":"other_test_consent","maptype":"ConsentPurposes","value":"ad_storage"},{"jsmap":null,"map":"test_consent","maptype":"ConsentPurposes","value":"ad_personalization"}]', }, reportService.cb, @@ -2370,9 +2370,9 @@ describe('Google Analytics 4 Event', function () { { conversionId: 'AW-123123123', enableGtag: 'True', - consentMapping: JSON.stringify(consentMap), - adPersonalizationConsent: 'Granted', // Will be overriden by User Consent State - adUserDataConsent: 'Granted', // Will be overriden by User Consent State + consentMappingSDK: JSON.stringify(consentMap), + adPersonalizationConsentSDK: 'Granted', // Will be overriden by User Consent State + adUserDataConsentSDK: 'Granted', // Will be overriden by User Consent State adStorageConsentSDK: 'Granted', analyticsStorageConsentSDK: 'Granted', }, @@ -2406,9 +2406,9 @@ describe('Google Analytics 4 Event', function () { { conversionId: 'AW-123123123', enableGtag: 'True', - consentMapping: JSON.stringify(consentMap), - adPersonalizationConsent: 'Unspecified', - adUserDataConsent: 'Unspecified', // Will be overriden by User Consent State + consentMappingSDK: JSON.stringify(consentMap), + adPersonalizationConsentSDK: 'Unspecified', + adUserDataConsentSDK: 'Unspecified', // Will be overriden by User Consent State adStorageConsentSDK: 'Unspecified', // Will be overriden by User Consent State analyticsStorageConsentSDK: 'Unspecified', }, @@ -2440,7 +2440,7 @@ describe('Google Analytics 4 Event', function () { { conversionId: 'AW-123123123', enableGtag: 'True', - consentMapping: JSON.stringify(consentMap), + consentMappingSDK: JSON.stringify(consentMap), }, reportService.cb, true @@ -2604,9 +2604,9 @@ describe('Google Analytics 4 Event', function () { { conversionId: 'AW-123123123', enableGtag: 'True', - consentMapping: JSON.stringify(consentMap), - adPersonalizationConsent: 'Granted', // Will be overriden by User Consent State - adUserDataConsent: 'Granted', // Will be overriden by User Consent State + consentMappingSDK: JSON.stringify(consentMap), + adPersonalizationConsentSDK: 'Granted', // Will be overriden by User Consent State + adUserDataConsentSDK: 'Granted', // Will be overriden by User Consent State adStorageConsentSDK: 'Granted', analyticsStorageConsentSDK: 'Granted', }, @@ -2775,7 +2775,7 @@ describe('Google Analytics 4 Event', function () { { conversionId: 'AW-123123123', enableGtag: 'True', - consentMapping: JSON.stringify(consentMap), + consentMappingSDK: JSON.stringify(consentMap), }, reportService.cb, true @@ -2912,8 +2912,8 @@ describe('Google Analytics 4 Event', function () { { conversionId: 'AW-123123123', enableGtag: 'True', - adUserDataConsent: 'Granted', - adPersonalizationConsent: 'Denied', + adUserDataConsentSDK: 'Granted', + adPersonalizationConsentSDK: 'Denied', adStorageConsentSDK: 'Granted', analyticsStorageConsentSDK: 'Denied', },