From 79e2152d670f69291005b1320295d9f92665dd5c Mon Sep 17 00:00:00 2001 From: Bohdan V <25197509+BohdanVV@users.noreply.github.com> Date: Thu, 6 Jun 2024 11:38:31 +0200 Subject: [PATCH 1/2] Pubmatic Bid Adapter: Add full ORTB2 device data to request payload --- modules/pubmaticBidAdapter.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/pubmaticBidAdapter.js b/modules/pubmaticBidAdapter.js index 5b470fdc34a..f44af7b4d5a 100644 --- a/modules/pubmaticBidAdapter.js +++ b/modules/pubmaticBidAdapter.js @@ -1285,6 +1285,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); From 59ee61d87ff15ddbd6c14363996c093b045f7729 Mon Sep 17 00:00:00 2001 From: Bohdan V <25197509+BohdanVV@users.noreply.github.com> Date: Mon, 10 Jun 2024 15:01:59 +0200 Subject: [PATCH 2/2] Pubmatic Bid Adapter: Add test to verify presence of ORTB2 device data in request --- test/spec/modules/pubmaticBidAdapter_spec.js | 34 ++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/test/spec/modules/pubmaticBidAdapter_spec.js b/test/spec/modules/pubmaticBidAdapter_spec.js index 745def57f4e..f62ce9e3d32 100644 --- a/test/spec/modules/pubmaticBidAdapter_spec.js +++ b/test/spec/modules/pubmaticBidAdapter_spec.js @@ -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'