From 5ec60e45e1c871427aa234c06e243bb4ab98bdc7 Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Fri, 20 May 2022 12:44:58 -0700 Subject: [PATCH] convert bidders: operaads --- modules/mytargetBidAdapter.js | 2 +- modules/nativoBidAdapter.js | 2 +- modules/nextrollBidAdapter.js | 3 ++- modules/nexx360BidAdapter.js | 3 ++- modules/nobidBidAdapter.js | 5 +++-- modules/onomagicBidAdapter.js | 5 +++-- modules/openwebBidAdapter.js | 3 ++- modules/openxBidAdapter.js | 2 +- modules/operaadsBidAdapter.js | 9 ++++----- test/spec/modules/mytargetBidAdapter_spec.js | 2 +- test/spec/modules/nobidBidAdapter_spec.js | 14 +++++++------- test/spec/modules/operaadsBidAdapter_spec.js | 4 ++-- 12 files changed, 29 insertions(+), 25 deletions(-) diff --git a/modules/mytargetBidAdapter.js b/modules/mytargetBidAdapter.js index f55f2e6b802..b9ce8b133d1 100644 --- a/modules/mytargetBidAdapter.js +++ b/modules/mytargetBidAdapter.js @@ -51,7 +51,7 @@ export const spec = { let referrer = ''; if (bidderRequest && bidderRequest.refererInfo) { - referrer = bidderRequest.refererInfo.referer; + referrer = bidderRequest.refererInfo.page; } const payload = { diff --git a/modules/nativoBidAdapter.js b/modules/nativoBidAdapter.js index e07a124665f..ff6ae0887b4 100644 --- a/modules/nativoBidAdapter.js +++ b/modules/nativoBidAdapter.js @@ -138,7 +138,7 @@ export const spec = { pageUrl = deepAccess( request, 'params.url', - bidderRequest.refererInfo.referer + bidderRequest.refererInfo.page ) placementId = deepAccess(request, 'params.placementId') diff --git a/modules/nextrollBidAdapter.js b/modules/nextrollBidAdapter.js index da5c0c848bf..533c47e1ea6 100644 --- a/modules/nextrollBidAdapter.js +++ b/modules/nextrollBidAdapter.js @@ -39,7 +39,8 @@ export const spec = { * @return ServerRequest Info describing the request to the server. */ buildRequests: function (validBidRequests, bidderRequest) { - let topLocation = parseUrl(deepAccess(bidderRequest, 'refererInfo.referer')); + // TODO: is 'page' the right value here? + let topLocation = parseUrl(deepAccess(bidderRequest, 'refererInfo.page')); return validBidRequests.map((bidRequest) => { return { diff --git a/modules/nexx360BidAdapter.js b/modules/nexx360BidAdapter.js index 814a2f55299..ed0c0c66a7a 100644 --- a/modules/nexx360BidAdapter.js +++ b/modules/nexx360BidAdapter.js @@ -59,7 +59,8 @@ export const spec = { }); const payload = { adUnits, - href: encodeURIComponent(bidderRequest.refererInfo.referer) + // TODO: does the fallback make sense here? + href: encodeURIComponent(bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation) }; if (bidderRequest) { // modules informations (gdpr, ccpa, schain, userId) if (bidderRequest.gdprConsent) { diff --git a/modules/nobidBidAdapter.js b/modules/nobidBidAdapter.js index 08119beafb4..b69f3b09d97 100644 --- a/modules/nobidBidAdapter.js +++ b/modules/nobidBidAdapter.js @@ -88,9 +88,10 @@ function nobidBuildRequests(bids, bidderRequest) { } var topLocation = function(bidderRequest) { var ret = ''; - if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) { - ret = bidderRequest.refererInfo.referer; + if (bidderRequest?.refererInfo?.page) { + ret = bidderRequest.refererInfo.page; } else { + // TODO: does this fallback make sense here? ret = (window.context && window.context.location && window.context.location.href) ? window.context.location.href : document.location.href; } return encodeURIComponent(ret.replace(/\%/g, '')); diff --git a/modules/onomagicBidAdapter.js b/modules/onomagicBidAdapter.js index 25b0f1a5934..67aed585db1 100644 --- a/modules/onomagicBidAdapter.js +++ b/modules/onomagicBidAdapter.js @@ -19,7 +19,7 @@ function buildRequests(bidReqs, bidderRequest) { try { let referrer = ''; if (bidderRequest && bidderRequest.refererInfo) { - referrer = bidderRequest.refererInfo.referer; + referrer = bidderRequest.refererInfo.page; } const onomagicImps = []; const publisherId = getBidIdParameter('publisherId', bidReqs[0].params); @@ -56,7 +56,8 @@ function buildRequests(bidReqs, bidderRequest) { id: getUniqueIdentifierStr(), imp: onomagicImps, site: { - domain: parseUrl(referrer).host, + // TODO: does the fallback make sense here? + domain: bidderRequest?.refererInfo?.domain || window.location.hostname, page: referrer, publisher: { id: publisherId diff --git a/modules/openwebBidAdapter.js b/modules/openwebBidAdapter.js index f515eb14011..f07b37e16e1 100644 --- a/modules/openwebBidAdapter.js +++ b/modules/openwebBidAdapter.js @@ -126,7 +126,8 @@ function parseRTBResponse(serverResponse, adapterRequest) { function bidToTag(bidRequests, adapterRequest) { // start publisher env const tag = { - Domain: deepAccess(adapterRequest, 'refererInfo.referer') + // TODO: is 'page' the right value here? + Domain: deepAccess(adapterRequest, 'refererInfo.page') }; if (config.getConfig('coppa') === true) { tag.Coppa = 1; diff --git a/modules/openxBidAdapter.js b/modules/openxBidAdapter.js index 065b8bdf47a..c780a585542 100644 --- a/modules/openxBidAdapter.js +++ b/modules/openxBidAdapter.js @@ -258,7 +258,7 @@ function buildCommonQueryParamsFromBids(bids, bidderRequest) { let defaultParams; defaultParams = { - ju: config.getConfig('pageUrl') || bidderRequest.refererInfo.referer, + ju: bidderRequest.refererInfo.page, ch: document.charSet || document.characterSet, res: `${screen.width}x${screen.height}x${screen.colorDepth}`, ifr: isInIframe, diff --git a/modules/operaadsBidAdapter.js b/modules/operaadsBidAdapter.js index 61ea8cdcb76..0331c8d3496 100644 --- a/modules/operaadsBidAdapter.js +++ b/modules/operaadsBidAdapter.js @@ -209,8 +209,6 @@ export const spec = { * @returns {Request} */ function buildOpenRtbBidRequest(bidRequest, bidderRequest) { - const pageReferrer = deepAccess(bidderRequest, 'refererInfo.referer'); - // build OpenRTB request body const payload = { id: bidderRequest.auctionId, @@ -220,9 +218,10 @@ function buildOpenRtbBidRequest(bidRequest, bidderRequest) { device: getDevice(), site: { id: String(deepAccess(bidRequest, 'params.publisherId')), - domain: getDomain(pageReferrer), - page: pageReferrer, - ref: window.self === window.top ? document.referrer : '', + // TODO: does the fallback make sense here? + domain: bidderRequest?.refererInfo?.domain || window.location.hostname, + page: bidderRequest?.refererInfo?.page, + ref: bidderRequest?.refererInfo?.ref || '', }, at: 1, bcat: getBcat(bidRequest), diff --git a/test/spec/modules/mytargetBidAdapter_spec.js b/test/spec/modules/mytargetBidAdapter_spec.js index 62d139bb926..8880efd3d7c 100644 --- a/test/spec/modules/mytargetBidAdapter_spec.js +++ b/test/spec/modules/mytargetBidAdapter_spec.js @@ -46,7 +46,7 @@ describe('MyTarget Adapter', function() { ]; let bidderRequest = { refererInfo: { - referer: 'https://example.com?param=value' + page: 'https://example.com?param=value' } }; diff --git a/test/spec/modules/nobidBidAdapter_spec.js b/test/spec/modules/nobidBidAdapter_spec.js index 6af803c66f3..7ea89f7dd3f 100644 --- a/test/spec/modules/nobidBidAdapter_spec.js +++ b/test/spec/modules/nobidBidAdapter_spec.js @@ -70,7 +70,7 @@ describe('Nobid Adapter', function () { ]; let bidderRequest = { - refererInfo: {referer: REFERER}, bidderCode: BIDDER_CODE + refererInfo: {page: REFERER}, bidderCode: BIDDER_CODE } const siteName = 'example'; @@ -132,7 +132,7 @@ describe('Nobid Adapter', function () { ]; let bidderRequest = { - refererInfo: {referer: REFERER}, bidderCode: BIDDER_CODE + refererInfo: {page: REFERER}, bidderCode: BIDDER_CODE } it('should add source and version to the tag', function () { @@ -306,7 +306,7 @@ describe('Nobid Adapter', function () { ]; let bidderRequest = { - refererInfo: {referer: REFERER} + refererInfo: {page: REFERER} } it('should add source and version to the tag', function () { @@ -395,7 +395,7 @@ describe('Nobid Adapter', function () { ]; let bidderRequest = { - refererInfo: {referer: REFERER} + refererInfo: {page: REFERER} } it('should add source and version to the tag', function () { @@ -481,7 +481,7 @@ describe('Nobid Adapter', function () { ]; let bidderRequest = { - refererInfo: {referer: REFERER} + refererInfo: {page: REFERER} } it('should criteo eid', function () { @@ -515,7 +515,7 @@ describe('Nobid Adapter', function () { ]; let bidderRequest = { - refererInfo: {referer: REFERER} + refererInfo: {page: REFERER} } it('should add source and version to the tag', function () { @@ -649,7 +649,7 @@ describe('Nobid Adapter', function () { ]; let bidderRequest = { - refererInfo: {referer: REFERER} + refererInfo: {page: REFERER} } it('should refreshCount = 4', function () { diff --git a/test/spec/modules/operaadsBidAdapter_spec.js b/test/spec/modules/operaadsBidAdapter_spec.js index 849a3eada3f..45bc8995a5c 100644 --- a/test/spec/modules/operaadsBidAdapter_spec.js +++ b/test/spec/modules/operaadsBidAdapter_spec.js @@ -49,7 +49,7 @@ describe('Opera Ads Bid Adapter', function () { bidderCode: 'myBidderCode', bidderRequestId: '15246a574e859f', refererInfo: { - referer: 'http://example.com', + page: 'http://example.com', stack: ['http://example.com'] }, gdprConsent: { @@ -242,7 +242,7 @@ describe('Opera Ads Bid Adapter', function () { expect(requestData.site).to.be.an('object'); expect(requestData.site.id).to.equal(bidRequest.params.publisherId); expect(requestData.site.domain).to.not.be.empty; - expect(requestData.site.page).to.equal(bidderRequest.refererInfo.referer); + expect(requestData.site.page).to.equal(bidderRequest.refererInfo.page); expect(requestData.at).to.equal(1); expect(requestData.bcat).to.be.an('array').that.is.empty; expect(requestData.cur).to.be.an('array').that.not.be.empty;