Skip to content

Commit 0be4560

Browse files
JacobKlein26shahinrahbariaslshahin-rahbariasldgirardikakikei
authored
NextMillennium Bid Adapter: Add ortb and element offsets (#8671)
* ortb2 and el offsets * return empty object * ortb2 and el offsets * IX Bid Adapter: Add support for impression level transactionId (imp[].ext.tid) (#8641) * IX Bid Adapter: add imp ext tid support * fix tid level in imp ext object Co-authored-by: shahin.rahbariasl <[email protected]> * PBjs Core Price Floors Module: improve logging on bid rejections to clarify which CPM is being compared with which floor (#8655) * Price floors module: improve logging on bid rejections to clarify which CPM is being compared with which floor * Use full precision in log message * Adgeneration Bid Adpter: add Criteo system and ID5 system and update test. (#8642) * update Adgeneration to add Criteo system and ID5 systems. * Change method name. * Correction_of_code_and_test_specs. * Adding adgext_id5_id_link_type parameter to ID5 object. * return empty object * fix ortb location (not in ext) * add unit testing Co-authored-by: shahinrahbariasl <[email protected]> Co-authored-by: shahin.rahbariasl <[email protected]> Co-authored-by: Demetrio Girardi <[email protected]> Co-authored-by: Keisuke Kakinuma <[email protected]>
1 parent 9af6d0c commit 0be4560

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

modules/nextMillenniumBidAdapter.js

+17-1
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ export const spec = {
3535

3636
'nextMillennium': {
3737
'refresh_count': window.nmmRefreshCounts[bid.adUnitCode]++,
38+
'elOffsets': getBoundingClient(bid),
39+
'scrollTop': window.pageYOffset || document.documentElement.scrollTop
3840
}
39-
}
41+
},
42+
...bid.ortb2
4043
}
4144

4245
const gdprConsent = bidderRequest && bidderRequest.gdprConsent;
@@ -132,6 +135,19 @@ export const spec = {
132135
}];
133136
},
134137
};
138+
function getAdEl(bid) {
139+
// best way I could think of to get El, is by matching adUnitCode to google slots...
140+
const slot = window.googletag && window.googletag.pubads && window.googletag.pubads().getSlots().find(slot => slot.getAdUnitPath() === bid.adUnitCode);
141+
const slotElementId = slot && slot.getSlotElementId();
142+
if (!slotElementId) return null;
143+
return document.querySelector('#' + slotElementId);
144+
}
145+
function getBoundingClient(bid) {
146+
// console.log(bid)
147+
const el = getAdEl(bid)
148+
if (!el) return {}
149+
return el.getBoundingClientRect();
150+
}
135151

136152
function getPlacementId(bid) {
137153
const groupId = getBidIdParameter('group_id', bid.params)

test/spec/modules/nextMillenniumBidAdapter_spec.js

+20
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ describe('nextMillenniumBidAdapterTests', function() {
1414
gdprConsent: {
1515
consentString: 'kjfdniwjnifwenrif3',
1616
gdprApplies: true
17+
},
18+
ortb2: {
19+
device: {
20+
w: 1500,
21+
h: 1000
22+
},
23+
site: {
24+
domain: 'example.com',
25+
page: 'http://example.com'
26+
}
1727
}
1828
}
1929
];
@@ -94,6 +104,16 @@ describe('nextMillenniumBidAdapterTests', function() {
94104
expect(JSON.parse(request[0].data).ext.nextMillennium.refresh_count).to.equal(3);
95105
});
96106

107+
it('Check if ORTB was added', function() {
108+
const request = spec.buildRequests(bidRequestData)
109+
expect(JSON.parse(request[0].data).site.domain).to.equal('example.com')
110+
})
111+
112+
it('Check if elOffsets was added', function() {
113+
const request = spec.buildRequests(bidRequestData)
114+
expect(JSON.parse(request[0].data).ext.nextMillennium.elOffsets).to.be.an('object')
115+
})
116+
97117
it('Test getUserSyncs function', function () {
98118
const syncOptions = {
99119
'iframeEnabled': true

0 commit comments

Comments
 (0)