From 1bf3b34ea1af3f2069e4773cd6574ccc44cd2bf8 Mon Sep 17 00:00:00 2001 From: Jozef Bartek Date: Wed, 23 May 2018 11:30:38 +0200 Subject: [PATCH 1/8] Adding GDPR support --- modules/improvedigitalBidAdapter.js | 38 +++++++++---------- .../modules/improvedigitalBidAdapter_spec.js | 29 +++++++++----- 2 files changed, 38 insertions(+), 29 deletions(-) diff --git a/modules/improvedigitalBidAdapter.js b/modules/improvedigitalBidAdapter.js index 2dcdcb2a808..c99e496f17c 100644 --- a/modules/improvedigitalBidAdapter.js +++ b/modules/improvedigitalBidAdapter.js @@ -6,7 +6,7 @@ import { userSync } from 'src/userSync'; const BIDDER_CODE = 'improvedigital'; export const spec = { - version: '4.1.0', + version: '4.2.0', code: BIDDER_CODE, aliases: ['id'], @@ -26,7 +26,7 @@ export const spec = { * @param {BidRequest[]} bidRequests A non-empty list of bid requests which should be sent to the Server. * @return ServerRequest Info describing the request to the server. */ - buildRequests: function (bidRequests) { + buildRequests: function (bidRequests, bidderRequest) { let normalizedBids = bidRequests.map((bidRequest) => { return getNormalizedBidRequest(bidRequest); }); @@ -34,11 +34,14 @@ export const spec = { let idClient = new ImproveDigitalAdServerJSClient('hb'); let requestParameters = { singleRequestMode: false, - httpRequestType: idClient.CONSTANTS.HTTP_REQUEST_TYPE.GET, - returnObjType: idClient.CONSTANTS.RETURN_OBJ_TYPE.PREBID, + returnObjType: idClient.CONSTANTS.RETURN_OBJ_TYPE.URL_PARAMS_SPLIT, libVersion: this.version }; + if (bidderRequest && bidderRequest.gdprConsent && bidderRequest.gdprConsent.consentString) { + requestParameters.gdpr = bidderRequest.gdprConsent.consentString; + } + let requestObj = idClient.createRequest( normalizedBids, // requestObject requestParameters @@ -154,10 +157,6 @@ registerBidder(spec); function ImproveDigitalAdServerJSClient(endPoint) { this.CONSTANTS = { - HTTP_REQUEST_TYPE: { - GET: 0, - POST: 1 - }, HTTP_SECURITY: { STANDARD: 0, SECURE: 1 @@ -165,16 +164,15 @@ function ImproveDigitalAdServerJSClient(endPoint) { AD_SERVER_BASE_URL: 'ad.360yield.com', END_POINT: endPoint || 'hb', AD_SERVER_URL_PARAM: 'jsonp=', - CLIENT_VERSION: 'JS-4.3.3', + CLIENT_VERSION: 'JS-5.1', MAX_URL_LENGTH: 2083, ERROR_CODES: { - BAD_HTTP_REQUEST_TYPE_PARAM: 1, MISSING_PLACEMENT_PARAMS: 2, LIB_VERSION_MISSING: 3 }, RETURN_OBJ_TYPE: { DEFAULT: 0, - PREBID: 1 + URL_PARAMS_SPLIT: 1 } }; @@ -187,9 +185,6 @@ function ImproveDigitalAdServerJSClient(endPoint) { }; this.createRequest = function(requestObject, requestParameters, extraRequestParameters) { - if (requestParameters.httpRequestType !== this.CONSTANTS.HTTP_REQUEST_TYPE.GET) { - return this.getErrorReturn(this.CONSTANTS.ERROR_CODES.BAD_HTTP_REQUEST_TYPE_PARAM); - } if (!requestParameters.libVersion) { return this.getErrorReturn(this.CONSTANTS.ERROR_CODES.LIB_VERSION_MISSING); } @@ -198,9 +193,8 @@ function ImproveDigitalAdServerJSClient(endPoint) { let impressionObjects = []; let impressionObject; - let counter; if (utils.isArray(requestObject)) { - for (counter = 0; counter < requestObject.length; counter++) { + for (let counter = 0; counter < requestObject.length; counter++) { impressionObject = this.createImpressionObject(requestObject[counter]); impressionObjects.push(impressionObject); } @@ -210,7 +204,7 @@ function ImproveDigitalAdServerJSClient(endPoint) { } let returnIdMappings = true; - if (requestParameters.returnObjType === this.CONSTANTS.RETURN_OBJ_TYPE.PREBID) { + if (requestParameters.returnObjType === this.CONSTANTS.RETURN_OBJ_TYPE.URL_PARAMS_SPLIT) { returnIdMappings = false; } @@ -226,7 +220,7 @@ function ImproveDigitalAdServerJSClient(endPoint) { let bidRequestObject = { bid_request: this.createBasicBidRequestObject(requestParameters, extraRequestParameters) }; - for (counter = 0; counter < impressionObjects.length; counter++) { + for (let counter = 0; counter < impressionObjects.length; counter++) { impressionObject = impressionObjects[counter]; if (impressionObject.errorCode) { @@ -279,7 +273,7 @@ function ImproveDigitalAdServerJSClient(endPoint) { this.formatRequest = function(requestParameters, bidRequestObject) { switch (requestParameters.returnObjType) { - case this.CONSTANTS.RETURN_OBJ_TYPE.PREBID: + case this.CONSTANTS.RETURN_OBJ_TYPE.URL_PARAMS_SPLIT: return { method: 'GET', url: `//${this.CONSTANTS.AD_SERVER_BASE_URL}/${this.CONSTANTS.END_POINT}`, @@ -320,6 +314,12 @@ function ImproveDigitalAdServerJSClient(endPoint) { if (requestParameters.libVersion) { impressionBidRequestObject.version = requestParameters.libVersion + '-' + this.CONSTANTS.CLIENT_VERSION; } + if (requestParameters.referrer) { + impressionBidRequestObject.referrer = requestParameters.referrer; + } + if (requestParameters.gdpr) { + impressionBidRequestObject.gdpr = requestParameters.gdpr; + } if (extraRequestParameters) { for (let prop in extraRequestParameters) { impressionBidRequestObject[prop] = extraRequestParameters[prop]; diff --git a/test/spec/modules/improvedigitalBidAdapter_spec.js b/test/spec/modules/improvedigitalBidAdapter_spec.js index cd68418d6c7..d7595934194 100644 --- a/test/spec/modules/improvedigitalBidAdapter_spec.js +++ b/test/spec/modules/improvedigitalBidAdapter_spec.js @@ -32,6 +32,14 @@ describe('Improve Digital Adapter Tests', function () { } }; + const bidderRequest = { + 'gdprConsent': { + 'consentString': 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==', + 'vendorData': {}, + 'gdprApplies': true + }, + }; + describe('isBidRequestValid', () => { it('should return false when no bid', () => { expect(spec.isBidRequestValid()).to.equal(false); @@ -139,6 +147,13 @@ describe('Improve Digital Adapter Tests', function () { getConfigStub.restore(); }); + it('should add GDPR consent string', () => { + const bidRequest = Object.assign({}, simpleBidRequest); + const request = spec.buildRequests([bidRequest], bidderRequest)[0]; + const params = JSON.parse(request.data.substring(PARAM_PREFIX.length)); + expect(params.bid_request.gdpr).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A=='); + }); + it('should return 2 requests', () => { const requests = spec.buildRequests([ simpleBidRequest, @@ -150,14 +165,6 @@ describe('Improve Digital Adapter Tests', function () { }); describe('interpretResponse', () => { - let registerSyncStub; - beforeEach(() => { - registerSyncStub = sinon.stub(userSync, 'registerSync'); - }); - - afterEach(() => { - registerSyncStub.restore(); - }); const serverResponse = { 'body': { 'id': '687a06c541d8d1', @@ -254,9 +261,11 @@ describe('Improve Digital Adapter Tests', function () { }); it('should register user syncs', () => { + const registerSyncSpy = sinon.spy(userSync, 'registerSync'); const bids = spec.interpretResponse(serverResponse); - expect(registerSyncStub.withArgs('image', 'improvedigital', 'http://link1').calledOnce).to.equal(true); - expect(registerSyncStub.withArgs('image', 'improvedigital', 'http://link2').calledOnce).to.equal(true); + expect(registerSyncSpy.withArgs('image', 'improvedigital', 'http://link1').calledOnce).to.equal(true); + expect(registerSyncSpy.withArgs('image', 'improvedigital', 'http://link2').calledOnce).to.equal(true); + registerSyncSpy.restore(); }); it('should set dealId correctly', () => { From 001e026e80a961f55d45061f9ef6edca17a42d4c Mon Sep 17 00:00:00 2001 From: Jozef Bartek Date: Thu, 23 Aug 2018 09:51:16 +0200 Subject: [PATCH 2/8] Always drop user syncs when available --- modules/improvedigitalBidAdapter.js | 36 +++-- .../modules/improvedigitalBidAdapter_spec.js | 135 ++++++++++-------- 2 files changed, 100 insertions(+), 71 deletions(-) diff --git a/modules/improvedigitalBidAdapter.js b/modules/improvedigitalBidAdapter.js index c99e496f17c..2cc1d8b39b0 100644 --- a/modules/improvedigitalBidAdapter.js +++ b/modules/improvedigitalBidAdapter.js @@ -1,12 +1,11 @@ import * as utils from 'src/utils'; import { registerBidder } from 'src/adapters/bidderFactory'; import { config } from 'src/config'; -import { userSync } from 'src/userSync'; const BIDDER_CODE = 'improvedigital'; export const spec = { - version: '4.2.0', + version: '4.3.0', code: BIDDER_CODE, aliases: ['id'], @@ -91,15 +90,34 @@ export const spec = { bid.width = bidObject.w; bids.push(bid); - - // Register user sync URLs - if (utils.isArray(bidObject.sync)) { - utils._each(bidObject.sync, function (syncElement) { - userSync.registerSync('image', spec.code, syncElement); - }); - } }); return bids; + }, + + /** + * Register the user sync pixels which should be dropped after the auction. + * + * @param {SyncOptions} syncOptions Which user syncs are allowed? + * @param {ServerResponse[]} serverResponses List of server's responses. + * @return {UserSync[]} The user syncs which should be dropped. + */ + getUserSyncs: function(syncOptions, serverResponses) { + if (syncOptions.pixelEnabled) { + const syncs = []; + serverResponses.forEach(response => { + response.body.bid.forEach(bidObject => { + if (utils.isArray(bidObject.sync)) { + bidObject.sync.forEach(syncElement => { + if (syncs.indexOf(syncElement) === -1) { + syncs.push(syncElement); + } + }); + } + }); + }); + return syncs.map(sync => ({ type: 'image', url: sync })); + } + return []; } }; diff --git a/test/spec/modules/improvedigitalBidAdapter_spec.js b/test/spec/modules/improvedigitalBidAdapter_spec.js index d7595934194..b3e99b3274e 100644 --- a/test/spec/modules/improvedigitalBidAdapter_spec.js +++ b/test/spec/modules/improvedigitalBidAdapter_spec.js @@ -164,61 +164,61 @@ describe('Improve Digital Adapter Tests', function () { }); }); - describe('interpretResponse', () => { - const serverResponse = { - 'body': { - 'id': '687a06c541d8d1', - 'site_id': 191642, - 'bid': [ - { - 'isNet': false, - 'id': '33e9500b21129f', - 'advid': '5279', - 'price': 1.45888594164456, - 'nurl': 'http://ad.360yield.com/imp_pixel?ic=wVmhKI07hCVyGC1sNdFp.6buOSiGYOw8jPyZLlcMY2RCwD4ek3Fy6.xUI7U002skGBs3objMBoNU-Frpvmb9js3NKIG0YZJgWaNdcpXY9gOXE9hY4-wxybCjVSNzhOQB-zic73hzcnJnKeoGgcfvt8fMy18-yD0aVdYWt4zbqdoITOkKNCPBEgbPFu1rcje-o7a64yZ7H3dKvtnIixXQYc1Ep86xGSBGXY6xW2KfUOMT6vnkemxO72divMkMdhR8cAuqIubbx-ZID8-xf5c9k7p6DseeBW0I8ionrlTHx.rGosgxhiFaMqtr7HiA7PBzKvPdeEYN0hQ8RYo8JzYL82hA91A3V2m9Ij6y0DfIJnnrKN8YORffhxmJ6DzwEl1zjrVFbD01bqB3Vdww8w8PQJSkKQkd313tr-atU8LS26fnBmOngEkVHwAr2WCKxuUvxHmuVBTA-Lgz7wKwMoOJCA3hFxMavVb0ZFB7CK0BUTVU6z0De92Q.FJKNCHLMbjX3vcAQ90=', - 'h': 290, - 'pid': 1053688, - 'sync': [ - 'http://link1', - 'http://link2' - ], - 'crid': '422031', - 'w': 600, - 'cid': '99006', - 'adm': 'document.writeln(\"\\\"\\\"\\/<\\/a>\");document.writeln(\"<\\/improvedigital_ad_output_information>\");' - } - ], - 'debug': '' - } - }; - - const serverResponseTwoBids = { - 'body': { - 'id': '687a06c541d8d1', - 'site_id': 191642, - 'bid': [ - serverResponse.body.bid[0], - { - 'isNet': true, - 'id': '1234', - 'advid': '5280', - 'price': 1.23, - 'nurl': 'http://link/imp_pixel?ic=wVmhKI07hCVyGC1sNdFp.6buOSiGYOw8jPyZLlcMY2RCwD4ek3Fy6.xUI7U002skGBs3objMBoNU-Frpvmb9js3NKIG0YZJgWaNdcpXY9gOXE9hY4-wxybCjVSNzhOQB-zic73hzcnJnKeoGgcfvt8fMy18-yD0aVdYWt4zbqdoITOkKNCPBEgbPFu1rcje-o7a64yZ7H3dKvtnIixXQYc1Ep86xGSBGXY6xW2KfUOMT6vnkemxO72divMkMdhR8cAuqIubbx-ZID8-xf5c9k7p6DseeBW0I8ionrlTHx.rGosgxhiFaMqtr7HiA7PBzKvPdeEYN0hQ8RYo8JzYL82hA91A3V2m9Ij6y0DfIJnnrKN8YORffhxmJ6DzwEl1zjrVFbD01bqB3Vdww8w8PQJSkKQkd313tr-atU8LS26fnBmOngEkVHwAr2WCKxuUvxHmuVBTA-Lgz7wKwMoOJCA3hFxMavVb0ZFB7CK0BUTVU6z0De92Q.FJKNCHLMbjX3vcAQ90=', - 'h': 400, - 'pid': 1053688, - 'sync': [ - 'http://link3' - ], - 'crid': '422033', - 'w': 700, - 'cid': '99006', - 'adm': 'document.writeln(\"\\\"\\\"\\/<\\/a>\");document.writeln(\"<\\/improvedigital_ad_output_information>\");' - } - ], - 'debug': '' - } - }; + const serverResponse = { + 'body': { + 'id': '687a06c541d8d1', + 'site_id': 191642, + 'bid': [ + { + 'isNet': false, + 'id': '33e9500b21129f', + 'advid': '5279', + 'price': 1.45888594164456, + 'nurl': 'http://ad.360yield.com/imp_pixel?ic=wVmhKI07hCVyGC1sNdFp.6buOSiGYOw8jPyZLlcMY2RCwD4ek3Fy6.xUI7U002skGBs3objMBoNU-Frpvmb9js3NKIG0YZJgWaNdcpXY9gOXE9hY4-wxybCjVSNzhOQB-zic73hzcnJnKeoGgcfvt8fMy18-yD0aVdYWt4zbqdoITOkKNCPBEgbPFu1rcje-o7a64yZ7H3dKvtnIixXQYc1Ep86xGSBGXY6xW2KfUOMT6vnkemxO72divMkMdhR8cAuqIubbx-ZID8-xf5c9k7p6DseeBW0I8ionrlTHx.rGosgxhiFaMqtr7HiA7PBzKvPdeEYN0hQ8RYo8JzYL82hA91A3V2m9Ij6y0DfIJnnrKN8YORffhxmJ6DzwEl1zjrVFbD01bqB3Vdww8w8PQJSkKQkd313tr-atU8LS26fnBmOngEkVHwAr2WCKxuUvxHmuVBTA-Lgz7wKwMoOJCA3hFxMavVb0ZFB7CK0BUTVU6z0De92Q.FJKNCHLMbjX3vcAQ90=', + 'h': 290, + 'pid': 1053688, + 'sync': [ + 'http://link1', + 'http://link2' + ], + 'crid': '422031', + 'w': 600, + 'cid': '99006', + 'adm': 'document.writeln(\"\\\"\\\"\\/<\\/a>\");document.writeln(\"<\\/improvedigital_ad_output_information>\");' + } + ], + 'debug': '' + } + }; + + const serverResponseTwoBids = { + 'body': { + 'id': '687a06c541d8d1', + 'site_id': 191642, + 'bid': [ + serverResponse.body.bid[0], + { + 'isNet': true, + 'id': '1234', + 'advid': '5280', + 'price': 1.23, + 'nurl': 'http://link/imp_pixel?ic=wVmhKI07hCVyGC1sNdFp.6buOSiGYOw8jPyZLlcMY2RCwD4ek3Fy6.xUI7U002skGBs3objMBoNU-Frpvmb9js3NKIG0YZJgWaNdcpXY9gOXE9hY4-wxybCjVSNzhOQB-zic73hzcnJnKeoGgcfvt8fMy18-yD0aVdYWt4zbqdoITOkKNCPBEgbPFu1rcje-o7a64yZ7H3dKvtnIixXQYc1Ep86xGSBGXY6xW2KfUOMT6vnkemxO72divMkMdhR8cAuqIubbx-ZID8-xf5c9k7p6DseeBW0I8ionrlTHx.rGosgxhiFaMqtr7HiA7PBzKvPdeEYN0hQ8RYo8JzYL82hA91A3V2m9Ij6y0DfIJnnrKN8YORffhxmJ6DzwEl1zjrVFbD01bqB3Vdww8w8PQJSkKQkd313tr-atU8LS26fnBmOngEkVHwAr2WCKxuUvxHmuVBTA-Lgz7wKwMoOJCA3hFxMavVb0ZFB7CK0BUTVU6z0De92Q.FJKNCHLMbjX3vcAQ90=', + 'h': 400, + 'pid': 1053688, + 'sync': [ + 'http://link3' + ], + 'crid': '422033', + 'w': 700, + 'cid': '99006', + 'adm': 'document.writeln(\"\\\"\\\"\\/<\\/a>\");document.writeln(\"<\\/improvedigital_ad_output_information>\");' + } + ], + 'debug': '' + } + }; + describe('interpretResponse', () => { let expectedBid = [ { 'ad': '', @@ -260,14 +260,6 @@ describe('Improve Digital Adapter Tests', function () { expect(bids).to.deep.equal(expectedTwoBids); }); - it('should register user syncs', () => { - const registerSyncSpy = sinon.spy(userSync, 'registerSync'); - const bids = spec.interpretResponse(serverResponse); - expect(registerSyncSpy.withArgs('image', 'improvedigital', 'http://link1').calledOnce).to.equal(true); - expect(registerSyncSpy.withArgs('image', 'improvedigital', 'http://link2').calledOnce).to.equal(true); - registerSyncSpy.restore(); - }); - it('should set dealId correctly', () => { let response = JSON.parse(JSON.stringify(serverResponse)); let bids; @@ -338,4 +330,23 @@ describe('Improve Digital Adapter Tests', function () { expect(bids[0].netRevenue).to.equal(true); }); }); + + describe('getUserSyncs', () => { + const serverResponses = [ serverResponseTwoBids ]; + + it('should return no syncs when pixel syncing is disabled', () => { + const syncs = spec.getUserSyncs({ pixelEnabled: false }, serverResponses); + expect(syncs).to.deep.equal([]); + }); + + it('should return user syncs', () => { + const syncs = spec.getUserSyncs({ pixelEnabled: true }, serverResponses); + const expected = [ + { type: 'image', url: 'http://link1' }, + { type: 'image', url: 'http://link2' }, + { type: 'image', url: 'http://link3' } + ]; + expect(syncs).to.deep.equal(expected); + }); + }); }); From 15792971cada379da75a4185fa85486007d7abc7 Mon Sep 17 00:00:00 2001 From: Jozef Bartek Date: Mon, 15 Oct 2018 21:17:55 +0200 Subject: [PATCH 3/8] Set dealID based on buying type --- modules/improvedigitalBidAdapter.js | 21 ++++++++++--- .../modules/improvedigitalBidAdapter_spec.js | 31 ++++++++++++++++--- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/modules/improvedigitalBidAdapter.js b/modules/improvedigitalBidAdapter.js index 2cc1d8b39b0..54eb3bb6574 100644 --- a/modules/improvedigitalBidAdapter.js +++ b/modules/improvedigitalBidAdapter.js @@ -5,7 +5,7 @@ import { config } from 'src/config'; const BIDDER_CODE = 'improvedigital'; export const spec = { - version: '4.3.0', + version: '4.4.0', code: BIDDER_CODE, aliases: ['id'], @@ -78,11 +78,24 @@ export const spec = { bid.cpm = parseFloat(bidObject.price); bid.creativeId = bidObject.crid; bid.currency = bidObject.currency ? bidObject.currency.toUpperCase() : 'USD'; - if (utils.isNumber(bidObject.lid)) { + + // Deal ID. Composite ads can have multiple line items and the ID of the first + // dealID line item will be used. + if (utils.isNumber(bidObject.lid) && bidObject.buying_type === 'deal_id') { bid.dealId = bidObject.lid; - } else if (typeof bidObject.lid === 'object' && bidObject.lid['1']) { - bid.dealId = bidObject.lid['1']; + } else if (Array.isArray(bidObject.lid) && + Array.isArray(bidObject.buying_type) && + bidObject.lid.length === bidObject.buying_type.length) { + let isDeal = false; + bidObject.buying_type.forEach((bt, i) => { + if (isDeal) return; + if (bt === 'deal_id') { + isDeal = true; + bid.dealId = bidObject.lid[i]; + } + }); } + bid.height = bidObject.h; bid.netRevenue = bidObject.isNet ? bidObject.isNet : false; bid.requestId = bidObject.id; diff --git a/test/spec/modules/improvedigitalBidAdapter_spec.js b/test/spec/modules/improvedigitalBidAdapter_spec.js index bab469b936e..3d7f5a86016 100644 --- a/test/spec/modules/improvedigitalBidAdapter_spec.js +++ b/test/spec/modules/improvedigitalBidAdapter_spec.js @@ -264,19 +264,40 @@ describe('Improve Digital Adapter Tests', function () { let response = JSON.parse(JSON.stringify(serverResponse)); let bids; - response.body.bid[0].lid = 'xyz'; + delete response.body.bid[0].lid; + response.body.bid[0].buying_type = 'deal_id'; bids = spec.interpretResponse(response); expect(bids[0].dealId).to.not.exist; response.body.bid[0].lid = 268515; + delete response.body.bid[0].buying_type; bids = spec.interpretResponse(response); - expect(bids[0].dealId).to.equal(268515); + expect(bids[0].dealId).to.not.exist; - response.body.bid[0].lid = { - 1: 268515 - }; + response.body.bid[0].lid = 268515; + response.body.bid[0].buying_type = 'classic'; + bids = spec.interpretResponse(response); + expect(bids[0].dealId).to.not.exist; + + response.body.bid[0].lid = 268515; + response.body.bid[0].buying_type = 'deal_id'; bids = spec.interpretResponse(response); expect(bids[0].dealId).to.equal(268515); + + response.body.bid[0].lid = [ 268515, 12456, 34567 ]; + response.body.bid[0].buying_type = 'deal_id'; + bids = spec.interpretResponse(response); + expect(bids[0].dealId).to.not.exist; + + response.body.bid[0].lid = [ 268515, 12456, 34567 ]; + response.body.bid[0].buying_type = [ 'deal_id', 'classic' ]; + bids = spec.interpretResponse(response); + expect(bids[0].dealId).to.not.exist; + + response.body.bid[0].lid = [ 268515, 12456, 34567 ]; + response.body.bid[0].buying_type = [ 'classic', 'deal_id', 'deal_id' ]; + bids = spec.interpretResponse(response); + expect(bids[0].dealId).to.equal(12456); }); it('should set currency', function () { From 5f8847c4cd39c076c109021fc2a4e8dac17088c2 Mon Sep 17 00:00:00 2001 From: Jozef Bartek Date: Thu, 20 Dec 2018 15:18:39 +0100 Subject: [PATCH 4/8] Native ads, single request option --- modules/improvedigitalBidAdapter.js | 99 ++++++++-- .../modules/improvedigitalBidAdapter_spec.js | 173 ++++++++++++++++-- 2 files changed, 247 insertions(+), 25 deletions(-) diff --git a/modules/improvedigitalBidAdapter.js b/modules/improvedigitalBidAdapter.js index 54eb3bb6574..87baef61a42 100644 --- a/modules/improvedigitalBidAdapter.js +++ b/modules/improvedigitalBidAdapter.js @@ -1,13 +1,15 @@ import * as utils from 'src/utils'; import { registerBidder } from 'src/adapters/bidderFactory'; import { config } from 'src/config'; +import { BANNER, NATIVE } from 'src/mediaTypes'; const BIDDER_CODE = 'improvedigital'; export const spec = { - version: '4.4.0', + version: '5.0.0', code: BIDDER_CODE, aliases: ['id'], + supportedMediaTypes: [BANNER, NATIVE], /** * Determines whether or not the given bid request is valid. @@ -32,7 +34,7 @@ export const spec = { let idClient = new ImproveDigitalAdServerJSClient('hb'); let requestParameters = { - singleRequestMode: false, + singleRequestMode: (config.getConfig('improvedigital.singleRequest') === true), returnObjType: idClient.CONSTANTS.RETURN_OBJ_TYPE.URL_PARAMS_SPLIT, libVersion: this.version }; @@ -59,21 +61,35 @@ export const spec = { * @param {*} serverResponse A successful response from the server. * @return {Bid[]} An array of bids which were nested inside the server. */ - interpretResponse: function (serverResponse, request) { + interpretResponse: function (serverResponse, bidRequest) { const bids = []; utils._each(serverResponse.body.bid, function (bidObject) { if (!bidObject.price || bidObject.price === null || bidObject.hasOwnProperty('errorCode') || - typeof bidObject.adm !== 'string') { + (!bidObject.adm && !bidObject.native)) { return; } - let bid = {}; - let nurl = ''; - if (bidObject.nurl && bidObject.nurl.length > 0) { - nurl = ``; + const bid = {}; + + if (bidObject.native) { + // Native + bid.native = getNormalizedNativeAd(bidObject.native); + if (bidObject.nurl) { + bid.native.impressionTrackers.unshift(bidObject.nurl); + } + bid.mediaType = NATIVE; + } else { + // Banner + let nurl = ''; + if (bidObject.nurl && bidObject.nurl.length > 0) { + nurl = ``; + } + bid.ad = `${nurl}`; + bid.mediaType = BANNER; } - bid.ad = `${nurl}`; + + // Common properties bid.adId = bidObject.id; bid.cpm = parseFloat(bidObject.price); bid.creativeId = bidObject.crid; @@ -102,6 +118,15 @@ export const spec = { bid.ttl = 300; bid.width = bidObject.w; + if (!bid.width || !bid.height) { + bid.width = 1; + bid.height = 1; + if (bidRequest.sizes) { + bid.width = bidRequest.sizes[0][0]; + bid.height = bidRequest.sizes[0][1]; + } + } + bids.push(bid); }); return bids; @@ -184,6 +209,56 @@ function getNormalizedBidRequest(bid) { } return normalizedBidRequest; } + +function getNormalizedNativeAd(rawNative) { + const native = {}; + if (!rawNative || !utils.isArray(rawNative.assets)) { + return null; + } + // Assets + rawNative.assets.forEach(asset => { + if (asset.title) { + native.title = asset.title.text; + } else if (asset.data) { + switch (asset.data.type) { + case 1: + native.sponsoredBy = asset.data.value; + break; + case 2: + native.body = asset.data.value; + break; + case 12: + native.cta = asset.data.value; + break; + } + } else if (asset.img) { + switch (asset.img.type) { + case 2: + native.icon = { + url: asset.img.url, + width: asset.img.w, + height: asset.img.h + }; + break; + case 3: + native.image = { + url: asset.img.url, + width: asset.img.w, + height: asset.img.h + }; + break; + } + } + }); + // Trackers + native.impressionTrackers = rawNative.imptrackers || []; + native.javascriptTrackers = rawNative.jstracker; + if (rawNative.link) { + native.clickUrl = rawNative.link.url; + native.clickTrackers = rawNative.link.clicktrackers; + } + return native; +} registerBidder(spec); function ImproveDigitalAdServerJSClient(endPoint) { @@ -195,7 +270,7 @@ function ImproveDigitalAdServerJSClient(endPoint) { AD_SERVER_BASE_URL: 'ad.360yield.com', END_POINT: endPoint || 'hb', AD_SERVER_URL_PARAM: 'jsonp=', - CLIENT_VERSION: 'JS-5.1', + CLIENT_VERSION: 'JS-5.2.0', MAX_URL_LENGTH: 2083, ERROR_CODES: { MISSING_PLACEMENT_PARAMS: 2, @@ -308,7 +383,7 @@ function ImproveDigitalAdServerJSClient(endPoint) { return { method: 'GET', url: `//${this.CONSTANTS.AD_SERVER_BASE_URL}/${this.CONSTANTS.END_POINT}`, - data: `${this.CONSTANTS.AD_SERVER_URL_PARAM}${JSON.stringify(bidRequestObject)}` + data: `${this.CONSTANTS.AD_SERVER_URL_PARAM}${encodeURIComponent(JSON.stringify(bidRequestObject))}` }; default: const baseUrl = `${(requestParameters.secure === 1 ? 'https' : 'http')}://` + @@ -348,7 +423,7 @@ function ImproveDigitalAdServerJSClient(endPoint) { if (requestParameters.referrer) { impressionBidRequestObject.referrer = requestParameters.referrer; } - if (requestParameters.gdpr) { + if (requestParameters.gdpr || requestParameters.gdpr === 0) { impressionBidRequestObject.gdpr = requestParameters.gdpr; } if (extraRequestParameters) { diff --git a/test/spec/modules/improvedigitalBidAdapter_spec.js b/test/spec/modules/improvedigitalBidAdapter_spec.js index 3d7f5a86016..8b76bfcbe9c 100644 --- a/test/spec/modules/improvedigitalBidAdapter_spec.js +++ b/test/spec/modules/improvedigitalBidAdapter_spec.js @@ -92,7 +92,7 @@ describe('Improve Digital Adapter Tests', function () { expect(request.url).to.equal(URL); expect(request.data.substring(0, PARAM_PREFIX.length)).to.equal(PARAM_PREFIX); - const params = JSON.parse(request.data.substring(PARAM_PREFIX.length)); + const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length))); expect(params.bid_request).to.be.an('object'); expect(params.bid_request.id).to.be.a('string'); expect(params.bid_request.version).to.equal(`${spec.version}-${idClient.CONSTANTS.CLIENT_VERSION}`); @@ -108,7 +108,7 @@ describe('Improve Digital Adapter Tests', function () { it('should set placementKey and publisherId for smart tags', function () { const requests = spec.buildRequests([simpleSmartTagBidRequest]); - const params = JSON.parse(requests[0].data.substring(PARAM_PREFIX.length)); + const params = JSON.parse(decodeURIComponent(requests[0].data.substring(PARAM_PREFIX.length))); expect(params.bid_request.imp[0].pubid).to.equal(1032); expect(params.bid_request.imp[0].pkey).to.equal('data_team_test_hb_smoke_test'); }); @@ -122,7 +122,7 @@ describe('Improve Digital Adapter Tests', function () { }; bidRequest.params.keyValues = keyValues; const request = spec.buildRequests([bidRequest])[0]; - const params = JSON.parse(request.data.substring(PARAM_PREFIX.length)); + const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length))); expect(params.bid_request.imp[0].kvw).to.deep.equal(keyValues); }); @@ -134,7 +134,7 @@ describe('Improve Digital Adapter Tests', function () { }; bidRequest.params.size = size; const request = spec.buildRequests([bidRequest])[0]; - const params = JSON.parse(request.data.substring(PARAM_PREFIX.length)); + const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length))); expect(params.bid_request.imp[0].banner).to.deep.equal(size); }); @@ -142,7 +142,7 @@ describe('Improve Digital Adapter Tests', function () { const bidRequest = Object.assign({}, simpleBidRequest); const getConfigStub = sinon.stub(config, 'getConfig').returns('JPY'); const request = spec.buildRequests([bidRequest])[0]; - const params = JSON.parse(request.data.substring(PARAM_PREFIX.length)); + const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length))); expect(params.bid_request.imp[0].currency).to.equal('JPY'); getConfigStub.restore(); }); @@ -150,7 +150,7 @@ describe('Improve Digital Adapter Tests', function () { it('should add GDPR consent string', function () { const bidRequest = Object.assign({}, simpleBidRequest); const request = spec.buildRequests([bidRequest], bidderRequest)[0]; - const params = JSON.parse(request.data.substring(PARAM_PREFIX.length)); + const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length))); expect(params.bid_request.gdpr).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A=='); }); @@ -162,6 +162,18 @@ describe('Improve Digital Adapter Tests', function () { expect(requests).to.be.an('array'); expect(requests.length).to.equal(2); }); + + it('should return one request in a single request mode', function () { + const getConfigStub = sinon.stub(config, 'getConfig'); + getConfigStub.withArgs('improvedigital.singleRequest').returns(true); + const requests = spec.buildRequests([ + simpleBidRequest, + simpleSmartTagBidRequest + ]); + expect(requests).to.be.an('array'); + expect(requests.length).to.equal(1); + getConfigStub.restore(); + }); }); const serverResponse = { @@ -218,6 +230,100 @@ describe('Improve Digital Adapter Tests', function () { } }; + const serverResponseNative = { + body: { + id: '687a06c541d8d1', + site_id: 191642, + bid: [ + { + isNet: false, + id: '33e9500b21129f', + advid: '5279', + price: 1.45888594164456, + nurl: 'http://ad.360yield.com/imp_pixel?ic=wVm', + h: 290, + pid: 1053688, + sync: [ + 'http://link1', + 'http://link2' + ], + crid: '422031', + w: 600, + cid: '99006', + native: { + assets: [ + { + title: { + text: 'Native title' + } + }, + { + data: { + type: 1, + value: 'Improve Digital' + } + }, + { + data: { + type: 2, + value: 'Native body' + } + }, + { + data: { + type: 3, + value: 'Should get ignored' + } + }, + { + data: { + type: 12, + value: 'Do it' + } + }, + { + img: { + type: 1, + url: 'Should get ignored', + h: 300, + w: 400 + } + }, + { + img: { + type: 2, + url: 'http://blah.com/icon.jpg', + h: 30, + w: 40 + } + }, + { + img: { + type: 3, + url: 'http://blah.com/image.jpg', + h: 200, + w: 800 + } + } + ], + link: { + url: 'http://advertiser.com', + clicktrackers: [ + 'http://click.tracker.com/click?impid=123' + ] + }, + imptrackers: [ + 'http://imptrack1.com', + 'http://imptrack2.com' + ], + jstracker: '' + } + } + ], + debug: '' + } + }; + describe('interpretResponse', function () { let expectedBid = [ { @@ -227,6 +333,7 @@ describe('Improve Digital Adapter Tests', function () { 'cpm': 1.45888594164456, 'currency': 'USD', 'height': 290, + 'mediaType': 'banner', 'netRevenue': false, 'requestId': '33e9500b21129f', 'ttl': 300, @@ -243,6 +350,7 @@ describe('Improve Digital Adapter Tests', function () { 'cpm': 1.23, 'currency': 'USD', 'height': 400, + 'mediaType': 'banner', 'netRevenue': true, 'requestId': '1234', 'ttl': 300, @@ -250,6 +358,45 @@ describe('Improve Digital Adapter Tests', function () { } ]; + let expectedBidNative = [ + { + mediaType: 'native', + adId: '33e9500b21129f', + creativeId: '422031', + cpm: 1.45888594164456, + currency: 'USD', + height: 290, + netRevenue: false, + requestId: '33e9500b21129f', + ttl: 300, + width: 600, + native: { + title: 'Native title', + body: 'Native body', + cta: 'Do it', + sponsoredBy: 'Improve Digital', + icon: { + url: 'http://blah.com/icon.jpg', + height: 30, + width: 40 + }, + image: { + url: 'http://blah.com/image.jpg', + height: 200, + width: 800 + }, + clickUrl: 'http://advertiser.com', + clickTrackers: ['http://click.tracker.com/click?impid=123'], + impressionTrackers: [ + 'http://ad.360yield.com/imp_pixel?ic=wVm', + 'http://imptrack1.com', + 'http://imptrack2.com' + ], + javascriptTrackers: '' + } + } + ]; + it('should return a well-formed bid', function () { const bids = spec.interpretResponse(serverResponse); expect(bids).to.deep.equal(expectedBid); @@ -328,7 +475,7 @@ describe('Improve Digital Adapter Tests', function () { bids = spec.interpretResponse(response); expect(bids).to.deep.equal([]); - // Adm missing or bad + // adm and native missing response = JSON.parse(JSON.stringify(serverResponse)); delete response.body.bid[0].adm; bids = spec.interpretResponse(response); @@ -336,12 +483,6 @@ describe('Improve Digital Adapter Tests', function () { response.body.bid[0].adm = null; bids = spec.interpretResponse(response); expect(bids).to.deep.equal([]); - response.body.bid[0].adm = 1234; - bids = spec.interpretResponse(response); - expect(bids).to.deep.equal([]); - response.body.bid[0].adm = {}; - bids = spec.interpretResponse(response); - expect(bids).to.deep.equal([]); }); it('should set netRevenue', function () { @@ -350,6 +491,12 @@ describe('Improve Digital Adapter Tests', function () { const bids = spec.interpretResponse(response); expect(bids[0].netRevenue).to.equal(true); }); + + // Native ads + it('should return a well-formed native ad bid', function () { + const bids = spec.interpretResponse(serverResponseNative); + expect(bids).to.deep.equal(expectedBidNative); + }); }); describe('getUserSyncs', function () { From c276f6dbfd2ccfd9f5ab815dc50c2acd75c3fec8 Mon Sep 17 00:00:00 2001 From: Jozef Bartek Date: Fri, 22 Feb 2019 11:39:01 +0100 Subject: [PATCH 5/8] Send ad unit sizes to Improve ad server --- modules/improvedigitalBidAdapter.js | 40 +++++++++++++++---- .../modules/improvedigitalBidAdapter_spec.js | 15 +++++-- 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/modules/improvedigitalBidAdapter.js b/modules/improvedigitalBidAdapter.js index c7360e6a8d6..7bd2b896998 100644 --- a/modules/improvedigitalBidAdapter.js +++ b/modules/improvedigitalBidAdapter.js @@ -170,7 +170,7 @@ function getNormalizedBidRequest(bid) { placementKey = utils.getBidIdParameter('placementKey', bid.params) || null; } let keyValues = utils.getBidIdParameter('keyValues', bid.params) || null; - let localSize = utils.getBidIdParameter('size', bid.params) || null; + let singleSizeFilter = utils.getBidIdParameter('size', bid.params) || null; let bidId = utils.getBidIdParameter('bidId', bid); let transactionId = utils.getBidIdParameter('transactionId', bid); const currency = config.getConfig('currency.adServerCurrency'); @@ -190,11 +190,19 @@ function getNormalizedBidRequest(bid) { if (keyValues) { normalizedBidRequest.keyValues = keyValues; } - if (localSize && localSize.w && localSize.h) { + + // If a single-size filter is set in the bid.params, use it. + // Otherwise request all ad unit sizes. + if (singleSizeFilter && singleSizeFilter.w && singleSizeFilter.h) { normalizedBidRequest.size = {}; - normalizedBidRequest.size.h = localSize.h; - normalizedBidRequest.size.w = localSize.w; + normalizedBidRequest.size.h = singleSizeFilter.h; + normalizedBidRequest.size.w = singleSizeFilter.w; + } else { + if (bid.sizes && bid.sizes.length > 0) { + normalizedBidRequest.format = bid.sizes; + } } + if (bidId) { normalizedBidRequest.id = bidId; } @@ -270,7 +278,7 @@ export function ImproveDigitalAdServerJSClient(endPoint) { AD_SERVER_BASE_URL: 'ad.360yield.com', END_POINT: endPoint || 'hb', AD_SERVER_URL_PARAM: 'jsonp=', - CLIENT_VERSION: 'JS-5.2.0', + CLIENT_VERSION: 'JS-5.3.0', MAX_URL_LENGTH: 2083, ERROR_CODES: { MISSING_PLACEMENT_PARAMS: 2, @@ -472,12 +480,28 @@ export function ImproveDigitalAdServerJSClient(endPoint) { } } } + + impressionObject.banner = {}; if (placementObject.size && placementObject.size.w && placementObject.size.h) { - impressionObject.banner = {}; impressionObject.banner.w = placementObject.size.w; impressionObject.banner.h = placementObject.size.h; - } else { - impressionObject.banner = {}; + } + + // Set of desired creative sizes + // Input Format: array of pairs, i.e. [[300, 250], [250, 250]] + if (placementObject.format && utils.isArray(placementObject.format)) { + const format = placementObject.format + .filter(sizePair => sizePair.length === 2 && + utils.isInteger(sizePair[0]) && + utils.isInteger(sizePair[1]) && + sizePair[0] >= 0 && + sizePair[1] >= 0) + .map(sizePair => { + return { w: sizePair[0], h: sizePair[1] } + }); + if (format.length > 0) { + impressionObject.banner.format = format; + } } if (!impressionObject.pid && diff --git a/test/spec/modules/improvedigitalBidAdapter_spec.js b/test/spec/modules/improvedigitalBidAdapter_spec.js index 8b76bfcbe9c..7c83f7b1e59 100644 --- a/test/spec/modules/improvedigitalBidAdapter_spec.js +++ b/test/spec/modules/improvedigitalBidAdapter_spec.js @@ -19,7 +19,8 @@ describe('Improve Digital Adapter Tests', function () { transactionId: 'f183e871-fbed-45f0-a427-c8a63c4c01eb', bidId: '33e9500b21129f', bidderRequestId: '2772c1e566670b', - auctionId: '192721e36a0239' + auctionId: '192721e36a0239', + sizes: [[300, 250], [160, 600], ['blah', 150], [-1, 300], [300, -5]] }; const simpleSmartTagBidRequest = { @@ -101,7 +102,12 @@ describe('Improve Digital Adapter Tests', function () { id: '33e9500b21129f', pid: 1053688, tid: 'f183e871-fbed-45f0-a427-c8a63c4c01eb', - banner: {} + banner: { + format: [ + { w: 300, h: 250 }, + { w: 160, h: 600 } + ] + } } ]); }); @@ -126,7 +132,7 @@ describe('Improve Digital Adapter Tests', function () { expect(params.bid_request.imp[0].kvw).to.deep.equal(keyValues); }); - it('should add size', function () { + it('should add single size filter', function () { let bidRequest = Object.assign({}, simpleBidRequest); const size = { w: 800, @@ -136,6 +142,9 @@ describe('Improve Digital Adapter Tests', function () { const request = spec.buildRequests([bidRequest])[0]; const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length))); expect(params.bid_request.imp[0].banner).to.deep.equal(size); + // When single size filter is set, format shouldn't be populated. This + // is to maintain backward compatibily + expect(params.bid_request.imp[0].banner.format).to.not.exist; }); it('should add currency', function () { From d8b871db7887972dd20859fc6749451eb31f83f0 Mon Sep 17 00:00:00 2001 From: Jozef Bartek Date: Tue, 5 Mar 2019 10:04:23 +0100 Subject: [PATCH 6/8] adapter version -> 5.1 --- modules/improvedigitalBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/improvedigitalBidAdapter.js b/modules/improvedigitalBidAdapter.js index 7bd2b896998..a72f37b624b 100644 --- a/modules/improvedigitalBidAdapter.js +++ b/modules/improvedigitalBidAdapter.js @@ -6,7 +6,7 @@ import { BANNER, NATIVE } from '../src/mediaTypes'; const BIDDER_CODE = 'improvedigital'; export const spec = { - version: '5.0.0', + version: '5.1.0', code: BIDDER_CODE, aliases: ['id'], supportedMediaTypes: [BANNER, NATIVE], From 6fb6a993c99d44534594cf1599833c23f1484c9d Mon Sep 17 00:00:00 2001 From: Jozef Bartek Date: Fri, 15 Mar 2019 20:38:23 +0100 Subject: [PATCH 7/8] Adding usePrebidSizes config param --- modules/improvedigitalBidAdapter.js | 10 ++--- .../modules/improvedigitalBidAdapter_spec.js | 41 ++++++++++++++++--- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/modules/improvedigitalBidAdapter.js b/modules/improvedigitalBidAdapter.js index a72f37b624b..fdfe5970572 100644 --- a/modules/improvedigitalBidAdapter.js +++ b/modules/improvedigitalBidAdapter.js @@ -191,16 +191,12 @@ function getNormalizedBidRequest(bid) { normalizedBidRequest.keyValues = keyValues; } - // If a single-size filter is set in the bid.params, use it. - // Otherwise request all ad unit sizes. - if (singleSizeFilter && singleSizeFilter.w && singleSizeFilter.h) { + if (config.getConfig('improvedigital.usePrebidSizes') === true && bid.sizes && bid.sizes.length > 0) { + normalizedBidRequest.format = bid.sizes; + } else if (singleSizeFilter && singleSizeFilter.w && singleSizeFilter.h) { normalizedBidRequest.size = {}; normalizedBidRequest.size.h = singleSizeFilter.h; normalizedBidRequest.size.w = singleSizeFilter.w; - } else { - if (bid.sizes && bid.sizes.length > 0) { - normalizedBidRequest.format = bid.sizes; - } } if (bidId) { diff --git a/test/spec/modules/improvedigitalBidAdapter_spec.js b/test/spec/modules/improvedigitalBidAdapter_spec.js index 7c83f7b1e59..61ba56ab822 100644 --- a/test/spec/modules/improvedigitalBidAdapter_spec.js +++ b/test/spec/modules/improvedigitalBidAdapter_spec.js @@ -102,12 +102,7 @@ describe('Improve Digital Adapter Tests', function () { id: '33e9500b21129f', pid: 1053688, tid: 'f183e871-fbed-45f0-a427-c8a63c4c01eb', - banner: { - format: [ - { w: 300, h: 250 }, - { w: 160, h: 600 } - ] - } + banner: {} } ]); }); @@ -183,6 +178,40 @@ describe('Improve Digital Adapter Tests', function () { expect(requests.length).to.equal(1); getConfigStub.restore(); }); + + it('should set Prebid sizes in bid request', function () { + const getConfigStub = sinon.stub(config, 'getConfig'); + getConfigStub.withArgs('improvedigital.usePrebidSizes').returns(true); + const request = spec.buildRequests([simpleBidRequest])[0]; + const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length))); + expect(params.bid_request.imp[0].banner).to.deep.equal({ + format: [ + { w: 300, h: 250 }, + { w: 160, h: 600 } + ] + }); + getConfigStub.restore(); + }); + + it('should not add single size filter when using Prebid sizes', function () { + const getConfigStub = sinon.stub(config, 'getConfig'); + getConfigStub.withArgs('improvedigital.usePrebidSizes').returns(true); + const bidRequest = Object.assign({}, simpleBidRequest); + const size = { + w: 800, + h: 600 + }; + bidRequest.params.size = size; + const request = spec.buildRequests([bidRequest])[0]; + const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length))); + expect(params.bid_request.imp[0].banner).to.deep.equal({ + format: [ + { w: 300, h: 250 }, + { w: 160, h: 600 } + ] + }); + getConfigStub.restore(); + }); }); const serverResponse = { From 61e7e6115050ab157936697ee3805f7d70a3eb1c Mon Sep 17 00:00:00 2001 From: Jozef Bartek Date: Thu, 9 May 2019 15:09:13 +0200 Subject: [PATCH 8/8] New ad server endpoint --- modules/improvedigitalBidAdapter.js | 4 ++-- .../modules/improvedigitalBidAdapter_spec.js | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/improvedigitalBidAdapter.js b/modules/improvedigitalBidAdapter.js index fdfe5970572..0c9028133e0 100644 --- a/modules/improvedigitalBidAdapter.js +++ b/modules/improvedigitalBidAdapter.js @@ -271,10 +271,10 @@ export function ImproveDigitalAdServerJSClient(endPoint) { STANDARD: 0, SECURE: 1 }, - AD_SERVER_BASE_URL: 'ad.360yield.com', + AD_SERVER_BASE_URL: 'ice.360yield.com', END_POINT: endPoint || 'hb', AD_SERVER_URL_PARAM: 'jsonp=', - CLIENT_VERSION: 'JS-5.3.0', + CLIENT_VERSION: 'JS-6.0.0', MAX_URL_LENGTH: 2083, ERROR_CODES: { MISSING_PLACEMENT_PARAMS: 2, diff --git a/test/spec/modules/improvedigitalBidAdapter_spec.js b/test/spec/modules/improvedigitalBidAdapter_spec.js index 61ba56ab822..6c78afca6b2 100644 --- a/test/spec/modules/improvedigitalBidAdapter_spec.js +++ b/test/spec/modules/improvedigitalBidAdapter_spec.js @@ -7,7 +7,7 @@ describe('Improve Digital Adapter Tests', function () { let idClient = new ImproveDigitalAdServerJSClient('hb'); const METHOD = 'GET'; - const URL = '//ad.360yield.com/hb'; + const URL = '//ice.360yield.com/hb'; const PARAM_PREFIX = 'jsonp='; const simpleBidRequest = { @@ -224,7 +224,7 @@ describe('Improve Digital Adapter Tests', function () { 'id': '33e9500b21129f', 'advid': '5279', 'price': 1.45888594164456, - 'nurl': 'http://ad.360yield.com/imp_pixel?ic=wVmhKI07hCVyGC1sNdFp.6buOSiGYOw8jPyZLlcMY2RCwD4ek3Fy6.xUI7U002skGBs3objMBoNU-Frpvmb9js3NKIG0YZJgWaNdcpXY9gOXE9hY4-wxybCjVSNzhOQB-zic73hzcnJnKeoGgcfvt8fMy18-yD0aVdYWt4zbqdoITOkKNCPBEgbPFu1rcje-o7a64yZ7H3dKvtnIixXQYc1Ep86xGSBGXY6xW2KfUOMT6vnkemxO72divMkMdhR8cAuqIubbx-ZID8-xf5c9k7p6DseeBW0I8ionrlTHx.rGosgxhiFaMqtr7HiA7PBzKvPdeEYN0hQ8RYo8JzYL82hA91A3V2m9Ij6y0DfIJnnrKN8YORffhxmJ6DzwEl1zjrVFbD01bqB3Vdww8w8PQJSkKQkd313tr-atU8LS26fnBmOngEkVHwAr2WCKxuUvxHmuVBTA-Lgz7wKwMoOJCA3hFxMavVb0ZFB7CK0BUTVU6z0De92Q.FJKNCHLMbjX3vcAQ90=', + 'nurl': 'http://ice.360yield.com/imp_pixel?ic=wVmhKI07hCVyGC1sNdFp.6buOSiGYOw8jPyZLlcMY2RCwD4ek3Fy6.xUI7U002skGBs3objMBoNU-Frpvmb9js3NKIG0YZJgWaNdcpXY9gOXE9hY4-wxybCjVSNzhOQB-zic73hzcnJnKeoGgcfvt8fMy18-yD0aVdYWt4zbqdoITOkKNCPBEgbPFu1rcje-o7a64yZ7H3dKvtnIixXQYc1Ep86xGSBGXY6xW2KfUOMT6vnkemxO72divMkMdhR8cAuqIubbx-ZID8-xf5c9k7p6DseeBW0I8ionrlTHx.rGosgxhiFaMqtr7HiA7PBzKvPdeEYN0hQ8RYo8JzYL82hA91A3V2m9Ij6y0DfIJnnrKN8YORffhxmJ6DzwEl1zjrVFbD01bqB3Vdww8w8PQJSkKQkd313tr-atU8LS26fnBmOngEkVHwAr2WCKxuUvxHmuVBTA-Lgz7wKwMoOJCA3hFxMavVb0ZFB7CK0BUTVU6z0De92Q.FJKNCHLMbjX3vcAQ90=', 'h': 290, 'pid': 1053688, 'sync': [ @@ -234,7 +234,7 @@ describe('Improve Digital Adapter Tests', function () { 'crid': '422031', 'w': 600, 'cid': '99006', - 'adm': 'document.writeln(\"\\\"\\\"\\/<\\/a>\");document.writeln(\"<\\/improvedigital_ad_output_information>\");' + 'adm': 'document.writeln(\"\\\"\\\"\\/<\\/a>\");document.writeln(\"<\\/improvedigital_ad_output_information>\");' } ], 'debug': '' @@ -261,7 +261,7 @@ describe('Improve Digital Adapter Tests', function () { 'crid': '422033', 'w': 700, 'cid': '99006', - 'adm': 'document.writeln(\"\\\"\\\"\\/<\\/a>\");document.writeln(\"<\\/improvedigital_ad_output_information>\");' + 'adm': 'document.writeln(\"\\\"\\\"\\/<\\/a>\");document.writeln(\"<\\/improvedigital_ad_output_information>\");' } ], 'debug': '' @@ -278,7 +278,7 @@ describe('Improve Digital Adapter Tests', function () { id: '33e9500b21129f', advid: '5279', price: 1.45888594164456, - nurl: 'http://ad.360yield.com/imp_pixel?ic=wVm', + nurl: 'http://ice.360yield.com/imp_pixel?ic=wVm', h: 290, pid: 1053688, sync: [ @@ -365,7 +365,7 @@ describe('Improve Digital Adapter Tests', function () { describe('interpretResponse', function () { let expectedBid = [ { - 'ad': '', + 'ad': '', 'adId': '33e9500b21129f', 'creativeId': '422031', 'cpm': 1.45888594164456, @@ -382,7 +382,7 @@ describe('Improve Digital Adapter Tests', function () { let expectedTwoBids = [ expectedBid[0], { - 'ad': '', + 'ad': '', 'adId': '1234', 'creativeId': '422033', 'cpm': 1.23, @@ -426,7 +426,7 @@ describe('Improve Digital Adapter Tests', function () { clickUrl: 'http://advertiser.com', clickTrackers: ['http://click.tracker.com/click?impid=123'], impressionTrackers: [ - 'http://ad.360yield.com/imp_pixel?ic=wVm', + 'http://ice.360yield.com/imp_pixel?ic=wVm', 'http://imptrack1.com', 'http://imptrack2.com' ],