Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[synacormedia] Update adapter to support Consent Management Module #5506

Merged
merged 17 commits into from
Jul 22, 2020
Merged
Show file tree
Hide file tree
Changes from 16 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
13 changes: 12 additions & 1 deletion modules/synacormediaBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

import { getAdUnitSizes, logWarn } from '../src/utils.js';
import { getAdUnitSizes, logWarn, deepSetValue } from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';
import includes from 'core-js-pure/features/array/includes.js';
Expand Down Expand Up @@ -85,6 +85,17 @@ export const spec = {
}
});

// CCPA
if (bidderRequest && bidderRequest.uspConsent) {
if (!openRtbBidRequest.regs) {
openRtbBidRequest.regs = {};
}
if (!openRtbBidRequest.regs.ext) {
openRtbBidRequest.regs.ext = {};
}
coreykress marked this conversation as resolved.
Show resolved Hide resolved
deepSetValue(openRtbBidRequest, 'regs.ext.us_privacy', bidderRequest.uspConsent);
}

if (openRtbBidRequest.imp.length && seatId) {
return {
method: 'POST',
Expand Down
20 changes: 20 additions & 0 deletions test/spec/modules/synacormediaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ describe('synacormediaBidAdapter ', function () {
}
};

let bidderRequestWithCCPA = {
auctionId: 'xyz123',
refererInfo: {
referer: 'https://test.com/foo/bar'
},
uspConsent: '1YYY'
};

let expectedDataImp1 = {
banner: {
format: [
Expand Down Expand Up @@ -560,6 +568,18 @@ describe('synacormediaBidAdapter ', function () {
}
]);
});
it('should contain the CCPA privacy string when UspConsent is in bidder request', function() {
// banner test
let req = spec.buildRequests([validBidRequest], bidderRequestWithCCPA);
expect(req).be.an('object');
expect(req).to.have.property('method', 'POST');
expect(req).to.have.property('url');
expect(req.url).to.contain('https://prebid.technoratimedia.com/openrtb/bids/prebid?');
expect(req.data).to.exist.and.to.be.an('object');
expect(req.data.id).to.equal('xyz123');
expect(req.data.regs.ext.us_privacy).to.equal('1YYY');
expect(req.data.imp).to.eql([expectedDataImp1]);
})
});

describe('Bid Requests with schain object ', function() {
Expand Down