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

Medianet Bidder Adpater: Support for FPD, transactionId and url changes #8607

Merged
merged 1 commit into from
Jun 23, 2022
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
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