prebid.js 7.10.0 → 7.13.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 (366) hide show
  1. package/.github/PULL_REQUEST_TEMPLATE.md +16 -10
  2. package/.github/codeql/codeql-config.yml +4 -0
  3. package/.github/workflows/codeql-analysis.yml +73 -0
  4. package/.github/workflows/issue_tracker.yml +1 -1
  5. package/README.md +0 -2
  6. package/babelConfig.js +10 -4
  7. package/dist/33acrossBidAdapter.js +1 -1
  8. package/dist/acuityAdsBidAdapter.js +1 -0
  9. package/dist/adagioBidAdapter.js +1 -1
  10. package/dist/adbookpspBidAdapter.js +1 -1
  11. package/dist/adgenerationBidAdapter.js +1 -1
  12. package/dist/adkernelBidAdapter.js +1 -1
  13. package/dist/adrelevantisBidAdapter.js +1 -1
  14. package/dist/adriverBidAdapter.js +1 -1
  15. package/dist/adriverIdSystem.js +1 -1
  16. package/dist/adtelligentBidAdapter.js +1 -1
  17. package/dist/adtrgtmeBidAdapter.js +1 -0
  18. package/dist/adxcgBidAdapter.js +1 -1
  19. package/dist/adyoulikeBidAdapter.js +1 -1
  20. package/dist/ajaBidAdapter.js +1 -1
  21. package/dist/alkimiBidAdapter.js +1 -1
  22. package/dist/amxBidAdapter.js +1 -1
  23. package/dist/amxIdSystem.js +1 -1
  24. package/dist/aniviewBidAdapter.js +1 -1
  25. package/dist/aolBidAdapter.js +1 -1
  26. package/dist/appierAnalyticsAdapter.js +1 -1
  27. package/dist/appnexusBidAdapter.js +1 -1
  28. package/dist/asoBidAdapter.js +1 -1
  29. package/dist/audiencerunBidAdapter.js +1 -1
  30. package/dist/axonixBidAdapter.js +1 -1
  31. package/dist/beopBidAdapter.js +1 -1
  32. package/dist/betweenBidAdapter.js +1 -1
  33. package/dist/bidglassBidAdapter.js +1 -1
  34. package/dist/bidwatchAnalyticsAdapter.js +1 -1
  35. package/dist/big-richmediaBidAdapter.js +1 -1
  36. package/dist/bluebillywigBidAdapter.js +1 -1
  37. package/dist/brandmetricsRtdProvider.js +1 -1
  38. package/dist/bridgewellBidAdapter.js +1 -1
  39. package/dist/brightMountainMediaBidAdapter.js +1 -1
  40. package/dist/browsiRtdProvider.js +1 -1
  41. package/dist/cleanioRtdProvider.js +1 -1
  42. package/dist/concertBidAdapter.js +1 -1
  43. package/dist/connectadBidAdapter.js +1 -1
  44. package/dist/consentManagement.js +1 -1
  45. package/dist/consentManagementUsp.js +1 -1
  46. package/dist/consumableBidAdapter.js +1 -1
  47. package/dist/conversantBidAdapter.js +1 -1
  48. package/dist/cpmstarBidAdapter.js +1 -1
  49. package/dist/craftBidAdapter.js +1 -1
  50. package/dist/criteoBidAdapter.js +1 -1
  51. package/dist/currency.js +1 -1
  52. package/dist/datawrkzBidAdapter.js +1 -0
  53. package/dist/debugging-standalone.js +1 -1
  54. package/dist/dfpAdServerVideo.js +1 -1
  55. package/dist/dgkeywordRtdProvider.js +1 -1
  56. package/dist/displayioBidAdapter.js +1 -3
  57. package/dist/dspxBidAdapter.js +1 -1
  58. package/dist/enrichmentFpdModule.js +1 -1
  59. package/dist/eplanningBidAdapter.js +1 -1
  60. package/dist/finativeBidAdapter.js +1 -1
  61. package/dist/glimpseBidAdapter.js +1 -1
  62. package/dist/gmosspBidAdapter.js +1 -1
  63. package/dist/goldbachBidAdapter.js +1 -1
  64. package/dist/gridBidAdapter.js +1 -1
  65. package/dist/gridNMBidAdapter.js +1 -1
  66. package/dist/gumgumBidAdapter.js +1 -1
  67. package/dist/h12mediaBidAdapter.js +1 -1
  68. package/dist/id5IdSystem.js +1 -1
  69. package/dist/imRtdProvider.js +1 -1
  70. package/dist/impactifyBidAdapter.js +1 -1
  71. package/dist/improvedigitalBidAdapter.js +1 -1
  72. package/dist/inmarBidAdapter.js +1 -1
  73. package/dist/insticatorBidAdapter.js +1 -1
  74. package/dist/ixBidAdapter.js +1 -1
  75. package/dist/jixieBidAdapter.js +1 -1
  76. package/dist/justpremiumBidAdapter.js +1 -1
  77. package/dist/kargoBidAdapter.js +1 -1
  78. package/dist/konduitAnalyticsAdapter.js +1 -1
  79. package/dist/kueezBidAdapter.js +1 -1
  80. package/dist/lassoBidAdapter.js +1 -1
  81. package/dist/lifestreetBidAdapter.js +1 -0
  82. package/dist/limelightDigitalBidAdapter.js +1 -1
  83. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  84. package/dist/logicadBidAdapter.js +1 -1
  85. package/dist/loglyliftBidAdapter.js +1 -1
  86. package/dist/mabidderBidAdapter.js +1 -0
  87. package/dist/malltvAnalyticsAdapter.js +1 -1
  88. package/dist/marsmediaBidAdapter.js +1 -1
  89. package/dist/mediafuseBidAdapter.js +1 -1
  90. package/dist/mediagoBidAdapter.js +1 -0
  91. package/dist/mediakeysBidAdapter.js +1 -1
  92. package/dist/mediasquareBidAdapter.js +1 -1
  93. package/dist/mgidBidAdapter.js +1 -1
  94. package/dist/minutemediaBidAdapter.js +1 -1
  95. package/dist/nextMillenniumBidAdapter.js +1 -1
  96. package/dist/not-for-prod/prebid.js +153 -147
  97. package/dist/oguryBidAdapter.js +1 -1
  98. package/dist/oneKeyIdSystem.js +1 -0
  99. package/dist/oneKeyRtdProvider.js +1 -0
  100. package/dist/onetagBidAdapter.js +1 -1
  101. package/dist/ooloAnalyticsAdapter.js +1 -1
  102. package/dist/openxAnalyticsAdapter.js +1 -1
  103. package/dist/outbrainBidAdapter.js +1 -1
  104. package/dist/parrableIdSystem.js +1 -1
  105. package/dist/permutiveRtdProvider.js +1 -1
  106. package/dist/pixfutureBidAdapter.js +1 -1
  107. package/dist/prebid-core.js +2 -2
  108. package/dist/publinkIdSystem.js +1 -1
  109. package/dist/pubmaticAnalyticsAdapter.js +1 -1
  110. package/dist/pubmaticBidAdapter.js +1 -1
  111. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  112. package/dist/pxyzBidAdapter.js +1 -1
  113. package/dist/quantcastBidAdapter.js +1 -1
  114. package/dist/rasBidAdapter.js +1 -1
  115. package/dist/readpeakBidAdapter.js +1 -1
  116. package/dist/relaidoBidAdapter.js +1 -1
  117. package/dist/rhythmoneBidAdapter.js +1 -1
  118. package/dist/riseBidAdapter.js +1 -1
  119. package/dist/rtbhouseBidAdapter.js +1 -1
  120. package/dist/rubiconAnalyticsAdapter.js +1 -1
  121. package/dist/rubiconBidAdapter.js +1 -1
  122. package/dist/seedingAllianceBidAdapter.js +1 -1
  123. package/dist/seedtagBidAdapter.js +1 -1
  124. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  125. package/dist/sharethroughBidAdapter.js +1 -1
  126. package/dist/shinezBidAdapter.js +1 -1
  127. package/dist/smaatoBidAdapter.js +1 -1
  128. package/dist/smartadserverBidAdapter.js +1 -1
  129. package/dist/smartxBidAdapter.js +1 -1
  130. package/dist/smilewantedBidAdapter.js +1 -1
  131. package/dist/sonobiBidAdapter.js +1 -1
  132. package/dist/sovrnAnalyticsAdapter.js +1 -1
  133. package/dist/sovrnBidAdapter.js +1 -1
  134. package/dist/sspBCBidAdapter.js +1 -1
  135. package/dist/sublimeBidAdapter.js +1 -1
  136. package/dist/synacormediaBidAdapter.js +1 -1
  137. package/dist/tappxBidAdapter.js +1 -1
  138. package/dist/targetVideoBidAdapter.js +1 -1
  139. package/dist/teadsBidAdapter.js +1 -1
  140. package/dist/trionBidAdapter.js +1 -1
  141. package/dist/tripleliftBidAdapter.js +1 -1
  142. package/dist/trustpidSystem.js +1 -1
  143. package/dist/ttdBidAdapter.js +1 -1
  144. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  145. package/dist/underdogmediaBidAdapter.js +1 -1
  146. package/dist/undertoneBidAdapter.js +1 -1
  147. package/dist/userId.js +1 -1
  148. package/dist/vidazooBidAdapter.js +1 -1
  149. package/dist/videobyteBidAdapter.js +1 -1
  150. package/dist/viewability.js +1 -1
  151. package/dist/visxBidAdapter.js +1 -1
  152. package/dist/vuukleBidAdapter.js +1 -1
  153. package/dist/widespaceBidAdapter.js +1 -1
  154. package/dist/winrBidAdapter.js +1 -1
  155. package/dist/yahoosspBidAdapter.js +1 -1
  156. package/dist/yieldmoBidAdapter.js +1 -1
  157. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  158. package/dist/zeta_global_sspBidAdapter.js +1 -1
  159. package/integrationExamples/gpt/permutiveRtdProvider_example.html +1 -1
  160. package/karma.conf.maker.js +2 -13
  161. package/modules/.submodules.json +2 -0
  162. package/modules/acuityAdsBidAdapter.js +207 -0
  163. package/modules/acuityAdsBidAdapter.md +79 -0
  164. package/modules/adagioBidAdapter.js +2 -3
  165. package/modules/adgenerationBidAdapter.js +2 -2
  166. package/modules/adkernelBidAdapter.js +28 -12
  167. package/modules/admixerBidAdapter.js +1 -1
  168. package/modules/adnowBidAdapter.js +1 -1
  169. package/modules/adpod.js +1 -1
  170. package/modules/adrelevantisBidAdapter.js +2 -2
  171. package/modules/adriverBidAdapter.js +5 -12
  172. package/modules/adriverIdSystem.js +2 -1
  173. package/modules/adtargetBidAdapter.js +1 -1
  174. package/modules/adtelligentBidAdapter.js +6 -2
  175. package/modules/adtrgtmeBidAdapter.js +333 -0
  176. package/modules/adtrgtmeBidAdapter.md +69 -0
  177. package/modules/adtrueBidAdapter.js +1 -1
  178. package/modules/adxpremiumAnalyticsAdapter.js +1 -1
  179. package/modules/adyoulikeBidAdapter.js +1 -1
  180. package/modules/alkimiBidAdapter.js +2 -1
  181. package/modules/aniviewBidAdapter.js +1 -1
  182. package/modules/appnexusBidAdapter.js +13 -93
  183. package/modules/apstreamBidAdapter.js +2 -2
  184. package/modules/beopBidAdapter.js +4 -4
  185. package/modules/betweenBidAdapter.js +4 -4
  186. package/modules/bidwatchAnalyticsAdapter.js +112 -59
  187. package/modules/bizzclickBidAdapter.js +1 -1
  188. package/modules/brightMountainMediaBidAdapter.js +1 -1
  189. package/modules/browsiRtdProvider.js +24 -10
  190. package/modules/cleanmedianetBidAdapter.js +1 -1
  191. package/modules/consentManagement.js +1 -1
  192. package/modules/consentManagementUsp.js +1 -1
  193. package/modules/consumableBidAdapter.js +43 -3
  194. package/modules/cpmstarBidAdapter.js +23 -13
  195. package/modules/criteoBidAdapter.js +19 -13
  196. package/modules/currency.js +1 -0
  197. package/modules/cwireBidAdapter.js +1 -1
  198. package/modules/datablocksBidAdapter.js +1 -1
  199. package/modules/datawrkzBidAdapter.js +633 -0
  200. package/modules/datawrkzBidAdapter.md +160 -0
  201. package/modules/dfpAdServerVideo.js +2 -2
  202. package/modules/dgkeywordRtdProvider.js +10 -1
  203. package/modules/displayioBidAdapter.js +92 -97
  204. package/modules/dspxBidAdapter.js +1 -1
  205. package/modules/e_volutionBidAdapter.js +3 -3
  206. package/modules/ebdrBidAdapter.js +1 -1
  207. package/modules/emx_digitalBidAdapter.js +1 -1
  208. package/modules/enrichmentFpdModule.js +11 -0
  209. package/modules/fabrickIdSystem.js +2 -2
  210. package/modules/gamoshiBidAdapter.js +1 -1
  211. package/modules/getintentBidAdapter.js +1 -1
  212. package/modules/gjirafaBidAdapter.js +2 -2
  213. package/modules/goldbachBidAdapter.js +8 -8
  214. package/modules/gothamadsBidAdapter.js +2 -2
  215. package/modules/gumgumBidAdapter.js +3 -3
  216. package/modules/h12mediaBidAdapter.js +1 -1
  217. package/modules/id5AnalyticsAdapter.js +1 -1
  218. package/modules/id5IdSystem.js +160 -111
  219. package/modules/id5IdSystem.md +16 -14
  220. package/modules/imRtdProvider.js +20 -7
  221. package/modules/imRtdProvider.md +3 -1
  222. package/modules/impactifyBidAdapter.js +1 -1
  223. package/modules/improvedigitalBidAdapter.js +50 -28
  224. package/modules/inskinBidAdapter.js +1 -1
  225. package/modules/insticatorBidAdapter.js +1 -1
  226. package/modules/integr8BidAdapter.js +2 -2
  227. package/modules/intentIqIdSystem.js +2 -2
  228. package/modules/interactiveOffersBidAdapter.js +1 -1
  229. package/modules/iqmBidAdapter.js +1 -1
  230. package/modules/ixBidAdapter.js +21 -328
  231. package/modules/ixBidAdapter.md +1 -19
  232. package/modules/kargoBidAdapter.js +4 -5
  233. package/modules/krushmediaBidAdapter.js +2 -2
  234. package/modules/lassoBidAdapter.js +3 -3
  235. package/modules/lifestreetBidAdapter.js +143 -0
  236. package/modules/limelightDigitalBidAdapter.js +2 -1
  237. package/modules/livewrappedAnalyticsAdapter.js +3 -3
  238. package/modules/lkqdBidAdapter.js +3 -3
  239. package/modules/loganBidAdapter.js +2 -2
  240. package/modules/luponmediaBidAdapter.js +3 -3
  241. package/modules/mabidderBidAdapter.js +60 -0
  242. package/modules/mabidderBidAdapter.md +31 -0
  243. package/modules/malltvBidAdapter.js +2 -2
  244. package/modules/mediagoBidAdapter.js +462 -0
  245. package/modules/mediagoBidAdapter.md +34 -0
  246. package/modules/mediakeysBidAdapter.js +2 -2
  247. package/modules/mgidBidAdapter.js +2 -2
  248. package/modules/nextMillenniumBidAdapter.js +25 -6
  249. package/modules/nobidBidAdapter.js +2 -2
  250. package/modules/novatiqIdSystem.js +1 -1
  251. package/modules/oneKeyIdSystem.js +78 -0
  252. package/modules/oneKeyIdSystem.md +109 -0
  253. package/modules/oneKeyRtdProvider.js +98 -0
  254. package/modules/oneKeyRtdProvider.md +127 -0
  255. package/modules/open8BidAdapter.js +1 -1
  256. package/modules/openwebBidAdapter.js +1 -1
  257. package/modules/openxAnalyticsAdapter.js +5 -744
  258. package/modules/openxAnalyticsAdapter.md +4 -0
  259. package/modules/openxBidAdapter.js +3 -3
  260. package/modules/permutiveRtdProvider.js +55 -8
  261. package/modules/pixfutureBidAdapter.js +1 -1
  262. package/modules/prebidmanagerAnalyticsAdapter.js +1 -1
  263. package/modules/priceFloors.js +1 -1
  264. package/modules/pubmaticAnalyticsAdapter.js +1 -1
  265. package/modules/pubmaticBidAdapter.js +19 -1
  266. package/modules/pubwiseAnalyticsAdapter.js +1 -1
  267. package/modules/pubwiseBidAdapter.js +3 -3
  268. package/modules/pubxBidAdapter.js +1 -1
  269. package/modules/pubxaiAnalyticsAdapter.js +2 -2
  270. package/modules/quantcastIdSystem.js +1 -1
  271. package/modules/radsBidAdapter.js +1 -1
  272. package/modules/rasBidAdapter.js +8 -0
  273. package/modules/rasBidAdapter.md +14 -13
  274. package/modules/revcontentBidAdapter.js +1 -1
  275. package/modules/richaudienceBidAdapter.js +1 -1
  276. package/modules/rtbhouseBidAdapter.js +25 -1
  277. package/modules/schain.js +1 -1
  278. package/modules/seedtagBidAdapter.md +25 -56
  279. package/modules/showheroes-bsBidAdapter.js +1 -1
  280. package/modules/sizeMappingV2.js +1 -1
  281. package/modules/smaatoBidAdapter.js +2 -2
  282. package/modules/sonobiAnalyticsAdapter.js +1 -1
  283. package/modules/sonobiBidAdapter.js +4 -3
  284. package/modules/staqAnalyticsAdapter.js +1 -1
  285. package/modules/tappxBidAdapter.js +11 -2
  286. package/modules/targetVideoBidAdapter.js +1 -1
  287. package/modules/theAdxBidAdapter.js +2 -2
  288. package/modules/tpmnBidAdapter.js +1 -1
  289. package/modules/trionBidAdapter.js +2 -2
  290. package/modules/tripleliftBidAdapter.js +20 -1
  291. package/modules/trustpidSystem.js +6 -42
  292. package/modules/trustpidSystem.md +10 -10
  293. package/modules/underdogmediaBidAdapter.js +1 -1
  294. package/modules/userId/eids.js +26 -0
  295. package/modules/userId/userId.md +2 -2
  296. package/modules/vdoaiBidAdapter.js +1 -1
  297. package/modules/vidazooBidAdapter.js +7 -5
  298. package/modules/vidoomyBidAdapter.js +1 -1
  299. package/modules/viewability.js +14 -14
  300. package/modules/winrBidAdapter.js +1 -1
  301. package/modules/yahoosspBidAdapter.js +3 -3
  302. package/modules/yandexBidAdapter.js +1 -1
  303. package/modules/yieldmoBidAdapter.js +3 -3
  304. package/modules/yieldoneBidAdapter.js +2 -2
  305. package/modules/zeta_global_sspBidAdapter.js +24 -21
  306. package/package.json +3 -3
  307. package/src/Renderer.js +1 -1
  308. package/src/adloader.js +2 -1
  309. package/src/adserver.js +0 -56
  310. package/src/auction.js +60 -16
  311. package/src/bidfactory.js +1 -1
  312. package/src/native.js +75 -60
  313. package/src/refererDetection.js +12 -1
  314. package/src/sizeMapping.js +5 -7
  315. package/src/targeting.js +1 -1
  316. package/src/userSync.js +1 -1
  317. package/src/utils/promise.js +3 -1
  318. package/src/utils.js +27 -0
  319. package/src/video.js +5 -4
  320. package/src/videoCache.js +8 -2
  321. package/test/pages/instream.html +2 -2
  322. package/test/spec/modules/acuityAdsBidAdapter_spec.js +398 -0
  323. package/test/spec/modules/adagioBidAdapter_spec.js +2 -0
  324. package/test/spec/modules/adkernelBidAdapter_spec.js +11 -2
  325. package/test/spec/modules/adriverBidAdapter_spec.js +6 -13
  326. package/test/spec/modules/adriverIdSystem_spec.js +3 -8
  327. package/test/spec/modules/adtelligentBidAdapter_spec.js +2 -0
  328. package/test/spec/modules/adtrgtmeBidAdapter_spec.js +802 -0
  329. package/test/spec/modules/alkimiBidAdapter_spec.js +2 -1
  330. package/test/spec/modules/appnexusBidAdapter_spec.js +1 -0
  331. package/test/spec/modules/beopBidAdapter_spec.js +11 -0
  332. package/test/spec/modules/betweenBidAdapter_spec.js +17 -0
  333. package/test/spec/modules/bidwatchAnalyticsAdapter_spec.js +28 -12
  334. package/test/spec/modules/big-richmediaBidAdapter_spec.js +1 -0
  335. package/test/spec/modules/browsiRtdProvider_spec.js +40 -1
  336. package/test/spec/modules/consumableBidAdapter_spec.js +158 -0
  337. package/test/spec/modules/cpmstarBidAdapter_spec.js +1 -1
  338. package/test/spec/modules/criteoBidAdapter_spec.js +35 -26
  339. package/test/spec/modules/currency_spec.js +22 -0
  340. package/test/spec/modules/datawrkzBidAdapter_spec.js +656 -0
  341. package/test/spec/modules/dgkeywordRtdProvider_spec.js +1 -1
  342. package/test/spec/modules/displayioBidAdapter_spec.js +16 -52
  343. package/test/spec/modules/enrichmentFpdModule_spec.js +16 -1
  344. package/test/spec/modules/fpdModule_spec.js +2 -1
  345. package/test/spec/modules/id5IdSystem_spec.js +529 -172
  346. package/test/spec/modules/imRtdProvider_spec.js +10 -5
  347. package/test/spec/modules/improvedigitalBidAdapter_spec.js +9 -13
  348. package/test/spec/modules/ixBidAdapter_spec.js +216 -123
  349. package/test/spec/modules/kargoBidAdapter_spec.js +11 -2
  350. package/test/spec/modules/lifestreetBidAdapter_spec.js +232 -0
  351. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +59 -7
  352. package/test/spec/modules/mabidderBidAdapter_spec.js +125 -0
  353. package/test/spec/modules/mediagoBidAdapter_spec.js +97 -0
  354. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +2 -7
  355. package/test/spec/modules/oneKeyIdSystem_spec.js +107 -0
  356. package/test/spec/modules/oneKeyRtdProvider_spec.js +152 -0
  357. package/test/spec/modules/openxAnalyticsAdapter_spec.js +6 -638
  358. package/test/spec/modules/permutiveRtdProvider_spec.js +152 -2
  359. package/test/spec/modules/pubmaticBidAdapter_spec.js +69 -4
  360. package/test/spec/modules/rasBidAdapter_spec.js +2 -0
  361. package/test/spec/modules/tripleliftBidAdapter_spec.js +18 -0
  362. package/test/spec/modules/trustpidSystem_spec.js +27 -45
  363. package/test/spec/modules/vidazooBidAdapter_spec.js +36 -23
  364. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +59 -0
  365. package/test/spec/native_spec.js +257 -2
  366. package/test/spec/videoCache_spec.js +37 -7
@@ -321,7 +321,7 @@ function buildRequests(validBidRequests, bidderRequest) {
321
321
  data.to = to;
322
322
 
323
323
  // ADTS-169 add adUnitCode to requests
324
- if (adUnitCode) data.aun = adUnitCode
324
+ if (adUnitCode) data.aun = adUnitCode;
325
325
 
326
326
  // ADTS-134 Retrieve ID envelopes
327
327
  for (const eid in eids) data[eid] = eids[eid];
@@ -374,7 +374,7 @@ function buildRequests(validBidRequests, bidderRequest) {
374
374
  data.pi = 8;
375
375
  }
376
376
  } else { // legacy params
377
- data = { ...data, ...handleLegacyParams(params, sizes) }
377
+ data = { ...data, ...handleLegacyParams(params, sizes) };
378
378
  }
379
379
 
380
380
  if (gdprConsent) {
@@ -400,7 +400,7 @@ function buildRequests(validBidRequests, bidderRequest) {
400
400
  url: BID_ENDPOINT,
401
401
  method: 'GET',
402
402
  data: Object.assign(data, _getBrowserParams(topWindowUrl), _getDigiTrustQueryParams(userId))
403
- })
403
+ });
404
404
  });
405
405
  return bids;
406
406
  }
@@ -198,7 +198,7 @@ function getIsHidden(elem) {
198
198
  } catch (o) {
199
199
  return false;
200
200
  }
201
- } while ((m < 250) && (lastElem != null) && (elemHidden === false))
201
+ } while ((m < 250) && (lastElem != null) && (elemHidden === false));
202
202
  return elemHidden;
203
203
  }
204
204
 
@@ -141,7 +141,7 @@ const ENABLE_FUNCTION = (config) => {
141
141
  logInfo('id5Analytics: Tracking events', _this.eventsToTrack);
142
142
  if (sampling > 0 && _this.random() < (1 / sampling)) {
143
143
  // Init the module only if we got lucky
144
- logInfo('id5Analytics: Selected by sampling. Starting up!')
144
+ logInfo('id5Analytics: Selected by sampling. Starting up!');
145
145
 
146
146
  // Clean start
147
147
  _this.eventBuffer = {};
@@ -7,19 +7,19 @@
7
7
 
8
8
  import {
9
9
  deepAccess,
10
- logInfo,
11
10
  deepSetValue,
12
- logError,
13
11
  isEmpty,
14
12
  isEmptyStr,
13
+ logError,
14
+ logInfo,
15
15
  logWarn,
16
16
  safeJSONParse
17
17
  } from '../src/utils.js';
18
- import { ajax } from '../src/ajax.js';
19
- import { submodule } from '../src/hook.js';
20
- import { getRefererInfo } from '../src/refererDetection.js';
21
- import { getStorageManager } from '../src/storageManager.js';
22
- import { uspDataHandler } from '../src/adapterManager.js';
18
+ import {ajax} from '../src/ajax.js';
19
+ import {submodule} from '../src/hook.js';
20
+ import {getRefererInfo} from '../src/refererDetection.js';
21
+ import {getStorageManager} from '../src/storageManager.js';
22
+ import {uspDataHandler} from '../src/adapterManager.js';
23
23
 
24
24
  const MODULE_NAME = 'id5Id';
25
25
  const GVLID = 131;
@@ -28,10 +28,11 @@ export const ID5_STORAGE_NAME = 'id5id';
28
28
  export const ID5_PRIVACY_STORAGE_NAME = `${ID5_STORAGE_NAME}_privacy`;
29
29
  const LOCAL_STORAGE = 'html5';
30
30
  const LOG_PREFIX = 'User ID - ID5 submodule: ';
31
+ const ID5_API_CONFIG_URL = 'https://id5-sync.com/api/config/prebid';
31
32
 
32
33
  // order the legacy cookie names in reverse priority order so the last
33
34
  // cookie in the array is the most preferred to use
34
- const LEGACY_COOKIE_NAMES = [ 'pbjs-id5id', 'id5id.1st', 'id5id' ];
35
+ const LEGACY_COOKIE_NAMES = ['pbjs-id5id', 'id5id.1st', 'id5id'];
35
36
 
36
37
  export const storage = getStorageManager({gvlid: GVLID, moduleName: MODULE_NAME});
37
38
 
@@ -102,92 +103,27 @@ export const id5IdSubmodule = {
102
103
  /**
103
104
  * performs action to obtain id and return a value in the callback's response argument
104
105
  * @function getId
105
- * @param {SubmoduleConfig} config
106
+ * @param {SubmoduleConfig} submoduleConfig
106
107
  * @param {ConsentData} consentData
107
108
  * @param {(Object|undefined)} cacheIdObj
108
109
  * @returns {IdResponse|undefined}
109
110
  */
110
- getId(config, consentData, cacheIdObj) {
111
- if (!hasRequiredConfig(config)) {
111
+ getId(submoduleConfig, consentData, cacheIdObj) {
112
+ if (!hasRequiredConfig(submoduleConfig)) {
112
113
  return undefined;
113
114
  }
114
115
 
115
- const url = `https://id5-sync.com/g/v2/${config.params.partner}.json`;
116
- const hasGdpr = (consentData && typeof consentData.gdprApplies === 'boolean' && consentData.gdprApplies) ? 1 : 0;
117
- const usp = uspDataHandler.getConsentData();
118
- const referer = getRefererInfo();
119
- const signature = (cacheIdObj && cacheIdObj.signature) ? cacheIdObj.signature : getLegacyCookieSignature();
120
- const data = {
121
- 'partner': config.params.partner,
122
- 'gdpr': hasGdpr,
123
- 'nbPage': incrementNb(config.params.partner),
124
- 'o': 'pbjs',
125
- 'rf': referer.topmostLocation,
126
- 'top': referer.reachedTop ? 1 : 0,
127
- 'u': referer.stack[0] || window.location.href,
128
- 'v': '$prebid.version$'
129
- };
130
-
131
- // pass in optional data, but only if populated
132
- if (hasGdpr && typeof consentData.consentString !== 'undefined' && !isEmpty(consentData.consentString) && !isEmptyStr(consentData.consentString)) {
133
- data.gdpr_consent = consentData.consentString;
134
- }
135
- if (typeof usp !== 'undefined' && !isEmpty(usp) && !isEmptyStr(usp)) {
136
- data.us_privacy = usp;
137
- }
138
- if (typeof signature !== 'undefined' && !isEmptyStr(signature)) {
139
- data.s = signature;
140
- }
141
- if (typeof config.params.pd !== 'undefined' && !isEmptyStr(config.params.pd)) {
142
- data.pd = config.params.pd;
143
- }
144
- if (typeof config.params.provider !== 'undefined' && !isEmptyStr(config.params.provider)) {
145
- data.provider = config.params.provider;
146
- }
147
-
148
- const abTestingConfig = getAbTestingConfig(config);
149
- if (abTestingConfig.enabled === true) {
150
- data.ab_testing = {
151
- enabled: true,
152
- control_group_pct: abTestingConfig.controlGroupPct // The server validates
153
- };
154
- }
155
-
156
- const resp = function (callback) {
157
- const callbacks = {
158
- success: response => {
159
- let responseObj;
160
- if (response) {
161
- try {
162
- responseObj = JSON.parse(response);
163
- logInfo(LOG_PREFIX + 'response received from the server', responseObj);
164
-
165
- resetNb(config.params.partner);
166
-
167
- if (responseObj.privacy) {
168
- storeInLocalStorage(ID5_PRIVACY_STORAGE_NAME, JSON.stringify(responseObj.privacy), NB_EXP_DAYS);
169
- }
170
-
171
- // TODO: remove after requiring publishers to use localstorage and
172
- // all publishers have upgraded
173
- if (config.storage.type === LOCAL_STORAGE) {
174
- removeLegacyCookies(config.params.partner);
175
- }
176
- } catch (error) {
177
- logError(LOG_PREFIX + error);
178
- }
179
- }
180
- callback(responseObj);
181
- },
182
- error: error => {
116
+ const resp = function (cbFunction) {
117
+ new IdFetchFlow(submoduleConfig, consentData, cacheIdObj, uspDataHandler.getConsentData()).execute()
118
+ .then(response => {
119
+ cbFunction(response)
120
+ })
121
+ .catch(error => {
183
122
  logError(LOG_PREFIX + 'getId fetch encountered an error', error);
184
- callback();
185
- }
186
- };
187
- logInfo(LOG_PREFIX + 'requesting an ID from the server', data);
188
- ajax(url, callbacks, JSON.stringify(data), { method: 'POST', withCredentials: true });
123
+ cbFunction();
124
+ });
189
125
  };
190
- return { callback: resp };
126
+ return {callback: resp};
191
127
  },
192
128
 
193
129
  /**
@@ -212,6 +148,139 @@ export const id5IdSubmodule = {
212
148
  }
213
149
  };
214
150
 
151
+ class IdFetchFlow {
152
+ constructor(submoduleConfig, gdprConsentData, cacheIdObj, usPrivacyData) {
153
+ this.submoduleConfig = submoduleConfig
154
+ this.gdprConsentData = gdprConsentData
155
+ this.cacheIdObj = cacheIdObj
156
+ this.usPrivacyData = usPrivacyData
157
+ }
158
+
159
+ execute() {
160
+ return this.#callForConfig(this.submoduleConfig)
161
+ .then(fetchFlowConfig => {
162
+ return this.#callForExtensions(fetchFlowConfig.extensionsCall)
163
+ .then(extensionsData => {
164
+ return this.#callId5Fetch(fetchFlowConfig.fetchCall, extensionsData)
165
+ })
166
+ })
167
+ .then(fetchCallResponse => {
168
+ try {
169
+ resetNb(this.submoduleConfig.params.partner);
170
+ if (fetchCallResponse.privacy) {
171
+ storeInLocalStorage(ID5_PRIVACY_STORAGE_NAME, JSON.stringify(fetchCallResponse.privacy), NB_EXP_DAYS);
172
+ }
173
+ } catch (error) {
174
+ logError(LOG_PREFIX + error);
175
+ }
176
+ return fetchCallResponse;
177
+ })
178
+ }
179
+
180
+ #ajaxPromise(url, data, options) {
181
+ return new Promise((resolve, reject) => {
182
+ ajax(url,
183
+ {
184
+ success: function (res) {
185
+ resolve(res)
186
+ },
187
+ error: function (err) {
188
+ reject(err)
189
+ }
190
+ }, data, options)
191
+ })
192
+ }
193
+
194
+ // eslint-disable-next-line no-dupe-class-members
195
+ #callForConfig(submoduleConfig) {
196
+ let url = submoduleConfig.params.configUrl || ID5_API_CONFIG_URL; // override for debug/test purposes only
197
+ return this.#ajaxPromise(url, JSON.stringify(submoduleConfig), {method: 'POST'})
198
+ .then(response => {
199
+ let responseObj = JSON.parse(response);
200
+ logInfo(LOG_PREFIX + 'config response received from the server', responseObj);
201
+ return responseObj;
202
+ });
203
+ }
204
+
205
+ // eslint-disable-next-line no-dupe-class-members
206
+ #callForExtensions(extensionsCallConfig) {
207
+ if (extensionsCallConfig === undefined) {
208
+ return Promise.resolve(undefined)
209
+ }
210
+ let extensionsUrl = extensionsCallConfig.url
211
+ let method = extensionsCallConfig.method || 'GET'
212
+ let data = method === 'GET' ? undefined : JSON.stringify(extensionsCallConfig.body || {})
213
+ return this.#ajaxPromise(extensionsUrl, data, {'method': method})
214
+ .then(response => {
215
+ let responseObj = JSON.parse(response);
216
+ logInfo(LOG_PREFIX + 'extensions response received from the server', responseObj);
217
+ return responseObj;
218
+ })
219
+ }
220
+
221
+ // eslint-disable-next-line no-dupe-class-members
222
+ #callId5Fetch(fetchCallConfig, extensionsData) {
223
+ let url = fetchCallConfig.url;
224
+ let additionalData = fetchCallConfig.overrides || {};
225
+ let data = {
226
+ ...this.#createFetchRequestData(),
227
+ ...additionalData,
228
+ extensions: extensionsData
229
+ };
230
+ return this.#ajaxPromise(url, JSON.stringify(data), {method: 'POST', withCredentials: true})
231
+ .then(response => {
232
+ let responseObj = JSON.parse(response);
233
+ logInfo(LOG_PREFIX + 'fetch response received from the server', responseObj);
234
+ return responseObj;
235
+ });
236
+ }
237
+
238
+ // eslint-disable-next-line no-dupe-class-members
239
+ #createFetchRequestData() {
240
+ const params = this.submoduleConfig.params;
241
+ const hasGdpr = (this.gdprConsentData && typeof this.gdprConsentData.gdprApplies === 'boolean' && this.gdprConsentData.gdprApplies) ? 1 : 0;
242
+ const referer = getRefererInfo();
243
+ const signature = (this.cacheIdObj && this.cacheIdObj.signature) ? this.cacheIdObj.signature : getLegacyCookieSignature();
244
+ const nbPage = incrementNb(params.partner);
245
+ const data = {
246
+ 'partner': params.partner,
247
+ 'gdpr': hasGdpr,
248
+ 'nbPage': nbPage,
249
+ 'o': 'pbjs',
250
+ 'rf': referer.topmostLocation,
251
+ 'top': referer.reachedTop ? 1 : 0,
252
+ 'u': referer.stack[0] || window.location.href,
253
+ 'v': '$prebid.version$',
254
+ 'storage': this.submoduleConfig.storage
255
+ };
256
+
257
+ // pass in optional data, but only if populated
258
+ if (hasGdpr && this.gdprConsentData.consentString !== undefined && !isEmpty(this.gdprConsentData.consentString) && !isEmptyStr(this.gdprConsentData.consentString)) {
259
+ data.gdpr_consent = this.gdprConsentData.consentString;
260
+ }
261
+ if (this.usPrivacyData !== undefined && !isEmpty(this.usPrivacyData) && !isEmptyStr(this.usPrivacyData)) {
262
+ data.us_privacy = this.usPrivacyData;
263
+ }
264
+ if (signature !== undefined && !isEmptyStr(signature)) {
265
+ data.s = signature;
266
+ }
267
+ if (params.pd !== undefined && !isEmptyStr(params.pd)) {
268
+ data.pd = params.pd;
269
+ }
270
+ if (params.provider !== undefined && !isEmptyStr(params.provider)) {
271
+ data.provider = params.provider;
272
+ }
273
+ const abTestingConfig = params.abTesting || {enabled: false};
274
+
275
+ if (abTestingConfig.enabled) {
276
+ data.ab_testing = {
277
+ enabled: true, control_group_pct: abTestingConfig.controlGroupPct // The server validates
278
+ };
279
+ }
280
+ return data;
281
+ }
282
+ }
283
+
215
284
  function hasRequiredConfig(config) {
216
285
  if (!config || !config.params || !config.params.partner || typeof config.params.partner !== 'number') {
217
286
  logError(LOG_PREFIX + 'partner required to be defined as a number');
@@ -242,25 +311,29 @@ export function expDaysStr(expDays) {
242
311
  export function nbCacheName(partnerId) {
243
312
  return `${ID5_STORAGE_NAME}_${partnerId}_nb`;
244
313
  }
314
+
245
315
  export function storeNbInCache(partnerId, nb) {
246
316
  storeInLocalStorage(nbCacheName(partnerId), nb, NB_EXP_DAYS);
247
317
  }
318
+
248
319
  export function getNbFromCache(partnerId) {
249
320
  let cacheNb = getFromLocalStorage(nbCacheName(partnerId));
250
321
  return (cacheNb) ? parseInt(cacheNb) : 0;
251
322
  }
323
+
252
324
  function incrementNb(partnerId) {
253
325
  const nb = (getNbFromCache(partnerId) + 1);
254
326
  storeNbInCache(partnerId, nb);
255
327
  return nb;
256
328
  }
329
+
257
330
  function resetNb(partnerId) {
258
331
  storeNbInCache(partnerId, 0);
259
332
  }
260
333
 
261
334
  function getLegacyCookieSignature() {
262
335
  let legacyStoredValue;
263
- LEGACY_COOKIE_NAMES.forEach(function(cookie) {
336
+ LEGACY_COOKIE_NAMES.forEach(function (cookie) {
264
337
  if (storage.getCookie(cookie)) {
265
338
  legacyStoredValue = safeJSONParse(storage.getCookie(cookie)) || legacyStoredValue;
266
339
  }
@@ -268,21 +341,6 @@ function getLegacyCookieSignature() {
268
341
  return (legacyStoredValue && legacyStoredValue.signature) || '';
269
342
  }
270
343
 
271
- /**
272
- * Remove our legacy cookie values. Needed until we move all publishers
273
- * to html5 storage in a future release
274
- * @param {integer} partnerId
275
- */
276
- function removeLegacyCookies(partnerId) {
277
- logInfo(LOG_PREFIX + 'removing legacy cookies');
278
- LEGACY_COOKIE_NAMES.forEach(function(cookie) {
279
- storage.setCookie(`${cookie}`, ' ', expDaysStr(-1));
280
- storage.setCookie(`${cookie}_nb`, ' ', expDaysStr(-1));
281
- storage.setCookie(`${cookie}_${partnerId}_nb`, ' ', expDaysStr(-1));
282
- storage.setCookie(`${cookie}_last`, ' ', expDaysStr(-1));
283
- });
284
- }
285
-
286
344
  /**
287
345
  * This will make sure we check for expiration before accessing local storage
288
346
  * @param {string} key
@@ -303,6 +361,7 @@ export function getFromLocalStorage(key) {
303
361
  storage.removeDataFromLocalStorage(key);
304
362
  return null;
305
363
  }
364
+
306
365
  /**
307
366
  * Ensure that we always set an expiration in local storage since
308
367
  * by default it's not required
@@ -315,14 +374,4 @@ export function storeInLocalStorage(key, value, expDays) {
315
374
  storage.setDataInLocalStorage(`${key}`, value);
316
375
  }
317
376
 
318
- /**
319
- * gets the existing abTesting config or generates a default config with abTesting off
320
- *
321
- * @param {SubmoduleConfig|undefined} config
322
- * @returns {Object} an object which always contains at least the property "enabled"
323
- */
324
- function getAbTestingConfig(config) {
325
- return deepAccess(config, 'params.abTesting', { enabled: false });
326
- }
327
-
328
377
  submodule('userId', id5IdSubmodule);
@@ -29,7 +29,8 @@ pbjs.setConfig({
29
29
  abTesting: { // optional
30
30
  enabled: true, // false by default
31
31
  controlGroupPct: 0.1 // valid values are 0.0 - 1.0 (inclusive)
32
- }
32
+ },
33
+ disableExtensions: false // optional
33
34
  },
34
35
  storage: {
35
36
  type: 'html5', // "html5" is the required storage type
@@ -43,21 +44,22 @@ pbjs.setConfig({
43
44
  });
44
45
  ```
45
46
 
46
- | Param under userSync.userIds[] | Scope | Type | Description | Example |
47
+ | Param under userSync.userIds[] | Scope | Type | Description | Example |
47
48
  | --- | --- | --- | --- | --- |
48
- | name | Required | String | The name of this module: `"id5Id"` | `"id5Id"` |
49
- | params | Required | Object | Details for the ID5 ID. | |
50
- | params.partner | Required | Number | This is the ID5 Partner Number obtained from registering with ID5. | `173` |
51
- | params.pd | Optional | String | Partner-supplied data used for linking ID5 IDs across domains. See [our documentation](https://support.id5.io/portal/en/kb/articles/passing-partner-data-to-id5) for details on generating the string. Omit the parameter or leave as an empty string if no data to supply | `"MT1iNTBjY..."` |
52
- | params.provider | Optional | String | An identifier provided by ID5 to technology partners who manage Prebid setups on behalf of publishers. Reach out to [ID5](mailto:prebid@id5.io) if you have questions about this parameter | `pubmatic-identity-hub` |
53
- | params.abTesting | Optional | Object | Allows publishers to easily run an A/B Test. If enabled and the user is in the Control Group, the ID5 ID will NOT be exposed to bid adapters for that request | Disabled by default |
54
- | params.abTesting.enabled | Optional | Boolean | Set this to `true` to turn on this feature | `true` or `false` |
49
+ | name | Required | String | The name of this module: `"id5Id"` | `"id5Id"` |
50
+ | params | Required | Object | Details for the ID5 ID. | |
51
+ | params.partner | Required | Number | This is the ID5 Partner Number obtained from registering with ID5. | `173` |
52
+ | params.pd | Optional | String | Partner-supplied data used for linking ID5 IDs across domains. See [our documentation](https://support.id5.io/portal/en/kb/articles/passing-partner-data-to-id5) for details on generating the string. Omit the parameter or leave as an empty string if no data to supply | `"MT1iNTBjY..."` |
53
+ | params.provider | Optional | String | An identifier provided by ID5 to technology partners who manage Prebid setups on behalf of publishers. Reach out to [ID5](mailto:prebid@id5.io) if you have questions about this parameter | `pubmatic-identity-hub` |
54
+ | params.abTesting | Optional | Object | Allows publishers to easily run an A/B Test. If enabled and the user is in the Control Group, the ID5 ID will NOT be exposed to bid adapters for that request | Disabled by default |
55
+ | params.abTesting.enabled | Optional | Boolean | Set this to `true` to turn on this feature | `true` or `false` |
55
56
  | params.abTesting.controlGroupPct | Optional | Number | Must be a number between `0.0` and `1.0` (inclusive) and is used to determine the percentage of requests that fall into the control group (and thus not exposing the ID5 ID). For example, a value of `0.20` will result in 20% of requests without an ID5 ID and 80% with an ID. | `0.1` |
56
- | storage | Required | Object | Storage settings for how the User ID module will cache the ID5 ID locally | |
57
- | storage.type | Required | String | This is where the results of the user ID will be stored. ID5 **requires** `"html5"`. | `"html5"` |
58
- | storage.name | Required | String | The name of the local storage where the user ID will be stored. ID5 **requires** `"id5id"`. | `"id5id"` |
59
- | storage.expires | Optional | Integer | How long (in days) the user ID information will be stored. ID5 recommends `90`. | `90` |
60
- | storage.refreshInSeconds | Optional | Integer | How many seconds until the ID5 ID will be refreshed. ID5 strongly recommends 8 hours between refreshes | `8*3600` |
57
+ | params.disableExtensions | Optional | Boolean | Set this to `true` to force turn off extensions call. Default `false` | `true` or `false` |
58
+ | storage | Required | Object | Storage settings for how the User ID module will cache the ID5 ID locally | |
59
+ | storage.type | Required | String | This is where the results of the user ID will be stored. ID5 **requires** `"html5"`. | `"html5"` |
60
+ | storage.name | Required | String | The name of the local storage where the user ID will be stored. ID5 **requires** `"id5id"`. | `"id5id"` |
61
+ | storage.expires | Optional | Integer | How long (in days) the user ID information will be stored. ID5 recommends `90`. | `90` |
62
+ | storage.refreshInSeconds | Optional | Integer | How many seconds until the ID5 ID will be refreshed. ID5 strongly recommends 8 hours between refreshes | `8*3600` |
61
63
 
62
64
  **ATTENTION:** As of Prebid.js v4.14.0, ID5 requires `storage.type` to be `"html5"` and `storage.name` to be `"id5id"`. Using other values will display a warning today, but in an upcoming release, it will prevent the ID5 module from loading. This change is to ensure the ID5 module in Prebid.js interoperates properly with the [ID5 API](https://github.com/id5io/id5-api.js) and to reduce the size of publishers' first-party cookies that are sent to their web servers. If you have any questions, please reach out to us at [prebid@id5.io](mailto:prebid@id5.io).
63
65
 
@@ -37,28 +37,40 @@ function setImDataInCookie(value) {
37
37
  );
38
38
  }
39
39
 
40
+ /**
41
+ * @param {Object} segments
42
+ * @param {Object} moduleConfig
43
+ */
44
+ function getSegments(segments, moduleConfig) {
45
+ if (!segments) return;
46
+ const maxSegments = !Number.isNaN(moduleConfig.params.maxSegments) ? moduleConfig.params.maxSegments : 200;
47
+ return segments.slice(0, maxSegments);
48
+ }
49
+
40
50
  /**
41
51
  * @param {string} bidderName
42
52
  */
43
53
  export function getBidderFunction(bidderName) {
44
54
  const biddersFunction = {
45
- pubmatic: function (bid, data) {
55
+ pubmatic: function (bid, data, moduleConfig) {
46
56
  if (data.im_segments && data.im_segments.length) {
57
+ const segments = getSegments(data.im_segments, moduleConfig);
47
58
  const dctr = deepAccess(bid, 'params.dctr');
48
59
  deepSetValue(
49
60
  bid,
50
61
  'params.dctr',
51
- `${dctr ? dctr + '|' : ''}im_segments=${data.im_segments.join(',')}`
62
+ `${dctr ? dctr + '|' : ''}im_segments=${segments.join(',')}`
52
63
  );
53
64
  }
54
65
  return bid
55
66
  },
56
- fluct: function (bid, data) {
67
+ fluct: function (bid, data, moduleConfig) {
57
68
  if (data.im_segments && data.im_segments.length) {
69
+ const segments = getSegments(data.im_segments, moduleConfig);
58
70
  deepSetValue(
59
71
  bid,
60
72
  'params.kv.imsids',
61
- data.im_segments
73
+ segments
62
74
  );
63
75
  }
64
76
  return bid
@@ -88,14 +100,15 @@ export function setRealTimeData(bidConfig, moduleConfig, data) {
88
100
  const utils = {deepSetValue, deepAccess, logInfo, logError, mergeDeep};
89
101
 
90
102
  if (data.im_segments) {
103
+ const segments = getSegments(data.im_segments, moduleConfig);
91
104
  const ortb2 = bidConfig.ortb2Fragments?.global || {};
92
- deepSetValue(ortb2, 'user.ext.data.im_segments', data.im_segments);
105
+ deepSetValue(ortb2, 'user.ext.data.im_segments', segments);
93
106
 
94
107
  if (moduleConfig.params.setGptKeyValues || !moduleConfig.params.hasOwnProperty('setGptKeyValues')) {
95
108
  window.googletag = window.googletag || {cmd: []};
96
109
  window.googletag.cmd = window.googletag.cmd || [];
97
110
  window.googletag.cmd.push(() => {
98
- window.googletag.pubads().setTargeting('im_segments', data.im_segments);
111
+ window.googletag.pubads().setTargeting('im_segments', segments);
99
112
  });
100
113
  }
101
114
  }
@@ -107,7 +120,7 @@ export function setRealTimeData(bidConfig, moduleConfig, data) {
107
120
  if (overwriteFunction) {
108
121
  overwriteFunction(bid, data, utils, config);
109
122
  } else if (bidderFunction) {
110
- bidderFunction(bid, data);
123
+ bidderFunction(bid, data, moduleConfig);
111
124
  }
112
125
  })
113
126
  });
@@ -21,7 +21,8 @@ pbjs.setConfig(
21
21
  waitForIt: true,
22
22
  params: {
23
23
  cid: 5126, // Set your Intimate Merger Customer ID here for production
24
- setGptKeyValues: true
24
+ setGptKeyValues: true,
25
+ maxSegments: 200 // maximum number is 200
25
26
  }
26
27
  }
27
28
  ]
@@ -39,3 +40,4 @@ pbjs.setConfig(
39
40
  | params | Required | Object | Details of module params. | |
40
41
  | params.cid | Required | Number | This is the Customer ID value obtained via Intimate Merger. | `5126` |
41
42
  | params.setGptKeyValues | Optional | Boolean | This is set targeting for GPT/GAM. Default setting is true. | `true` |
43
+ | params.maxSegments | Optional | Number | This is set maximum number of rtd segments at once. Default setting is 200. | `200` |
@@ -25,7 +25,7 @@ const getDeviceType = () => {
25
25
  return 4;
26
26
  }
27
27
  return 2;
28
- }
28
+ };
29
29
 
30
30
  const createOpenRtbRequest = (validBidRequests, bidderRequest) => {
31
31
  // Create request and set imp bids inside
@@ -19,6 +19,7 @@ import {Renderer} from '../src/Renderer.js';
19
19
  import {createEidsArray} from './userId/eids.js';
20
20
  import {hasPurpose1Consent} from '../src/utils/gpdr.js';
21
21
  import { convertOrtbRequestToProprietaryNative } from '../src/native.js';
22
+ import {loadExternalScript} from '../src/adloader.js';
22
23
 
23
24
  const BIDDER_CODE = 'improvedigital';
24
25
  const CREATIVE_TTL = 300;
@@ -212,7 +213,7 @@ export const spec = {
212
213
 
213
214
  ID_RESPONSE.buildAd(bid, bidRequest, bidObject);
214
215
 
215
- ID_RAZR.addBidData({
216
+ ID_RAZR.forwardBid({
216
217
  bidRequest,
217
218
  bid
218
219
  });
@@ -640,37 +641,58 @@ const ID_OUTSTREAM = {
640
641
  };
641
642
 
642
643
  const ID_RAZR = {
643
- RENDERER_URL: 'https://razr.improvedigital.com/renderer.js',
644
- addBidData({bid, bidRequest}) {
645
- if (this.isValidBid(bid)) {
646
- bid.renderer = Renderer.install({
647
- url: this.RENDERER_URL,
648
- config: {bidRequest}
649
- });
650
- bid.renderer.setRender(this.render);
644
+ RENDERER_URL: 'https://cdn.360yield.com/razr/tag.js',
645
+
646
+ forwardBid({bidRequest, bid}) {
647
+ if (bid.mediaType !== BANNER) {
648
+ return;
651
649
  }
652
- },
653
650
 
654
- isValidBid(bid) {
655
- return bid && /razr:\/\//.test(bid.ad);
651
+ const cfg = {
652
+ prebid: {
653
+ bidRequest,
654
+ bid
655
+ }
656
+ };
657
+
658
+ const cfgStr = JSON.stringify(cfg).replace(/<\/script>/g, '\\x3C/script>');
659
+ const s = `<script>window.__razr_config = ${cfgStr};</script>`;
660
+ bid.ad = bid.ad.replace(/<body[^>]*>/, match => match + s);
661
+
662
+ this.installListener();
656
663
  },
657
664
 
658
- render(bid) {
659
- const {bidRequest} = bid.renderer.getConfig();
660
-
661
- const payload = {
662
- type: 'prebid',
663
- bidRequest,
664
- bid,
665
- config: mergeDeep(
666
- {},
667
- config.getConfig('improvedigital.rendererConfig'),
668
- deepAccess(bidRequest, 'params.rendererConfig')
669
- )
670
- };
665
+ installListener() {
666
+ if (this._listenerInstalled) {
667
+ return;
668
+ }
669
+
670
+ window.addEventListener('message', function(e) {
671
+ const data = e.data?.razr?.load;
672
+ if (!data) {
673
+ return;
674
+ }
675
+
676
+ if (e.source) {
677
+ data.source = e.source;
678
+ if (data.id) {
679
+ e.source.postMessage({
680
+ razr: {
681
+ id: data.id
682
+ }
683
+ }, '*');
684
+ }
685
+ }
686
+
687
+ const ns = window.razr = window.razr || {};
688
+ ns.q = ns.q || [];
689
+ ns.q.push(data);
690
+
691
+ if (!ns.loaded) {
692
+ loadExternalScript(ID_RAZR.RENDERER_URL, BIDDER_CODE);
693
+ }
694
+ });
671
695
 
672
- const razr = window.razr = window.razr || {};
673
- razr.queue = razr.queue || [];
674
- razr.queue.push(payload);
696
+ this._listenerInstalled = true;
675
697
  }
676
698
  };
@@ -184,7 +184,7 @@ export const spec = {
184
184
  bid.currency = 'USD';
185
185
  bid.creativeId = decision.adId;
186
186
  bid.ttl = 360;
187
- bid.meta = { advertiserDomains: decision.adomain ? decision.adomain : [] }
187
+ bid.meta = { advertiserDomains: decision.adomain ? decision.adomain : [] };
188
188
  bid.netRevenue = true;
189
189
 
190
190
  bidResponses.push(bid);