Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions modules/smartadserverBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,21 @@ export const spec = {
sdc: sellerDefinedContext
};

if (bidderRequest && bidderRequest.gdprConsent) {
payload.addtl_consent = bidderRequest.gdprConsent.addtlConsent;
payload.gdpr_consent = bidderRequest.gdprConsent.consentString;
payload.gdpr = bidderRequest.gdprConsent.gdprApplies; // we're handling the undefined case server side
if (bidderRequest) {
if (bidderRequest.gdprConsent) {
payload.addtl_consent = bidderRequest.gdprConsent.addtlConsent;
payload.gdpr_consent = bidderRequest.gdprConsent.consentString;
payload.gdpr = bidderRequest.gdprConsent.gdprApplies; // we're handling the undefined case server side
}

if (bidderRequest.gppConsent) {
payload.gpp = bidderRequest.gppConsent.gppString;
payload.gpp_sid = bidderRequest.gppConsent.applicableSections;
}

if (bidderRequest.uspConsent) {
payload.us_privacy = bidderRequest.uspConsent;
}
}

if (bid && bid.userId) {
Expand Down
24 changes: 24 additions & 0 deletions test/spec/modules/smartadserverBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,30 @@ describe('Smart bid adapter tests', function () {
});
});

describe('GPP', function () {
it('should be added to payload when gppConsent available in bidder request', function () {
const options = {
gppConsent: {
gppString: 'some-gpp-string',
applicableSections: [3, 5]
}
};
const request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, options);
const payload = JSON.parse(request[0].data);

expect(payload).to.have.property('gpp').and.to.equal(options.gppConsent.gppString);
expect(payload).to.have.property('gpp_sid').and.to.be.an('array');
expect(payload.gpp_sid).to.have.lengthOf(2).and.to.deep.equal(options.gppConsent.applicableSections);
});

it('should be undefined on payload when gppConsent unavailable in bidder request', function () {
const request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, {});
const payload = JSON.parse(request[0].data);

expect(payload.gpp).to.be.undefined;
});
});

describe('ccpa/us privacy tests', function () {
afterEach(function () {
config.resetConfig();
Expand Down