Skip to content

Commit

Permalink
CadentApertureMX Bid Adapter : GPP support for usersync endpoint (#13)
Browse files Browse the repository at this point in the history
* add gpp support to usersync endpoint

* added usersync support testcases for gpp

---------

Co-authored-by: Murtaza Haji <mhaji@cadent.tv>
  • Loading branch information
EMXDigital and mhaji-cadent committed Aug 22, 2023
1 parent c3769d9 commit 933dcd9
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 933dcd9

Please sign in to comment.