Skip to content

Commit

Permalink
Cadent Aperture MX Bid Adapter: Include gpp consent in usersync endpo…
Browse files Browse the repository at this point in the history
…int (prebid#10404)

* Cadent Aperture MX Bid Adapter: Include gpp string and section id in usersync endpoint

* Cadent Aperture MX Bid Adapter: lint fix

---------

Co-authored-by: Michael Denton <mdenton@cadent.tv>
  • Loading branch information
EMXDigital and Michael Denton authored Sep 5, 2023
1 parent 2087aca commit aeaf23e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/cadentApertureMXBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ export const spec = {
}
return cadentBidResponses;
},
getUserSyncs: function (syncOptions, responses, gdprConsent, uspConsent) {
getUserSyncs: function (syncOptions, responses, gdprConsent, uspConsent, gppConsent) {
const syncs = [];
const consentParams = [];
if (syncOptions.iframeEnabled) {
Expand All @@ -390,6 +390,14 @@ export const spec = {
if (uspConsent && typeof uspConsent.consentString === 'string') {
consentParams.push(`usp=${uspConsent.consentString}`);
}
if (gppConsent && typeof gppConsent === 'object') {
if (gppConsent.gppString && typeof gppConsent.gppString === 'string') {
consentParams.push(`gpp=${gppConsent.gppString}`);
}
if (gppConsent.applicableSections && typeof gppConsent.applicableSections === 'object') {
consentParams.push(`gpp_sid=${gppConsent.applicableSections}`);
}
}
if (consentParams.length > 0) {
url = url + '?' + consentParams.join('&');
}
Expand Down
33 changes: 33 additions & 0 deletions test/spec/modules/cadentApertureMXBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -834,5 +834,38 @@ describe('cadent_aperture_mx Adapter', function () {
expect(syncs[0].url).to.contains('usp=test');
expect(syncs[0].url).to.equal('https://biddr.brealtime.com/check.html?gdpr=1&gdpr_consent=test&usp=test')
});

it('should pass gpp string and section id', function() {
let syncs = spec.getUserSyncs({iframeEnabled: true}, {}, {}, {}, {
gppString: 'abcdefgs',
applicableSections: [1, 2, 4]
});
expect(syncs).to.not.be.an('undefined');
expect(syncs[0].url).to.contains('gpp=abcdefgs')
expect(syncs[0].url).to.contains('gpp_sid=1,2,4')
});

it('should pass us_privacy and gdpr string and gpp string', function () {
let syncs = spec.getUserSyncs({ iframeEnabled: true }, {},
{
gdprApplies: true,
consentString: 'test'
},
{
consentString: 'test'
},
{
gppString: 'abcdefgs',
applicableSections: [1, 2, 4]
}
);
expect(syncs).to.not.be.an('undefined');
expect(syncs).to.have.lengthOf(1);
expect(syncs[0].type).to.equal('iframe');
expect(syncs[0].url).to.contains('gdpr=1');
expect(syncs[0].url).to.contains('usp=test');
expect(syncs[0].url).to.contains('gpp=abcdefgs');
expect(syncs[0].url).to.equal('https://biddr.brealtime.com/check.html?gdpr=1&gdpr_consent=test&usp=test&gpp=abcdefgs&gpp_sid=1,2,4');
});
});
});

0 comments on commit aeaf23e

Please sign in to comment.