From b0373ea7b4bb1343bf971cbd446ceac1700a1813 Mon Sep 17 00:00:00 2001 From: Nicolas Faure Date: Wed, 25 Jul 2018 11:22:34 +0200 Subject: [PATCH 1/2] Pass Prebid version to Criteo direct bidder --- modules/criteoBidAdapter.js | 3 ++- test/spec/modules/criteoBidAdapter_spec.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/criteoBidAdapter.js b/modules/criteoBidAdapter.js index 81da55ebf67..7f5d1b7b280 100755 --- a/modules/criteoBidAdapter.js +++ b/modules/criteoBidAdapter.js @@ -51,7 +51,7 @@ export const spec = { } if (publisherTagAvailable()) { - const adapter = new Criteo.PubTag.Adapters.Prebid(PROFILE_ID, ADAPTER_VERSION, bidRequests, bidderRequest); + const adapter = new Criteo.PubTag.Adapters.Prebid(PROFILE_ID, ADAPTER_VERSION, bidRequests, bidderRequest, '$prebid.version$'); url = adapter.buildCdbUrl(); data = adapter.buildCdbRequest(); } else { @@ -158,6 +158,7 @@ function buildCdbUrl(context) { let url = CDB_ENDPOINT; url += '?profileId=' + PROFILE_ID; url += '&av=' + String(ADAPTER_VERSION); + url += '&wv=' + encodeURIComponent('$prebid.version$'); url += '&cb=' + String(Math.floor(Math.random() * 99999999999)); if (context.integrationMode in INTEGRATION_MODES) { diff --git a/test/spec/modules/criteoBidAdapter_spec.js b/test/spec/modules/criteoBidAdapter_spec.js index e855c828b1f..6e2276d7e22 100755 --- a/test/spec/modules/criteoBidAdapter_spec.js +++ b/test/spec/modules/criteoBidAdapter_spec.js @@ -73,7 +73,7 @@ describe('The Criteo bidding adapter', () => { }, ]; const request = spec.buildRequests(bidRequests, bidderRequest); - expect(request.url).to.match(/^\/\/bidder\.criteo\.com\/cdb\?profileId=207&av=\d+&cb=\d/); + expect(request.url).to.match(/^\/\/bidder\.criteo\.com\/cdb\?profileId=207&av=\d+&wv=[^&]+&cb=\d/); expect(request.method).to.equal('POST'); const ortbRequest = request.data; expect(ortbRequest.publisher.url).to.equal(utils.getTopWindowUrl()); @@ -113,7 +113,7 @@ describe('The Criteo bidding adapter', () => { }, ]; const request = spec.buildRequests(bidRequests, bidderRequest); - expect(request.url).to.match(/^\/\/bidder\.criteo\.com\/cdb\?profileId=207&av=\d+&cb=\d/); + expect(request.url).to.match(/^\/\/bidder\.criteo\.com\/cdb\?profileId=207&av=\d+&wv=[^&]+&cb=\d/); expect(request.method).to.equal('POST'); const ortbRequest = request.data; expect(ortbRequest.publisher.url).to.equal(utils.getTopWindowUrl()); @@ -152,7 +152,7 @@ describe('The Criteo bidding adapter', () => { }, ]; const request = spec.buildRequests(bidRequests, bidderRequest); - expect(request.url).to.match(/^\/\/bidder\.criteo\.com\/cdb\?profileId=207&av=\d+&cb=\d/); + expect(request.url).to.match(/^\/\/bidder\.criteo\.com\/cdb\?profileId=207&av=\d+&wv=[^&]+&cb=\d/); expect(request.method).to.equal('POST'); const ortbRequest = request.data; expect(ortbRequest.publisher.url).to.equal(utils.getTopWindowUrl()); From 365838b185086ca32ad87f41dcebed908d4e5022 Mon Sep 17 00:00:00 2001 From: Nicolas Faure Date: Tue, 24 Jul 2018 17:31:45 +0200 Subject: [PATCH 2/2] Update Criteo profile IDs --- modules/criteoBidAdapter.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/criteoBidAdapter.js b/modules/criteoBidAdapter.js index 7f5d1b7b280..0595fc890f0 100755 --- a/modules/criteoBidAdapter.js +++ b/modules/criteoBidAdapter.js @@ -4,14 +4,15 @@ import { parse } from 'src/url'; import * as utils from 'src/utils'; import find from 'core-js/library/fn/array/find'; -const ADAPTER_VERSION = 8; +const ADAPTER_VERSION = 11; const BIDDER_CODE = 'criteo'; const CDB_ENDPOINT = '//bidder.criteo.com/cdb'; const CRITEO_VENDOR_ID = 91; const INTEGRATION_MODES = { 'amp': 1, }; -const PROFILE_ID = 207; +const PROFILE_ID_INLINE = 207; +const PROFILE_ID_PUBLISHERTAG = 185; // Unminified source code can be found in: https://github.com/Prebid-org/prebid-js-external-js-criteo/blob/master/dist/prod.js const PUBLISHER_TAG_URL = '//static.criteo.net/js/ld/publishertag.prebid.js'; @@ -51,7 +52,7 @@ export const spec = { } if (publisherTagAvailable()) { - const adapter = new Criteo.PubTag.Adapters.Prebid(PROFILE_ID, ADAPTER_VERSION, bidRequests, bidderRequest, '$prebid.version$'); + const adapter = new Criteo.PubTag.Adapters.Prebid(PROFILE_ID_PUBLISHERTAG, ADAPTER_VERSION, bidRequests, bidderRequest, '$prebid.version$'); url = adapter.buildCdbUrl(); data = adapter.buildCdbRequest(); } else { @@ -156,7 +157,7 @@ function buildContext(bidRequests) { */ function buildCdbUrl(context) { let url = CDB_ENDPOINT; - url += '?profileId=' + PROFILE_ID; + url += '?profileId=' + PROFILE_ID_INLINE; url += '&av=' + String(ADAPTER_VERSION); url += '&wv=' + encodeURIComponent('$prebid.version$'); url += '&cb=' + String(Math.floor(Math.random() * 99999999999));