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

RTBHouse Adapter: bcat & badv support #9871

Merged
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
15 changes: 6 additions & 9 deletions modules/rtbhouseBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,12 @@ export const spec = {
}

const ortb2Params = bidderRequest?.ortb2 || {};
if (ortb2Params.site) {
mergeDeep(request, { site: ortb2Params.site });
}
if (ortb2Params.user) {
mergeDeep(request, { user: ortb2Params.user });
}
if (ortb2Params.device) {
mergeDeep(request, { device: ortb2Params.device });
}
['site', 'user', 'device', 'bcat', 'badv'].forEach(entry => {
const ortb2Param = ortb2Params[entry];
if (ortb2Param) {
mergeDeep(request, { [entry]: ortb2Param });
}
});

let computedEndpointUrl = ENDPOINT_URL;

Expand Down
22 changes: 22 additions & 0 deletions test/spec/modules/rtbhouseBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,28 @@ describe('RTBHouseAdapter', () => {
expect(data.source).to.not.have.property('ext');
});

it('should include first party data', function () {
const bidRequest = Object.assign([], bidRequests);
const localBidderRequest = {
...bidderRequest,
ortb2: {
bcat: ['IAB1', 'IAB2-1'],
badv: ['domain1.com', 'domain2.com'],
site: { ext: { data: 'some site data' } },
device: { ext: { data: 'some device data' } },
user: { ext: { data: 'some user data' } }
}
};

const request = spec.buildRequests(bidRequest, localBidderRequest);
const data = JSON.parse(request.data);
expect(data.bcat).to.deep.equal(localBidderRequest.ortb2.bcat);
expect(data.badv).to.deep.equal(localBidderRequest.ortb2.badv);
expect(data.site).to.nested.include({'ext.data': 'some site data'});
expect(data.device).to.nested.include({'ext.data': 'some device data'});
expect(data.user).to.nested.include({'ext.data': 'some user data'});
});

context('FLEDGE', function() {
afterEach(function () {
config.resetConfig();
Expand Down