diff --git a/src/consent.js b/src/consent.js index 38c1c3b..b1ae5f2 100644 --- a/src/consent.js +++ b/src/consent.js @@ -90,7 +90,10 @@ ConsentHandler.prototype.generateConsentStatePayloadFromMappings = function ( for (var i = 0; i <= mappings.length - 1; i++) { var mappingEntry = mappings[i]; - var mpMappedConsentName = mappingEntry.map; + // Although consent purposes can be inputted into the UI in any casing + // the SDK will automatically lowercase them to prevent pseudo-duplicate + // consent purposes, so we call `toLowerCase` on the consentMapping purposes here + var mpMappedConsentName = mappingEntry.map.toLowerCase(); var googleMappedConsentName = mappingEntry.value; if ( diff --git a/test/tests.js b/test/tests.js index 7fb1412..5e10073 100644 --- a/test/tests.js +++ b/test/tests.js @@ -508,25 +508,25 @@ describe('DoubleClick', function () { var consentMap = [ { jsmap: null, - map: 'some_consent', + map: 'Some_consent', maptype: 'ConsentPurposes', value: 'ad_user_data', }, { jsmap: null, - map: 'storage_consent', + map: 'Storage_consent', maptype: 'ConsentPurposes', value: 'analytics_storage', }, { jsmap: null, - map: 'other_test_consent', + map: 'Other_test_consent', maptype: 'ConsentPurposes', value: 'ad_storage', }, { jsmap: null, - map: 'test_consent', + map: 'Test_consent', maptype: 'ConsentPurposes', value: 'ad_personalization', }, @@ -541,7 +541,7 @@ describe('DoubleClick', function () { { conversionId: 'AW-123123123', consentMappingWeb: - '[{"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"}]', + '[{"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"}]', eventMapping: '[]', customVariables: '[]', },