Skip to content

Commit

Permalink
Update consent mappings in GA4Client
Browse files Browse the repository at this point in the history
  • Loading branch information
alexs-mparticle committed Feb 28, 2024
1 parent e63d7af commit 260ebca
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
6 changes: 2 additions & 4 deletions packages/GA4Client/src/consent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};
Expand Down
4 changes: 2 additions & 2 deletions packages/GA4Client/src/initialization.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 14 additions & 14 deletions packages/GA4Client/test/src/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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',
},
Expand Down Expand Up @@ -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',
},
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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',
},
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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',
},
Expand Down

0 comments on commit 260ebca

Please sign in to comment.