From a2fc9ccce9f02f8815abb4e630b818364b742308 Mon Sep 17 00:00:00 2001 From: Jeff Ye Date: Fri, 22 Sep 2017 18:02:00 -0400 Subject: [PATCH 01/13] add arteebee adapter --- modules/arteebeeBidAdapter.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 modules/arteebeeBidAdapter.js diff --git a/modules/arteebeeBidAdapter.js b/modules/arteebeeBidAdapter.js new file mode 100644 index 00000000000..89eeabf53a5 --- /dev/null +++ b/modules/arteebeeBidAdapter.js @@ -0,0 +1,23 @@ +import bidfactory from 'src/bidfactory'; +import bidmanager from 'src/bidmanager'; +import * as utils from 'src/utils'; // useful functions +import { ajax } from 'src/ajax'; // recommended AJAX library +import { STATUS } from 'src/constants'; + +/** + * Adapter for requesting bids from ArTeeBee. + * + * @returns {{callBids: _callBids}} + */ +function ArteebeeAdapter() { + function _callBids(params) { + } + + return { + callBids: _callBids + }; +} + +adaptermanager.registerBidAdapter(new ArteebeeAdapter(), 'arteebee'); + +module.exports = ArteebeeAdapter; From edcdb534bdc3617412ca323a9c6328ffb2ba9ffe Mon Sep 17 00:00:00 2001 From: Jeff Ye Date: Wed, 15 Nov 2017 17:27:44 -0500 Subject: [PATCH 02/13] set log --- modules/arteebeeBidAdapter.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/arteebeeBidAdapter.js b/modules/arteebeeBidAdapter.js index 89eeabf53a5..b042f79fd27 100644 --- a/modules/arteebeeBidAdapter.js +++ b/modules/arteebeeBidAdapter.js @@ -1,8 +1,8 @@ import bidfactory from 'src/bidfactory'; import bidmanager from 'src/bidmanager'; import * as utils from 'src/utils'; // useful functions -import { ajax } from 'src/ajax'; // recommended AJAX library -import { STATUS } from 'src/constants'; +import {ajax} from 'src/ajax'; // recommended AJAX library +import {STATUS} from 'src/constants'; /** * Adapter for requesting bids from ArTeeBee. @@ -10,14 +10,16 @@ import { STATUS } from 'src/constants'; * @returns {{callBids: _callBids}} */ function ArteebeeAdapter() { - function _callBids(params) { - } + function _callBids(params) { + console.log("dsdssd"); + } - return { - callBids: _callBids - }; + return { + callBids: _callBids + }; } adaptermanager.registerBidAdapter(new ArteebeeAdapter(), 'arteebee'); module.exports = ArteebeeAdapter; + From 599e3b9b5d7e4b47b8bb5406d20c6d99fa6b9bef Mon Sep 17 00:00:00 2001 From: Jeff Ye Date: Thu, 16 Nov 2017 14:18:19 -0500 Subject: [PATCH 03/13] basic structure --- modules/arteebeeBidAdapter.js | 61 +++++++++++++++++++++++------------ modules/arteebeeBidAdapter.md | 31 ++++++++++++++++++ 2 files changed, 71 insertions(+), 21 deletions(-) create mode 100644 modules/arteebeeBidAdapter.md diff --git a/modules/arteebeeBidAdapter.js b/modules/arteebeeBidAdapter.js index b042f79fd27..14b6be4e008 100644 --- a/modules/arteebeeBidAdapter.js +++ b/modules/arteebeeBidAdapter.js @@ -1,25 +1,44 @@ -import bidfactory from 'src/bidfactory'; -import bidmanager from 'src/bidmanager'; -import * as utils from 'src/utils'; // useful functions -import {ajax} from 'src/ajax'; // recommended AJAX library -import {STATUS} from 'src/constants'; -/** - * Adapter for requesting bids from ArTeeBee. - * - * @returns {{callBids: _callBids}} - */ -function ArteebeeAdapter() { - function _callBids(params) { - console.log("dsdssd"); - } +import { BANNER } from 'src/mediaTypes'; +import { registerBidder } from 'src/adapters/bidderFactory'; - return { - callBids: _callBids - }; +const BIDDER_CODE = 'arteebee'; +export const spec = { + code: BIDDER_CODE, + supportedMediaTypes: [BANNER], + isBidRequestValid: function(bidRequest) { + return 'params' in bidRequest && bidRequest.params.pub !== undefined + && bidRequest.params.source !== undefined; + }, + buildRequests: function(validBidRequests) { + const payload = {}; + const payloadString = JSON.stringify(payload); + return { + method: 'POST', + url: 'https://bidder.mamrtb.com/dsdds', + data: payloadString + }; + }, + interpretResponse: function(serverResponse, bidRequest) { + const bidResponses = []; + const bidResponse = { + requestId: bidRequest.bidId, + cpm: 1, + width: 300, + height: 250, + mediaType: BANNER, + creativeId: 'aaa', + currency: 'USD', + netRevenue: true, + ttl: 360, + ad: 'dsdsd' + }; + bidResponses.push(bidResponse); + return bidResponses; + }, + getUserSyncs: function(syncOptions, serverResponses) { + return []; + } } -adaptermanager.registerBidAdapter(new ArteebeeAdapter(), 'arteebee'); - -module.exports = ArteebeeAdapter; - +registerBidder(spec); \ No newline at end of file diff --git a/modules/arteebeeBidAdapter.md b/modules/arteebeeBidAdapter.md new file mode 100644 index 00000000000..c4b40d793f0 --- /dev/null +++ b/modules/arteebeeBidAdapter.md @@ -0,0 +1,31 @@ +# Overview + +``` +Module Name: Arteebee Bidder Adapter +Module Type: Bidder Adapter +Maintainer: jeffyecn@gmail.com +``` + +# Description + +Module that connects to Arteebee's demand source + +# Test Parameters +``` + var adUnits = [ + { + code: 'banner-ad-div', + sizes: [[300, 250]], + bids: [ + { + bidder: 'arteebee', + params: { + ssp: 'mock', + pub: 'prebidtest', + source: 'prebidtest' + } + } + ] + } + ]; +``` \ No newline at end of file From 2f875ce280ed9e0e4c8923b868a9700bf1a45422 Mon Sep 17 00:00:00 2001 From: Jeff Ye Date: Thu, 16 Nov 2017 16:18:43 -0500 Subject: [PATCH 04/13] basic structure --- modules/arteebeeBidAdapter.js | 126 +++++++++++++++++++++++++++++++--- 1 file changed, 116 insertions(+), 10 deletions(-) diff --git a/modules/arteebeeBidAdapter.js b/modules/arteebeeBidAdapter.js index 14b6be4e008..f3912c0dac8 100644 --- a/modules/arteebeeBidAdapter.js +++ b/modules/arteebeeBidAdapter.js @@ -1,8 +1,14 @@ - +import * as utils from 'src/utils'; import { BANNER } from 'src/mediaTypes'; import { registerBidder } from 'src/adapters/bidderFactory'; +import { config } from 'src/config'; const BIDDER_CODE = 'arteebee'; + +const DEFAULT_HOST = 'bidder.mamrtb.com'; + +const DEFAULT_SSP = 'arteebee'; + export const spec = { code: BIDDER_CODE, supportedMediaTypes: [BANNER], @@ -11,16 +17,19 @@ export const spec = { && bidRequest.params.source !== undefined; }, buildRequests: function(validBidRequests) { - const payload = {}; - const payloadString = JSON.stringify(payload); - return { - method: 'POST', - url: 'https://bidder.mamrtb.com/dsdds', - data: payloadString - }; + var requests = []; + + for(let i=0; i Date: Fri, 17 Nov 2017 09:07:09 -0500 Subject: [PATCH 05/13] send caller as placeholder for ip and user agent --- modules/arteebeeBidAdapter.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/arteebeeBidAdapter.js b/modules/arteebeeBidAdapter.js index f3912c0dac8..51fd0fad5b3 100644 --- a/modules/arteebeeBidAdapter.js +++ b/modules/arteebeeBidAdapter.js @@ -78,6 +78,7 @@ function makeRtbRequest(req) { 'id': auctionId, 'imp': imp, 'site': makeSite(req), + 'device': makeDevice(), 'at': 1, 'tmax': config.getConfig("bidderTimeout") }; @@ -147,4 +148,13 @@ function getDomain(url) { a.href = url; return a.host; +} + +function makeDevice() { + var device = { + 'ua': 'caller', + 'ip': 'caller' + }; + + return device; } \ No newline at end of file From a2e5e6b563dfab867b22af2ff6852c45eab02adf Mon Sep 17 00:00:00 2001 From: Jeff Ye Date: Fri, 17 Nov 2017 09:55:55 -0500 Subject: [PATCH 06/13] send caller as placeholder for ip and user agent --- modules/arteebeeBidAdapter.js | 9 +++++++-- modules/arteebeeBidAdapter.md | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/arteebeeBidAdapter.js b/modules/arteebeeBidAdapter.js index 51fd0fad5b3..6460532b9c5 100644 --- a/modules/arteebeeBidAdapter.js +++ b/modules/arteebeeBidAdapter.js @@ -84,7 +84,11 @@ function makeRtbRequest(req) { }; if ( req.params.coppa ) { - reqReq.regs = {coppa:1}; + rtbReq.regs = {coppa:1}; + } + + if ( req.params.test ) { + rtbReq.test = 1; } return rtbReq; @@ -153,7 +157,8 @@ function getDomain(url) { function makeDevice() { var device = { 'ua': 'caller', - 'ip': 'caller' + 'ip': 'caller', + 'js': 1 }; return device; diff --git a/modules/arteebeeBidAdapter.md b/modules/arteebeeBidAdapter.md index c4b40d793f0..4c178d722b1 100644 --- a/modules/arteebeeBidAdapter.md +++ b/modules/arteebeeBidAdapter.md @@ -22,7 +22,8 @@ Module that connects to Arteebee's demand source params: { ssp: 'mock', pub: 'prebidtest', - source: 'prebidtest' + source: 'prebidtest', + test: true } } ] From bec7bc47895015e01092bd326d24813d1457c087 Mon Sep 17 00:00:00 2001 From: Jeff Ye Date: Fri, 17 Nov 2017 11:32:00 -0500 Subject: [PATCH 07/13] send caller as placeholder for ip and user agent --- modules/arteebeeBidAdapter.js | 40 +++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/modules/arteebeeBidAdapter.js b/modules/arteebeeBidAdapter.js index 6460532b9c5..71343788d9d 100644 --- a/modules/arteebeeBidAdapter.js +++ b/modules/arteebeeBidAdapter.js @@ -29,20 +29,34 @@ export const spec = { return requests; }, interpretResponse: function(serverResponse, bidRequest) { + var rtbResp = serverResponse.body; + + if ( (! rtbResp) || (! rtbResp.seatbid) ) { + return []; + } + let bidResponses = []; - const bidResponse = { - requestId: bidRequest.bidId, - cpm: 1, - width: 300, - height: 250, - mediaType: BANNER, - creativeId: 'aaa', - currency: 'USD', - netRevenue: true, - ttl: 360, - ad: 'dsdsd' - }; - bidResponses.push(bidResponse); + + for(let i=0; i Date: Fri, 17 Nov 2017 15:46:16 -0500 Subject: [PATCH 08/13] first version of adapter --- modules/arteebeeBidAdapter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/arteebeeBidAdapter.js b/modules/arteebeeBidAdapter.js index 71343788d9d..5ba8c46d40c 100644 --- a/modules/arteebeeBidAdapter.js +++ b/modules/arteebeeBidAdapter.js @@ -45,8 +45,8 @@ export const spec = { let bidResponse = { requestId: bid.impid, cpm: bid.price, - width: 300, - height: 250, + width: bid.w, + height: bid.h, mediaType: BANNER, creativeId: bid.crid, currency: 'USD', From 7ddfcb6db9cd3942e46b481778261587059b1b77 Mon Sep 17 00:00:00 2001 From: Jeff Ye Date: Fri, 17 Nov 2017 17:44:30 -0500 Subject: [PATCH 09/13] add unit testing for arteebee bid adapter --- modules/arteebeeBidAdapter.js | 3 +- test/spec/modules/arteebeeBidAdapter_spec.js | 128 +++++++++++++++++++ 2 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 test/spec/modules/arteebeeBidAdapter_spec.js diff --git a/modules/arteebeeBidAdapter.js b/modules/arteebeeBidAdapter.js index 5ba8c46d40c..7d27eb12488 100644 --- a/modules/arteebeeBidAdapter.js +++ b/modules/arteebeeBidAdapter.js @@ -41,7 +41,6 @@ export const spec = { let seatbid = rtbResp.seatbid[i]; for (let j=0; j{ + + describe('Test validate req', ()=>{ + + it('should accept minimum valid bid', ()=>{ + let bid = { + bidder: 'arteebee', + params: { + pub: 'prebidtest', + source: 'prebidtest' + } + }; + const isValid = spec.isBidRequestValid(bid); + + expect(isValid).to.equal(true); + }); + + it('should reject missing pub', ()=>{ + let bid = { + bidder: 'arteebee', + params: { + source: 'prebidtest' + } + }; + const isValid = spec.isBidRequestValid(bid); + + expect(isValid).to.equal(false); + }); + + it('should reject missing source', ()=>{ + let bid = { + bidder: 'arteebee', + params: { + pub: 'prebidtest' + } + }; + const isValid = spec.isBidRequestValid(bid); + + expect(isValid).to.equal(false); + }); + }); + + describe('Test build request', () => { + it('minimum request', ()=>{ + let bid = { + bidder: 'arteebee', + params: { + pub: 'prebidtest', + source: 'prebidtest' + }, + sizes:[[300,250]] + }; + + const req = JSON.parse(spec.buildRequests([bid])[0].data); + + expect(req).to.not.have.property('reg'); + expect(req).to.not.have.property('test'); + expect(req.imp[0]).to.not.have.property('secure'); + }); + + it('make test request', ()=>{ + let bid = { + bidder: 'arteebee', + params: { + pub: 'prebidtest', + source: 'prebidtest', + test: true + }, + sizes:[[300,250]] + }; + + const req = JSON.parse(spec.buildRequests([bid])[0].data); + + expect(req).to.not.have.property('reg'); + expect(req).to.have.property('test', 1); + expect(req.imp[0]).to.not.have.property('secure'); + }); + + it('test coppa', ()=>{ + let bid = { + bidder: 'arteebee', + params: { + pub: 'prebidtest', + source: 'prebidtest', + coppa: true + }, + sizes:[[300,250]] + }; + + const req = JSON.parse(spec.buildRequests([bid])[0].data); + + expect(req.regs).to.have.property('coppa', 1); + expect(req).to.not.have.property('test'); + expect(req.imp[0]).to.not.have.property('secure'); + }); + }); + + describe('Test interpret response', () => { + it('General banner response', ()=>{ + let resp = spec.interpretResponse({body: { + id: 'abcd', + seatbid: [{ + bid: [{ + id: 'abcd', + impid: 'banner-bid', + price: 0.3, + adm: 'hello', + crid: 'efgh', + w: 300, + h: 250, + exp: 5 + }] + }] + }}, null)[0]; + + expect(resp).to.have.property('requestId', 'banner-bid'); + expect(resp).to.have.property('cpm', 0.3); + expect(resp).to.have.property('width', 300); + expect(resp).to.have.property('height', 250); + expect(resp).to.have.property('creativeId', 'efgh'); + expect(resp).to.have.property('ttl', 5); + expect(resp).to.have.property('ad', 'hello'); + }); + }); +}); \ No newline at end of file From 05489483c4972653ac6684b28d8633e3e63ba69c Mon Sep 17 00:00:00 2001 From: Jeff Ye Date: Mon, 20 Nov 2017 18:00:17 -0500 Subject: [PATCH 10/13] fix indent --- modules/arteebeeBidAdapter.js | 254 +++++++++---------- test/spec/modules/arteebeeBidAdapter_spec.js | 246 +++++++++--------- 2 files changed, 251 insertions(+), 249 deletions(-) diff --git a/modules/arteebeeBidAdapter.js b/modules/arteebeeBidAdapter.js index 7d27eb12488..3a3e41727ca 100644 --- a/modules/arteebeeBidAdapter.js +++ b/modules/arteebeeBidAdapter.js @@ -1,7 +1,7 @@ import * as utils from 'src/utils'; -import { BANNER } from 'src/mediaTypes'; -import { registerBidder } from 'src/adapters/bidderFactory'; -import { config } from 'src/config'; +import {BANNER} from 'src/mediaTypes'; +import {registerBidder} from 'src/adapters/bidderFactory'; +import {config} from 'src/config'; const BIDDER_CODE = 'arteebee'; @@ -10,169 +10,169 @@ const DEFAULT_HOST = 'bidder.mamrtb.com'; const DEFAULT_SSP = 'arteebee'; export const spec = { - code: BIDDER_CODE, - supportedMediaTypes: [BANNER], - isBidRequestValid: function(bidRequest) { - return 'params' in bidRequest && bidRequest.params.pub !== undefined - && bidRequest.params.source !== undefined; - }, - buildRequests: function(validBidRequests) { - var requests = []; - - for(let i=0; i{ - - describe('Test validate req', ()=>{ - - it('should accept minimum valid bid', ()=>{ - let bid = { - bidder: 'arteebee', - params: { - pub: 'prebidtest', - source: 'prebidtest' - } - }; - const isValid = spec.isBidRequestValid(bid); - - expect(isValid).to.equal(true); - }); - - it('should reject missing pub', ()=>{ - let bid = { - bidder: 'arteebee', - params: { - source: 'prebidtest' - } - }; - const isValid = spec.isBidRequestValid(bid); - - expect(isValid).to.equal(false); - }); - - it('should reject missing source', ()=>{ - let bid = { - bidder: 'arteebee', - params: { - pub: 'prebidtest' - } - }; - const isValid = spec.isBidRequestValid(bid); - - expect(isValid).to.equal(false); - }); +import {expect} from 'chai'; +import {spec} from 'modules/arteebeeBidAdapter'; + +describe('Arteebee adapater', () => { + + describe('Test validate req', () => { + + it('should accept minimum valid bid', () => { + let bid = { + bidder: 'arteebee', + params: { + pub: 'prebidtest', + source: 'prebidtest' + } + }; + const isValid = spec.isBidRequestValid(bid); + + expect(isValid).to.equal(true); + }); + + it('should reject missing pub', () => { + let bid = { + bidder: 'arteebee', + params: { + source: 'prebidtest' + } + }; + const isValid = spec.isBidRequestValid(bid); + + expect(isValid).to.equal(false); + }); + + it('should reject missing source', () => { + let bid = { + bidder: 'arteebee', + params: { + pub: 'prebidtest' + } + }; + const isValid = spec.isBidRequestValid(bid); + + expect(isValid).to.equal(false); + }); + }); + + describe('Test build request', () => { + it('minimum request', () => { + let bid = { + bidder: 'arteebee', + params: { + pub: 'prebidtest', + source: 'prebidtest' + }, + sizes: [[300, 250]] + }; + + const req = JSON.parse(spec.buildRequests([bid])[0].data); + + expect(req).to.not.have.property('reg'); + expect(req).to.not.have.property('test'); + expect(req.imp[0]).to.not.have.property('secure'); }); - describe('Test build request', () => { - it('minimum request', ()=>{ - let bid = { - bidder: 'arteebee', - params: { - pub: 'prebidtest', - source: 'prebidtest' - }, - sizes:[[300,250]] - }; - - const req = JSON.parse(spec.buildRequests([bid])[0].data); - - expect(req).to.not.have.property('reg'); - expect(req).to.not.have.property('test'); - expect(req.imp[0]).to.not.have.property('secure'); - }); - - it('make test request', ()=>{ - let bid = { - bidder: 'arteebee', - params: { - pub: 'prebidtest', - source: 'prebidtest', - test: true - }, - sizes:[[300,250]] - }; - - const req = JSON.parse(spec.buildRequests([bid])[0].data); - - expect(req).to.not.have.property('reg'); - expect(req).to.have.property('test', 1); - expect(req.imp[0]).to.not.have.property('secure'); - }); - - it('test coppa', ()=>{ - let bid = { - bidder: 'arteebee', - params: { - pub: 'prebidtest', - source: 'prebidtest', - coppa: true - }, - sizes:[[300,250]] - }; - - const req = JSON.parse(spec.buildRequests([bid])[0].data); - - expect(req.regs).to.have.property('coppa', 1); - expect(req).to.not.have.property('test'); - expect(req.imp[0]).to.not.have.property('secure'); - }); + it('make test request', () => { + let bid = { + bidder: 'arteebee', + params: { + pub: 'prebidtest', + source: 'prebidtest', + test: true + }, + sizes: [[300, 250]] + }; + + const req = JSON.parse(spec.buildRequests([bid])[0].data); + + expect(req).to.not.have.property('reg'); + expect(req).to.have.property('test', 1); + expect(req.imp[0]).to.not.have.property('secure'); }); - describe('Test interpret response', () => { - it('General banner response', ()=>{ - let resp = spec.interpretResponse({body: { - id: 'abcd', - seatbid: [{ - bid: [{ - id: 'abcd', - impid: 'banner-bid', - price: 0.3, - adm: 'hello', - crid: 'efgh', - w: 300, - h: 250, - exp: 5 - }] - }] - }}, null)[0]; - - expect(resp).to.have.property('requestId', 'banner-bid'); - expect(resp).to.have.property('cpm', 0.3); - expect(resp).to.have.property('width', 300); - expect(resp).to.have.property('height', 250); - expect(resp).to.have.property('creativeId', 'efgh'); - expect(resp).to.have.property('ttl', 5); - expect(resp).to.have.property('ad', 'hello'); - }); + it('test coppa', () => { + let bid = { + bidder: 'arteebee', + params: { + pub: 'prebidtest', + source: 'prebidtest', + coppa: true + }, + sizes: [[300, 250]] + }; + + const req = JSON.parse(spec.buildRequests([bid])[0].data); + + expect(req.regs).to.have.property('coppa', 1); + expect(req).to.not.have.property('test'); + expect(req.imp[0]).to.not.have.property('secure'); + }); + }); + + describe('Test interpret response', () => { + it('General banner response', () => { + let resp = spec.interpretResponse({ + body: { + id: 'abcd', + seatbid: [{ + bid: [{ + id: 'abcd', + impid: 'banner-bid', + price: 0.3, + adm: 'hello', + crid: 'efgh', + w: 300, + h: 250, + exp: 5 + }] + }] + } + }, null)[0]; + + expect(resp).to.have.property('requestId', 'banner-bid'); + expect(resp).to.have.property('cpm', 0.3); + expect(resp).to.have.property('width', 300); + expect(resp).to.have.property('height', 250); + expect(resp).to.have.property('creativeId', 'efgh'); + expect(resp).to.have.property('ttl', 5); + expect(resp).to.have.property('ad', 'hello'); }); + }); }); \ No newline at end of file From dce3793b9a75c2579c3a20189fe41fdbcbc76bda Mon Sep 17 00:00:00 2001 From: Jeff Ye Date: Mon, 20 Nov 2017 18:04:36 -0500 Subject: [PATCH 11/13] fix lint complain --- modules/arteebeeBidAdapter.js | 20 ++++++++++---------- test/spec/modules/arteebeeBidAdapter_spec.js | 4 +--- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/modules/arteebeeBidAdapter.js b/modules/arteebeeBidAdapter.js index 3a3e41727ca..65510b43bc0 100644 --- a/modules/arteebeeBidAdapter.js +++ b/modules/arteebeeBidAdapter.js @@ -13,8 +13,8 @@ export const spec = { code: BIDDER_CODE, supportedMediaTypes: [BANNER], isBidRequestValid: function (bidRequest) { - return 'params' in bidRequest && bidRequest.params.pub !== undefined - && bidRequest.params.source !== undefined; + return 'params' in bidRequest && bidRequest.params.pub !== undefined && + bidRequest.params.source !== undefined; }, buildRequests: function (validBidRequests) { var requests = []; @@ -69,7 +69,7 @@ function makePrebidRequest(req) { var host = req.params.host || DEFAULT_HOST; var ssp = req.params.ssp || DEFAULT_SSP; - var url = window.location.protocol + "//" + host + "/rtb/bid/" + ssp + "?type=json®ister=0"; + var url = window.location.protocol + '//' + host + '/rtb/bid/' + ssp + '?type=json®ister=0'; const payload = makeRtbRequest(req); const payloadString = JSON.stringify(payload); @@ -93,7 +93,7 @@ function makeRtbRequest(req) { 'site': makeSite(req), 'device': makeDevice(), 'at': 1, - 'tmax': config.getConfig("bidderTimeout") + 'tmax': config.getConfig('bidderTimeout') }; if (req.params.coppa) { @@ -140,10 +140,10 @@ function makeSite(req) { var params = req.params; var site = { - "id": params.source, - "page": utils.getTopWindowUrl(), + 'id': params.source, + 'page': utils.getTopWindowUrl(), 'ref': utils.getTopWindowReferrer(), - "publisher": makePublisher(req) + 'publisher': makePublisher(req) }; return site; @@ -153,8 +153,8 @@ function makePublisher(req) { var params = req.params; var publisher = { - "id": params.pub, - "domain": getDomain(config.getConfig("publisherDomain")) + 'id': params.pub, + 'domain': getDomain(config.getConfig('publisherDomain')) }; return publisher; @@ -175,4 +175,4 @@ function makeDevice() { }; return device; -} \ No newline at end of file +} diff --git a/test/spec/modules/arteebeeBidAdapter_spec.js b/test/spec/modules/arteebeeBidAdapter_spec.js index ee6a9f2a5d3..fe5bbf7ff25 100644 --- a/test/spec/modules/arteebeeBidAdapter_spec.js +++ b/test/spec/modules/arteebeeBidAdapter_spec.js @@ -2,9 +2,7 @@ import {expect} from 'chai'; import {spec} from 'modules/arteebeeBidAdapter'; describe('Arteebee adapater', () => { - describe('Test validate req', () => { - it('should accept minimum valid bid', () => { let bid = { bidder: 'arteebee', @@ -127,4 +125,4 @@ describe('Arteebee adapater', () => { expect(resp).to.have.property('ad', 'hello'); }); }); -}); \ No newline at end of file +}); From ee21c72699491df6ebb8985ddce290a723d680a7 Mon Sep 17 00:00:00 2001 From: "jeffye@yesup.com" Date: Tue, 29 May 2018 11:40:57 -0400 Subject: [PATCH 12/13] Add consent manager support --- modules/arteebeeBidAdapter.js | 24 ++++++++++++----- test/spec/modules/arteebeeBidAdapter_spec.js | 28 ++++++++++++++++++++ 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/modules/arteebeeBidAdapter.js b/modules/arteebeeBidAdapter.js index 65510b43bc0..3aad985b92d 100644 --- a/modules/arteebeeBidAdapter.js +++ b/modules/arteebeeBidAdapter.js @@ -16,11 +16,11 @@ export const spec = { return 'params' in bidRequest && bidRequest.params.pub !== undefined && bidRequest.params.source !== undefined; }, - buildRequests: function (validBidRequests) { + buildRequests: function (validBidRequests, bidderRequest) { var requests = []; for (let i = 0; i < validBidRequests.length; i++) { - let prebidReq = makePrebidRequest(validBidRequests[i]); + let prebidReq = makePrebidRequest(validBidRequests[i], bidderRequest); if (prebidReq) { requests.push(prebidReq); } @@ -58,20 +58,20 @@ export const spec = { } return bidResponses; }, - getUserSyncs: function (syncOptions, serverResponses) { + getUserSyncs: function (syncOptions, serverResponses, gdprConsent) { return []; } } registerBidder(spec); -function makePrebidRequest(req) { +function makePrebidRequest(req, bidderRequest) { var host = req.params.host || DEFAULT_HOST; var ssp = req.params.ssp || DEFAULT_SSP; var url = window.location.protocol + '//' + host + '/rtb/bid/' + ssp + '?type=json®ister=0'; - const payload = makeRtbRequest(req); + const payload = makeRtbRequest(req, bidderRequest); const payloadString = JSON.stringify(payload); return { @@ -81,7 +81,7 @@ function makePrebidRequest(req) { }; } -function makeRtbRequest(req) { +function makeRtbRequest(req, bidderRequest) { var auctionId = req.requestId; var imp = []; @@ -100,6 +100,18 @@ function makeRtbRequest(req) { rtbReq.regs = {coppa: 1}; } + if (bidderRequest && bidderRequest.gdprConsent) { + if ((typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') && bidderRequest.gdprConsent.gdprApplies) { + if (!rtbReq.regs) { + rtbReq.regs = {}; + } + rtbReq.regs['ext'] = {'gdpr': 1}; + } + if ((typeof bidderRequest.gdprConsent.consentString === 'string') && bidderRequest.gdprConsent.consentString) { + rtbReq['user'] = {'ext': {'consent': bidderRequest.gdprConsent.consentString}}; + } + } + if (req.params.test) { rtbReq.test = 1; } diff --git a/test/spec/modules/arteebeeBidAdapter_spec.js b/test/spec/modules/arteebeeBidAdapter_spec.js index fe5bbf7ff25..041b48b0bc9 100644 --- a/test/spec/modules/arteebeeBidAdapter_spec.js +++ b/test/spec/modules/arteebeeBidAdapter_spec.js @@ -94,6 +94,34 @@ describe('Arteebee adapater', () => { expect(req).to.not.have.property('test'); expect(req.imp[0]).to.not.have.property('secure'); }); + + it('test gdpr', () => { + let bid = { + bidder: 'arteebee', + params: { + pub: 'prebidtest', + source: 'prebidtest' + }, + sizes: [[300, 250]] + }; + let consentString = 'ABCD'; + let bidderRequest = { + 'gdprConsent': { + consentString: consentString, + gdprApplies: true + } + }; + + const req = JSON.parse(spec.buildRequests([bid], bidderRequest)[0].data); + + expect(req.regs).to.exist; + expect(req.regs.ext).to.exist; + expect(req.regs.ext).to.have.property('gdpr', 1); + + expect(req.user).to.exist; + expect(req.user.ext).to.exist; + expect(req.user.ext).to.have.property('consent', consentString); + }); }); describe('Test interpret response', () => { From 77c65e6fa96610377a1c5a2b2def697ee3c21ee9 Mon Sep 17 00:00:00 2001 From: "jeffye@yesup.com" Date: Wed, 30 May 2018 15:49:11 -0400 Subject: [PATCH 13/13] fix requestId missing --- modules/arteebeeBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/arteebeeBidAdapter.js b/modules/arteebeeBidAdapter.js index 3aad985b92d..e8d319c8845 100644 --- a/modules/arteebeeBidAdapter.js +++ b/modules/arteebeeBidAdapter.js @@ -82,7 +82,7 @@ function makePrebidRequest(req, bidderRequest) { } function makeRtbRequest(req, bidderRequest) { - var auctionId = req.requestId; + var auctionId = req.bidderRequestId; var imp = []; imp.push(makeImp(req));