prebid.js 7.11.0 → 7.12.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 (170) hide show
  1. package/.github/workflows/issue_tracker.yml +1 -1
  2. package/dist/33acrossBidAdapter.js +1 -1
  3. package/dist/adagioBidAdapter.js +1 -1
  4. package/dist/adbookpspBidAdapter.js +1 -1
  5. package/dist/adgenerationBidAdapter.js +1 -1
  6. package/dist/adkernelBidAdapter.js +1 -1
  7. package/dist/adrelevantisBidAdapter.js +1 -1
  8. package/dist/adriverBidAdapter.js +1 -1
  9. package/dist/adriverIdSystem.js +1 -1
  10. package/dist/adtelligentBidAdapter.js +1 -1
  11. package/dist/adtrgtmeBidAdapter.js +1 -1
  12. package/dist/adxcgBidAdapter.js +1 -1
  13. package/dist/ajaBidAdapter.js +1 -1
  14. package/dist/alkimiBidAdapter.js +1 -1
  15. package/dist/amxBidAdapter.js +1 -1
  16. package/dist/amxIdSystem.js +1 -1
  17. package/dist/appierAnalyticsAdapter.js +1 -1
  18. package/dist/appnexusBidAdapter.js +1 -1
  19. package/dist/asoBidAdapter.js +1 -1
  20. package/dist/axonixBidAdapter.js +1 -1
  21. package/dist/betweenBidAdapter.js +1 -1
  22. package/dist/bidglassBidAdapter.js +1 -1
  23. package/dist/bidwatchAnalyticsAdapter.js +1 -1
  24. package/dist/big-richmediaBidAdapter.js +1 -1
  25. package/dist/bridgewellBidAdapter.js +1 -1
  26. package/dist/brightMountainMediaBidAdapter.js +1 -1
  27. package/dist/concertBidAdapter.js +1 -1
  28. package/dist/connectadBidAdapter.js +1 -1
  29. package/dist/consumableBidAdapter.js +1 -1
  30. package/dist/conversantBidAdapter.js +1 -1
  31. package/dist/craftBidAdapter.js +1 -1
  32. package/dist/criteoBidAdapter.js +1 -1
  33. package/dist/dfpAdServerVideo.js +1 -1
  34. package/dist/dgkeywordRtdProvider.js +1 -1
  35. package/dist/displayioBidAdapter.js +1 -3
  36. package/dist/dspxBidAdapter.js +1 -1
  37. package/dist/eplanningBidAdapter.js +1 -1
  38. package/dist/finativeBidAdapter.js +1 -1
  39. package/dist/glimpseBidAdapter.js +1 -1
  40. package/dist/gmosspBidAdapter.js +1 -1
  41. package/dist/goldbachBidAdapter.js +1 -1
  42. package/dist/gridBidAdapter.js +1 -1
  43. package/dist/gridNMBidAdapter.js +1 -1
  44. package/dist/gumgumBidAdapter.js +1 -1
  45. package/dist/h12mediaBidAdapter.js +1 -1
  46. package/dist/id5IdSystem.js +1 -1
  47. package/dist/improvedigitalBidAdapter.js +1 -1
  48. package/dist/inmarBidAdapter.js +1 -1
  49. package/dist/insticatorBidAdapter.js +1 -1
  50. package/dist/ixBidAdapter.js +1 -1
  51. package/dist/justpremiumBidAdapter.js +1 -1
  52. package/dist/konduitAnalyticsAdapter.js +1 -1
  53. package/dist/kueezBidAdapter.js +1 -1
  54. package/dist/lassoBidAdapter.js +1 -1
  55. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  56. package/dist/logicadBidAdapter.js +1 -1
  57. package/dist/loglyliftBidAdapter.js +1 -1
  58. package/dist/malltvAnalyticsAdapter.js +1 -1
  59. package/dist/marsmediaBidAdapter.js +1 -1
  60. package/dist/mediafuseBidAdapter.js +1 -1
  61. package/dist/mediagoBidAdapter.js +1 -0
  62. package/dist/mediasquareBidAdapter.js +1 -1
  63. package/dist/mgidBidAdapter.js +1 -1
  64. package/dist/minutemediaBidAdapter.js +1 -1
  65. package/dist/nextMillenniumBidAdapter.js +1 -1
  66. package/dist/not-for-prod/prebid.js +120 -121
  67. package/dist/oguryBidAdapter.js +1 -1
  68. package/dist/onetagBidAdapter.js +1 -1
  69. package/dist/ooloAnalyticsAdapter.js +1 -1
  70. package/dist/outbrainBidAdapter.js +1 -1
  71. package/dist/parrableIdSystem.js +1 -1
  72. package/dist/pixfutureBidAdapter.js +1 -1
  73. package/dist/prebid-core.js +1 -1
  74. package/dist/publinkIdSystem.js +1 -1
  75. package/dist/pubmaticAnalyticsAdapter.js +1 -1
  76. package/dist/pubmaticBidAdapter.js +1 -1
  77. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  78. package/dist/pxyzBidAdapter.js +1 -1
  79. package/dist/quantcastBidAdapter.js +1 -1
  80. package/dist/rasBidAdapter.js +1 -1
  81. package/dist/readpeakBidAdapter.js +1 -1
  82. package/dist/relaidoBidAdapter.js +1 -1
  83. package/dist/rhythmoneBidAdapter.js +1 -1
  84. package/dist/riseBidAdapter.js +1 -1
  85. package/dist/rubiconAnalyticsAdapter.js +1 -1
  86. package/dist/rubiconBidAdapter.js +1 -1
  87. package/dist/seedingAllianceBidAdapter.js +1 -1
  88. package/dist/seedtagBidAdapter.js +1 -1
  89. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  90. package/dist/sharethroughBidAdapter.js +1 -1
  91. package/dist/shinezBidAdapter.js +1 -1
  92. package/dist/smaatoBidAdapter.js +1 -1
  93. package/dist/smartadserverBidAdapter.js +1 -1
  94. package/dist/smartxBidAdapter.js +1 -1
  95. package/dist/smilewantedBidAdapter.js +1 -1
  96. package/dist/sonobiBidAdapter.js +1 -1
  97. package/dist/sovrnAnalyticsAdapter.js +1 -1
  98. package/dist/sovrnBidAdapter.js +1 -1
  99. package/dist/sspBCBidAdapter.js +1 -1
  100. package/dist/sublimeBidAdapter.js +1 -1
  101. package/dist/synacormediaBidAdapter.js +1 -1
  102. package/dist/tappxBidAdapter.js +1 -1
  103. package/dist/targetVideoBidAdapter.js +1 -1
  104. package/dist/teadsBidAdapter.js +1 -1
  105. package/dist/trionBidAdapter.js +1 -1
  106. package/dist/tripleliftBidAdapter.js +1 -1
  107. package/dist/ttdBidAdapter.js +1 -1
  108. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  109. package/dist/underdogmediaBidAdapter.js +1 -1
  110. package/dist/undertoneBidAdapter.js +1 -1
  111. package/dist/userId.js +1 -1
  112. package/dist/vidazooBidAdapter.js +1 -1
  113. package/dist/videobyteBidAdapter.js +1 -1
  114. package/dist/visxBidAdapter.js +1 -1
  115. package/dist/vuukleBidAdapter.js +1 -1
  116. package/dist/widespaceBidAdapter.js +1 -1
  117. package/dist/winrBidAdapter.js +1 -1
  118. package/dist/yahoosspBidAdapter.js +1 -1
  119. package/dist/yieldmoBidAdapter.js +1 -1
  120. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  121. package/modules/adkernelBidAdapter.js +28 -12
  122. package/modules/adriverBidAdapter.js +5 -12
  123. package/modules/adriverIdSystem.js +2 -1
  124. package/modules/adtelligentBidAdapter.js +2 -0
  125. package/modules/alkimiBidAdapter.js +2 -1
  126. package/modules/betweenBidAdapter.js +3 -3
  127. package/modules/bidwatchAnalyticsAdapter.js +112 -59
  128. package/modules/consumableBidAdapter.js +2 -2
  129. package/modules/criteoBidAdapter.js +19 -13
  130. package/modules/dgkeywordRtdProvider.js +9 -0
  131. package/modules/displayioBidAdapter.js +92 -97
  132. package/modules/id5IdSystem.js +160 -111
  133. package/modules/id5IdSystem.md +16 -14
  134. package/modules/improvedigitalBidAdapter.js +50 -28
  135. package/modules/ixBidAdapter.js +13 -306
  136. package/modules/mediagoBidAdapter.js +462 -0
  137. package/modules/mediagoBidAdapter.md +34 -0
  138. package/modules/nextMillenniumBidAdapter.js +25 -6
  139. package/modules/pubmaticAnalyticsAdapter.js +1 -1
  140. package/modules/rasBidAdapter.js +8 -0
  141. package/modules/rasBidAdapter.md +14 -13
  142. package/modules/sonobiBidAdapter.js +1 -0
  143. package/modules/tappxBidAdapter.js +9 -0
  144. package/package.json +1 -1
  145. package/src/adloader.js +2 -1
  146. package/src/adserver.js +0 -56
  147. package/src/auction.js +58 -15
  148. package/src/native.js +1 -0
  149. package/src/refererDetection.js +12 -1
  150. package/src/videoCache.js +8 -2
  151. package/test/spec/modules/adkernelBidAdapter_spec.js +11 -2
  152. package/test/spec/modules/adriverBidAdapter_spec.js +6 -13
  153. package/test/spec/modules/adriverIdSystem_spec.js +3 -8
  154. package/test/spec/modules/adtelligentBidAdapter_spec.js +1 -0
  155. package/test/spec/modules/alkimiBidAdapter_spec.js +2 -1
  156. package/test/spec/modules/betweenBidAdapter_spec.js +17 -0
  157. package/test/spec/modules/bidwatchAnalyticsAdapter_spec.js +28 -12
  158. package/test/spec/modules/criteoBidAdapter_spec.js +35 -26
  159. package/test/spec/modules/dgkeywordRtdProvider_spec.js +1 -1
  160. package/test/spec/modules/displayioBidAdapter_spec.js +16 -52
  161. package/test/spec/modules/enrichmentFpdModule_spec.js +2 -1
  162. package/test/spec/modules/fpdModule_spec.js +2 -1
  163. package/test/spec/modules/id5IdSystem_spec.js +529 -172
  164. package/test/spec/modules/improvedigitalBidAdapter_spec.js +9 -13
  165. package/test/spec/modules/ixBidAdapter_spec.js +210 -104
  166. package/test/spec/modules/mediagoBidAdapter_spec.js +97 -0
  167. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +2 -7
  168. package/test/spec/modules/rasBidAdapter_spec.js +2 -0
  169. package/test/spec/native_spec.js +144 -0
  170. package/test/spec/videoCache_spec.js +37 -7
@@ -0,0 +1,462 @@
1
+ /**
2
+ * gulp serve --modules=mediagoBidAdapter,pubCommonId --nolint --notest
3
+ */
4
+
5
+ import * as utils from '../src/utils.js';
6
+ import { getStorageManager } from '../src/storageManager.js';
7
+ import { registerBidder } from '../src/adapters/bidderFactory.js';
8
+ // import { config } from '../src/config.js';
9
+ // import { isPubcidEnabled } from './pubCommonId.js';
10
+
11
+ const BIDDER_CODE = 'mediago';
12
+ // const PROTOCOL = window.document.location.protocol;
13
+ const ENDPOINT_URL =
14
+ // ((PROTOCOL === 'https:') ? 'https' : 'http') +
15
+ 'https://rtb-us.mediago.io/api/bid?tn=';
16
+ const TIME_TO_LIVE = 500;
17
+ // const ENDPOINT_URL = '/api/bid?tn=';
18
+ const storage = getStorageManager();
19
+ let globals = {};
20
+ let itemMaps = {};
21
+
22
+ /**
23
+ * 获取随机id
24
+ * @param {number} a random number from 0 to 15
25
+ * @return {string} random number or random string
26
+ */
27
+ // function getRandomId(
28
+ // a // placeholder
29
+ // ) {
30
+ // // if the placeholder was passed, return
31
+ // // a random number from 0 to 15
32
+ // return a
33
+ // ? (
34
+ // a ^ // unless b is 8,
35
+ // ((Math.random() * // in which case
36
+ // 16) >> // a random number from
37
+ // (a / 4))
38
+ // ) // 8 to 11
39
+ // .toString(16) // in hexadecimal
40
+ // : ( // or otherwise a concatenated string:
41
+ // [1e7] + // 10000000 +
42
+ // 1e3 + // -1000 +
43
+ // 4e3 + // -4000 +
44
+ // 8e3 + // -80000000 +
45
+ // 1e11
46
+ // ) // -100000000000,
47
+ // .replace(
48
+ // // replacing
49
+ // /[018]/g, // zeroes, ones, and eights with
50
+ // getRandomId // random hex digits
51
+ // );
52
+ // }
53
+
54
+ /* ----- mguid:start ------ */
55
+ const COOKIE_KEY_MGUID = '__mguid_';
56
+
57
+ /**
58
+ * 获取用户id
59
+ * @return {string}
60
+ */
61
+ const getUserID = () => {
62
+ const i = storage.getCookie(COOKIE_KEY_MGUID);
63
+
64
+ if (i === null) {
65
+ const uuid = utils.generateUUID();
66
+ storage.setCookie(COOKIE_KEY_MGUID, uuid);
67
+ return uuid;
68
+ }
69
+ return i;
70
+ };
71
+
72
+ /* ----- mguid:end ------ */
73
+
74
+ /**
75
+ * 获取一个对象的某个值,如果没有则返回空字符串
76
+ * @param {Object} obj 对象
77
+ * @param {...string} keys 键名
78
+ * @return {any}
79
+ */
80
+ function getProperty(obj, ...keys) {
81
+ let o = obj;
82
+
83
+ for (let key of keys) {
84
+ // console.log(key, o);
85
+ if (o && o[key]) {
86
+ o = o[key];
87
+ } else {
88
+ return '';
89
+ }
90
+ }
91
+ return o;
92
+ }
93
+
94
+ /**
95
+ * 是不是移动设备或者平板
96
+ * @return {boolean}
97
+ */
98
+ function isMobileAndTablet() {
99
+ let check = false;
100
+ (function (a) {
101
+ let reg1 = new RegExp(
102
+ [
103
+ '(android|bbd+|meego)',
104
+ '.+mobile|avantgo|bada/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)',
105
+ '|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone',
106
+ '|p(ixi|re)/|plucker|pocket|psp|series(4|6)0|symbian|treo|up.(browser|link)|vodafone|wap',
107
+ '|windows ce|xda|xiino|android|ipad|playbook|silk',
108
+ ].join(''),
109
+ 'i'
110
+ );
111
+ let reg2 = new RegExp(
112
+ [
113
+ '1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)',
114
+ '|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )',
115
+ '|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55/|capi|ccwa|cdm-|cell',
116
+ '|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)',
117
+ '|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene',
118
+ '|gf-5|g-mo|go(.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c',
119
+ '|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|/)|ibro|idea|ig01|ikom',
120
+ '|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |/)|klon|kpt |kwc-|kyo(c|k)',
121
+ '|le(no|xi)|lg( g|/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50/|ma(te|ui|xo)|mc(01|21|ca)',
122
+ '|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]',
123
+ '|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)',
124
+ '|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio',
125
+ '|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55/|sa(ge|ma|mm|ms',
126
+ '|ny|va)|sc(01|h-|oo|p-)|sdk/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al',
127
+ '|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)',
128
+ '|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(.b|g1|si)|utst|',
129
+ 'v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)',
130
+ '|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-',
131
+ '|your|zeto|zte-',
132
+ ].join(''),
133
+ 'i'
134
+ );
135
+ if (reg1.test(a) || reg2.test(a.substr(0, 4))) {
136
+ check = true;
137
+ }
138
+ })(navigator.userAgent || navigator.vendor || window.opera);
139
+ return check;
140
+ }
141
+
142
+ /**
143
+ * 获取底价
144
+ * @param {*} bid
145
+ * @param {*} mediaType
146
+ * @param {*} sizes
147
+ * @returns
148
+ */
149
+ // function getBidFloor(bid, mediaType, sizes) {
150
+ // var floor;
151
+ // var size = sizes.length === 1 ? sizes[0] : "*";
152
+ // if (typeof bid.getFloor === "function") {
153
+ // const floorInfo = bid.getFloor({ currency: "USD", mediaType, size });
154
+ // if (
155
+ // typeof floorInfo === "object" &&
156
+ // floorInfo.currency === "USD" &&
157
+ // !isNaN(parseFloat(floorInfo.floor))
158
+ // ) {
159
+ // floor = parseFloat(floorInfo.floor);
160
+ // }
161
+ // }
162
+ // return floor;
163
+ // }
164
+ function getBidFloor(bid) {
165
+ if (!utils.isFn(bid.getFloor)) {
166
+ return utils.deepAccess(bid, 'params.bidfloor', 0);
167
+ }
168
+
169
+ try {
170
+ const bidFloor = bid.getFloor({
171
+ currency: 'USD',
172
+ mediaType: '*',
173
+ size: '*',
174
+ });
175
+ return bidFloor.floor;
176
+ } catch (_) {
177
+ return 0;
178
+ }
179
+ }
180
+
181
+ /**
182
+ * 将尺寸转为RTB识别的尺寸
183
+ *
184
+ * @param {Array|Object} requestSizes 配置尺寸
185
+ * @return {Object}
186
+ */
187
+ function transformSizes(requestSizes) {
188
+ let sizes = [];
189
+ let sizeObj = {};
190
+
191
+ if (
192
+ utils.isArray(requestSizes) &&
193
+ requestSizes.length === 2 &&
194
+ !utils.isArray(requestSizes[0])
195
+ ) {
196
+ sizeObj.width = parseInt(requestSizes[0], 10);
197
+ sizeObj.height = parseInt(requestSizes[1], 10);
198
+ sizes.push(sizeObj);
199
+ } else if (typeof requestSizes === 'object') {
200
+ for (let i = 0; i < requestSizes.length; i++) {
201
+ let size = requestSizes[i];
202
+ sizeObj = {};
203
+ sizeObj.width = parseInt(size[0], 10);
204
+ sizeObj.height = parseInt(size[1], 10);
205
+ sizes.push(sizeObj);
206
+ }
207
+ }
208
+
209
+ return sizes;
210
+ }
211
+
212
+ // 支持的广告尺寸
213
+ const mediagoAdSize = [
214
+ { w: 300, h: 250 },
215
+ { w: 300, h: 600 },
216
+ { w: 728, h: 90 },
217
+ { w: 970, h: 250 },
218
+ { w: 320, h: 50 },
219
+ { w: 160, h: 600 },
220
+ { w: 320, h: 180 },
221
+ { w: 320, h: 100 },
222
+ { w: 336, h: 280 },
223
+ ];
224
+
225
+ /**
226
+ * 获取广告位配置
227
+ * @param {Array} validBidRequests an an array of bids
228
+ * @param {Object} bidderRequest The master bidRequest object
229
+ * @return {Object}
230
+ */
231
+ function getItems(validBidRequests, bidderRequest) {
232
+ let items = [];
233
+ items = validBidRequests.map((req, i) => {
234
+ let ret = {};
235
+ let mediaTypes = getProperty(req, 'mediaTypes');
236
+
237
+ let sizes = transformSizes(getProperty(req, 'sizes'));
238
+ let matchSize;
239
+
240
+ // 确认尺寸是否符合我们要求
241
+ for (let size of sizes) {
242
+ matchSize = mediagoAdSize.find(
243
+ (item) => size.width === item.w && size.height === item.h
244
+ );
245
+ if (matchSize) {
246
+ break;
247
+ }
248
+ }
249
+ if (!matchSize) {
250
+ return {};
251
+ }
252
+
253
+ const bidFloor = getBidFloor(req);
254
+ // const gpid =
255
+ // utils.deepAccess(req, 'ortb2Imp.ext.gpid') ||
256
+ // utils.deepAccess(req, 'ortb2Imp.ext.data.pbadslot') ||
257
+ // utils.deepAccess(req, 'params.placementId', 0);
258
+ // console.log("wjh getItems:", req, bidFloor, gpid);
259
+
260
+ // if (mediaTypes.native) {}
261
+ // banner广告类型
262
+ if (mediaTypes.banner) {
263
+ let id = '' + (i + 1);
264
+ ret = {
265
+ id: id,
266
+ bidfloor: bidFloor,
267
+ banner: {
268
+ h: matchSize.h,
269
+ w: matchSize.w,
270
+ pos: 1,
271
+ },
272
+ ext: {
273
+ // gpid: gpid, // 加入后无法返回广告
274
+ },
275
+ };
276
+ itemMaps[id] = {
277
+ req,
278
+ ret,
279
+ };
280
+ }
281
+
282
+ return ret;
283
+ });
284
+ return items;
285
+ }
286
+
287
+ /**
288
+ * 获取rtb请求参数
289
+ *
290
+ * @param {Array} validBidRequests an an array of bids
291
+ * @param {Object} bidderRequest The master bidRequest object
292
+ * @return {Object}
293
+ */
294
+ function getParam(validBidRequests, bidderRequest) {
295
+ const pubcid = utils.deepAccess(validBidRequests[0], 'crumbs.pubcid');
296
+ // console.log('wjh getParam', validBidRequests, bidderRequest);
297
+ let isMobile = isMobileAndTablet() ? 1 : 0;
298
+ let isTest = 0;
299
+ let auctionId = getProperty(bidderRequest, 'auctionId');
300
+ let items = getItems(validBidRequests, bidderRequest);
301
+
302
+ const domain = document.domain;
303
+ const location = utils.deepAccess(bidderRequest, 'refererInfo.referer');
304
+
305
+ const timeout = bidderRequest.timeout || 2000;
306
+
307
+ if (items && items.length) {
308
+ let c = {
309
+ id: 'mgprebidjs_' + auctionId,
310
+ test: +isTest,
311
+ at: 1,
312
+ cur: ['USD'],
313
+ device: {
314
+ connectiontype: 0,
315
+ // ip: '64.188.178.115',
316
+ js: 1,
317
+ // language: "en",
318
+ // os: "Microsoft Windows",
319
+ // ua: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19043",
320
+ os: navigator.platform || '',
321
+ ua: navigator.userAgent,
322
+ language: /en/.test(navigator.language) ? 'en' : navigator.language,
323
+ },
324
+ ext: {},
325
+ user: {
326
+ buyeruid: getUserID(),
327
+ id: pubcid,
328
+ },
329
+ site: {
330
+ name: domain,
331
+ domain: domain,
332
+ page: location,
333
+ ref: location,
334
+ mobile: isMobile,
335
+ cat: [], // todo
336
+ publisher: {
337
+ // todo
338
+ id: domain,
339
+ name: domain,
340
+ },
341
+ },
342
+ imp: items,
343
+ tmax: timeout,
344
+ };
345
+ return c;
346
+ } else {
347
+ return null;
348
+ }
349
+ }
350
+
351
+ export const spec = {
352
+ code: BIDDER_CODE,
353
+ // aliases: ['ex'], // short code
354
+ /**
355
+ * Determines whether or not the given bid request is valid.
356
+ *
357
+ * @param {BidRequest} bid The bid params to validate.
358
+ * @return boolean True if this is a valid bid, and false otherwise.
359
+ */
360
+ isBidRequestValid: function (bid) {
361
+ // console.log('mediago', {
362
+ // bid
363
+ // });
364
+ if (bid.params.token) {
365
+ globals['token'] = bid.params.token;
366
+ }
367
+ return !!bid.params.token;
368
+ },
369
+
370
+ /**
371
+ * Make a server request from the list of BidRequests.
372
+ *
373
+ * @param {Array} validBidRequests an an array of bids
374
+ * @param {Object} bidderRequest The master bidRequest object
375
+ * @return ServerRequest Info describing the request to the server.
376
+ */
377
+ buildRequests: function (validBidRequests, bidderRequest) {
378
+ let payload = getParam(validBidRequests, bidderRequest);
379
+
380
+ const payloadString = JSON.stringify(payload);
381
+ return {
382
+ method: 'POST',
383
+ url: ENDPOINT_URL + globals['token'],
384
+ data: payloadString,
385
+ };
386
+ },
387
+
388
+ /**
389
+ * Unpack the response from the server into a list of bids.
390
+ *
391
+ * @param {ServerResponse} serverResponse A successful response from the server.
392
+ * @return {Bid[]} An array of bids which were nested inside the server.
393
+ */
394
+ interpretResponse: function (serverResponse, bidRequest) {
395
+ const bids = getProperty(serverResponse, 'body', 'seatbid', 0, 'bid');
396
+ const cur = getProperty(serverResponse, 'body', 'cur');
397
+
398
+ const bidResponses = [];
399
+ for (let bid of bids) {
400
+ let impid = getProperty(bid, 'impid');
401
+ if (itemMaps[impid]) {
402
+ let bidId = getProperty(itemMaps[impid], 'req', 'bidId');
403
+ const bidResponse = {
404
+ requestId: bidId,
405
+ cpm: getProperty(bid, 'price'),
406
+ width: getProperty(bid, 'w'),
407
+ height: getProperty(bid, 'h'),
408
+ creativeId: getProperty(bid, 'crid'),
409
+ dealId: '',
410
+ currency: cur,
411
+ netRevenue: true,
412
+ ttl: TIME_TO_LIVE,
413
+ // referrer: REFERER,
414
+ ad: getProperty(bid, 'adm'),
415
+ nurl: getProperty(bid, 'nurl'),
416
+ // adserverTargeting: {
417
+ // granularityMultiplier: 0.1,
418
+ // priceGranularity: "pbHg",
419
+ // pbMg: "0.01",
420
+ // },
421
+ // pbMg: "0.01",
422
+ // granularityMultiplier: 0.1,
423
+ // priceGranularity: "pbHg",
424
+ };
425
+ bidResponses.push(bidResponse);
426
+ }
427
+ }
428
+
429
+ return bidResponses;
430
+ },
431
+
432
+ /**
433
+ * Register bidder specific code, which will execute if bidder timed out after an auction
434
+ * @param {data} Containing timeout specific data
435
+ */
436
+ // onTimeout: function (data) {
437
+ // // console.log('onTimeout', data);
438
+ // // Bidder specifc code
439
+ // },
440
+
441
+ /**
442
+ * Register bidder specific code, which will execute if a bid from this bidder won the auction
443
+ * @param {Bid} The bid that won the auction
444
+ */
445
+ onBidWon: function (bid) {
446
+ // console.log('onBidWon: ', bid, config.getConfig('priceGranularity'));
447
+ // Bidder specific code
448
+ if (bid['nurl']) {
449
+ utils.triggerPixel(bid['nurl']);
450
+ }
451
+ },
452
+
453
+ /**
454
+ * Register bidder specific code, which will execute when the adserver targeting has been set for a bid from this bidder
455
+ * @param {Bid} The bid of which the targeting has been set
456
+ */
457
+ // onSetTargeting: function (bid) {
458
+ // // console.log('onSetTargeting', bid);
459
+ // // Bidder specific code
460
+ // },
461
+ };
462
+ registerBidder(spec);
@@ -0,0 +1,34 @@
1
+ # Overview
2
+
3
+ ```
4
+ Module Name: MediaGo Bidder Adapter
5
+ Module Type: Bidder Adapter
6
+ Maintainer: fangsimin@baidu.com
7
+ ```
8
+
9
+ # Description
10
+
11
+ Module that connects to MediaGo's demand sources
12
+
13
+ # Test Parameters
14
+
15
+ ```
16
+ var adUnits = [
17
+ {
18
+ code: 'test-div',
19
+ mediaTypes: {
20
+ banner: {
21
+ sizes: [[300, 250]],
22
+ }
23
+ },
24
+ bids: [
25
+ {
26
+ bidder: "mediago",
27
+ params: {
28
+ token: '' // required, send email to ext_mediago_am@baidu.com to get the corresponding token
29
+ }
30
+ }
31
+ ]
32
+ }
33
+ ];
34
+ ```
@@ -26,11 +26,12 @@ export const spec = {
26
26
  _each(validBidRequests, function(bid) {
27
27
  window.nmmRefreshCounts[bid.adUnitCode] = window.nmmRefreshCounts[bid.adUnitCode] || 0;
28
28
  const id = getPlacementId(bid)
29
+ let sizes = bid.sizes
30
+ if (sizes && !Array.isArray(sizes[0])) sizes = [sizes]
31
+
32
+ const site = getSiteObj()
33
+ const device = getDeviceObj()
29
34
 
30
- if (bid.sizes && !Array.isArray(bid.sizes[0])) bid.sizes = [bid.sizes]
31
- if (!bid.ortb2) bid.ortb2 = {}
32
- if (!bid.ortb2.device) bid.ortb2.device = {}
33
- bid.ortb2.device.referrer = (getRefererInfo && getRefererInfo().ref) || ''
34
35
  const postBody = {
35
36
  'id': bid.auctionId,
36
37
  'ext': {
@@ -46,10 +47,11 @@ export const spec = {
46
47
  'scrollTop': window.pageYOffset || document.documentElement.scrollTop
47
48
  }
48
49
  },
49
- ...bid.ortb2,
50
+ device,
51
+ site,
50
52
  'imp': [{
51
53
  'banner': {
52
- 'format': (bid.sizes || []).map(s => { return {w: s[0], h: s[1]} })
54
+ 'format': (sizes || []).map(s => { return {w: s[0], h: s[1]} })
53
55
  },
54
56
  'ext': {
55
57
  'prebid': {
@@ -198,4 +200,21 @@ function getTopWindow(curWindow, nesting = 0) {
198
200
  }
199
201
  }
200
202
 
203
+ function getSiteObj() {
204
+ const refInfo = (getRefererInfo && getRefererInfo()) || {}
205
+
206
+ return {
207
+ page: refInfo.page,
208
+ ref: refInfo.ref,
209
+ domain: refInfo.domain
210
+ }
211
+ }
212
+
213
+ function getDeviceObj() {
214
+ return {
215
+ w: window.innerWidth || window.document.documentElement.clientWidth || window.document.body.clientWidth || 0,
216
+ h: window.innerHeight || window.document.documentElement.clientHeight || window.document.body.clientHeight || 0,
217
+ }
218
+ }
219
+
201
220
  registerBidder(spec);
@@ -382,7 +382,7 @@ function bidResponseHandler(args) {
382
382
  return;
383
383
  }
384
384
 
385
- if (bid.bidder && args.bidderCode && bid.bidder !== args.bidderCode) {
385
+ if ((bid.bidder && args.bidderCode && bid.bidder !== args.bidderCode) || (bid.bidder === args.bidderCode && bid.status === SUCCESS)) {
386
386
  bid = copyRequiredBidDetails(args);
387
387
  cache.auctions[args.auctionId].adUnitCodes[args.adUnitCode].bids[args.requestId].push(bid);
388
388
  }
@@ -1,3 +1,4 @@
1
+ import * as utils from '../src/utils.js';
1
2
  import { registerBidder } from '../src/adapters/bidderFactory.js';
2
3
  import { BANNER } from '../src/mediaTypes.js';
3
4
  import { isEmpty, getAdUnitSizes, parseSizesInput, deepAccess } from '../src/utils.js';
@@ -92,11 +93,18 @@ const getSlots = (bidRequests) => {
92
93
  const batchSize = bidRequests.length;
93
94
  for (let i = 0; i < batchSize; i++) {
94
95
  const adunit = bidRequests[i];
96
+ const slotSequence = utils.deepAccess(adunit, 'params.slotSequence');
97
+
95
98
  const sizes = parseSizesInput(getAdUnitSizes(adunit)).join(',');
99
+
96
100
  queryString += `&slot${i}=${encodeURIComponent(adunit.params.slot)}&id${i}=${encodeURIComponent(adunit.bidId)}&composition${i}=CHILD`;
101
+
97
102
  if (sizes.length) {
98
103
  queryString += `&iusizes${i}=${encodeURIComponent(sizes)}`;
99
104
  }
105
+ if (slotSequence !== undefined) {
106
+ queryString += `&pos${i}=${encodeURIComponent(slotSequence)}`;
107
+ }
100
108
  }
101
109
  return queryString;
102
110
  };
@@ -34,17 +34,18 @@ var adUnits = [{
34
34
 
35
35
  # Parameters
36
36
 
37
- | Name | Scope | Type | Description | Example
38
- | --- | --- | --- | --- | ---
39
- | network | required | String | Specific identifier provided by RAS | `"4178463"`
40
- | site | required | String | Specific identifier name (case-insensitive) that is associated with this ad unit and provided by RAS | `"example_com"`
41
- | area | required | String | Ad unit category name; only case-insensitive alphanumeric with underscores and hyphens are allowed | `"sport"`
42
- | slot | required | String | Ad unit placement name (case-insensitive) provided by RAS | `"slot"`
43
- | pageContext | optional | Object | Web page context data | `{}`
44
- | pageContext.dr | optional | String | Document referrer URL address | `"https://example.com/"`
45
- | pageContext.du | optional | String | Document URL address | `"https://example.com/sport/football/article.html?id=932016a5-02fc-4d5c-b643-fafc2f270f06"`
37
+ | Name | Scope | Type | Description | Example
38
+ | --- | --- | --- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ---
39
+ | network | required | String | Specific identifier provided by RAS | `"4178463"`
40
+ | site | required | String | Specific identifier name (case-insensitive) that is associated with this ad unit and provided by RAS | `"example_com"`
41
+ | area | required | String | Ad unit category name; only case-insensitive alphanumeric with underscores and hyphens are allowed | `"sport"`
42
+ | slot | required | String | Ad unit placement name (case-insensitive) provided by RAS | `"slot"`
43
+ | slotSequence | optional | Number | Ad unit sequence position provided by RAS | `1`
44
+ | pageContext | optional | Object | Web page context data | `{}`
45
+ | pageContext.dr | optional | String | Document referrer URL address | `"https://example.com/"`
46
+ | pageContext.du | optional | String | Document URL address | `"https://example.com/sport/football/article.html?id=932016a5-02fc-4d5c-b643-fafc2f270f06"`
46
47
  | pageContext.dv | optional | String | Document virtual address as slash-separated path that may consist of any number of parts (case-insensitive alphanumeric with underscores and hyphens); first part should be the same as `site` value and second as `area` value; next parts may reflect website navigation | `"example_com/sport/football"`
47
- | pageContext.keyWords | optional | String[] | List of keywords associated with this ad unit; only case-insensitive alphanumeric with underscores and hyphens are allowed | `["euro", "lewandowski"]`
48
- | pageContext.keyValues | optional | Object | Key-values associated with this ad unit (case-insensitive); following characters are not allowed in the values: `" ' = ! + # * ~ ; ^ ( ) < > [ ] & @` | `{}`
49
- | pageContext.keyValues.ci | optional | String | Content unique identifier | `"932016a5-02fc-4d5c-b643-fafc2f270f06"`
50
- | pageContext.keyValues.adunit | optional | String | Ad unit name | `"example_com/sport"`
48
+ | pageContext.keyWords | optional | String[] | List of keywords associated with this ad unit; only case-insensitive alphanumeric with underscores and hyphens are allowed | `["euro", "lewandowski"]`
49
+ | pageContext.keyValues | optional | Object | Key-values associated with this ad unit (case-insensitive); following characters are not allowed in the values: `" ' = ! + # * ~ ; ^ ( ) < > [ ] & @` | `{}`
50
+ | pageContext.keyValues.ci | optional | String | Content unique identifier | `"932016a5-02fc-4d5c-b643-fafc2f270f06"`
51
+ | pageContext.keyValues.adunit | optional | String | Ad unit name | `"example_com/sport"`
@@ -11,6 +11,7 @@ const OUTSTREAM_REDNERER_URL = 'https://mtrx.go.sonobi.com/sbi_outstream_rendere
11
11
 
12
12
  export const spec = {
13
13
  code: BIDDER_CODE,
14
+ gvlid: 104,
14
15
  supportedMediaTypes: [BANNER, VIDEO],
15
16
  /**
16
17
  * Determines whether or not the given bid request is valid.
@@ -484,9 +484,18 @@ export function _getHostInfo(validBidRequests) {
484
484
 
485
485
  domainInfo.domain = hostParam.split('/', 1)[0];
486
486
 
487
+ let regexHostParamHttps = new RegExp(`^https:\/\/`);
488
+ let regexHostParamHttp = new RegExp(`^http:\/\/`);
489
+
487
490
  let regexNewEndpoints = new RegExp(`^(vz.*|zz.*)\\.[a-z]{3}\\.tappx\\.com$`, 'i');
488
491
  let regexClassicEndpoints = new RegExp(`^([a-z]{3}|testing)\\.[a-z]{3}\\.tappx\\.com$`, 'i');
489
492
 
493
+ if (regexHostParamHttps.test(hostParam)) {
494
+ hostParam = hostParam.replace('https://', '');
495
+ } else if (regexHostParamHttp.test(hostParam)) {
496
+ hostParam = hostParam.replace('http://', '');
497
+ }
498
+
490
499
  if (regexNewEndpoints.test(domainInfo.domain)) {
491
500
  domainInfo.newEndpoint = true;
492
501
  domainInfo.endpoint = domainInfo.domain.split('.', 1)[0]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prebid.js",
3
- "version": "7.11.0",
3
+ "version": "7.12.0",
4
4
  "description": "Header Bidding Management Library",
5
5
  "main": "src/prebid.js",
6
6
  "scripts": {
package/src/adloader.js CHANGED
@@ -18,7 +18,8 @@ const _approvedLoadExternalJSList = [
18
18
  'ftrackId',
19
19
  'inskin',
20
20
  'hadron',
21
- 'medianet'
21
+ 'medianet',
22
+ 'improvedigital'
22
23
  ]
23
24
 
24
25
  /**