Skip to content

Commit

Permalink
medianetBidAdapter refererInfo, transactionId and ortb2 changes (preb…
Browse files Browse the repository at this point in the history
…id#8607)

Co-authored-by: monis.q <[email protected]>
  • Loading branch information
2 people authored and bwhisp committed Jul 13, 2022
1 parent ca279c2 commit cd0c8a6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
14 changes: 9 additions & 5 deletions modules/medianetBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ function getTopWindowReferrer() {
}
}

function siteDetails(site) {
function siteDetails(site, bidderRequest) {
const urlData = bidderRequest.refererInfo;
site = site || {};
let siteData = {
domain: site.domain || mnData.urlData.domain,
page: site.page || mnData.urlData.page,
domain: site.domain || urlData.domain,
page: site.page || urlData.page,
ref: site.ref || getTopWindowReferrer(),
isTop: site.isTop || mnData.urlData.isTop
topMostLocation: urlData.topmostLocation,
isTop: site.isTop || urlData.reachedTop
};

return Object.assign(siteData, getPageMeta());
Expand Down Expand Up @@ -187,6 +189,7 @@ function slotParams(bidRequest) {
// check with Media.net Account manager for bid floor and crid parameters
let params = {
id: bidRequest.bidId,
transactionId: bidRequest.transactionId,
ext: {
dfp_id: bidRequest.adUnitCode,
display_count: bidRequest.bidRequestsCount
Expand Down Expand Up @@ -320,10 +323,11 @@ function getBidderURL(cid) {

function generatePayload(bidRequests, bidderRequests) {
return {
site: siteDetails(bidRequests[0].params.site),
site: siteDetails(bidRequests[0].params.site, bidderRequests),
ext: extParams(bidRequests[0], bidderRequests),
id: bidRequests[0].auctionId,
imp: bidRequests.map(request => slotParams(request)),
ortb2: bidderRequests.ortb2,
tmax: bidderRequests.timeout || config.getConfig('bidderTimeout')
}
}
Expand Down
25 changes: 24 additions & 1 deletion test/spec/modules/medianetBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ let VALID_BID_REQUEST = [{
'refererInfo': {
referer: 'http://media.net/prebidtest',
stack: ['http://media.net/prebidtest'],
page: 'http://media.net/page',
domain: 'media.net',
topmostLocation: 'http://media.net/topmost',
reachedTop: true
}
},
Expand All @@ -369,6 +372,7 @@ let VALID_BID_REQUEST = [{
'page': 'http://media.net/prebidtest',
'domain': 'media.net',
'ref': 'http://media.net/prebidtest',
'topMostLocation': 'http://media.net/topmost',
'isTop': true
},
'ext': {
Expand All @@ -385,6 +389,7 @@ let VALID_BID_REQUEST = [{
'id': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d',
'imp': [{
'id': '28f8f8130a583e',
'transactionId': '277b631f-92f5-4844-8b19-ea13c095d3f1',
'ext': {
'dfp_id': 'div-gpt-ad-1460505748561-0',
'visibility': 1,
Expand Down Expand Up @@ -417,6 +422,7 @@ let VALID_BID_REQUEST = [{
}
}, {
'id': '3f97ca71b1e5c2',
'transactionId': 'c52a5c62-3c2b-4b90-9ff8-ec1487754822',
'ext': {
'dfp_id': 'div-gpt-ad-1460505748561-123',
'visibility': 1,
Expand Down Expand Up @@ -454,6 +460,7 @@ let VALID_BID_REQUEST = [{
'page': 'http://media.net/prebidtest',
'domain': 'media.net',
'ref': 'http://media.net/prebidtest',
'topMostLocation': 'http://media.net/topmost',
'isTop': true
},
'ext': {
Expand All @@ -470,6 +477,7 @@ let VALID_BID_REQUEST = [{
'id': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d',
'imp': [{
'id': '28f8f8130a583e',
'transactionId': '277b631f-92f5-4844-8b19-ea13c095d3f1',
'ext': {
'dfp_id': 'div-gpt-ad-1460505748561-0',
'visibility': 1,
Expand Down Expand Up @@ -502,6 +510,7 @@ let VALID_BID_REQUEST = [{
}
}, {
'id': '3f97ca71b1e5c2',
'transactionId': 'c52a5c62-3c2b-4b90-9ff8-ec1487754822',
'ext': {
'dfp_id': 'div-gpt-ad-1460505748561-123',
'visibility': 1,
Expand Down Expand Up @@ -540,6 +549,7 @@ let VALID_BID_REQUEST = [{
'page': 'http://media.net/prebidtest',
'domain': 'media.net',
'ref': 'http://media.net/prebidtest',
'topMostLocation': 'http://media.net/topmost',
'isTop': true
},
'ext': {
Expand All @@ -556,6 +566,7 @@ let VALID_BID_REQUEST = [{
'id': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d',
'imp': [{
'id': '28f8f8130a583e',
'transactionId': '277b631f-92f5-4844-8b19-ea13c095d3f1',
'ext': {
'dfp_id': 'div-gpt-ad-1460505748561-0',
'visibility': 1,
Expand Down Expand Up @@ -587,6 +598,7 @@ let VALID_BID_REQUEST = [{
}
}, {
'id': '3f97ca71b1e5c2',
'transactionId': 'c52a5c62-3c2b-4b90-9ff8-ec1487754822',
'ext': {
'dfp_id': 'div-gpt-ad-1460505748561-123',
'visibility': 1,
Expand Down Expand Up @@ -624,6 +636,7 @@ let VALID_BID_REQUEST = [{
'page': 'http://media.net/prebidtest',
'domain': 'media.net',
'ref': 'http://media.net/prebidtest',
'topMostLocation': 'http://media.net/topmost',
'isTop': true
},
'ext': {
Expand All @@ -643,6 +656,7 @@ let VALID_BID_REQUEST = [{
'id': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d',
'imp': [{
'id': '28f8f8130a583e',
'transactionId': '277b631f-92f5-4844-8b19-ea13c095d3f1',
'tagid': 'crid',
'ext': {
'dfp_id': 'div-gpt-ad-1460505748561-0',
Expand Down Expand Up @@ -676,6 +690,7 @@ let VALID_BID_REQUEST = [{
}
}, {
'id': '3f97ca71b1e5c2',
'transactionId': 'c52a5c62-3c2b-4b90-9ff8-ec1487754822',
'tagid': 'crid',
'ext': {
'dfp_id': 'div-gpt-ad-1460505748561-123',
Expand Down Expand Up @@ -715,6 +730,7 @@ let VALID_BID_REQUEST = [{
'page': 'http://media.net/prebidtest',
'domain': 'media.net',
'ref': 'http://media.net/prebidtest',
'topMostLocation': 'http://media.net/topmost',
'isTop': true
},
'ext': {
Expand All @@ -731,6 +747,7 @@ let VALID_BID_REQUEST = [{
'id': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d',
'imp': [{
'id': '28f8f8130a583e',
'transactionId': '277b631f-92f5-4844-8b19-ea13c095d3f1',
'tagid': 'crid',
'ext': {
'dfp_id': 'div-gpt-ad-1460505748561-0',
Expand Down Expand Up @@ -764,6 +781,7 @@ let VALID_BID_REQUEST = [{
}
}, {
'id': '3f97ca71b1e5c2',
'transactionId': 'c52a5c62-3c2b-4b90-9ff8-ec1487754822',
'tagid': 'crid',
'ext': {
'dfp_id': 'div-gpt-ad-1460505748561-123',
Expand Down Expand Up @@ -1105,6 +1123,9 @@ let VALID_BID_REQUEST = [{
refererInfo: {
referer: 'http://media.net/prebidtest',
stack: ['http://media.net/prebidtest'],
page: 'http://media.net/page',
domain: 'media.net',
topmostLocation: 'http://media.net/topmost',
reachedTop: true
}
},
Expand All @@ -1113,8 +1134,8 @@ let VALID_BID_REQUEST = [{
'domain': 'media.net',
'page': 'http://media.net/prebidtest',
'ref': 'http://media.net/prebidtest',
'topMostLocation': 'http://media.net/topmost',
'isTop': true

},
'ext': {
'customer_id': 'customer_id',
Expand All @@ -1132,6 +1153,7 @@ let VALID_BID_REQUEST = [{
'id': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d',
'imp': [{
'id': '28f8f8130a583e',
'transactionId': '277b631f-92f5-4844-8b19-ea13c095d3f1',
'ext': {
'dfp_id': 'div-gpt-ad-1460505748561-0',
'visibility': 1,
Expand Down Expand Up @@ -1163,6 +1185,7 @@ let VALID_BID_REQUEST = [{
}
}, {
'id': '3f97ca71b1e5c2',
'transactionId': 'c52a5c62-3c2b-4b90-9ff8-ec1487754822',
'ext': {
'dfp_id': 'div-gpt-ad-1460505748561-123',
'visibility': 1,
Expand Down

0 comments on commit cd0c8a6

Please sign in to comment.