Skip to content

Commit

Permalink
fix: Set mapped consent name from server to lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
rmi22186 committed Apr 12, 2024
1 parent fd09f40 commit 284fd7c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/GoogleAdWordsEventForwarder.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,11 @@

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 mpMappedConsentName = mappingEntry.map;
var googleMappedConsentName = mappingEntry.value;

if (
Expand Down
10 changes: 5 additions & 5 deletions test/src/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1135,25 +1135,25 @@ describe('Adwords forwarder', 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',
},
Expand Down Expand Up @@ -1204,7 +1204,7 @@ describe('Adwords forwarder', function () {
conversionId: 'AW-123123123',
enableGtag: 'True',
consentMappingWeb:
'[{&quot;jsmap&quot;:null,&quot;map&quot;:&quot;some_consent&quot;,&quot;maptype&quot;:&quot;ConsentPurposes&quot;,&quot;value&quot;:&quot;ad_user_data&quot;},{&quot;jsmap&quot;:null,&quot;map&quot;:&quot;storage_consent&quot;,&quot;maptype&quot;:&quot;ConsentPurposes&quot;,&quot;value&quot;:&quot;analytics_storage&quot;},{&quot;jsmap&quot;:null,&quot;map&quot;:&quot;other_test_consent&quot;,&quot;maptype&quot;:&quot;ConsentPurposes&quot;,&quot;value&quot;:&quot;ad_storage&quot;},{&quot;jsmap&quot;:null,&quot;map&quot;:&quot;test_consent&quot;,&quot;maptype&quot;:&quot;ConsentPurposes&quot;,&quot;value&quot;:&quot;ad_personalization&quot;}]',
'[{&quot;jsmap&quot;:null,&quot;map&quot;:&quot;Some_consent&quot;,&quot;maptype&quot;:&quot;ConsentPurposes&quot;,&quot;value&quot;:&quot;ad_user_data&quot;},{&quot;jsmap&quot;:null,&quot;map&quot;:&quot;Storage_consent&quot;,&quot;maptype&quot;:&quot;ConsentPurposes&quot;,&quot;value&quot;:&quot;analytics_storage&quot;},{&quot;jsmap&quot;:null,&quot;map&quot;:&quot;Other_test_consent&quot;,&quot;maptype&quot;:&quot;ConsentPurposes&quot;,&quot;value&quot;:&quot;ad_storage&quot;},{&quot;jsmap&quot;:null,&quot;map&quot;:&quot;Test_consent&quot;,&quot;maptype&quot;:&quot;ConsentPurposes&quot;,&quot;value&quot;:&quot;ad_personalization&quot;}]',
},
reportService.cb,
true
Expand Down

0 comments on commit 284fd7c

Please sign in to comment.