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

Ogury Bid Adapter: add device pixel density in bid request #9796

Merged
merged 1 commit into from
Apr 12, 2023
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: 3 additions & 2 deletions modules/oguryBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const DEFAULT_TIMEOUT = 1000;
const BID_HOST = 'https://mweb-hb.presage.io/api/header-bidding-request';
const TIMEOUT_MONITORING_HOST = 'https://ms-ads-monitoring-events.presage.io';
const MS_COOKIE_SYNC_DOMAIN = 'https://ms-cookie-sync.presage.io';
const ADAPTER_VERSION = '1.4.0';
const ADAPTER_VERSION = '1.4.1';

function getClientWidth() {
const documentElementClientWidth = window.top.document.documentElement.clientWidth
Expand Down Expand Up @@ -90,7 +90,8 @@ function buildRequests(validBidRequests, bidderRequest) {
},
device: {
w: getClientWidth(),
h: getClientHeight()
h: getClientHeight(),
pxratio: window.devicePixelRatio
}
};

Expand Down
23 changes: 19 additions & 4 deletions test/spec/modules/oguryBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ describe('OguryBidAdapter', function () {
const stubbedWidth = 200
const stubbedHeight = 600
const stubbedCurrentTime = 1234567890
const stubbedDevicePixelRatio = 1
const stubbedWidthMethod = sinon.stub(window.top.document.documentElement, 'clientWidth').get(function() {
return stubbedWidth;
});
Expand All @@ -255,6 +256,10 @@ describe('OguryBidAdapter', function () {
return stubbedCurrentTime;
});

const stubbedDevicePixelMethod = sinon.stub(window, 'devicePixelRatio').get(function() {
return stubbedDevicePixelRatio;
});

const defaultTimeout = 1000;
const expectedRequestObject = {
id: bidRequests[0].auctionId,
Expand Down Expand Up @@ -305,18 +310,20 @@ describe('OguryBidAdapter', function () {
},
ext: {
prebidversion: '$prebid.version$',
adapterversion: '1.4.0'
adapterversion: '1.4.1'
},
device: {
w: stubbedWidth,
h: stubbedHeight
h: stubbedHeight,
pxratio: stubbedDevicePixelRatio,
}
};

after(function() {
stubbedWidthMethod.restore();
stubbedHeightMethod.restore();
stubbedCurrentTimeMethod.restore();
stubbedDevicePixelMethod.restore();
});

it('sends bid request to ENDPOINT via POST', function () {
Expand All @@ -338,6 +345,14 @@ describe('OguryBidAdapter', function () {
stubbedTimelineMethod.restore();
});

it('send device pixel ratio in bid request', function() {
const validBidRequests = utils.deepClone(bidRequests)

const request = spec.buildRequests(validBidRequests, bidderRequest);
expect(request.data).to.deep.equal(expectedRequestObject);
expect(request.data.device.pxratio).to.be.a('number');
})

it('bid request object should be conform', function () {
const validBidRequests = utils.deepClone(bidRequests)

Expand Down Expand Up @@ -697,7 +712,7 @@ describe('OguryBidAdapter', function () {
advertiserDomains: openRtbBidResponse.body.seatbid[0].bid[0].adomain
},
nurl: openRtbBidResponse.body.seatbid[0].bid[0].nurl,
adapterVersion: '1.4.0',
adapterVersion: '1.4.1',
prebidVersion: '$prebid.version$'
}, {
requestId: openRtbBidResponse.body.seatbid[0].bid[1].impid,
Expand All @@ -714,7 +729,7 @@ describe('OguryBidAdapter', function () {
advertiserDomains: openRtbBidResponse.body.seatbid[0].bid[1].adomain
},
nurl: openRtbBidResponse.body.seatbid[0].bid[1].nurl,
adapterVersion: '1.4.0',
adapterVersion: '1.4.1',
prebidVersion: '$prebid.version$'
}]

Expand Down