Skip to content

Commit

Permalink
convert bidders: criteo
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi committed May 20, 2022
1 parent 5cf6955 commit 985dcbc
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
3 changes: 2 additions & 1 deletion modules/cpmstarBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion modules/craftBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
4 changes: 2 additions & 2 deletions modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/cpmstarBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const valid_bid_requests = [{

const bidderRequest = {
refererInfo: {
referer: 'referer',
page: 'referer',
reachedTop: false,
}
};
Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/craftBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
9 changes: 6 additions & 3 deletions test/spec/modules/criteoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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
};
Expand Down

0 comments on commit 985dcbc

Please sign in to comment.