Skip to content

Commit

Permalink
NextMillennium Bid Adapter: Add ortb and element offsets (#8671)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
5 people authored Jul 13, 2022
1 parent 9af6d0c commit 0be4560
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
18 changes: 17 additions & 1 deletion modules/nextMillenniumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ export const spec = {

'nextMillennium': {
'refresh_count': window.nmmRefreshCounts[bid.adUnitCode]++,
'elOffsets': getBoundingClient(bid),
'scrollTop': window.pageYOffset || document.documentElement.scrollTop
}
}
},
...bid.ortb2
}

const gdprConsent = bidderRequest && bidderRequest.gdprConsent;
Expand Down Expand Up @@ -132,6 +135,19 @@ export const spec = {
}];
},
};
function getAdEl(bid) {
// best way I could think of to get El, is by matching adUnitCode to google slots...
const slot = window.googletag && window.googletag.pubads && window.googletag.pubads().getSlots().find(slot => slot.getAdUnitPath() === bid.adUnitCode);
const slotElementId = slot && slot.getSlotElementId();
if (!slotElementId) return null;
return document.querySelector('#' + slotElementId);
}
function getBoundingClient(bid) {
// console.log(bid)
const el = getAdEl(bid)
if (!el) return {}
return el.getBoundingClientRect();
}

function getPlacementId(bid) {
const groupId = getBidIdParameter('group_id', bid.params)
Expand Down
20 changes: 20 additions & 0 deletions test/spec/modules/nextMillenniumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ describe('nextMillenniumBidAdapterTests', function() {
gdprConsent: {
consentString: 'kjfdniwjnifwenrif3',
gdprApplies: true
},
ortb2: {
device: {
w: 1500,
h: 1000
},
site: {
domain: 'example.com',
page: 'http://example.com'
}
}
}
];
Expand Down Expand Up @@ -94,6 +104,16 @@ describe('nextMillenniumBidAdapterTests', function() {
expect(JSON.parse(request[0].data).ext.nextMillennium.refresh_count).to.equal(3);
});

it('Check if ORTB was added', function() {
const request = spec.buildRequests(bidRequestData)
expect(JSON.parse(request[0].data).site.domain).to.equal('example.com')
})

it('Check if elOffsets was added', function() {
const request = spec.buildRequests(bidRequestData)
expect(JSON.parse(request[0].data).ext.nextMillennium.elOffsets).to.be.an('object')
})

it('Test getUserSyncs function', function () {
const syncOptions = {
'iframeEnabled': true
Expand Down

0 comments on commit 0be4560

Please sign in to comment.