diff --git a/modules/yieldmoBidAdapter.js b/modules/yieldmoBidAdapter.js index 64ab8a87eea..5a0f302ab34 100644 --- a/modules/yieldmoBidAdapter.js +++ b/modules/yieldmoBidAdapter.js @@ -385,7 +385,7 @@ function openRtbRequest(bidRequests, bidderRequest) { at: 1, imp: bidRequests.map(bidRequest => openRtbImpression(bidRequest)), site: openRtbSite(bidRequests[0], bidderRequest), - device: openRtbDevice(bidRequests[0]), + device: deepAccess(bidderRequest, 'ortb2.device'), badv: bidRequests[0].params.badv || [], bcat: deepAccess(bidderRequest, 'bcat') || bidRequests[0].params.bcat || [], ext: { @@ -507,17 +507,6 @@ function openRtbSite(bidRequest, bidderRequest) { return result; } -/** - * @return Object OpenRTB's 'device' object - */ -function openRtbDevice(bidRequest) { - const deviceObj = { - ua: navigator.userAgent, - language: (navigator.language || navigator.browserLanguage || navigator.userLanguage || navigator.systemLanguage), - }; - return deviceObj; -} - /** * Updates openRtbRequest with GDPR info from bidderRequest, if present. * @param {Object} openRtbRequest OpenRTB's request to update. diff --git a/test/spec/modules/yieldmoBidAdapter_spec.js b/test/spec/modules/yieldmoBidAdapter_spec.js index 8a0ebf863dd..4123422ce6e 100644 --- a/test/spec/modules/yieldmoBidAdapter_spec.js +++ b/test/spec/modules/yieldmoBidAdapter_spec.js @@ -543,6 +543,76 @@ describe('YieldmoAdapter', function () { }; expect(buildAndGetData([mockVideoBid({...params})]).user.eids).to.eql(params.fakeUserIdAsEids); }); + it('should add device info to payload if available', function () { + let videoBidder = mockBidderRequest({ ortb2: { + device: { + sua: { + platform: { + brand: 'macOS', + version: [ '12', '4', '0' ] + }, + browsers: [ + { + brand: 'Chromium', + version: [ '106', '0', '5249', '119' ] + }, + { + brand: 'Google Chrome', + version: [ '106', '0', '5249', '119' ] + }, + { + brand: 'Not;A=Brand', + version: [ '99', '0', '0', '0' ] + } + ], + mobile: 0, + model: '', + bitness: '64', + architecture: 'x86' + } + } + }}, [mockVideoBid()]); + let payload = buildAndGetData([mockVideoBid()], 0, videoBidder); + expect(payload.device.sua).to.exist; + expect(payload.device.sua).to.deep.equal({ + platform: { + brand: 'macOS', + version: [ '12', '4', '0' ] + }, + browsers: [ + { + brand: 'Chromium', + version: [ '106', '0', '5249', '119' ] + }, + { + brand: 'Google Chrome', + version: [ '106', '0', '5249', '119' ] + }, + { + brand: 'Not;A=Brand', + version: [ '99', '0', '0', '0' ] + } + ], + mobile: 0, + model: '', + bitness: '64', + architecture: 'x86' + } + ); + expect(payload.device.ua).to.not.exist; + expect(payload.device.language).to.not.exist; + // remove sua info and check device object + videoBidder = mockBidderRequest({ ortb2: { + device: { + ua: navigator.userAgent, + language: (navigator.language || navigator.browserLanguage || navigator.userLanguage || navigator.systemLanguage), + } + }}, [mockVideoBid()]); + payload = buildAndGetData([mockVideoBid()], 0, videoBidder); + expect(payload.device.sua).to.not.exist; + expect(payload.device.ua).to.exist; + expect(payload.device.language).to.exist; + }); }); });