prebid.js 9.0.0 → 9.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 (307) hide show
  1. package/.nvmrc +1 -1
  2. package/browsers.json +3 -3
  3. package/dist/33acrossAnalyticsAdapter.js +1 -1
  4. package/dist/33acrossBidAdapter.js +1 -1
  5. package/dist/33acrossIdSystem.js +1 -1
  6. package/dist/BTBidAdapter.js +1 -1
  7. package/dist/acuityadsBidAdapter.js +1 -1
  8. package/dist/adagioAnalyticsAdapter.js +1 -1
  9. package/dist/adagioBidAdapter.js +1 -1
  10. package/dist/adagioRtdProvider.js +1 -1
  11. package/dist/adagioUtils.js +1 -0
  12. package/dist/adgenerationBidAdapter.js +1 -1
  13. package/dist/admanBidAdapter.js +1 -1
  14. package/dist/adpod.js +1 -1
  15. package/dist/adprimeBidAdapter.js +1 -1
  16. package/dist/adqueryBidAdapter.js +1 -1
  17. package/dist/adrelevantisBidAdapter.js +1 -1
  18. package/dist/adstirBidAdapter.js +1 -1
  19. package/dist/adtrgtmeBidAdapter.js +1 -1
  20. package/dist/adxcgBidAdapter.js +1 -1
  21. package/dist/adyoulikeBidAdapter.js +1 -1
  22. package/dist/agmaAnalyticsAdapter.js +1 -1
  23. package/dist/ajaBidAdapter.js +1 -1
  24. package/dist/amxBidAdapter.js +1 -1
  25. package/dist/amxIdSystem.js +1 -1
  26. package/dist/appierAnalyticsAdapter.js +1 -1
  27. package/dist/appnexusBidAdapter.js +1 -1
  28. package/dist/appnexusUtils.js +1 -1
  29. package/dist/asoBidAdapter.js +1 -1
  30. package/dist/autoplayDetection.js +1 -1
  31. package/dist/axisBidAdapter.js +1 -1
  32. package/dist/axonixBidAdapter.js +1 -1
  33. package/dist/beyondmediaBidAdapter.js +1 -1
  34. package/dist/bidglassBidAdapter.js +1 -1
  35. package/dist/big-richmediaBidAdapter.js +1 -1
  36. package/dist/bliinkBidAdapter.js +1 -1
  37. package/dist/boldwinBidAdapter.js +1 -1
  38. package/dist/bridBidAdapter.js +1 -1
  39. package/dist/bridgewellBidAdapter.js +1 -1
  40. package/dist/brightMountainMediaBidAdapter.js +1 -1
  41. package/dist/carodaBidAdapter.js +1 -1
  42. package/dist/chtnwBidAdapter.js +1 -1
  43. package/dist/chunk-core.js +1 -1
  44. package/dist/compassBidAdapter.js +1 -1
  45. package/dist/concertBidAdapter.js +1 -1
  46. package/dist/connectadBidAdapter.js +1 -1
  47. package/dist/consumableBidAdapter.js +1 -1
  48. package/dist/contentexchangeBidAdapter.js +1 -1
  49. package/dist/conversantAnalyticsAdapter.js +1 -1
  50. package/dist/conversantBidAdapter.js +1 -1
  51. package/dist/craftBidAdapter.js +1 -1
  52. package/dist/criteoBidAdapter.js +1 -1
  53. package/dist/cwireBidAdapter.js +1 -1
  54. package/dist/dailymotionBidAdapter.js +1 -1
  55. package/dist/dependencies.json +83 -4
  56. package/dist/dspxBidAdapter.js +1 -1
  57. package/dist/dxkultureBidAdapter.js +1 -1
  58. package/dist/e_volutionBidAdapter.js +1 -1
  59. package/dist/emtvBidAdapter.js +1 -1
  60. package/dist/eplanningBidAdapter.js +1 -1
  61. package/dist/euidIdSystem.js +1 -1
  62. package/dist/exadsBidAdapter.js +1 -1
  63. package/dist/feedadBidAdapter.js +1 -1
  64. package/dist/finativeBidAdapter.js +1 -1
  65. package/dist/freewheel-sspBidAdapter.js +1 -1
  66. package/dist/globalsunBidAdapter.js +1 -1
  67. package/dist/gmosspBidAdapter.js +1 -1
  68. package/dist/goldbachBidAdapter.js +1 -1
  69. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  70. package/dist/greenbidsRtdProvider.js +1 -1
  71. package/dist/gridBidAdapter.js +1 -1
  72. package/dist/gumgumBidAdapter.js +1 -1
  73. package/dist/h12mediaBidAdapter.js +1 -1
  74. package/dist/hypelabBidAdapter.js +1 -1
  75. package/dist/id5IdSystem.js +1 -1
  76. package/dist/illuminBidAdapter.js +1 -1
  77. package/dist/imdsBidAdapter.js +1 -1
  78. package/dist/improvedigitalBidAdapter.js +1 -1
  79. package/dist/insticatorBidAdapter.js +1 -1
  80. package/dist/iqzoneBidAdapter.js +1 -1
  81. package/dist/ixBidAdapter.js +1 -1
  82. package/dist/jixieBidAdapter.js +1 -1
  83. package/dist/justpremiumBidAdapter.js +1 -1
  84. package/dist/kargoBidAdapter.js +1 -1
  85. package/dist/kimberliteBidAdapter.js +1 -1
  86. package/dist/kiviadsBidAdapter.js +1 -1
  87. package/dist/konduitAnalyticsAdapter.js +1 -1
  88. package/dist/krushmediaBidAdapter.js +1 -1
  89. package/dist/kueezBidAdapter.js +1 -1
  90. package/dist/kueezRtbBidAdapter.js +1 -1
  91. package/dist/lassoBidAdapter.js +1 -1
  92. package/dist/lifestreetBidAdapter.js +1 -1
  93. package/dist/liveIntentIdSystem.js +1 -1
  94. package/dist/logicadBidAdapter.js +1 -1
  95. package/dist/loglyliftBidAdapter.js +1 -1
  96. package/dist/loyalBidAdapter.js +1 -1
  97. package/dist/luceadBidAdapter.js +1 -1
  98. package/dist/lunamediahbBidAdapter.js +1 -1
  99. package/dist/magniteAnalyticsAdapter.js +1 -1
  100. package/dist/malltvAnalyticsAdapter.js +1 -1
  101. package/dist/marsmediaBidAdapter.js +1 -1
  102. package/dist/mathildeadsBidAdapter.js +1 -1
  103. package/dist/mediafuseBidAdapter.js +1 -1
  104. package/dist/mediasquareBidAdapter.js +1 -1
  105. package/dist/mgidBidAdapter.js +1 -1
  106. package/dist/mgidXBidAdapter.js +1 -1
  107. package/dist/minutemediaBidAdapter.js +1 -1
  108. package/dist/missenaBidAdapter.js +1 -1
  109. package/dist/mobfoxpbBidAdapter.js +1 -1
  110. package/dist/mobianRtdProvider.js +1 -0
  111. package/dist/nexx360BidAdapter.js +1 -1
  112. package/dist/nobidAnalyticsAdapter.js +1 -1
  113. package/dist/nobidBidAdapter.js +1 -1
  114. package/dist/not-for-prod/prebid.js +190 -186
  115. package/dist/oguryBidAdapter.js +1 -1
  116. package/dist/onetagBidAdapter.js +1 -1
  117. package/dist/ooloAnalyticsAdapter.js +1 -1
  118. package/dist/openwebBidAdapter.js +1 -1
  119. package/dist/openxBidAdapter.js +1 -1
  120. package/dist/optidigitalBidAdapter.js +1 -1
  121. package/dist/ortbConverter.js +1 -1
  122. package/dist/outbrainBidAdapter.js +1 -1
  123. package/dist/ozoneBidAdapter.js +1 -1
  124. package/dist/paapi.js +1 -1
  125. package/dist/pgamsspBidAdapter.js +1 -1
  126. package/dist/pixfutureBidAdapter.js +1 -1
  127. package/dist/playdigoBidAdapter.js +1 -1
  128. package/dist/prebidServerBidAdapter.js +1 -1
  129. package/dist/pubCircleBidAdapter.js +1 -1
  130. package/dist/publinkIdSystem.js +1 -1
  131. package/dist/publirBidAdapter.js +1 -1
  132. package/dist/pubmaticAnalyticsAdapter.js +1 -1
  133. package/dist/pubmaticBidAdapter.js +1 -1
  134. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  135. package/dist/pubxaiAnalyticsAdapter.js +1 -1
  136. package/dist/pxyzBidAdapter.js +1 -1
  137. package/dist/qtBidAdapter.js +1 -1
  138. package/dist/quantcastBidAdapter.js +1 -1
  139. package/dist/raynRtdProvider.js +1 -1
  140. package/dist/readpeakBidAdapter.js +1 -1
  141. package/dist/relaidoBidAdapter.js +1 -1
  142. package/dist/retailspotBidAdapter.js +1 -1
  143. package/dist/rhythmoneBidAdapter.js +1 -1
  144. package/dist/richaudienceBidAdapter.js +1 -0
  145. package/dist/ringieraxelspringerBidAdapter.js +1 -1
  146. package/dist/riseBidAdapter.js +1 -1
  147. package/dist/rubiconBidAdapter.js +1 -1
  148. package/dist/seedingAllianceBidAdapter.js +1 -1
  149. package/dist/seedtagBidAdapter.js +1 -1
  150. package/dist/setupadBidAdapter.js +1 -1
  151. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  152. package/dist/sharethroughBidAdapter.js +1 -1
  153. package/dist/shinezBidAdapter.js +1 -1
  154. package/dist/shinezRtbBidAdapter.js +1 -1
  155. package/dist/smaatoBidAdapter.js +1 -1
  156. package/dist/smartadserverBidAdapter.js +1 -1
  157. package/dist/smartxBidAdapter.js +1 -1
  158. package/dist/smartytechBidAdapter.js +1 -1
  159. package/dist/smilewantedBidAdapter.js +1 -1
  160. package/dist/sonobiBidAdapter.js +1 -1
  161. package/dist/sovrnBidAdapter.js +1 -1
  162. package/dist/sspBCBidAdapter.js +1 -1
  163. package/dist/stnBidAdapter.js +1 -1
  164. package/dist/stvBidAdapter.js +1 -1
  165. package/dist/sublimeBidAdapter.js +1 -1
  166. package/dist/taboolaBidAdapter.js +1 -1
  167. package/dist/tagorasBidAdapter.js +1 -1
  168. package/dist/targetVideoBidAdapter.js +1 -1
  169. package/dist/teadsBidAdapter.js +1 -1
  170. package/dist/teqblazeUtils.js +1 -0
  171. package/dist/themoneytizerBidAdapter.js +1 -1
  172. package/dist/topicsFpdModule.js +1 -1
  173. package/dist/trionBidAdapter.js +1 -1
  174. package/dist/tripleliftBidAdapter.js +1 -1
  175. package/dist/ttdBidAdapter.js +1 -1
  176. package/dist/twistDigitalBidAdapter.js +1 -1
  177. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  178. package/dist/uid2IdSystem.js +1 -1
  179. package/dist/underdogmediaBidAdapter.js +1 -1
  180. package/dist/undertoneBidAdapter.js +1 -1
  181. package/dist/unrulyBidAdapter.js +1 -1
  182. package/dist/vidazooBidAdapter.js +1 -1
  183. package/dist/videobyteBidAdapter.js +1 -1
  184. package/dist/visiblemeasuresBidAdapter.js +1 -1
  185. package/dist/visxBidAdapter.js +1 -1
  186. package/dist/vuukleBidAdapter.js +1 -1
  187. package/dist/widespaceBidAdapter.js +1 -1
  188. package/dist/winrBidAdapter.js +1 -1
  189. package/dist/yahooAdsBidAdapter.js +1 -1
  190. package/dist/yieldmoBidAdapter.js +1 -1
  191. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  192. package/dist/zeta_global_sspAnalyticsAdapter.js +1 -1
  193. package/integrationExamples/gpt/raynRtdProvider_example.html +1 -0
  194. package/libraries/adagioUtils/adagioUtils.js +35 -0
  195. package/libraries/appnexusUtils/anUtils.js +1 -0
  196. package/libraries/autoplayDetection/autoplay.js +8 -1
  197. package/libraries/ortbConverter/converter.js +1 -1
  198. package/libraries/teqblazeUtils/bidderUtils.js +253 -0
  199. package/modules/.submodules.json +1 -0
  200. package/modules/acuityadsBidAdapter.js +5 -203
  201. package/modules/adagioBidAdapter.js +1 -17
  202. package/modules/adagioRtdProvider.js +41 -51
  203. package/modules/adagioRtdProvider.md +1 -0
  204. package/modules/admanBidAdapter.js +31 -188
  205. package/modules/adprimeBidAdapter.js +28 -165
  206. package/modules/axisBidAdapter.js +33 -165
  207. package/modules/beyondmediaBidAdapter.js +5 -189
  208. package/modules/bliinkBidAdapter.js +3 -31
  209. package/modules/boldwinBidAdapter.js +21 -159
  210. package/modules/ceeIdSystem.js +1 -1
  211. package/modules/compassBidAdapter.js +5 -198
  212. package/modules/contentexchangeBidAdapter.js +5 -200
  213. package/modules/conversantBidAdapter.js +1 -0
  214. package/modules/dailymotionBidAdapter.js +1 -1
  215. package/modules/e_volutionBidAdapter.js +4 -186
  216. package/modules/emtvBidAdapter.js +5 -198
  217. package/modules/globalsunBidAdapter.js +5 -199
  218. package/modules/id5IdSystem.js +31 -2
  219. package/modules/id5IdSystem.md +67 -2
  220. package/modules/iqzoneBidAdapter.js +5 -224
  221. package/modules/kiviadsBidAdapter.js +5 -199
  222. package/modules/krushmediaBidAdapter.js +25 -143
  223. package/modules/loyalBidAdapter.js +4 -178
  224. package/modules/lunamediahbBidAdapter.js +5 -118
  225. package/modules/mathildeadsBidAdapter.js +5 -198
  226. package/modules/mgidXBidAdapter.js +14 -209
  227. package/modules/mobfoxpbBidAdapter.js +4 -135
  228. package/modules/mobianRtdProvider.js +52 -0
  229. package/modules/mobianRtdProvider.md +11 -0
  230. package/modules/nobidAnalyticsAdapter.js +2 -3
  231. package/modules/novatiqIdSystem.md +2 -3
  232. package/modules/ozoneBidAdapter.js +117 -58
  233. package/modules/paapi.js +2 -1
  234. package/modules/pgamsspBidAdapter.js +5 -240
  235. package/modules/playdigoBidAdapter.js +4 -186
  236. package/modules/prebidServerBidAdapter/index.js +9 -2
  237. package/modules/pubCircleBidAdapter.js +5 -218
  238. package/modules/pubmaticAnalyticsAdapter.js +21 -8
  239. package/modules/pubxaiAnalyticsAdapter.js +1 -5
  240. package/modules/qtBidAdapter.js +5 -224
  241. package/modules/raynRtdProvider.js +36 -3
  242. package/modules/richaudienceBidAdapter.js +375 -0
  243. package/modules/richaudienceBidAdapter.md +1 -1
  244. package/modules/seedtagBidAdapter.js +1 -0
  245. package/modules/setupadBidAdapter.js +76 -153
  246. package/modules/setupadBidAdapter.md +1 -1
  247. package/modules/smaatoBidAdapter.js +17 -6
  248. package/modules/smartytechBidAdapter.js +7 -2
  249. package/modules/topicsFpdModule.js +1 -1
  250. package/modules/uid2IdSystem.js +0 -1
  251. package/modules/uid2IdSystem_shared.js +0 -1
  252. package/modules/visiblemeasuresBidAdapter.js +5 -199
  253. package/modules/zeta_global_sspAnalyticsAdapter.js +8 -4
  254. package/package.json +1 -1
  255. package/src/auction.js +5 -63
  256. package/src/utils/focusTimeout.js +41 -0
  257. package/src/utils/ttlCollection.js +2 -1
  258. package/src/utils.js +42 -0
  259. package/src/videoCache.js +72 -0
  260. package/test/mocks/videoCacheStub.js +1 -1
  261. package/test/spec/auctionmanager_spec.js +16 -1
  262. package/test/spec/libraries/teqblazeUtils/bidderUtils_spec.js +519 -0
  263. package/test/spec/modules/acuityadsBidAdapter_spec.js +79 -43
  264. package/test/spec/modules/adagioRtdProvider_spec.js +62 -1
  265. package/test/spec/modules/admanBidAdapter_spec.js +370 -247
  266. package/test/spec/modules/adprimeBidAdapter_spec.js +225 -78
  267. package/test/spec/modules/axisBidAdapter_spec.js +78 -14
  268. package/test/spec/modules/beyondmediaBidAdapter_spec.js +80 -18
  269. package/test/spec/modules/bliinkBidAdapter_spec.js +8 -2
  270. package/test/spec/modules/boldwinBidAdapter_spec.js +221 -75
  271. package/test/spec/modules/compassBidAdapter_spec.js +130 -16
  272. package/test/spec/modules/contentexchangeBidAdapter_spec.js +134 -21
  273. package/test/spec/modules/conversantBidAdapter_spec.js +7 -0
  274. package/test/spec/modules/dailymotionBidAdapter_spec.js +3 -3
  275. package/test/spec/modules/e_volutionBidAdapter_spec.js +65 -3
  276. package/test/spec/modules/emtvBidAdapter_spec.js +131 -16
  277. package/test/spec/modules/globalsunBidAdapter_spec.js +130 -16
  278. package/test/spec/modules/id5IdSystem_spec.js +79 -3
  279. package/test/spec/modules/iqzoneBidAdapter_spec.js +66 -12
  280. package/test/spec/modules/kiviadsBidAdapter_spec.js +131 -20
  281. package/test/spec/modules/krushmediaBidAdapter_spec.js +272 -90
  282. package/test/spec/modules/loyalBidAdapter_spec.js +114 -14
  283. package/test/spec/modules/lunamediahbBidAdapter_spec.js +221 -87
  284. package/test/spec/modules/mathildeadsBidAdapter_spec.js +87 -18
  285. package/test/spec/modules/mgidXBidAdapter_spec.js +11 -3
  286. package/test/spec/modules/mobfoxpbBidAdapter_spec.js +229 -91
  287. package/test/spec/modules/mobianRtdProvider_spec.js +107 -0
  288. package/test/spec/modules/ozoneBidAdapter_spec.js +192 -22
  289. package/test/spec/modules/paapi_spec.js +5 -5
  290. package/test/spec/modules/pgamsspBidAdapter_spec.js +83 -16
  291. package/test/spec/modules/playdigoBidAdapter_spec.js +38 -9
  292. package/test/spec/modules/prebidServerBidAdapter_spec.js +14 -0
  293. package/test/spec/modules/pubCircleBidAdapter_spec.js +82 -17
  294. package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +52 -5
  295. package/test/spec/modules/qtBidAdapter_spec.js +15 -3
  296. package/test/spec/modules/raynRtdProvider_spec.js +25 -0
  297. package/test/spec/modules/richaudienceBidAdapter_spec.js +1304 -0
  298. package/test/spec/modules/seedtagBidAdapter_spec.js +2 -0
  299. package/test/spec/modules/setupadBidAdapter_spec.js +139 -97
  300. package/test/spec/modules/smaatoBidAdapter_spec.js +27 -0
  301. package/test/spec/modules/smartytechBidAdapter_spec.js +5 -1
  302. package/test/spec/modules/topicsFpdModule_spec.js +43 -59
  303. package/test/spec/modules/visiblemeasuresBidAdapter_spec.js +130 -16
  304. package/test/spec/modules/zeta_global_sspAnalyticsAdapter_spec.js +4 -0
  305. package/test/spec/ortbConverter/converter_spec.js +7 -3
  306. package/test/spec/unit/utils/focusTimeout_spec.js +60 -0
  307. package/test/spec/videoCache_spec.js +56 -53
@@ -15,6 +15,8 @@ import {
15
15
  deepAccess,
16
16
  deepSetValue,
17
17
  generateUUID,
18
+ getDomLoadingDuration,
19
+ getSafeframeGeometry,
18
20
  getUniqueIdentifierStr,
19
21
  getWindowSelf,
20
22
  getWindowTop,
@@ -24,6 +26,7 @@ import {
24
26
  isStr,
25
27
  prefixLog
26
28
  } from '../src/utils.js';
29
+ import { _ADAGIO, getBestWindowForAdagio } from '../libraries/adagioUtils/adagioUtils.js';
27
30
  import { getGptSlotInfoForAdUnitCode } from '../libraries/gptUtils/gptUtils.js';
28
31
 
29
32
  /**
@@ -35,6 +38,11 @@ const ADAGIO_BIDDER_CODE = 'adagio';
35
38
  const GVLID = 617;
36
39
  const SCRIPT_URL = 'https://script.4dex.io/a/latest/adagio.js';
37
40
  const SESS_DURATION = 30 * 60 * 1000;
41
+ export const PLACEMENT_SOURCES = {
42
+ ORTB: 'ortb', // implicit default, not used atm.
43
+ ADUNITCODE: 'code',
44
+ GPID: 'gpid'
45
+ };
38
46
  export const storage = getStorageManager({ moduleType: MODULE_TYPE_RTD, moduleName: SUBMODULE_NAME });
39
47
 
40
48
  const { logError, logWarn } = prefixLog('AdagioRtdProvider:');
@@ -42,23 +50,6 @@ const { logError, logWarn } = prefixLog('AdagioRtdProvider:');
42
50
  // Guard to avoid storing the same bid data several times.
43
51
  const guard = new Set();
44
52
 
45
- /**
46
- * Returns the window.ADAGIO global object used to store Adagio data.
47
- * This object is created in window.top if possible, otherwise in window.self.
48
- */
49
- const _ADAGIO = (function() {
50
- const w = (canAccessWindowTop()) ? getWindowTop() : getWindowSelf();
51
-
52
- w.ADAGIO = w.ADAGIO || {};
53
- w.ADAGIO.pageviewId = w.ADAGIO.pageviewId || generateUUID();
54
- w.ADAGIO.adUnits = w.ADAGIO.adUnits || {};
55
- w.ADAGIO.pbjsAdUnits = w.ADAGIO.pbjsAdUnits || [];
56
- w.ADAGIO.queue = w.ADAGIO.queue || [];
57
- w.ADAGIO.windows = w.ADAGIO.windows || [];
58
-
59
- return w.ADAGIO;
60
- })();
61
-
62
53
  /**
63
54
  * Store the sampling data.
64
55
  * This data is used to determine if beacons should be sent to adagio.
@@ -131,12 +122,14 @@ const _FEATURES = (function() {
131
122
  features.data = {};
132
123
  },
133
124
  get: function() {
125
+ const w = getBestWindowForAdagio();
126
+
134
127
  if (!features.initialized) {
135
128
  features.data = {
136
129
  page_dimensions: getPageDimensions().toString(),
137
130
  viewport_dimensions: getViewPortDimensions().toString(),
138
131
  user_timestamp: getTimestampUTC().toString(),
139
- dom_loading: getDomLoadingDuration().toString(),
132
+ dom_loading: getDomLoadingDuration(w).toString(),
140
133
  };
141
134
  features.initialized = true;
142
135
  }
@@ -271,10 +264,12 @@ function onBidRequest(bidderRequest, config, _userConsent) {
271
264
  * @param {*} config
272
265
  */
273
266
  function onGetBidRequestData(bidReqConfig, callback, config) {
267
+ const configParams = deepAccess(config, 'params', {});
274
268
  const { site: ortb2Site } = bidReqConfig.ortb2Fragments.global;
275
269
  const features = _internal.getFeatures().get();
276
270
  const ext = {
277
271
  uid: generateUUID(),
272
+ pageviewId: _ADAGIO.pageviewId,
278
273
  features: { ...features },
279
274
  session: { ..._SESSION.get() }
280
275
  };
@@ -294,8 +289,26 @@ function onGetBidRequestData(bidReqConfig, callback, config) {
294
289
  const slotPosition = getSlotPosition(adUnit);
295
290
  deepSetValue(ortb2Imp, `ext.data.adg_rtd.adunit_position`, slotPosition);
296
291
 
297
- // We expect `pagetype` `category` are defined in FPD `ortb2.site.ext.data` object.
298
- // `placement` is expected in FPD `adUnits[].ortb2Imp.ext.data` object. (Please note that this `placement` is not related to the oRTB video property.)
292
+ // It is expected that the publisher set a `adUnits[].ortb2Imp.ext.data.placement` value.
293
+ // Btw, We allow fallback sources to programmatically set this value.
294
+ // The source is defined in the `config.params.placementSource` and the possible values are `code` or `gpid`.
295
+ // (Please note that this `placement` is not related to the oRTB video property.)
296
+ if (!deepAccess(ortb2Imp, 'ext.data.placement')) {
297
+ const { placementSource = '' } = configParams;
298
+
299
+ switch (placementSource.toLowerCase()) {
300
+ case PLACEMENT_SOURCES.ADUNITCODE:
301
+ deepSetValue(ortb2Imp, 'ext.data.placement', adUnit.code);
302
+ break;
303
+ case PLACEMENT_SOURCES.GPID:
304
+ deepSetValue(ortb2Imp, 'ext.data.placement', deepAccess(ortb2Imp, 'ext.gpid'));
305
+ break;
306
+ default:
307
+ logWarn('`ortb2Imp.ext.data.placement` is missing and `params.definePlacement` is not set in the config.');
308
+ }
309
+ }
310
+
311
+ // We expect that `pagetype`, `category`, `placement` are defined in FPD `ortb2.site.ext.data` and `adUnits[].ortb2Imp.ext.data` objects.
299
312
  // Btw, we have to ensure compatibility with publishers that use the "legacy" adagio params at the adUnit.params level.
300
313
  const adagioBid = adUnit.bids.find(bid => _internal.isAdagioBidder(bid.bidder));
301
314
  if (adagioBid) {
@@ -316,9 +329,6 @@ function onGetBidRequestData(bidReqConfig, callback, config) {
316
329
  if (adagioBid.params.placement) {
317
330
  deepSetValue(ortb2Imp, 'ext.data.placement', adagioBid.params.placement);
318
331
  mustWarnOrtb2Imp = true;
319
- } else {
320
- // If the placement is not defined, we fallback to the adUnit code.
321
- deepSetValue(ortb2Imp, 'ext.data.placement', adUnit.code);
322
332
  }
323
333
  }
324
334
 
@@ -428,16 +438,14 @@ function getSlotPosition(adUnit) {
428
438
  const position = { x: 0, y: 0 };
429
439
 
430
440
  if (isSafeFrameWindow()) {
431
- const ws = getWindowSelf();
432
-
433
- const sfGeom = (typeof ws.$sf.ext.geom === 'function') ? ws.$sf.ext.geom() : null;
441
+ const { self } = getSafeframeGeometry() || {};
434
442
 
435
- if (!sfGeom || !sfGeom.self) {
443
+ if (!self) {
436
444
  return '';
437
445
  }
438
446
 
439
- position.x = Math.round(sfGeom.self.t);
440
- position.y = Math.round(sfGeom.self.l);
447
+ position.x = Math.round(self.t);
448
+ position.y = Math.round(self.l);
441
449
  } else {
442
450
  try {
443
451
  // window.top based computing
@@ -513,16 +521,14 @@ function getViewPortDimensions() {
513
521
  const viewportDims = { w: 0, h: 0 };
514
522
 
515
523
  if (isSafeFrameWindow()) {
516
- const ws = getWindowSelf();
524
+ const { win } = getSafeframeGeometry() || {};
517
525
 
518
- const sfGeom = (typeof ws.$sf.ext.geom === 'function') ? ws.$sf.ext.geom() : null;
519
-
520
- if (!sfGeom || !sfGeom.win) {
526
+ if (!win) {
521
527
  return '';
522
528
  }
523
529
 
524
- viewportDims.w = Math.round(sfGeom.win.w);
525
- viewportDims.h = Math.round(sfGeom.win.h);
530
+ viewportDims.w = Math.round(win.w);
531
+ viewportDims.h = Math.round(win.h);
526
532
  } else {
527
533
  // window.top based computing
528
534
  const wt = getWindowTop();
@@ -538,22 +544,6 @@ function getTimestampUTC() {
538
544
  return Math.floor(new Date().getTime() / 1000) - new Date().getTimezoneOffset() * 60;
539
545
  }
540
546
 
541
- function getDomLoadingDuration() {
542
- const w = (canAccessWindowTop()) ? getWindowTop() : getWindowSelf();
543
- const performance = w.performance;
544
-
545
- let domLoadingDuration = -1;
546
-
547
- if (performance && performance.timing && performance.timing.navigationStart > 0) {
548
- const val = performance.timing.domLoading - performance.timing.navigationStart;
549
- if (val > 0) {
550
- domLoadingDuration = val;
551
- }
552
- }
553
-
554
- return domLoadingDuration;
555
- }
556
-
557
547
  /**
558
548
  * registerEventsForAdServers bind adagio listeners to ad-server events.
559
549
  * Theses events are used to track the viewability and attention.
@@ -30,6 +30,7 @@ pbjs.setConfig({
30
30
  params: {
31
31
  organizationId: '1000' // Required. Provided by Adagio
32
32
  site: 'my-site' // Required. Provided by Adagio
33
+ placementSource: 'ortb' // Optional. Where to find the "placement" value. Possible values: 'ortb'<default> | 'code' | 'gpid'
33
34
  }
34
35
  }]
35
36
  }
@@ -1,208 +1,51 @@
1
- import {registerBidder} from '../src/adapters/bidderFactory.js';
1
+ import { registerBidder } from '../src/adapters/bidderFactory.js';
2
2
  import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
3
- import { isFn, deepAccess, logMessage } from '../src/utils.js';
4
- import {config} from '../src/config.js';
5
- import { convertOrtbRequestToProprietaryNative } from '../src/native.js';
3
+ import { deepAccess } from '../src/utils.js';
4
+ import { config } from '../src/config.js';
5
+ import {
6
+ isBidRequestValid,
7
+ buildRequestsBase,
8
+ interpretResponse,
9
+ getUserSyncs,
10
+ buildPlacementProcessingFunction
11
+ } from '../libraries/teqblazeUtils/bidderUtils.js';
6
12
 
7
13
  const GVLID = 149;
8
14
  const BIDDER_CODE = 'adman';
9
15
  const AD_URL = 'https://pub.admanmedia.com/?c=o&m=multi';
10
- const URL_SYNC = 'https://sync.admanmedia.com';
16
+ const SYNC_URL = 'https://sync.admanmedia.com';
11
17
 
12
- function isBidResponseValid(bid) {
13
- if (!bid.requestId || !bid.cpm || !bid.creativeId ||
14
- !bid.ttl || !bid.currency) {
15
- return false;
16
- }
17
- switch (bid['mediaType']) {
18
- case BANNER:
19
- return Boolean(bid.width && bid.height && bid.ad);
20
- case VIDEO:
21
- return Boolean(bid.vastUrl);
22
- case NATIVE:
23
- return Boolean(bid.native && bid.native.title && bid.native.image && bid.native.impressionTrackers);
24
- default:
25
- return false;
26
- }
27
- }
18
+ const addCustomFieldsToPlacement = (bid, bidderRequest, placement) => {
19
+ placement.traffic = placement.adFormat;
28
20
 
29
- function getBidFloor(bid) {
30
- if (!isFn(bid.getFloor)) {
31
- return deepAccess(bid, 'params.bidfloor', 0);
21
+ if (placement.adFormat === VIDEO) {
22
+ placement.wPlayer = placement.playerSize?.[0]?.[0];
23
+ placement.hPlayer = placement.playerSize?.[0]?.[1];
32
24
  }
25
+ };
33
26
 
34
- try {
35
- const bidFloor = bid.getFloor({
36
- currency: 'USD',
37
- mediaType: '*',
38
- size: '*',
39
- });
40
- return bidFloor.floor;
41
- } catch (_) {
42
- return 0
43
- }
44
- }
27
+ const placementProcessingFunction = buildPlacementProcessingFunction({ addCustomFieldsToPlacement });
28
+
29
+ const buildRequests = (validBidRequests = [], bidderRequest = {}) => {
30
+ const request = buildRequestsBase({ adUrl: AD_URL, validBidRequests, bidderRequest, placementProcessingFunction });
31
+ const content = deepAccess(bidderRequest, 'ortb2.site.content', config.getAnyConfig('ortb2.site.content'));
45
32
 
46
- function getUserId(eids, id, source, uidExt) {
47
- if (id) {
48
- var uid = { id };
49
- if (uidExt) {
50
- uid.ext = uidExt;
51
- }
52
- eids.push({
53
- source,
54
- uids: [ uid ]
55
- });
33
+ if (content) {
34
+ request.data.content = content;
56
35
  }
57
- }
36
+
37
+ return request;
38
+ };
58
39
 
59
40
  export const spec = {
60
41
  code: BIDDER_CODE,
61
42
  gvlid: GVLID,
62
43
  supportedMediaTypes: [BANNER, VIDEO, NATIVE],
63
44
 
64
- isBidRequestValid: (bid) => {
65
- return Boolean(bid.bidId && bid.params && !isNaN(bid.params.placementId));
66
- },
67
-
68
- buildRequests: (validBidRequests = [], bidderRequest) => {
69
- // convert Native ORTB definition to old-style prebid native definition
70
- validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
71
- const content = deepAccess(bidderRequest, 'ortb2.site.content', config.getAnyConfig('ortb2.site.content'));
72
-
73
- let winTop = window;
74
- let location;
75
- // TODO: this odd try-catch block was copied in several adapters; it doesn't seem to be correct for cross-origin
76
- try {
77
- location = new URL(bidderRequest.refererInfo.page)
78
- winTop = window.top;
79
- } catch (e) {
80
- location = winTop.location;
81
- logMessage(e);
82
- };
83
- let placements = [];
84
- let request = {
85
- 'deviceWidth': winTop.screen.width,
86
- 'deviceHeight': winTop.screen.height,
87
- 'language': (navigator && navigator.language) ? navigator.language : '',
88
- 'secure': 1,
89
- 'host': location.host,
90
- 'page': location.pathname,
91
- 'placements': placements
92
- };
93
- request.language.indexOf('-') != -1 && (request.language = request.language.split('-')[0])
94
- if (bidderRequest) {
95
- if (bidderRequest.uspConsent) {
96
- request.ccpa = bidderRequest.uspConsent;
97
- }
98
- if (bidderRequest.gdprConsent) {
99
- request.gdpr = {
100
- consentString: bidderRequest.gdprConsent.consentString
101
- };
102
- }
103
- if (content) {
104
- request.content = content;
105
- }
106
- }
107
- const len = validBidRequests.length;
108
-
109
- for (let i = 0; i < len; i++) {
110
- const bid = validBidRequests[i];
111
- const { params, bidId, mediaTypes } = bid;
112
-
113
- const placement = {
114
- placementId: params.placementId,
115
- bidId,
116
- eids: [],
117
- bidFloor: getBidFloor(bid)
118
- }
119
-
120
- if (bid.transactionId) {
121
- placement.ext = placement.ext || {};
122
- placement.ext.tid = bid.transactionId;
123
- }
124
-
125
- if (bid.schain) {
126
- placement.schain = bid.schain;
127
- }
128
-
129
- if (bid.userId) {
130
- getUserId(placement.eids, bid.userId.uid2 && bid.userId.uid2.id, 'uidapi.com');
131
- getUserId(placement.eids, bid.userId.lotamePanoramaId, 'lotame.com');
132
- getUserId(placement.eids, bid.userId.idx, 'idx.lat');
133
- }
134
-
135
- if (mediaTypes?.[BANNER]) {
136
- placement.traffic = BANNER;
137
- placement.sizes = mediaTypes[BANNER].sizes;
138
- } else if (mediaTypes?.[VIDEO]) {
139
- placement.traffic = VIDEO;
140
- placement.playerSize = mediaTypes[VIDEO].playerSize;
141
- placement.minduration = mediaTypes[VIDEO].minduration;
142
- placement.maxduration = mediaTypes[VIDEO].maxduration;
143
- placement.mimes = mediaTypes[VIDEO].mimes;
144
- placement.protocols = mediaTypes[VIDEO].protocols;
145
- placement.startdelay = mediaTypes[VIDEO].startdelay;
146
- placement.placement = mediaTypes[VIDEO].placement;
147
- placement.plcmt = mediaTypes[VIDEO].plcmt;
148
- placement.skip = mediaTypes[VIDEO].skip;
149
- placement.skipafter = mediaTypes[VIDEO].skipafter;
150
- placement.minbitrate = mediaTypes[VIDEO].minbitrate;
151
- placement.maxbitrate = mediaTypes[VIDEO].maxbitrate;
152
- placement.delivery = mediaTypes[VIDEO].delivery;
153
- placement.playbackmethod = mediaTypes[VIDEO].playbackmethod;
154
- placement.api = mediaTypes[VIDEO].api;
155
- placement.linearity = mediaTypes[VIDEO].linearity;
156
- }
157
-
158
- placements.push(placement);
159
- }
160
-
161
- return {
162
- method: 'POST',
163
- url: AD_URL,
164
- data: request
165
- };
166
- },
167
-
168
- interpretResponse: (serverResponse) => {
169
- let response = [];
170
- serverResponse = serverResponse.body;
171
- for (let i = 0; i < serverResponse.length; i++) {
172
- let resItem = serverResponse[i];
173
- if (isBidResponseValid(resItem)) {
174
- const advertiserDomains = resItem.adomain && resItem.adomain.length ? resItem.adomain : [];
175
- resItem.meta = { ...resItem.meta, advertiserDomains };
176
-
177
- response.push(resItem);
178
- }
179
- }
180
- return response;
181
- },
182
-
183
- getUserSyncs: (syncOptions, serverResponses, gdprConsent, uspConsent) => {
184
- let syncType = syncOptions.iframeEnabled ? 'iframe' : 'image';
185
- let syncUrl = URL_SYNC + `/${syncType}?pbjs=1`;
186
- if (gdprConsent && gdprConsent.consentString) {
187
- if (typeof gdprConsent.gdprApplies === 'boolean') {
188
- syncUrl += `&gdpr=${Number(gdprConsent.gdprApplies)}&gdpr_consent=${gdprConsent.consentString}`;
189
- } else {
190
- syncUrl += `&gdpr=0&gdpr_consent=${gdprConsent.consentString}`;
191
- }
192
- }
193
- if (uspConsent && uspConsent.consentString) {
194
- syncUrl += `&ccpa_consent=${uspConsent.consentString}`;
195
- }
196
-
197
- const coppa = config.getConfig('coppa') ? 1 : 0;
198
- syncUrl += `&coppa=${coppa}`;
199
-
200
- return [{
201
- type: syncType,
202
- url: syncUrl
203
- }];
204
- }
205
-
45
+ isBidRequestValid: isBidRequestValid(['placementId']),
46
+ buildRequests,
47
+ interpretResponse,
48
+ getUserSyncs: getUserSyncs(SYNC_URL)
206
49
  };
207
50
 
208
51
  registerBidder(spec);
@@ -1,183 +1,46 @@
1
- import {registerBidder} from '../src/adapters/bidderFactory.js';
1
+ import { registerBidder } from '../src/adapters/bidderFactory.js';
2
2
  import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
3
- import { isFn, deepAccess, logMessage } from '../src/utils.js';
4
- import { config } from '../src/config.js';
5
- import { convertOrtbRequestToProprietaryNative } from '../src/native.js';
6
- import {getAllOrtbKeywords} from '../libraries/keywords/keywords.js';
3
+ import { getAllOrtbKeywords } from '../libraries/keywords/keywords.js';
4
+ import {
5
+ isBidRequestValid,
6
+ buildRequestsBase,
7
+ interpretResponse,
8
+ getUserSyncs,
9
+ buildPlacementProcessingFunction
10
+ } from '../libraries/teqblazeUtils/bidderUtils.js';
7
11
 
8
12
  const BIDDER_CODE = 'adprime';
9
13
  const AD_URL = 'https://delta.adprime.com/pbjs';
10
14
  const SYNC_URL = 'https://sync.adprime.com';
11
15
 
12
- function isBidResponseValid(bid) {
13
- if (!bid.requestId || !bid.cpm || !bid.creativeId ||
14
- !bid.ttl || !bid.currency || !bid.meta) {
15
- return false;
16
+ const addCustomFieldsToPlacement = (bid, bidderRequest, placement) => {
17
+ if (placement.adFormat === VIDEO) {
18
+ placement.wPlayer = placement.playerSize?.[0]?.[0];
19
+ placement.hPlayer = placement.playerSize?.[0]?.[1];
16
20
  }
17
- switch (bid.mediaType) {
18
- case BANNER:
19
- return Boolean(bid.width && bid.height && bid.ad);
20
- case VIDEO:
21
- return Boolean(bid.vastUrl);
22
- case NATIVE:
23
- return Boolean(bid.native && bid.native.title && bid.native.image && bid.native.impressionTrackers);
24
- default:
25
- return false;
21
+ if (bid.userId && bid.userId.idl_env) {
22
+ placement.identeties = {};
23
+ placement.identeties.identityLink = bid.userId.idl_env;
26
24
  }
27
- }
28
25
 
29
- function getBidFloor(bid) {
30
- if (!isFn(bid.getFloor)) {
31
- return deepAccess(bid, 'params.bidfloor', 0);
32
- }
26
+ placement.keywords = getAllOrtbKeywords(bidderRequest.ortb2, bid.params.keywords);
27
+ placement.audiences = bid.params.audiences || [];
28
+ };
33
29
 
34
- try {
35
- const bidFloor = bid.getFloor({
36
- currency: 'USD',
37
- mediaType: '*',
38
- size: '*',
39
- });
40
- return bidFloor.floor;
41
- } catch (_) {
42
- return 0
43
- }
44
- }
30
+ const placementProcessingFunction = buildPlacementProcessingFunction({ addCustomFieldsToPlacement });
31
+
32
+ const buildRequests = (validBidRequests = [], bidderRequest = {}) => {
33
+ return buildRequestsBase({ adUrl: AD_URL, validBidRequests, bidderRequest, placementProcessingFunction });
34
+ };
45
35
 
46
36
  export const spec = {
47
37
  code: BIDDER_CODE,
48
38
  supportedMediaTypes: [BANNER, VIDEO, NATIVE],
49
39
 
50
- isBidRequestValid: (bid) => {
51
- return Boolean(bid.bidId && bid.params && bid.params.placementId);
52
- },
53
-
54
- buildRequests: (validBidRequests = [], bidderRequest) => {
55
- // convert Native ORTB definition to old-style prebid native definition
56
- validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
57
-
58
- let winTop = window;
59
- let location;
60
- // TODO: this odd try-catch block was copied in several adapters; it doesn't seem to be correct for cross-origin
61
- try {
62
- location = new URL(bidderRequest.refererInfo.page)
63
- winTop = window.top;
64
- } catch (e) {
65
- location = winTop.location;
66
- logMessage(e);
67
- };
68
- let placements = [];
69
- let request = {
70
- deviceWidth: winTop.screen.width,
71
- deviceHeight: winTop.screen.height,
72
- language: (navigator && navigator.language) ? navigator.language.split('-')[0] : '',
73
- secure: 1,
74
- host: location.host,
75
- page: location.pathname,
76
- placements: placements
77
- };
78
- if (bidderRequest) {
79
- if (bidderRequest.uspConsent) {
80
- request.ccpa = bidderRequest.uspConsent;
81
- }
82
- if (bidderRequest.gdprConsent) {
83
- request.gdpr = bidderRequest.gdprConsent
84
- }
85
- }
86
- const len = validBidRequests.length;
87
-
88
- for (let i = 0; i < len; i++) {
89
- let bid = validBidRequests[i];
90
- const { mediaTypes } = bid;
91
- const placement = {};
92
- let sizes
93
- let identeties = {}
94
- if (mediaTypes) {
95
- if (mediaTypes[BANNER] && mediaTypes[BANNER].sizes) {
96
- placement.adFormat = BANNER;
97
- sizes = mediaTypes[BANNER].sizes
98
- } else if (mediaTypes[VIDEO] && mediaTypes[VIDEO].playerSize) {
99
- placement.adFormat = VIDEO;
100
- sizes = mediaTypes[VIDEO].playerSize
101
- placement.minduration = mediaTypes[VIDEO].minduration;
102
- placement.maxduration = mediaTypes[VIDEO].maxduration;
103
- placement.mimes = mediaTypes[VIDEO].mimes;
104
- placement.protocols = mediaTypes[VIDEO].protocols;
105
- placement.startdelay = mediaTypes[VIDEO].startdelay;
106
- placement.placement = mediaTypes[VIDEO].placement;
107
- placement.skip = mediaTypes[VIDEO].skip;
108
- placement.skipafter = mediaTypes[VIDEO].skipafter;
109
- placement.minbitrate = mediaTypes[VIDEO].minbitrate;
110
- placement.maxbitrate = mediaTypes[VIDEO].maxbitrate;
111
- placement.delivery = mediaTypes[VIDEO].delivery;
112
- placement.playbackmethod = mediaTypes[VIDEO].playbackmethod;
113
- placement.api = mediaTypes[VIDEO].api;
114
- placement.linearity = mediaTypes[VIDEO].linearity;
115
- } else {
116
- placement.adFormat = NATIVE;
117
- placement.native = mediaTypes[NATIVE];
118
- }
119
- }
120
- if (bid.userId && bid.userId.idl_env) {
121
- identeties.identityLink = bid.userId.idl_env
122
- }
123
-
124
- placements.push({
125
- ...placement,
126
- placementId: bid.params.placementId,
127
- bidId: bid.bidId,
128
- sizes: sizes || [],
129
- wPlayer: sizes ? sizes[0] : 0,
130
- hPlayer: sizes ? sizes[1] : 0,
131
- schain: bid.schain || {},
132
- keywords: getAllOrtbKeywords(bidderRequest.ortb2, bid.params.keywords),
133
- audiences: bid.params.audiences || [],
134
- identeties,
135
- bidFloor: getBidFloor(bid)
136
- });
137
- }
138
- return {
139
- method: 'POST',
140
- url: AD_URL,
141
- data: request
142
- };
143
- },
144
-
145
- interpretResponse: (serverResponse) => {
146
- let response = [];
147
- for (let i = 0; i < serverResponse.body.length; i++) {
148
- let resItem = serverResponse.body[i];
149
- if (isBidResponseValid(resItem)) {
150
- const advertiserDomains = resItem.adomain && resItem.adomain.length ? resItem.adomain : [];
151
- resItem.meta = { ...resItem.meta, advertiserDomains };
152
-
153
- response.push(resItem);
154
- }
155
- }
156
- return response;
157
- },
158
-
159
- getUserSyncs: (syncOptions, serverResponses, gdprConsent, uspConsent) => {
160
- let syncType = syncOptions.iframeEnabled ? 'iframe' : 'image';
161
- let syncUrl = SYNC_URL + `/${syncType}?pbjs=1`;
162
- if (gdprConsent && gdprConsent.consentString) {
163
- if (typeof gdprConsent.gdprApplies === 'boolean') {
164
- syncUrl += `&gdpr=${Number(gdprConsent.gdprApplies)}&gdpr_consent=${gdprConsent.consentString}`;
165
- } else {
166
- syncUrl += `&gdpr=0&gdpr_consent=${gdprConsent.consentString}`;
167
- }
168
- }
169
- if (uspConsent && uspConsent.consentString) {
170
- syncUrl += `&ccpa_consent=${uspConsent.consentString}`;
171
- }
172
-
173
- const coppa = config.getConfig('coppa') ? 1 : 0;
174
- syncUrl += `&coppa=${coppa}`;
175
-
176
- return [{
177
- type: syncType,
178
- url: syncUrl
179
- }];
180
- }
40
+ isBidRequestValid: isBidRequestValid(['placementId']),
41
+ buildRequests,
42
+ interpretResponse,
43
+ getUserSyncs: getUserSyncs(SYNC_URL)
181
44
  };
182
45
 
183
46
  registerBidder(spec);