Skip to content

Commit

Permalink
Limelight Digital Bid Adapter: fix page field filling (#11436)
Browse files Browse the repository at this point in the history
  • Loading branch information
imedvedko committed May 2, 2024
1 parent 5cfae1b commit 7ab6165
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
6 changes: 3 additions & 3 deletions modules/limelightDigitalBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ function buildRequest(winTop, host, adUnits, bidderRequest) {
deviceWidth: winTop.screen.width,
deviceHeight: winTop.screen.height,
adUnits: adUnits,
sua: bidderRequest?.ortb2?.device?.sua
sua: bidderRequest?.ortb2?.device?.sua,
page: bidderRequest?.ortb2?.site?.page || bidderRequest?.refererInfo?.page
}
}
}
Expand Down Expand Up @@ -170,8 +171,7 @@ function buildPlacement(bidRequest) {
custom2: bidRequest.params.custom2,
custom3: bidRequest.params.custom3,
custom4: bidRequest.params.custom4,
custom5: bidRequest.params.custom5,
page: bidRequest.refererInfo.page
custom5: bidRequest.params.custom5
}
}
}
36 changes: 19 additions & 17 deletions test/spec/modules/limelightDigitalBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ describe('limelightDigitalAdapter', function () {
custom4: 'custom4',
custom5: 'custom5'
},
refererInfo: {
page: 'https://publisher.com/page1'
},
placementCode: 'placement_0',
auctionId: '74f78609-a92d-4cf1-869f-1b244bbfb5d2',
mediaTypes: {
Expand Down Expand Up @@ -68,9 +65,6 @@ describe('limelightDigitalAdapter', function () {
custom4: 'custom4',
custom5: 'custom5'
},
refererInfo: {
page: 'https://publisher.com/page2'
},
placementCode: 'placement_1',
auctionId: '482f88de-29ab-45c8-981a-d25e39454a34',
sizes: [[350, 200]],
Expand Down Expand Up @@ -121,9 +115,6 @@ describe('limelightDigitalAdapter', function () {
custom4: 'custom4',
custom5: 'custom5'
},
refererInfo: {
page: 'https://publisher.com/page3'
},
placementCode: 'placement_2',
auctionId: 'e4771143-6aa7-41ec-8824-ced4342c96c8',
sizes: [[800, 600]],
Expand Down Expand Up @@ -171,9 +162,6 @@ describe('limelightDigitalAdapter', function () {
custom4: 'custom4',
custom5: 'custom5'
},
refererInfo: {
page: 'https://publisher.com/page4'
},
placementCode: 'placement_2',
auctionId: 'e4771143-6aa7-41ec-8824-ced4342c96c8',
video: {
Expand Down Expand Up @@ -218,6 +206,9 @@ describe('limelightDigitalAdapter', function () {
architecture: 'arm'
}
}
},
refererInfo: {
page: 'testPage'
}
}
const serverRequests = spec.buildRequests([bid1, bid2, bid3, bid4], bidderRequest)
Expand All @@ -243,7 +234,8 @@ describe('limelightDigitalAdapter', function () {
'deviceHeight',
'secure',
'adUnits',
'sua'
'sua',
'page'
);
expect(data.deviceWidth).to.be.a('number');
expect(data.deviceHeight).to.be.a('number');
Expand All @@ -262,8 +254,7 @@ describe('limelightDigitalAdapter', function () {
'custom2',
'custom3',
'custom4',
'custom5',
'page'
'custom5'
);
expect(adUnit.id).to.be.a('number');
expect(adUnit.bidId).to.be.a('string');
Expand All @@ -277,12 +268,13 @@ describe('limelightDigitalAdapter', function () {
expect(adUnit.custom3).to.be.a('string');
expect(adUnit.custom4).to.be.a('string');
expect(adUnit.custom5).to.be.a('string');
expect(adUnit.page).to.be.a('string');
})
expect(data.sua.browsers).to.be.a('array');
expect(data.sua.platform).to.be.a('array');
expect(data.sua.mobile).to.be.a('number');
expect(data.sua.architecture).to.be.a('string');
expect(data.page).to.be.a('string');
expect(data.page).to.be.equal('testPage');
})
})
it('Returns valid URL', function () {
Expand All @@ -298,6 +290,17 @@ describe('limelightDigitalAdapter', function () {
const serverRequests = spec.buildRequests([])
expect(serverRequests).to.be.an('array').that.is.empty
})
it('Returns request with page field value from ortb2 object if ortb2 has page field', function () {
bidderRequest.ortb2.site = {
page: 'testSitePage'
}
const serverRequests = spec.buildRequests([bid1], bidderRequest)
expect(serverRequests).to.have.lengthOf(1)
serverRequests.forEach(serverRequest => {
expect(serverRequest.data.page).to.be.a('string');
expect(serverRequest.data.page).to.be.equal('testSitePage');
})
})
})
describe('interpretBannerResponse', function () {
let resObject = {
Expand Down Expand Up @@ -716,5 +719,4 @@ function validateAdUnit(adUnit, bid) {
expect(adUnit.publisherId).to.equal(bid.params.publisherId);
expect(adUnit.userIdAsEids).to.deep.equal(bid.userIdAsEids);
expect(adUnit.supplyChain).to.deep.equal(bid.schain);
expect(adUnit.page).to.equal(bid.refererInfo.page);
}

0 comments on commit 7ab6165

Please sign in to comment.