Skip to content

Commit

Permalink
Outbrain bid adapter add ortb2 device (#11748)
Browse files Browse the repository at this point in the history
* Outbrain Bid Adapter: Add full ORTB2 device data to request payload

* Outbrain Bid Adapter: Add test to verify presence of ORTB2 device data in request

---------

Co-authored-by: Bohdan V <[email protected]>
  • Loading branch information
jwrosewell and BohdanVV authored Jul 1, 2024
1 parent 3192ed1 commit 41df410
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/outbrainBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const spec = {
const request = {
id: bidderRequest.bidderRequestId,
site: { page, publisher },
device: { ua },
device: ortb2?.device || { ua },
source: { fd: 1 },
cur: [cur],
tmax: timeout,
Expand Down
30 changes: 30 additions & 0 deletions test/spec/modules/outbrainBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,23 @@ describe('Outbrain Adapter', function () {
}
}

const ortb2WithDeviceData = {
ortb2: {
device: {
w: 980,
h: 1720,
dnt: 0,
ua: 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/125.0.6422.80 Mobile/15E148 Safari/604.1',
language: 'en',
devicetype: 1,
make: 'Apple',
model: 'iPhone 12 Pro Max',
os: 'iOS',
osv: '17.4'
}
}
};

describe('isBidRequestValid', function () {
before(() => {
config.setConfig({
Expand Down Expand Up @@ -621,6 +638,19 @@ describe('Outbrain Adapter', function () {
const resData = JSON.parse(res.data)
expect(resData.imp[0].native.request).to.equal(JSON.stringify(expectedNativeAssets));
});

it('should pass ortb2 device data', function () {
const bidRequest = {
...commonBidRequest,
...nativeBidRequestParams,
};

const res = spec.buildRequests(
[bidRequest],
{...commonBidderRequest, ...ortb2WithDeviceData},
);
expect(JSON.parse(res.data).device).to.deep.equal(ortb2WithDeviceData.ortb2.device);
});
})

describe('interpretResponse', function () {
Expand Down

0 comments on commit 41df410

Please sign in to comment.