From 985dcbca4d92d1095ad3223aa1b7744f6ff1994e Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Fri, 20 May 2022 09:14:29 -0700 Subject: [PATCH] convert bidders: criteo --- modules/cpmstarBidAdapter.js | 3 ++- modules/craftBidAdapter.js | 3 ++- modules/criteoBidAdapter.js | 4 ++-- test/spec/modules/cpmstarBidAdapter_spec.js | 2 +- test/spec/modules/craftBidAdapter_spec.js | 2 +- test/spec/modules/criteoBidAdapter_spec.js | 9 ++++++--- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/modules/cpmstarBidAdapter.js b/modules/cpmstarBidAdapter.js index 75a7007ee36..6e32c5c4713 100755 --- a/modules/cpmstarBidAdapter.js +++ b/modules/cpmstarBidAdapter.js @@ -46,7 +46,8 @@ export const spec = { for (var i = 0; i < validBidRequests.length; i++) { var bidRequest = validBidRequests[i]; - var referer = encodeURIComponent(bidderRequest.refererInfo.referer); + // TODO: is 'page' the right value here? + var referer = encodeURIComponent(bidderRequest.refererInfo.page); var e = getBidIdParameter('endpoint', bidRequest.params); var ENDPOINT = e == 'dev' ? ENDPOINT_DEV : e == 'staging' ? ENDPOINT_STAGING : ENDPOINT_PRODUCTION; var mediaType = spec.getMediaType(bidRequest); diff --git a/modules/craftBidAdapter.js b/modules/craftBidAdapter.js index 61ca4f929e7..777b71e31e3 100644 --- a/modules/craftBidAdapter.js +++ b/modules/craftBidAdapter.js @@ -51,7 +51,8 @@ export const spec = { } if (bidderRequest && bidderRequest.refererInfo) { let refererinfo = { - rd_ref: bidderRequest.refererInfo.referer, + // TODO: this collects everything it finds, except for the canonical URL + rd_ref: bidderRequest.refererInfo.topmostLocation, rd_top: bidderRequest.refererInfo.reachedTop, rd_ifs: bidderRequest.refererInfo.numIframes, }; diff --git a/modules/criteoBidAdapter.js b/modules/criteoBidAdapter.js index 114326d0dab..2da09c548c1 100644 --- a/modules/criteoBidAdapter.js +++ b/modules/criteoBidAdapter.js @@ -224,9 +224,9 @@ function publisherTagAvailable() { function buildContext(bidRequests, bidderRequest) { let referrer = ''; if (bidderRequest && bidderRequest.refererInfo) { - referrer = bidderRequest.refererInfo.referer; + referrer = bidderRequest.refererInfo.page; } - const queryString = parseUrl(referrer).search; + const queryString = parseUrl(bidderRequest?.refererInfo?.topmostLocation).search; const context = { url: referrer, diff --git a/test/spec/modules/cpmstarBidAdapter_spec.js b/test/spec/modules/cpmstarBidAdapter_spec.js index 285fca9690a..dd076d060b9 100755 --- a/test/spec/modules/cpmstarBidAdapter_spec.js +++ b/test/spec/modules/cpmstarBidAdapter_spec.js @@ -14,7 +14,7 @@ const valid_bid_requests = [{ const bidderRequest = { refererInfo: { - referer: 'referer', + page: 'referer', reachedTop: false, } }; diff --git a/test/spec/modules/craftBidAdapter_spec.js b/test/spec/modules/craftBidAdapter_spec.js index 3f4bc977016..9bb8c7f9880 100644 --- a/test/spec/modules/craftBidAdapter_spec.js +++ b/test/spec/modules/craftBidAdapter_spec.js @@ -75,7 +75,7 @@ describe('craftAdapter', function () { }]; let bidderRequest = { refererInfo: { - referer: 'https://www.gacraft.jp/publish/craft-prebid-example.html' + topmostLocation: 'https://www.gacraft.jp/publish/craft-prebid-example.html' } }; it('sends bid request to ENDPOINT via POST', function () { diff --git a/test/spec/modules/criteoBidAdapter_spec.js b/test/spec/modules/criteoBidAdapter_spec.js index aaec33d9931..634fd757e4a 100755 --- a/test/spec/modules/criteoBidAdapter_spec.js +++ b/test/spec/modules/criteoBidAdapter_spec.js @@ -404,7 +404,8 @@ describe('The Criteo bidding adapter', function () { const refererUrl = 'https://criteo.com?pbt_debug=1&pbt_nolog=1'; const bidderRequest = { refererInfo: { - referer: refererUrl + page: refererUrl, + topmostLocation: refererUrl }, timeout: 3000, gdprConsent: { @@ -553,7 +554,8 @@ describe('The Criteo bidding adapter', function () { it('should properly build a networkId request', function () { const bidderRequest = { refererInfo: { - referer: refererUrl + page: refererUrl, + topmostLocation: refererUrl, }, timeout: 3000, gdprConsent: { @@ -600,7 +602,8 @@ describe('The Criteo bidding adapter', function () { it('should properly build a mixed request', function () { const bidderRequest = { refererInfo: { - referer: refererUrl + page: refererUrl, + topmostLocation: refererUrl, }, timeout: 3000 };