Skip to content

Commit

Permalink
MinuteMediaPlusBidAdapter: pass gpp consent to userSync server. (#10376)
Browse files Browse the repository at this point in the history
* MinuteMediaPlus Bid Adapter: pass gpp consent to userSync server.

* minutemediaplusBidAdapter: gpp to user sync

* minutemediaplusBidAdapter: gpp to user sync
  • Loading branch information
saar120 committed Aug 22, 2023
1 parent f4f850b commit 6cab521
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
11 changes: 9 additions & 2 deletions modules/minutemediaplusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,20 @@ function interpretResponse(serverResponse, request) {
}
}

function getUserSyncs(syncOptions, responses, gdprConsent = {}, uspConsent = '') {
function getUserSyncs(syncOptions, responses, gdprConsent = {}, uspConsent = '', gppConsent = {}) {
let syncs = [];
const {iframeEnabled, pixelEnabled} = syncOptions;
const {gdprApplies, consentString = ''} = gdprConsent;
const {gppString, applicableSections} = gppConsent;

const cidArr = responses.filter(resp => deepAccess(resp, 'body.cid')).map(resp => resp.body.cid).filter(uniques);
const params = `?cid=${encodeURIComponent(cidArr.join(','))}&gdpr=${gdprApplies ? 1 : 0}&gdpr_consent=${encodeURIComponent(consentString || '')}&us_privacy=${encodeURIComponent(uspConsent || '')}`
let params = `?cid=${encodeURIComponent(cidArr.join(','))}&gdpr=${gdprApplies ? 1 : 0}&gdpr_consent=${encodeURIComponent(consentString || '')}&us_privacy=${encodeURIComponent(uspConsent || '')}`

if (gppString && applicableSections?.length) {
params += '&gpp=' + encodeURIComponent(gppString);
params += '&gpp_sid=' + encodeURIComponent(applicableSections.join(','));
}

if (iframeEnabled) {
syncs.push({
type: 'iframe',
Expand Down
19 changes: 19 additions & 0 deletions test/spec/modules/minutemediaplusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,25 @@ describe('MinuteMediaPlus Bid Adapter', function () {
'type': 'image'
}]);
})

it('should generate url with consent data', function () {
const gdprConsent = {
gdprApplies: true,
consentString: 'consent_string'
};
const uspConsent = 'usp_string';
const gppConsent = {
gppString: 'gpp_string',
applicableSections: [7]
}

const result = adapter.getUserSyncs({pixelEnabled: true}, [SERVER_RESPONSE], gdprConsent, uspConsent, gppConsent);

expect(result).to.deep.equal([{
'url': 'https://sync.minutemedia-prebid.com/api/sync/image/?cid=testcid123&gdpr=1&gdpr_consent=consent_string&us_privacy=usp_string&gpp=gpp_string&gpp_sid=7',
'type': 'image'
}]);
});
});

describe('interpret response', function () {
Expand Down

0 comments on commit 6cab521

Please sign in to comment.