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

PubMatic bid adapter add ortb2 device #11783

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
5 changes: 5 additions & 0 deletions modules/pubmaticBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,11 @@ export const spec = {
}
}

// if present, merge device object from ortb2 into `payload.device`
if (bidderRequest?.ortb2?.device) {
mergeDeep(payload.device, bidderRequest.ortb2.device);
}

if (commonFpd.ext?.prebid?.bidderparams?.[bidderRequest.bidderCode]?.acat) {
const acatParams = commonFpd.ext.prebid.bidderparams[bidderRequest.bidderCode].acat;
_allowedIabCategoriesValidation(payload, acatParams);
Expand Down
34 changes: 34 additions & 0 deletions test/spec/modules/pubmaticBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2378,6 +2378,40 @@ describe('PubMatic adapter', function () {
expect(data.device.ext).to.deep.equal(cdepObj);
});

it('should pass enriched device data from ortb2 object if present in bidderRequest fpd', function () {
const fpdBidderRequest = {
auctionId: 'new-auction-id',
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',
}
},
};

const request = spec.buildRequests(multipleMediaRequests, fpdBidderRequest);
const data = JSON.parse(request.data);

expect(data.device.w).to.equal(fpdBidderRequest.ortb2.device.w);
expect(data.device.h).to.equal(fpdBidderRequest.ortb2.device.h);
expect(data.device.dnt).to.equal(fpdBidderRequest.ortb2.device.dnt);
expect(data.device.ua).to.equal(fpdBidderRequest.ortb2.device.ua);
expect(data.device.language).to.equal(fpdBidderRequest.ortb2.device.language);
expect(data.device.devicetype).to.equal(fpdBidderRequest.ortb2.device.devicetype);
expect(data.device.make).to.equal(fpdBidderRequest.ortb2.device.make);
expect(data.device.model).to.equal(fpdBidderRequest.ortb2.device.model);
expect(data.device.os).to.equal(fpdBidderRequest.ortb2.device.os);
expect(data.device.osv).to.equal(fpdBidderRequest.ortb2.device.osv);
});

it('Request params should have valid native bid request for all valid params', function () {
let request = spec.buildRequests(nativeBidRequests, {
auctionId: 'new-auction-id'
Expand Down