prebid.js 6.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/.babelrc.js +1 -7
  2. package/gulpfile.js +1 -0
  3. package/modules/adheseBidAdapter.js +7 -2
  4. package/modules/adkernelBidAdapter.js +1 -0
  5. package/modules/adlivetechBidAdapter.md +61 -0
  6. package/modules/adomikAnalyticsAdapter.js +10 -4
  7. package/modules/appnexusBidAdapter.js +4 -0
  8. package/modules/codefuelBidAdapter.js +1 -3
  9. package/modules/codefuelBidAdapter.md +3 -3
  10. package/modules/datablocksBidAdapter.js +3 -3
  11. package/modules/deepintentBidAdapter.js +1 -1
  12. package/modules/engageyaBidAdapter.js +68 -54
  13. package/modules/glimpseBidAdapter.js +31 -16
  14. package/modules/gptPreAuction.js +11 -5
  15. package/modules/gridBidAdapter.js +1 -1
  16. package/modules/id5IdSystem.md +6 -6
  17. package/modules/imRtdProvider.js +31 -0
  18. package/modules/ixBidAdapter.js +166 -21
  19. package/modules/merkleIdSystem.js +5 -0
  20. package/modules/nativoBidAdapter.js +27 -1
  21. package/modules/oguryBidAdapter.js +2 -1
  22. package/modules/openxBidAdapter.js +6 -1
  23. package/modules/prebidServerBidAdapter/index.js +3 -3
  24. package/modules/pubmaticBidAdapter.js +2 -0
  25. package/modules/saambaaBidAdapter.js +420 -0
  26. package/modules/saambaaBidAdapter.md +65 -68
  27. package/modules/seedtagBidAdapter.js +6 -0
  28. package/modules/smaatoBidAdapter.js +6 -1
  29. package/modules/sspBCBidAdapter.js +34 -3
  30. package/modules/trustxBidAdapter.js +10 -1
  31. package/modules/vidoomyBidAdapter.js +51 -100
  32. package/modules/visxBidAdapter.js +1 -1
  33. package/modules/yieldlabBidAdapter.js +41 -10
  34. package/modules/yieldlabBidAdapter.md +91 -48
  35. package/package.json +6 -1
  36. package/src/adapterManager.js +14 -8
  37. package/test/spec/modules/adheseBidAdapter_spec.js +27 -1
  38. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
  39. package/test/spec/modules/appnexusBidAdapter_spec.js +14 -0
  40. package/test/spec/modules/codefuelBidAdapter_spec.js +1 -1
  41. package/test/spec/modules/datablocksBidAdapter_spec.js +3 -3
  42. package/test/spec/modules/engageyaBidAdapter_spec.js +231 -95
  43. package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
  44. package/test/spec/modules/glimpseBidAdapter_spec.js +33 -0
  45. package/test/spec/modules/gptPreAuction_spec.js +58 -4
  46. package/test/spec/modules/imRtdProvider_spec.js +25 -0
  47. package/test/spec/modules/ixBidAdapter_spec.js +285 -2
  48. package/test/spec/modules/konduitWrapper_spec.js +0 -1
  49. package/test/spec/modules/merkleIdSystem_spec.js +18 -0
  50. package/test/spec/modules/nativoBidAdapter_spec.js +35 -18
  51. package/test/spec/modules/oguryBidAdapter_spec.js +13 -11
  52. package/test/spec/modules/openxBidAdapter_spec.js +5 -0
  53. package/test/spec/modules/prebidServerBidAdapter_spec.js +19 -2
  54. package/test/spec/modules/seedtagBidAdapter_spec.js +3 -0
  55. package/test/spec/modules/smaatoBidAdapter_spec.js +30 -0
  56. package/test/spec/modules/sspBCBidAdapter_spec.js +33 -3
  57. package/test/spec/modules/trustxBidAdapter_spec.js +42 -0
  58. package/test/spec/modules/vidoomyBidAdapter_spec.js +32 -13
  59. package/test/spec/modules/visxBidAdapter_spec.js +1 -1
  60. package/test/spec/modules/yieldlabBidAdapter_spec.js +81 -0
  61. package/test/spec/unit/core/adapterManager_spec.js +24 -6
@@ -76,7 +76,7 @@ export const spec = {
76
76
  if (!userIdAsEids) {
77
77
  userIdAsEids = bid.userIdAsEids;
78
78
  }
79
- const {params: {uid, keywords}, mediaTypes, bidId, adUnitCode, rtd} = bid;
79
+ const {params: {uid, keywords}, mediaTypes, bidId, adUnitCode, rtd, ortb2Imp} = bid;
80
80
  bidsMap[bidId] = bid;
81
81
  const bidFloor = _getFloor(mediaTypes || {}, bid);
82
82
  if (rtd) {
@@ -102,6 +102,15 @@ export const spec = {
102
102
  }
103
103
  };
104
104
 
105
+ if (ortb2Imp && ortb2Imp.ext && ortb2Imp.ext.data) {
106
+ impObj.ext.data = ortb2Imp.ext.data;
107
+ if (impObj.ext.data.adserver && impObj.ext.data.adserver.adslot) {
108
+ impObj.ext.gpid = impObj.ext.data.adserver.adslot.toString();
109
+ } else {
110
+ impObj.ext.gpid = ortb2Imp.ext.data.pbadslot && ortb2Imp.ext.data.pbadslot.toString();
111
+ }
112
+ }
113
+
105
114
  if (!isEmpty(keywords)) {
106
115
  if (!pageKeywords) {
107
116
  pageKeywords = keywords;
@@ -9,7 +9,17 @@ const ENDPOINT = `https://d.vidoomy.com/api/rtbserver/prebid/`;
9
9
  const BIDDER_CODE = 'vidoomy';
10
10
  const GVLID = 380;
11
11
 
12
- const COOKIE_SYNC_JSON = 'https://vpaid.vidoomy.com/sync/urls.json';
12
+ const COOKIE_SYNC_FALLBACK_URLS = [
13
+ 'https://x.bidswitch.net/sync?ssp=vidoomy',
14
+ 'https://ib.adnxs.com/getuid?https%3A%2F%2Fa-prebid.vidoomy.com%2Fsetuid%3Fbidder%3Dadnxs%26gdpr%3D{{GDPR}}%26gdpr_consent%3D{{GDPR_CONSENT}}%26uid%3D%24UID',
15
+ 'https://pixel-sync.sitescout.com/dmp/pixelSync?nid=120&redir=https%3A%2F%2Fa.vidoomy.com%2Fapi%2Frtbserver%2Fcookie%3Fi%3DCEN%26uid%3D%7BuserId%7D',
16
+ 'https://sync.1rx.io/usersync2/vidoomy?redir=https%3A%2F%2Fa.vidoomy.com%2Fapi%2Frtbserver%2Fcookie%3Fi%3DUN%26uid%3D%5BRX_UUID%5D',
17
+ 'https://rtb.openx.net/sync/prebid?gdpr={{GDPR}}&gdpr_consent={{GDPR_CONSENT}}&r=https%3A%2F%2Fa-prebid.vidoomy.com%2Fsetuid%3Fbidder%3Dopenx%26uid%3D$%7BUID%7D',
18
+ 'https://ads.pubmatic.com/AdServer/js/user_sync.html?gdpr={{GDPR}}&gdpr_consent={{GDPR_CONSENT}}&us_privacy=&predirect=https%3A%2F%2Fa-prebid.vidoomy.com%2Fsetuid%3Fbidder%3Dpubmatic%26gdpr%3D{{GDPR}}%26gdpr_consent%3D{{GDPR_CONSENT}}%26uid%3D',
19
+ 'https://cm.adform.net/cookie?redirect_url=https%3A%2F%2Fa-prebid.vidoomy.com%2Fsetuid%3Fbidder%3Dadf%26gdpr%3D{{GDPR}}%26gdpr_consent%3D{{GDPR_CONSENT}}%26uid%3D%24UID',
20
+ 'https://ups.analytics.yahoo.com/ups/58531/occ?gdpr={{GDPR}}&gdpr_consent={{GDPR_CONSENT}}',
21
+ 'https://ap.lijit.com/pixel?redir=https%3A%2F%2Fa-prebid.vidoomy.com%2Fsetuid%3Fbidder%3Dsovrn%26gdpr%3D{{GDPR}}%26gdpr_consent%3D{{GDPR_CONSENT}}%26uid%3D%24UID'
22
+ ];
13
23
 
14
24
  const isBidRequestValid = bid => {
15
25
  if (!bid.params) {
@@ -36,7 +46,7 @@ const isBidRequestValid = bid => {
36
46
  };
37
47
 
38
48
  const isBidResponseValid = bid => {
39
- if (!bid.requestId || !bid.cpm || !bid.ttl || !bid.currency) {
49
+ if (!bid || !bid.requestId || !bid.cpm || !bid.ttl || !bid.currency) {
40
50
  return false;
41
51
  }
42
52
  switch (bid.mediaType) {
@@ -67,35 +77,33 @@ const buildRequests = (validBidRequests, bidderRequest) => {
67
77
 
68
78
  const videoContext = deepAccess(bid, 'mediaTypes.video.context');
69
79
 
70
- const queryParams = [];
71
- queryParams.push(['id', bid.params.id]);
72
- queryParams.push(['adtype', adType]);
73
- queryParams.push(['w', w]);
74
- queryParams.push(['h', h]);
75
- queryParams.push(['pos', parseInt(bid.params.position) || 1]);
76
- queryParams.push(['ua', navigator.userAgent]);
77
- queryParams.push(['l', navigator.language && navigator.language.indexOf('-') !== -1 ? navigator.language.split('-')[0] : '']);
78
- queryParams.push(['dt', /Mobi/.test(navigator.userAgent) ? 2 : 1]);
79
- queryParams.push(['pid', bid.params.pid]);
80
- queryParams.push(['requestId', bid.bidId]);
81
- queryParams.push(['d', getDomainWithoutSubdomain(hostname)]);
82
- queryParams.push(['sp', encodeURIComponent(aElement.href)]);
80
+ const queryParams = {
81
+ id: bid.params.id,
82
+ adtype: adType,
83
+ w,
84
+ h,
85
+ pos: parseInt(bid.params.position) || 1,
86
+ ua: navigator.userAgent,
87
+ l: navigator.language && navigator.language.indexOf('-') !== -1 ? navigator.language.split('-')[0] : '',
88
+ dt: /Mobi/.test(navigator.userAgent) ? 2 : 1,
89
+ pid: bid.params.pid,
90
+ requestId: bid.bidId,
91
+ d: getDomainWithoutSubdomain(hostname),
92
+ sp: encodeURIComponent(aElement.href),
93
+ usp: bidderRequest.uspConsent || '',
94
+ coppa: !!config.getConfig('coppa'),
95
+ videoContext: videoContext || ''
96
+ };
97
+
83
98
  if (bidderRequest.gdprConsent) {
84
- queryParams.push(['gdpr', bidderRequest.gdprConsent.gdprApplies]);
85
- queryParams.push(['gdprcs', bidderRequest.gdprConsent.consentString]);
99
+ queryParams.gdpr = bidderRequest.gdprConsent.gdprApplies;
100
+ queryParams.gdprcs = bidderRequest.gdprConsent.consentString;
86
101
  }
87
- queryParams.push(['usp', bidderRequest.uspConsent || '']);
88
- queryParams.push(['coppa', !!config.getConfig('coppa')]);
89
-
90
- const rawQueryParams = queryParams.map(qp => qp.join('=')).join('&');
91
102
 
92
- cookieSync(bidderRequest)
93
-
94
- const url = `${ENDPOINT}?${rawQueryParams}`;
95
103
  return {
96
104
  method: 'GET',
97
- url: url,
98
- data: {videoContext}
105
+ url: ENDPOINT,
106
+ data: queryParams
99
107
  }
100
108
  });
101
109
  return serverRequests;
@@ -117,6 +125,7 @@ const render = (bid) => {
117
125
  const interpretResponse = (serverResponse, bidRequest) => {
118
126
  try {
119
127
  let responseBody = serverResponse.body;
128
+ if (!responseBody) return;
120
129
  if (responseBody.mediaType === 'video') {
121
130
  responseBody.ad = responseBody.vastUrl;
122
131
  const videoContext = bidRequest.data.videoContext;
@@ -185,6 +194,21 @@ const interpretResponse = (serverResponse, bidRequest) => {
185
194
  }
186
195
  };
187
196
 
197
+ function getUserSyncs (syncOptions, responses, gdprConsent, uspConsent) {
198
+ if (syncOptions.iframeEnabled || syncOptions.pixelEnabled) {
199
+ const pixelType = syncOptions.pixelEnabled ? 'image' : 'iframe';
200
+ const urls = deepAccess(responses, '0.body.pixels') || COOKIE_SYNC_FALLBACK_URLS;
201
+
202
+ return [].concat(urls).map(url => ({
203
+ type: pixelType,
204
+ url: url
205
+ .replace('{{GDPR}}', gdprConsent ? gdprConsent.gdprApplies : '0')
206
+ .replace('{{GDPR_CONSENT}}', gdprConsent ? encodeURIComponent(gdprConsent.consentString) : '')
207
+ .replace('{{USP_CONSENT}}', uspConsent ? encodeURIComponent(uspConsent) : '')
208
+ }));
209
+ }
210
+ };
211
+
188
212
  export const spec = {
189
213
  code: BIDDER_CODE,
190
214
  supportedMediaTypes: [BANNER, VIDEO],
@@ -192,84 +216,11 @@ export const spec = {
192
216
  buildRequests,
193
217
  interpretResponse,
194
218
  gvlid: GVLID,
219
+ getUserSyncs,
195
220
  };
196
221
 
197
222
  registerBidder(spec);
198
223
 
199
- let cookieSynced = false;
200
- function cookieSync(bidderRequest) {
201
- if (cookieSynced) return;
202
- const xhr = new XMLHttpRequest();
203
- xhr.open('GET', COOKIE_SYNC_JSON)
204
- xhr.addEventListener('load', function () {
205
- const macro = Macro({
206
- gpdr: bidderRequest.gdprConsent ? bidderRequest.gdprConsent.gdprApplies : '0',
207
- gpdr_consent: bidderRequest.gdprConsent ? bidderRequest.gdprConsent.consentString : '',
208
- });
209
- JSON.parse(this.responseText).filter(Boolean).forEach(url => {
210
- firePixel(macro.replace(url))
211
- })
212
- })
213
- xhr.send()
214
- cookieSynced = true;
215
- }
216
-
217
- function firePixel(url) {
218
- const img = document.createElement('img');
219
- img.width = 1;
220
- img.height = 1;
221
- img.src = url;
222
- document.body.appendChild(img);
223
- setTimeout(() => {
224
- img.remove();
225
- }, 10000)
226
- }
227
-
228
- function normalizeKey (x) {
229
- return x.replace(/_/g, '').toLowerCase();
230
- }
231
-
232
- function Macro (obj) {
233
- const macros = {};
234
- for (const key in obj) {
235
- macros[normalizeKey(key)] = obj[key];
236
- }
237
-
238
- const set = (key, value) => {
239
- macros[normalizeKey(key)] = typeof value === 'function' ? value : String(value);
240
- };
241
-
242
- return {
243
- set,
244
- setAll (obj) {
245
- for (const key in obj) {
246
- macros[normalizeKey(key)] = set(obj[key]);
247
- }
248
- },
249
- replace (string, extraMacros = {}) {
250
- const allMacros = {
251
- ...macros,
252
- ...extraMacros,
253
- };
254
- const regexes = [
255
- /{{\s*([a-zA-Z0-9_]+)\s*}}/g,
256
- /\$\$\s*([a-zA-Z0-9_]+)\s*\$\$/g,
257
- /\[\s*([a-zA-Z0-9_]+)\s*\]/g,
258
- /\{\s*([a-zA-Z0-9_]+)\s*\}/g,
259
- ];
260
- regexes.forEach(regex => {
261
- string = string.replace(regex, (str, x) => {
262
- x = normalizeKey(x);
263
- let value = allMacros[x];
264
- value = typeof value === 'function' ? value(allMacros) : value;
265
- return !value && value !== 0 ? '' : value;
266
- });
267
- });
268
- return string;
269
- },
270
- };
271
- }
272
-
273
224
  function getDomainWithoutSubdomain (hostname) {
274
225
  const parts = hostname.split('.');
275
226
  const newParts = [];
@@ -203,7 +203,7 @@ export const spec = {
203
203
  },
204
204
  onTimeout: function(timeoutData) {
205
205
  // Call '/track/bid_timeout' with timeout data
206
- triggerPixel(buildUrl(TRACK_TIMEOUT_PATH) + '?data=' + JSON.stringify(timeoutData));
206
+ triggerPixel(buildUrl(TRACK_TIMEOUT_PATH) + '//' + JSON.stringify(timeoutData));
207
207
  }
208
208
  };
209
209
 
@@ -1,7 +1,7 @@
1
1
  import { _each, isPlainObject, isArray, deepAccess } from '../src/utils.js';
2
2
  import { registerBidder } from '../src/adapters/bidderFactory.js'
3
3
  import find from 'core-js-pure/features/array/find.js'
4
- import { VIDEO, BANNER } from '../src/mediaTypes.js'
4
+ import { VIDEO, BANNER, NATIVE } from '../src/mediaTypes.js'
5
5
  import { Renderer } from '../src/Renderer.js'
6
6
  import { config } from '../src/config.js';
7
7
 
@@ -15,7 +15,7 @@ const GVLID = 70
15
15
  export const spec = {
16
16
  code: BIDDER_CODE,
17
17
  gvlid: GVLID,
18
- supportedMediaTypes: [VIDEO, BANNER],
18
+ supportedMediaTypes: [VIDEO, BANNER, NATIVE],
19
19
 
20
20
  isBidRequestValid: function (bid) {
21
21
  if (bid && bid.params && bid.params.adslotId && bid.params.supplyId) {
@@ -149,6 +149,27 @@ export const spec = {
149
149
  }
150
150
  }
151
151
 
152
+ if (isNative(bidRequest, adType)) {
153
+ const url = `${ENDPOINT}/d/${matchedBid.id}/${bidRequest.params.supplyId}/?ts=${timestamp}${extId}${gdprApplies}${gdprConsent}${pvId}`
154
+ bidResponse.adUrl = url
155
+ bidResponse.mediaType = NATIVE
156
+ const nativeImageAssetObj = find(matchedBid.native.assets, e => e.id === 2)
157
+ const nativeImageAsset = nativeImageAssetObj ? nativeImageAssetObj.img : {url: '', w: 0, h: 0};
158
+ const nativeTitleAsset = find(matchedBid.native.assets, e => e.id === 1)
159
+ const nativeBodyAsset = find(matchedBid.native.assets, e => e.id === 3)
160
+ bidResponse.native = {
161
+ title: nativeTitleAsset ? nativeTitleAsset.title.text : '',
162
+ body: nativeBodyAsset ? nativeBodyAsset.data.value : '',
163
+ image: {
164
+ url: nativeImageAsset.url,
165
+ width: nativeImageAsset.w,
166
+ height: nativeImageAsset.h,
167
+ },
168
+ clickUrl: matchedBid.native.link.url,
169
+ impressionTrackers: matchedBid.native.imptrackers,
170
+ };
171
+ }
172
+
152
173
  bidResponses.push(bidResponse)
153
174
  }
154
175
  })
@@ -162,16 +183,26 @@ export const spec = {
162
183
  * @param {String} adtype
163
184
  * @returns {Boolean}
164
185
  */
165
- function isVideo (format, adtype) {
186
+ function isVideo(format, adtype) {
166
187
  return deepAccess(format, 'mediaTypes.video') && adtype.toLowerCase() === 'video'
167
188
  }
168
189
 
190
+ /**
191
+ * Is this a native format?
192
+ * @param {Object} format
193
+ * @param {String} adtype
194
+ * @returns {Boolean}
195
+ */
196
+ function isNative(format, adtype) {
197
+ return deepAccess(format, 'mediaTypes.native') && adtype.toLowerCase() === 'native'
198
+ }
199
+
169
200
  /**
170
201
  * Is this an outstream context?
171
202
  * @param {Object} format
172
203
  * @returns {Boolean}
173
204
  */
174
- function isOutstream (format) {
205
+ function isOutstream(format) {
175
206
  let context = deepAccess(format, 'mediaTypes.video.context')
176
207
  return (context === 'outstream')
177
208
  }
@@ -181,7 +212,7 @@ function isOutstream (format) {
181
212
  * @param {Object} format
182
213
  * @returns {Array}
183
214
  */
184
- function getPlayerSize (format) {
215
+ function getPlayerSize(format) {
185
216
  let playerSize = deepAccess(format, 'mediaTypes.video.playerSize')
186
217
  return (playerSize && isArray(playerSize[0])) ? playerSize[0] : playerSize
187
218
  }
@@ -191,7 +222,7 @@ function getPlayerSize (format) {
191
222
  * @param {String} size
192
223
  * @returns {Array}
193
224
  */
194
- function parseSize (size) {
225
+ function parseSize(size) {
195
226
  return size.split('x').map(Number)
196
227
  }
197
228
 
@@ -200,7 +231,7 @@ function parseSize (size) {
200
231
  * @param {Array} eids
201
232
  * @returns {String}
202
233
  */
203
- function createUserIdString (eids) {
234
+ function createUserIdString(eids) {
204
235
  let str = []
205
236
  for (let i = 0; i < eids.length; i++) {
206
237
  str.push(eids[i].source + ':' + eids[i].uids[0].id)
@@ -213,7 +244,7 @@ function createUserIdString (eids) {
213
244
  * @param {Object} obj
214
245
  * @returns {String}
215
246
  */
216
- function createQueryString (obj) {
247
+ function createQueryString(obj) {
217
248
  let str = []
218
249
  for (var p in obj) {
219
250
  if (obj.hasOwnProperty(p)) {
@@ -233,7 +264,7 @@ function createQueryString (obj) {
233
264
  * @param {Object} obj
234
265
  * @returns {String}
235
266
  */
236
- function createTargetingString (obj) {
267
+ function createTargetingString(obj) {
237
268
  let str = []
238
269
  for (var p in obj) {
239
270
  if (obj.hasOwnProperty(p)) {
@@ -250,7 +281,7 @@ function createTargetingString (obj) {
250
281
  * @param {Object} schain
251
282
  * @returns {String}
252
283
  */
253
- function createSchainString (schain) {
284
+ function createSchainString(schain) {
254
285
  const ver = schain.ver || ''
255
286
  const complete = (schain.complete === 1 || schain.complete === 0) ? schain.complete : ''
256
287
  const keys = ['asi', 'sid', 'hp', 'rid', 'name', 'domain', 'ext']
@@ -11,53 +11,96 @@ Maintainer: solutions@yieldlab.de
11
11
  Module that connects to Yieldlab's demand sources
12
12
 
13
13
  # Test Parameters
14
+
15
+ ```javascript
16
+ const adUnits = [
17
+ {
18
+ code: 'banner',
19
+ sizes: [ [ 728, 90 ] ],
20
+ bids: [{
21
+ bidder: 'yieldlab',
22
+ params: {
23
+ adslotId: '5220336',
24
+ supplyId: '1381604',
25
+ targeting: {
26
+ key1: 'value1',
27
+ key2: 'value2'
28
+ },
29
+ extId: 'abc',
30
+ iabContent: {
31
+ id: 'some_id',
32
+ episode: '1',
33
+ title: 'some title',
34
+ series: 'some series',
35
+ season: 's1',
36
+ artist: 'John Doe',
37
+ genre: 'some genre',
38
+ isrc: 'CC-XXX-YY-NNNNN',
39
+ url: 'http://foo_url.de',
40
+ cat: [ 'IAB1-1', 'IAB1-2', 'IAB2-10' ],
41
+ context: '7',
42
+ keywords: ['k1', 'k2'],
43
+ live: '0'
44
+ }
45
+ }
46
+ }]
47
+ },
48
+ {
49
+ code: 'video',
50
+ sizes: [ [ 640, 480 ] ],
51
+ mediaTypes: {
52
+ video: {
53
+ context: 'instream' // or 'outstream'
54
+ }
55
+ },
56
+ bids: [{
57
+ bidder: 'yieldlab',
58
+ params: {
59
+ adslotId: '5220339',
60
+ supplyId: '1381604'
61
+ }
62
+ }]
63
+ },
64
+ {
65
+ code: 'native',
66
+ mediaTypes: {
67
+ native: {
68
+ // native config
69
+ }
70
+ },
71
+ bids: [{
72
+ bidder: 'yieldlab',
73
+ params: {
74
+ adslotId: '5220339',
75
+ supplyId: '1381604'
76
+ }
77
+ }]
78
+ }
79
+ ];
14
80
  ```
15
- var adUnits = [
16
- {
17
- code: "banner",
18
- sizes: [[728, 90]],
19
- bids: [{
20
- bidder: "yieldlab",
21
- params: {
22
- adslotId: "5220336",
23
- supplyId: "1381604",
24
- targeting: {
25
- key1: "value1",
26
- key2: "value2"
27
- },
28
- extId: "abc",
29
- iabContent: {
30
- id: "some_id",
31
- episode: "1",
32
- title: "some title",
33
- series: "some series",
34
- season: "s1",
35
- artist: "John Doe",
36
- genre: "some genre",
37
- isrc: "CC-XXX-YY-NNNNN",
38
- url: "http://foo_url.de",
39
- cat: ["IAB1-1", "IAB1-2", "IAB2-10"],
40
- context: "7",
41
- keywords: ["k1", "k2"],
42
- live: "0"
43
- }
44
- }
45
- }]
46
- }, {
47
- code: "video",
48
- sizes: [[640, 480]],
49
- mediaTypes: {
50
- video: {
51
- context: "instream" // or "outstream"
52
- }
53
- },
54
- bids: [{
55
- bidder: "yieldlab",
56
- params: {
57
- adslotId: "5220339",
58
- supplyId: "1381604"
59
- }
60
- }]
61
- }
62
- ];
81
+
82
+ # Multi-Format Setup
83
+
84
+ A general overview of how to set up multi-format ads can be found in the offical Prebid.js docs. See: [show multi-format ads](https://docs.prebid.org/dev-docs/show-multi-format-ads.html)
85
+
86
+ When setting up multi-format ads with Yieldlab make sure to always add at least one eligible Adslot per given media type in the ad unit configuration.
87
+
88
+ ```javascript
89
+ const adUnit = {
90
+ code: 'multi-format-adslot',
91
+ mediaTypes: {
92
+ banner: {
93
+ sizes: [ [ 728, 90 ] ]
94
+ },
95
+ native: {
96
+ // native config
97
+ }
98
+ },
99
+ bids: [
100
+ // banner Adslot
101
+ { bidder: 'yieldlab', params: { adslotId: '1234', supplyId: '42' } },
102
+ // native Adslot
103
+ { bidder: 'yieldlab', params: { adslotId: '2345', supplyId: '42' } }
104
+ ]
105
+ };
63
106
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prebid.js",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "Header Bidding Management Library",
5
5
  "main": "src/prebid.js",
6
6
  "scripts": {
@@ -11,6 +11,11 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/prebid/Prebid.js.git"
13
13
  },
14
+ "browserslist": [
15
+ "> 0.25%",
16
+ "not IE 11",
17
+ "not op_mini all"
18
+ ],
14
19
  "keywords": [
15
20
  "advertising",
16
21
  "auction",
@@ -262,14 +262,16 @@ adapterManager.makeBidRequests = hook('sync', function (adUnits, auctionStart, a
262
262
  }
263
263
 
264
264
  let adUnitsS2SCopy = getAdUnitCopyForPrebidServer(adUnits, s2sConfig);
265
- let tid = generateUUID();
265
+
266
+ // uniquePbsTid is so we know which server to send which bids to during the callBids function
267
+ let uniquePbsTid = generateUUID();
266
268
  adaptersServerSide.forEach(bidderCode => {
267
269
  const bidderRequestId = getUniqueIdentifierStr();
268
270
  const bidderRequest = {
269
271
  bidderCode,
270
272
  auctionId,
271
273
  bidderRequestId,
272
- tid,
274
+ uniquePbsTid,
273
275
  bids: hookedGetBids({bidderCode, auctionId, bidderRequestId, 'adUnits': deepClone(adUnitsS2SCopy), labels, src: CONSTANTS.S2S.SRC}),
274
276
  auctionStart: auctionStart,
275
277
  timeout: s2sConfig.timeout,
@@ -350,7 +352,7 @@ adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, request
350
352
  serverBidRequests.forEach(serverBidRequest => {
351
353
  var index = -1;
352
354
  for (var i = 0; i < uniqueServerBidRequests.length; ++i) {
353
- if (serverBidRequest.tid === uniqueServerBidRequests[i].tid) {
355
+ if (serverBidRequest.uniquePbsTid === uniqueServerBidRequests[i].uniquePbsTid) {
354
356
  index = i;
355
357
  break;
356
358
  }
@@ -360,7 +362,10 @@ adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, request
360
362
  }
361
363
  });
362
364
 
363
- let counter = 0
365
+ let counter = 0;
366
+
367
+ // $.source.tid MUST be a unique UUID and also THE SAME between all PBS Requests for a given Auction
368
+ const sourceTid = generateUUID();
364
369
  _s2sConfigs.forEach((s2sConfig) => {
365
370
  if (s2sConfig && uniqueServerBidRequests[counter] && includes(s2sConfig.bidders, uniqueServerBidRequests[counter].bidderCode)) {
366
371
  // s2s should get the same client side timeout as other client side requests.
@@ -370,13 +375,13 @@ adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, request
370
375
  } : undefined);
371
376
  let adaptersServerSide = s2sConfig.bidders;
372
377
  const s2sAdapter = _bidderRegistry[s2sConfig.adapter];
373
- let tid = uniqueServerBidRequests[counter].tid;
378
+ let uniquePbsTid = uniqueServerBidRequests[counter].uniquePbsTid;
374
379
  let adUnitsS2SCopy = uniqueServerBidRequests[counter].adUnitsS2SCopy;
375
380
 
376
- let uniqueServerRequests = serverBidRequests.filter(serverBidRequest => serverBidRequest.tid === tid)
381
+ let uniqueServerRequests = serverBidRequests.filter(serverBidRequest => serverBidRequest.uniquePbsTid === uniquePbsTid);
377
382
 
378
383
  if (s2sAdapter) {
379
- let s2sBidRequest = {tid, 'ad_units': adUnitsS2SCopy, s2sConfig};
384
+ let s2sBidRequest = {tid: sourceTid, 'ad_units': adUnitsS2SCopy, s2sConfig};
380
385
  if (s2sBidRequest.ad_units.length) {
381
386
  let doneCbs = uniqueServerRequests.map(bidRequest => {
382
387
  bidRequest.start = timestamp();
@@ -391,7 +396,8 @@ adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, request
391
396
 
392
397
  // fire BID_REQUESTED event for each s2s bidRequest
393
398
  uniqueServerRequests.forEach(bidRequest => {
394
- events.emit(CONSTANTS.EVENTS.BID_REQUESTED, bidRequest);
399
+ // add the new sourceTid
400
+ events.emit(CONSTANTS.EVENTS.BID_REQUESTED, {...bidRequest, tid: sourceTid});
395
401
  });
396
402
 
397
403
  // make bid requests
@@ -1,5 +1,6 @@
1
1
  import {expect} from 'chai';
2
2
  import {spec} from 'modules/adheseBidAdapter.js';
3
+ import {config} from 'src/config.js';
3
4
 
4
5
  const BID_ID = 456;
5
6
  const TTL = 360;
@@ -131,12 +132,21 @@ describe('AdheseAdapter', function () {
131
132
  expect(JSON.parse(req.data)).to.not.have.key('eids');
132
133
  });
133
134
 
134
- it('should request vast content as url', function () {
135
+ it('should request vast content as url by default', function () {
135
136
  let req = spec.buildRequests([ minimalBid() ], bidderRequest);
136
137
 
137
138
  expect(JSON.parse(req.data).vastContentAsUrl).to.equal(true);
138
139
  });
139
140
 
141
+ it('should request vast content as markup when configured', function () {
142
+ sinon.stub(config, 'getConfig').withArgs('adhese').returns({ vastContentAsUrl: false });
143
+
144
+ let req = spec.buildRequests([ minimalBid() ], bidderRequest);
145
+
146
+ expect(JSON.parse(req.data).vastContentAsUrl).to.equal(false);
147
+ config.getConfig.restore();
148
+ });
149
+
140
150
  it('should include bids', function () {
141
151
  let bid = minimalBid();
142
152
  let req = spec.buildRequests([ bid ], bidderRequest);
@@ -155,6 +165,22 @@ describe('AdheseAdapter', function () {
155
165
 
156
166
  expect(req.url).to.equal('https://ads-demo.adhese.com/json');
157
167
  });
168
+
169
+ it('should include params specified in the config', function () {
170
+ sinon.stub(config, 'getConfig').withArgs('adhese').returns({ globalTargets: { 'tl': [ 'all' ] } });
171
+ let req = spec.buildRequests([ minimalBid() ], bidderRequest);
172
+
173
+ expect(JSON.parse(req.data).parameters).to.deep.include({ 'tl': [ 'all' ] });
174
+ config.getConfig.restore();
175
+ });
176
+
177
+ it('should give priority to bid params over config params', function () {
178
+ sinon.stub(config, 'getConfig').withArgs('adhese').returns({ globalTargets: { 'xt': ['CONFIG_CONSENT_STRING'] } });
179
+ let req = spec.buildRequests([ minimalBid() ], bidderRequest);
180
+
181
+ expect(JSON.parse(req.data).parameters).to.deep.include({ 'xt': [ 'CONSENT_STRING' ] });
182
+ config.getConfig.restore();
183
+ });
158
184
  });
159
185
 
160
186
  describe('interpretResponse', () => {
@@ -1,5 +1,6 @@
1
1
  import adomikAnalytics from 'modules/adomikAnalyticsAdapter.js';
2
2
  import {expect} from 'chai';
3
+
3
4
  let events = require('src/events');
4
5
  let adapterManager = require('src/adapterManager').default;
5
6
  let constants = require('src/constants.json');
@@ -8,6 +9,7 @@ describe('Adomik Prebid Analytic', function () {
8
9
  let sendEventStub;
9
10
  let sendWonEventStub;
10
11
  let clock;
12
+
11
13
  before(function () {
12
14
  clock = sinon.useFakeTimers();
13
15
  });
@@ -91,7 +93,7 @@ describe('Adomik Prebid Analytic', function () {
91
93
  type: 'request',
92
94
  event: {
93
95
  bidder: 'BIDDERTEST',
94
- placementCode: 'placementtest',
96
+ placementCode: '0000',
95
97
  }
96
98
  });
97
99