prebid.js 6.1.0 → 6.2.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 (69) hide show
  1. package/README.md +1 -1
  2. package/browsers.json +13 -29
  3. package/karma.conf.maker.js +1 -1
  4. package/modules/admixerBidAdapter.js +2 -1
  5. package/modules/adnuntiusBidAdapter.js +2 -1
  6. package/modules/adplusBidAdapter.js +203 -0
  7. package/modules/adplusBidAdapter.md +39 -0
  8. package/modules/adyoulikeBidAdapter.js +7 -2
  9. package/modules/appnexusBidAdapter.js +19 -2
  10. package/modules/beachfrontBidAdapter.js +14 -17
  11. package/modules/craftBidAdapter.js +5 -3
  12. package/modules/dchain.js +149 -0
  13. package/modules/dchain.md +45 -0
  14. package/modules/emx_digitalBidAdapter.js +9 -1
  15. package/modules/freewheel-sspBidAdapter.js +6 -0
  16. package/modules/goldbachBidAdapter.js +1176 -0
  17. package/modules/goldbachBidAdapter.md +151 -0
  18. package/modules/gumgumBidAdapter.js +5 -1
  19. package/modules/intersectionRtdProvider.js +114 -0
  20. package/modules/invibesBidAdapter.js +15 -9
  21. package/modules/ipromBidAdapter.js +79 -0
  22. package/modules/limelightDigitalBidAdapter.js +2 -1
  23. package/modules/luponmediaBidAdapter.js +570 -0
  24. package/modules/missenaBidAdapter.js +89 -0
  25. package/modules/pubmaticBidAdapter.js +3 -3
  26. package/modules/relaidoBidAdapter.js +86 -65
  27. package/modules/richaudienceBidAdapter.js +1 -1
  28. package/modules/smaatoBidAdapter.js +4 -1
  29. package/modules/smartxBidAdapter.js +17 -1
  30. package/modules/tappxBidAdapter.js +3 -1
  31. package/modules/undertoneBidAdapter.js +8 -1
  32. package/modules/userId/index.js +27 -2
  33. package/modules/ventes.md +71 -0
  34. package/modules/ventesBidAdapter.js +104 -64
  35. package/modules/ventesBidAdapter.md +0 -1
  36. package/modules/visxBidAdapter.js +19 -2
  37. package/modules/visxBidAdapter.md +4 -6
  38. package/modules/yahoosspBidAdapter.md +1 -1
  39. package/modules/yieldoneBidAdapter.js +115 -11
  40. package/package.json +1 -1
  41. package/src/auction.js +3 -2
  42. package/src/targeting.js +2 -2
  43. package/src/utils.js +7 -0
  44. package/test/spec/integration/faker/googletag.js +6 -0
  45. package/test/spec/modules/adnuntiusBidAdapter_spec.js +18 -0
  46. package/test/spec/modules/adplusBidAdapter_spec.js +213 -0
  47. package/test/spec/modules/adyoulikeBidAdapter_spec.js +26 -0
  48. package/test/spec/modules/appnexusBidAdapter_spec.js +49 -1
  49. package/test/spec/modules/beachfrontBidAdapter_spec.js +65 -1
  50. package/test/spec/modules/dchain_spec.js +329 -0
  51. package/test/spec/modules/emx_digitalBidAdapter_spec.js +10 -0
  52. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +19 -0
  53. package/test/spec/modules/goldbachBidAdapter_spec.js +1359 -0
  54. package/test/spec/modules/gumgumBidAdapter_spec.js +6 -0
  55. package/test/spec/modules/intersectionRtdProvider_spec.js +141 -0
  56. package/test/spec/modules/invibesBidAdapter_spec.js +29 -4
  57. package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
  58. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +10 -7
  59. package/test/spec/modules/luponmediaBidAdapter_spec.js +412 -0
  60. package/test/spec/modules/missenaBidAdapter_spec.js +134 -0
  61. package/test/spec/modules/pubmaticBidAdapter_spec.js +1 -1
  62. package/test/spec/modules/relaidoBidAdapter_spec.js +71 -63
  63. package/test/spec/modules/smaatoBidAdapter_spec.js +31 -0
  64. package/test/spec/modules/smartxBidAdapter_spec.js +9 -0
  65. package/test/spec/modules/tappxBidAdapter_spec.js +4 -0
  66. package/test/spec/modules/userId_spec.js +51 -0
  67. package/test/spec/modules/visxBidAdapter_spec.js +120 -4
  68. package/test/spec/modules/yieldoneBidAdapter_spec.js +299 -53
  69. package/test/spec/unit/core/targeting_spec.js +44 -0
@@ -0,0 +1,151 @@
1
+ #Overview
2
+
3
+ ```
4
+ Module Name: Goldbach Bid Adapter
5
+ Module Type: Bidder Adapter
6
+ Maintainer: dusan.veljovic@goldbach.com
7
+ ```
8
+
9
+ # Description
10
+
11
+ Connects to Xandr exchange for bids.
12
+
13
+ Goldbach bid adapter supports Banner, Video (instream and outstream) and Native.
14
+
15
+ # Test Parameters
16
+ ```
17
+ var adUnits = [
18
+ // Banner adUnit
19
+ {
20
+ code: 'banner-div',
21
+ mediaTypes: {
22
+ banner: {
23
+ sizes: [[300, 250], [300,600]]
24
+ }
25
+ },
26
+ bids: [{
27
+ bidder: 'goldbach',
28
+ params: {
29
+ placementId: 13144370
30
+ }
31
+ }]
32
+ },
33
+ // Native adUnit
34
+ {
35
+ code: 'native-div',
36
+ sizes: [[1, 1]],
37
+ mediaTypes: {
38
+ native: {
39
+ title: {
40
+ required: true
41
+ },
42
+ body: {
43
+ required: true
44
+ },
45
+ image: {
46
+ required: true
47
+ },
48
+ sponsoredBy: {
49
+ required: true
50
+ },
51
+ icon: {
52
+ required: false
53
+ }
54
+ }
55
+ },
56
+ bids: [{
57
+ bidder: 'goldbach',
58
+ params: {
59
+ placementId: 13232354,
60
+ allowSmallerSizes: true
61
+ }
62
+ }]
63
+ },
64
+ // Video instream adUnit
65
+ {
66
+ code: 'video-instream',
67
+ sizes: [[640, 480]],
68
+ mediaTypes: {
69
+ video: {
70
+ playerSize: [[640, 480]],
71
+ context: 'instream'
72
+ },
73
+ },
74
+ bids: [{
75
+ goldbach: 'goldbach',
76
+ params: {
77
+ placementId: 13232361,
78
+ video: {
79
+ skippable: true,
80
+ playback_methods: ['auto_play_sound_off']
81
+ }
82
+ }
83
+ }]
84
+ },
85
+ // Video outstream adUnit
86
+ {
87
+ code: 'video-outstream',
88
+ sizes: [[300, 250]],
89
+ mediaTypes: {
90
+ video: {
91
+ playerSize: [[300, 250]],
92
+ context: 'outstream',
93
+ // Certain ORTB 2.5 video values can be read from the mediatypes object; below are examples of supported params.
94
+ // To note - goldbach supports additional values for our system that are not part of the ORTB spec. If you want
95
+ // to use these values, they will have to be declared in the bids[].params.video object instead using the goldbach syntax.
96
+ // Between the corresponding values of the mediaTypes.video and params.video objects, the properties in params.video will
97
+ // take precedence if declared; eg in the example below, the `skippable: true` setting will be used instead of the `skip: 0`.
98
+ minduration: 1,
99
+ maxduration: 60,
100
+ skip: 0, // 1 - true, 0 - false
101
+ skipafter: 5,
102
+ playbackmethod: [2], // note - we only support options 1-4 at this time
103
+ api: [1,2,3] // note - option 6 is not supported at this time
104
+ }
105
+ },
106
+ bids: [
107
+ {
108
+ bidder: 'goldbach',
109
+ params: {
110
+ placementId: 13232385,
111
+ video: {
112
+ skippable: true,
113
+ playback_method: 'auto_play_sound_off'
114
+ }
115
+ }
116
+ }
117
+ ]
118
+ },
119
+ // Banner adUnit in a App Webview
120
+ // Only use this for situations where prebid.js is in a webview of an App
121
+ // See Prebid Mobile for displaying ads via an SDK
122
+ {
123
+ code: 'banner-div',
124
+ mediaTypes: {
125
+ banner: {
126
+ sizes: [[300, 250], [300,600]]
127
+ }
128
+ }
129
+ bids: [{
130
+ bidder: 'goldbach',
131
+ params: {
132
+ placementId: 13144370,
133
+ app: {
134
+ id: "B1O2W3M4AN.com.prebid.webview",
135
+ geo: {
136
+ lat: 40.0964439,
137
+ lng: -75.3009142
138
+ },
139
+ device_id: {
140
+ idfa: "4D12078D-3246-4DA4-AD5E-7610481E7AE", // Apple advertising identifier
141
+ aaid: "38400000-8cf0-11bd-b23e-10b96e40000d", // Android advertising identifier
142
+ md5udid: "5756ae9022b2ea1e47d84fead75220c8", // MD5 hash of the ANDROID_ID
143
+ sha1udid: "4DFAA92388699AC6539885AEF1719293879985BF", // SHA1 hash of the ANDROID_ID
144
+ windowsadid: "750c6be243f1c4b5c9912b95a5742fc5" // Windows advertising identifier
145
+ }
146
+ }
147
+ }
148
+ }]
149
+ }
150
+ ];
151
+ ```
@@ -286,7 +286,8 @@ function buildRequests(validBidRequests, bidderRequest) {
286
286
  schain,
287
287
  transactionId,
288
288
  userId = {},
289
- ortb2Imp
289
+ ortb2Imp,
290
+ adUnitCode = ''
290
291
  } = bidRequest;
291
292
  const { currency, floor } = _getFloor(mediaTypes, params.bidfloor, bidRequest);
292
293
  const eids = getEids(userId);
@@ -302,6 +303,9 @@ function buildRequests(validBidRequests, bidderRequest) {
302
303
  data.to = to;
303
304
  }
304
305
 
306
+ // ADTS-169 add adUnitCode to requests
307
+ if (adUnitCode) data.aun = adUnitCode
308
+
305
309
  // ADTS-134 Retrieve ID envelopes
306
310
  for (const eid in eids) data[eid] = eids[eid];
307
311
 
@@ -0,0 +1,114 @@
1
+ import {submodule} from '../src/hook.js';
2
+ import {isFn, logError} from '../src/utils.js';
3
+ import {config} from '../src/config.js';
4
+ import {getGlobal} from '../src/prebidGlobal.js';
5
+ import includes from 'core-js-pure/features/array/includes.js';
6
+ import '../src/adapterManager.js';
7
+ let observerAvailable = true;
8
+ function getIntersectionData(requestBidsObject, onDone, providerConfig, userConsent) {
9
+ const intersectionMap = {};
10
+ const placeholdersMap = {};
11
+ let done = false;
12
+ if (!observerAvailable) return complete();
13
+ const observer = new IntersectionObserver(observerCallback, {threshold: 0.5});
14
+ const adUnitCodes = requestBidsObject.adUnitCodes || [];
15
+ const auctionDelay = config.getConfig('realTimeData.auctionDelay') || 0;
16
+ const waitForIt = providerConfig.waitForIt;
17
+ let adUnits = requestBidsObject.adUnits || getGlobal().adUnits || [];
18
+ if (adUnitCodes.length) {
19
+ adUnits = adUnits.filter(unit => includes(adUnitCodes, unit.code));
20
+ }
21
+ let checkTimeoutId;
22
+ findAndObservePlaceholders();
23
+ if (auctionDelay > 0) {
24
+ setTimeout(complete, auctionDelay);
25
+ }
26
+ function findAndObservePlaceholders() {
27
+ const observed = adUnits.filter((unit) => {
28
+ const code = unit.code;
29
+ if (placeholdersMap[code]) return true;
30
+ const ph = document.getElementById(code);
31
+ if (ph) {
32
+ placeholdersMap[code] = ph;
33
+ observer.observe(ph);
34
+ return true;
35
+ }
36
+ });
37
+ if (
38
+ observed.length === adUnits.length ||
39
+ !waitForIt ||
40
+ auctionDelay <= 0
41
+ ) {
42
+ return;
43
+ }
44
+ checkTimeoutId = setTimeout(findAndObservePlaceholders);
45
+ }
46
+ function observerCallback(entries) {
47
+ let entry = entries.pop();
48
+ while (entry) {
49
+ const target = entry.target;
50
+ const id = target.getAttribute('id');
51
+ if (id) {
52
+ const intersection = intersectionMap[id];
53
+ if (!intersection || intersection.time < entry.time) {
54
+ intersectionMap[id] = {
55
+ 'boundingClientRect': cloneRect(entry.boundingClientRect),
56
+ 'intersectionRect': cloneRect(entry.intersectionRect),
57
+ 'rootRect': cloneRect(entry.rootRect),
58
+ 'intersectionRatio': entry.intersectionRatio,
59
+ 'isIntersecting': entry.isIntersecting,
60
+ 'time': entry.time
61
+ };
62
+ if (adUnits.every(unit => !!intersectionMap[unit.code])) {
63
+ complete();
64
+ }
65
+ }
66
+ }
67
+ entry = entries.pop();
68
+ }
69
+ }
70
+ function complete() {
71
+ if (done) return;
72
+ if (checkTimeoutId) clearTimeout(checkTimeoutId);
73
+ done = true;
74
+ checkTimeoutId = null;
75
+ observer && observer.disconnect();
76
+ adUnits && adUnits.forEach((unit) => {
77
+ const intersection = intersectionMap[unit.code];
78
+ if (intersection && unit.bids) {
79
+ unit.bids.forEach(bid => bid.intersection = intersection);
80
+ }
81
+ });
82
+ onDone();
83
+ }
84
+ }
85
+ function init(moduleConfig) {
86
+ if (!isFn(window.IntersectionObserver)) {
87
+ logError('IntersectionObserver is not defined');
88
+ observerAvailable = false;
89
+ } else {
90
+ observerAvailable = true;
91
+ }
92
+ return observerAvailable;
93
+ }
94
+ function cloneRect(rect) {
95
+ return rect ? {
96
+ 'left': rect.left,
97
+ 'top': rect.top,
98
+ 'right': rect.right,
99
+ 'bottom': rect.bottom,
100
+ 'width': rect.width,
101
+ 'height': rect.height,
102
+ 'x': rect.x,
103
+ 'y': rect.y,
104
+ } : rect;
105
+ }
106
+ export const intersectionSubmodule = {
107
+ name: 'intersection',
108
+ getBidRequestData: getIntersectionData,
109
+ init: init,
110
+ };
111
+ function registerSubModule() {
112
+ submodule('realTimeData', intersectionSubmodule);
113
+ }
114
+ registerSubModule();
@@ -77,12 +77,14 @@ function isBidRequestValid(bid) {
77
77
  function buildRequest(bidRequests, bidderRequest) {
78
78
  bidderRequest = bidderRequest || {};
79
79
  const _placementIds = [];
80
+ const _adUnitCodes = [];
80
81
  let _loginId, _customEndpoint, _userId;
81
82
  let _ivAuctionStart = bidderRequest.auctionStart || Date.now();
82
83
 
83
84
  bidRequests.forEach(function (bidRequest) {
84
85
  bidRequest.startTime = new Date().getTime();
85
86
  _placementIds.push(bidRequest.params.placementId);
87
+ _adUnitCodes.push(bidRequest.adUnitCode);
86
88
  _loginId = _loginId || bidRequest.params.loginId;
87
89
  _customEndpoint = _customEndpoint || bidRequest.params.customEndpoint;
88
90
  _customUserSync = _customUserSync || bidRequest.params.customUserSync;
@@ -99,6 +101,7 @@ function buildRequest(bidRequests, bidderRequest) {
99
101
  let userIdModel = getUserIds(_userId);
100
102
  let bidParamsJson = {
101
103
  placementIds: _placementIds,
104
+ adUnitCodes: _adUnitCodes,
102
105
  loginId: _loginId,
103
106
  auctionStartTime: _ivAuctionStart,
104
107
  bidVersion: CONSTANTS.PREBID_VERSION
@@ -181,9 +184,12 @@ function handleResponse(responseObj, bidRequests) {
181
184
  const bidResponses = [];
182
185
  for (let i = 0; i < bidRequests.length; i++) {
183
186
  let bidRequest = bidRequests[i];
187
+ let usedPlacementId = responseObj.UseAdUnitCode === true
188
+ ? bidRequest.params.placementId + '_' + bidRequest.adUnitCode
189
+ : bidRequest.params.placementId;
184
190
 
185
- if (invibes.placementBids.indexOf(bidRequest.params.placementId) > -1) {
186
- logInfo('Invibes Adapter - Placement was previously bid on ' + bidRequest.params.placementId);
191
+ if (invibes.placementBids.indexOf(usedPlacementId) > -1) {
192
+ logInfo('Invibes Adapter - Placement was previously bid on ' + usedPlacementId);
187
193
  continue;
188
194
  }
189
195
 
@@ -191,21 +197,21 @@ function handleResponse(responseObj, bidRequests) {
191
197
  if (responseObj.AdPlacements != null) {
192
198
  for (let j = 0; j < responseObj.AdPlacements.length; j++) {
193
199
  let bidModel = responseObj.AdPlacements[j].BidModel;
194
- if (bidModel != null && bidModel.PlacementId == bidRequest.params.placementId) {
200
+ if (bidModel != null && bidModel.PlacementId == usedPlacementId) {
195
201
  requestPlacement = responseObj.AdPlacements[j];
196
202
  break;
197
203
  }
198
204
  }
199
205
  } else {
200
206
  let bidModel = responseObj.BidModel;
201
- if (bidModel != null && bidModel.PlacementId == bidRequest.params.placementId) {
207
+ if (bidModel != null && bidModel.PlacementId == usedPlacementId) {
202
208
  requestPlacement = responseObj;
203
209
  }
204
210
  }
205
211
 
206
- let bid = createBid(bidRequest, requestPlacement, responseObj.MultipositionEnabled);
212
+ let bid = createBid(bidRequest, requestPlacement, responseObj.MultipositionEnabled, usedPlacementId);
207
213
  if (bid !== null) {
208
- invibes.placementBids.push(bidRequest.params.placementId);
214
+ invibes.placementBids.push(usedPlacementId);
209
215
  bidResponses.push(bid);
210
216
  }
211
217
  }
@@ -213,9 +219,9 @@ function handleResponse(responseObj, bidRequests) {
213
219
  return bidResponses;
214
220
  }
215
221
 
216
- function createBid(bidRequest, requestPlacement, multipositionEnabled) {
222
+ function createBid(bidRequest, requestPlacement, multipositionEnabled, usedPlacementId) {
217
223
  if (requestPlacement === null || requestPlacement.BidModel === null) {
218
- logInfo('Invibes Adapter - Placement not configured for bidding ' + bidRequest.params.placementId);
224
+ logInfo('Invibes Adapter - Placement not configured for bidding ' + usedPlacementId);
219
225
  return null;
220
226
  }
221
227
 
@@ -684,7 +690,7 @@ let keywords = (function () {
684
690
  return kw;
685
691
  }());
686
692
 
687
- // =====================
693
+ // ======================
688
694
 
689
695
  export function resetInvibes() {
690
696
  invibes.optIn = undefined;
@@ -0,0 +1,79 @@
1
+ import { logError } from '../src/utils.js';
2
+ import { registerBidder } from '../src/adapters/bidderFactory.js';
3
+
4
+ const BIDDER_CODE = 'iprom';
5
+ const ENDPOINT_URL = 'https://core.iprom.net/programmatic';
6
+ const VERSION = 'v1.0.2';
7
+ const DEFAULT_CURRENCY = 'EUR';
8
+ const DEFAULT_NETREVENUE = true;
9
+ const DEFAULT_TTL = 360;
10
+
11
+ export const spec = {
12
+ code: BIDDER_CODE,
13
+ isBidRequestValid: function ({ bidder, params = {} } = {}) {
14
+ // id parameter checks
15
+ if (!params.id) {
16
+ logError(`${bidder}: Parameter 'id' missing`);
17
+ return false;
18
+ } else if (typeof params.id !== 'string') {
19
+ logError(`${bidder}: Parameter 'id' needs to be a string`);
20
+ return false;
21
+ }
22
+ // dimension parameter checks
23
+ if (!params.dimension) {
24
+ logError(`${bidder}: Required parameter 'dimension' missing`);
25
+ return false;
26
+ } else if (typeof params.dimension !== 'string') {
27
+ logError(`${bidder}: Parameter 'dimension' needs to be a string`);
28
+ return false;
29
+ }
30
+
31
+ return true;
32
+ },
33
+
34
+ buildRequests: function (validBidRequests, bidderRequest) {
35
+ const payload = {
36
+ bids: validBidRequests,
37
+ referer: bidderRequest.refererInfo,
38
+ version: VERSION
39
+ };
40
+ const payloadString = JSON.stringify(payload);
41
+
42
+ return {
43
+ method: 'POST',
44
+ url: ENDPOINT_URL,
45
+ data: payloadString
46
+ };
47
+ },
48
+
49
+ interpretResponse: function (serverResponse, request) {
50
+ let bids = serverResponse.body;
51
+
52
+ const bidResponses = [];
53
+
54
+ bids.forEach(bid => {
55
+ const b = {
56
+ ad: bid.ad,
57
+ requestId: bid.requestId,
58
+ cpm: bid.cpm,
59
+ width: bid.width,
60
+ height: bid.height,
61
+ creativeId: bid.creativeId,
62
+ currency: bid.currency || DEFAULT_CURRENCY,
63
+ netRevenue: bid.netRevenue || DEFAULT_NETREVENUE,
64
+ ttl: bid.ttl || DEFAULT_TTL,
65
+ meta: {},
66
+ };
67
+
68
+ if (bid.aDomains && bid.aDomains.length) {
69
+ b.meta.advertiserDomains = bid.aDomains;
70
+ }
71
+
72
+ bidResponses.push(b);
73
+ });
74
+
75
+ return bidResponses;
76
+ },
77
+ }
78
+
79
+ registerBidder(spec);
@@ -158,7 +158,8 @@ function buildPlacement(bidRequest) {
158
158
  height: size[1]
159
159
  }
160
160
  }),
161
- type: bidRequest.params.adUnitType.toUpperCase()
161
+ type: bidRequest.params.adUnitType.toUpperCase(),
162
+ publisherId: bidRequest.params.publisherId
162
163
  }
163
164
  }
164
165
  }