prebid.js 6.0.0 → 6.4.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 (201) hide show
  1. package/.babelrc.js +1 -7
  2. package/.circleci/config.yml +1 -1
  3. package/README.md +1 -1
  4. package/browsers.json +13 -29
  5. package/gulpfile.js +88 -82
  6. package/integrationExamples/gpt/weboramaRtdProvider_example.html +23 -14
  7. package/karma.conf.maker.js +2 -2
  8. package/modules/33acrossBidAdapter.js +189 -102
  9. package/modules/adagioBidAdapter.js +1 -1
  10. package/modules/addefendBidAdapter.js +1 -0
  11. package/modules/adheseBidAdapter.js +7 -2
  12. package/modules/adkernelBidAdapter.js +147 -61
  13. package/modules/adlivetechBidAdapter.md +61 -0
  14. package/modules/adlooxAdServerVideo.js +2 -2
  15. package/modules/adlooxAnalyticsAdapter.js +4 -4
  16. package/modules/admanBidAdapter.js +1 -0
  17. package/modules/admixerBidAdapter.js +3 -2
  18. package/modules/adnuntiusBidAdapter.js +5 -2
  19. package/modules/adomikAnalyticsAdapter.js +16 -4
  20. package/modules/adplusBidAdapter.js +203 -0
  21. package/modules/adplusBidAdapter.md +39 -0
  22. package/modules/adxcgBidAdapter.js +311 -359
  23. package/modules/adxcgBidAdapter.md +22 -21
  24. package/modules/adyoulikeBidAdapter.js +7 -2
  25. package/modules/aniviewBidAdapter.js +1 -1
  26. package/modules/appnexusBidAdapter.js +23 -3
  27. package/modules/beachfrontBidAdapter.js +14 -17
  28. package/modules/beopBidAdapter.js +6 -4
  29. package/modules/bidViewability.js +3 -3
  30. package/modules/bidViewabilityIO.js +3 -3
  31. package/modules/codefuelBidAdapter.js +1 -3
  32. package/modules/codefuelBidAdapter.md +3 -3
  33. package/modules/colossussspBidAdapter.js +7 -0
  34. package/modules/compassBidAdapter.js +201 -0
  35. package/modules/compassBidAdapter.md +79 -0
  36. package/modules/craftBidAdapter.js +5 -3
  37. package/modules/criteoBidAdapter.js +1 -1
  38. package/modules/currency.js +2 -2
  39. package/modules/cwireBidAdapter.js +3 -0
  40. package/modules/dailyhuntBidAdapter.js +435 -0
  41. package/modules/dailyhuntBidAdapter.md +4 -0
  42. package/modules/datablocksBidAdapter.js +3 -3
  43. package/modules/dchain.js +149 -0
  44. package/modules/dchain.md +45 -0
  45. package/modules/deepintentBidAdapter.js +1 -1
  46. package/modules/dspxBidAdapter.js +1 -1
  47. package/modules/emx_digitalBidAdapter.js +9 -1
  48. package/modules/engageyaBidAdapter.js +68 -54
  49. package/modules/feedadBidAdapter.js +2 -2
  50. package/modules/feedadBidAdapter.md +4 -2
  51. package/modules/freewheel-sspBidAdapter.js +6 -0
  52. package/modules/futureads.md +48 -0
  53. package/modules/glimpseBidAdapter.js +44 -16
  54. package/modules/goldbachBidAdapter.js +1176 -0
  55. package/modules/goldbachBidAdapter.md +151 -0
  56. package/modules/gptPreAuction.js +11 -5
  57. package/modules/gridBidAdapter.js +5 -4
  58. package/modules/gumgumBidAdapter.js +7 -3
  59. package/modules/id5IdSystem.md +6 -6
  60. package/modules/imRtdProvider.js +31 -0
  61. package/modules/improvedigitalBidAdapter.js +19 -3
  62. package/modules/instreamTracking.js +4 -4
  63. package/modules/intersectionRtdProvider.js +114 -0
  64. package/modules/invibesBidAdapter.js +64 -14
  65. package/modules/invibesBidAdapter.md +2 -1
  66. package/modules/ipromBidAdapter.js +79 -0
  67. package/modules/ixBidAdapter.js +185 -22
  68. package/modules/kinessoIdSystem.js +1 -1
  69. package/modules/limelightDigitalBidAdapter.js +2 -1
  70. package/modules/livewrappedBidAdapter.js +8 -2
  71. package/modules/lotamePanoramaIdSystem.js +80 -8
  72. package/modules/luponmediaBidAdapter.js +570 -0
  73. package/modules/mediasquareBidAdapter.js +1 -9
  74. package/modules/merkleIdSystem.js +5 -0
  75. package/modules/missenaBidAdapter.js +89 -0
  76. package/modules/nativoBidAdapter.js +27 -1
  77. package/modules/nextMillenniumBidAdapter.js +37 -7
  78. package/modules/oguryBidAdapter.js +2 -1
  79. package/modules/openxBidAdapter.js +6 -1
  80. package/modules/prebidServerBidAdapter/index.js +19 -15
  81. package/modules/pubgeniusBidAdapter.js +1 -1
  82. package/modules/pubmaticBidAdapter.js +5 -3
  83. package/modules/pubxaiAnalyticsAdapter.js +17 -0
  84. package/modules/relaidoBidAdapter.js +86 -65
  85. package/modules/richaudienceBidAdapter.js +2 -3
  86. package/modules/rtdModule/index.js +48 -18
  87. package/modules/rubiconBidAdapter.js +31 -19
  88. package/modules/saambaaBidAdapter.js +420 -0
  89. package/modules/saambaaBidAdapter.md +65 -68
  90. package/modules/seedtagBidAdapter.js +6 -0
  91. package/modules/sharedIdSystem.js +27 -1
  92. package/modules/smaatoBidAdapter.js +9 -1
  93. package/modules/smartxBidAdapter.js +17 -1
  94. package/modules/sspBCBidAdapter.js +34 -3
  95. package/modules/tappxBidAdapter.js +3 -1
  96. package/modules/targetVideoBidAdapter.js +187 -0
  97. package/modules/targetVideoBidAdapter.md +34 -0
  98. package/modules/telariaBidAdapter.js +2 -2
  99. package/modules/trustxBidAdapter.js +18 -17
  100. package/modules/undertoneBidAdapter.js +8 -1
  101. package/modules/userId/index.js +27 -2
  102. package/modules/ventes.md +71 -0
  103. package/modules/ventesBidAdapter.js +104 -64
  104. package/modules/ventesBidAdapter.md +0 -1
  105. package/modules/vidoomyBidAdapter.js +65 -108
  106. package/modules/visxBidAdapter.js +20 -3
  107. package/modules/visxBidAdapter.md +4 -6
  108. package/modules/weboramaRtdProvider.js +288 -73
  109. package/modules/weboramaRtdProvider.md +27 -10
  110. package/modules/yahoosspBidAdapter.js +5 -1
  111. package/modules/yahoosspBidAdapter.md +1 -1
  112. package/modules/yieldlabBidAdapter.js +41 -10
  113. package/modules/yieldlabBidAdapter.md +91 -48
  114. package/modules/yieldoneBidAdapter.js +115 -11
  115. package/modules/zetaSspBidAdapter.md +33 -1
  116. package/modules/zeta_global_sspBidAdapter.js +22 -1
  117. package/package.json +6 -1
  118. package/plugins/pbjsGlobals.js +28 -1
  119. package/src/adapterManager.js +14 -8
  120. package/src/auction.js +5 -4
  121. package/src/prebid.js +1 -2
  122. package/src/targeting.js +24 -3
  123. package/src/utils.js +41 -7
  124. package/test/helpers/prebidGlobal.js +1 -0
  125. package/test/spec/integration/faker/googletag.js +6 -0
  126. package/test/spec/modules/33acrossBidAdapter_spec.js +300 -78
  127. package/test/spec/modules/adheseBidAdapter_spec.js +27 -1
  128. package/test/spec/modules/adlooxAnalyticsAdapter_spec.js +6 -6
  129. package/test/spec/modules/adnuntiusBidAdapter_spec.js +35 -0
  130. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +9 -1
  131. package/test/spec/modules/adplusBidAdapter_spec.js +213 -0
  132. package/test/spec/modules/adxcgBidAdapter_spec.js +820 -571
  133. package/test/spec/modules/adyoulikeBidAdapter_spec.js +26 -0
  134. package/test/spec/modules/appnexusBidAdapter_spec.js +63 -1
  135. package/test/spec/modules/beachfrontBidAdapter_spec.js +65 -1
  136. package/test/spec/modules/beopBidAdapter_spec.js +1 -1
  137. package/test/spec/modules/bidViewabilityIO_spec.js +2 -2
  138. package/test/spec/modules/bidViewability_spec.js +4 -4
  139. package/test/spec/modules/codefuelBidAdapter_spec.js +1 -1
  140. package/test/spec/modules/colossussspBidAdapter_spec.js +9 -0
  141. package/test/spec/modules/compassBidAdapter_spec.js +397 -0
  142. package/test/spec/modules/cwireBidAdapter_spec.js +10 -8
  143. package/test/spec/modules/dailyhuntBidAdapter_spec.js +404 -0
  144. package/test/spec/modules/datablocksBidAdapter_spec.js +3 -3
  145. package/test/spec/modules/dchain_spec.js +329 -0
  146. package/test/spec/modules/emx_digitalBidAdapter_spec.js +10 -0
  147. package/test/spec/modules/engageyaBidAdapter_spec.js +231 -95
  148. package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
  149. package/test/spec/modules/feedadBidAdapter_spec.js +15 -0
  150. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +19 -0
  151. package/test/spec/modules/glimpseBidAdapter_spec.js +33 -0
  152. package/test/spec/modules/goldbachBidAdapter_spec.js +1359 -0
  153. package/test/spec/modules/gptPreAuction_spec.js +58 -4
  154. package/test/spec/modules/gumgumBidAdapter_spec.js +6 -0
  155. package/test/spec/modules/imRtdProvider_spec.js +25 -0
  156. package/test/spec/modules/improvedigitalBidAdapter_spec.js +3 -1
  157. package/test/spec/modules/intersectionRtdProvider_spec.js +141 -0
  158. package/test/spec/modules/invibesBidAdapter_spec.js +148 -4
  159. package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
  160. package/test/spec/modules/ixBidAdapter_spec.js +293 -2
  161. package/test/spec/modules/konduitWrapper_spec.js +0 -1
  162. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +10 -7
  163. package/test/spec/modules/livewrappedBidAdapter_spec.js +31 -0
  164. package/test/spec/modules/lotamePanoramaIdSystem_spec.js +227 -0
  165. package/test/spec/modules/luponmediaBidAdapter_spec.js +412 -0
  166. package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -4
  167. package/test/spec/modules/merkleIdSystem_spec.js +18 -0
  168. package/test/spec/modules/missenaBidAdapter_spec.js +134 -0
  169. package/test/spec/modules/nativoBidAdapter_spec.js +35 -18
  170. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +26 -1
  171. package/test/spec/modules/oguryBidAdapter_spec.js +13 -11
  172. package/test/spec/modules/openxBidAdapter_spec.js +5 -0
  173. package/test/spec/modules/prebidServerBidAdapter_spec.js +62 -2
  174. package/test/spec/modules/pubgeniusBidAdapter_spec.js +3 -3
  175. package/test/spec/modules/pubmaticBidAdapter_spec.js +1 -1
  176. package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +11 -0
  177. package/test/spec/modules/realTimeDataModule_spec.js +135 -49
  178. package/test/spec/modules/relaidoBidAdapter_spec.js +71 -63
  179. package/test/spec/modules/richaudienceBidAdapter_spec.js +2 -2
  180. package/test/spec/modules/rubiconBidAdapter_spec.js +65 -9
  181. package/test/spec/modules/seedtagBidAdapter_spec.js +3 -0
  182. package/test/spec/modules/sharedIdSystem_spec.js +52 -6
  183. package/test/spec/modules/smaatoBidAdapter_spec.js +61 -0
  184. package/test/spec/modules/smartxBidAdapter_spec.js +9 -0
  185. package/test/spec/modules/sspBCBidAdapter_spec.js +33 -3
  186. package/test/spec/modules/tappxBidAdapter_spec.js +4 -0
  187. package/test/spec/modules/targetVideoBidAdapter_spec.js +96 -0
  188. package/test/spec/modules/trustxBidAdapter_spec.js +42 -0
  189. package/test/spec/modules/userId_spec.js +51 -0
  190. package/test/spec/modules/vidoomyBidAdapter_spec.js +32 -13
  191. package/test/spec/modules/visxBidAdapter_spec.js +121 -5
  192. package/test/spec/modules/weboramaRtdProvider_spec.js +408 -214
  193. package/test/spec/modules/yahoosspBidAdapter_spec.js +28 -1
  194. package/test/spec/modules/yieldlabBidAdapter_spec.js +81 -0
  195. package/test/spec/modules/yieldoneBidAdapter_spec.js +299 -53
  196. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +33 -1
  197. package/test/spec/unit/core/adapterManager_spec.js +24 -6
  198. package/test/spec/unit/core/targeting_spec.js +116 -0
  199. package/test/spec/utils_spec.js +38 -0
  200. package/test/test_deps.js +3 -0
  201. package/test/test_index.js +1 -3
@@ -17,6 +17,16 @@ const adUnitsRequested = {}
17
17
 
18
18
  // Prebid adapter referrence doc: https://docs.prebid.org/dev-docs/bidder-adaptor.html
19
19
 
20
+ // Validity checks for optionsl paramters
21
+ const validParameter = {
22
+ url: (value) => typeof value === 'string',
23
+ placementId: (value) => {
24
+ const isString = typeof value === 'string'
25
+ const isNumber = typeof value === 'number'
26
+ return isString || isNumber
27
+ },
28
+ }
29
+
20
30
  export const spec = {
21
31
  code: BIDDER_CODE,
22
32
  gvlid: GVLID,
@@ -30,7 +40,23 @@ export const spec = {
30
40
  * @return boolean True if this is a valid bid, and false otherwise.
31
41
  */
32
42
  isBidRequestValid: function (bid) {
33
- return true
43
+ // We don't need any specific parameters to make a bid request
44
+ // If not parameters are supplied just verify it's the correct bidder code
45
+ if (!bid.params) return bid.bidder === BIDDER_CODE
46
+
47
+ // Check if any supplied parameters are invalid
48
+ const hasInvalidParameters = Object.keys(bid.params).some(key => {
49
+ const value = bid.params[key]
50
+ const validityCheck = validParameter[key]
51
+
52
+ // We don't have a test for this so it's not a paramter we care about
53
+ if (!validityCheck) return false
54
+
55
+ // Return if the check is not passed
56
+ return !validityCheck(value)
57
+ })
58
+
59
+ return !hasInvalidParameters
34
60
  },
35
61
 
36
62
  /**
@@ -4,6 +4,7 @@ import { BANNER } from '../src/mediaTypes.js';
4
4
 
5
5
  const BIDDER_CODE = 'nextMillennium';
6
6
  const ENDPOINT = 'https://pbs.nextmillmedia.com/openrtb2/auction';
7
+ const SYNC_ENDPOINT = 'https://statics.nextmillmedia.com/load-cookie.html?v=4';
7
8
  const TIME_TO_LIVE = 360;
8
9
 
9
10
  export const spec = {
@@ -18,10 +19,13 @@ export const spec = {
18
19
 
19
20
  buildRequests: function(validBidRequests, bidderRequest) {
20
21
  const requests = [];
22
+ window.nmmRefreshCounts = window.nmmRefreshCounts || {};
21
23
 
22
24
  _each(validBidRequests, function(bid) {
25
+ window.nmmRefreshCounts[bid.adUnitCode] = window.nmmRefreshCounts[bid.adUnitCode] || 0;
23
26
  const postBody = {
24
27
  'id': bid.auctionId,
28
+ 'refresh_count': window.nmmRefreshCounts[bid.adUnitCode]++,
25
29
  'ext': {
26
30
  'prebid': {
27
31
  'storedrequest': {
@@ -40,12 +44,14 @@ export const spec = {
40
44
  if (uspConsent) {
41
45
  postBody.regs.ext.us_privacy = uspConsent;
42
46
  }
43
- if (typeof gdprConsent.gdprApplies !== 'undefined') {
44
- postBody.regs.ext.gdpr = gdprConsent.gdprApplies ? 1 : 0;
45
- }
46
- if (typeof gdprConsent.consentString !== 'undefined') {
47
- postBody.user = {
48
- ext: { consent: gdprConsent.consentString }
47
+ if (gdprConsent) {
48
+ if (typeof gdprConsent.gdprApplies !== 'undefined') {
49
+ postBody.regs.ext.gdpr = gdprConsent.gdprApplies ? 1 : 0;
50
+ }
51
+ if (typeof gdprConsent.consentString !== 'undefined') {
52
+ postBody.user = {
53
+ ext: { consent: gdprConsent.consentString }
54
+ }
49
55
  }
50
56
  }
51
57
  }
@@ -89,7 +95,31 @@ export const spec = {
89
95
  });
90
96
 
91
97
  return bidResponses;
92
- }
98
+ },
99
+
100
+ getUserSyncs: function (syncOptions, responses, gdprConsent, uspConsent) {
101
+ if (!syncOptions.iframeEnabled) {
102
+ return
103
+ }
104
+
105
+ let syncurl = gdprConsent && gdprConsent.gdprApplies ? `${SYNC_ENDPOINT}&gdpr=1&gdpr_consent=${gdprConsent.consentString}` : SYNC_ENDPOINT
106
+
107
+ let bidders = []
108
+ if (responses) {
109
+ _each(responses, (response) => {
110
+ _each(Object.keys(response.body.ext.responsetimemillis), b => bidders.push(b))
111
+ })
112
+ }
113
+
114
+ if (bidders.length) {
115
+ syncurl += `&bidders=${bidders.join(',')}`
116
+ }
117
+
118
+ return [{
119
+ type: 'iframe',
120
+ url: syncurl
121
+ }];
122
+ },
93
123
  };
94
124
 
95
125
  registerBidder(spec);
@@ -83,7 +83,8 @@ function buildRequests(validBidRequests, bidderRequest) {
83
83
  bidfloor: getFloor(bidRequest),
84
84
  banner: {
85
85
  format: sizes
86
- }
86
+ },
87
+ ext: bidRequest.params
87
88
  });
88
89
  }
89
90
  });
@@ -42,7 +42,12 @@ export const USER_ID_CODE_TO_QUERY_ARG = {
42
42
  novatiq: 'novatiqid', // Novatiq ID
43
43
  mwOpenLinkId: 'mwopenlinkid', // MediaWallah OpenLink ID
44
44
  dapId: 'dapid', // Akamai DAP ID
45
- amxId: 'amxid' // AMX RTB ID
45
+ amxId: 'amxid', // AMX RTB ID
46
+ kpuid: 'kpuid', // Kinesso ID
47
+ publinkId: 'publinkid', // Publisher Link
48
+ naveggId: 'naveggid', // Navegg ID
49
+ imuid: 'imuid', // IM-UID by Intimate Merger
50
+ adtelligentId: 'adtelligentid' // Adtelligent ID
46
51
  };
47
52
 
48
53
  export const spec = {
@@ -56,6 +56,7 @@ let eidPermissions;
56
56
  * @property {string} [adapter='prebidServer'] adapter code to use for S2S
57
57
  * @property {boolean} [enabled=false] enables S2S bidding
58
58
  * @property {number} [timeout=1000] timeout for S2S bidders - should be lower than `pbjs.requestBids({timeout})`
59
+ * @property {number} [syncTimeout=1000] timeout for cookie sync iframe / image rendering
59
60
  * @property {number} [maxBids=1]
60
61
  * @property {AdapterOptions} [adapterOptions] adds arguments to resulting OpenRTB payload to Prebid Server
61
62
  * @property {Object} [syncUrlModifier]
@@ -77,6 +78,7 @@ let eidPermissions;
77
78
  */
78
79
  const s2sDefaultConfig = {
79
80
  timeout: 1000,
81
+ syncTimeout: 1000,
80
82
  maxBids: 1,
81
83
  adapter: 'prebidServer',
82
84
  adapterOptions: {},
@@ -274,11 +276,9 @@ function doAllSyncs(bidders, s2sConfig) {
274
276
  */
275
277
  function doPreBidderSync(type, url, bidder, done, s2sConfig) {
276
278
  if (s2sConfig.syncUrlModifier && typeof s2sConfig.syncUrlModifier[bidder] === 'function') {
277
- const newSyncUrl = s2sConfig.syncUrlModifier[bidder](type, url, bidder);
278
- doBidderSync(type, newSyncUrl, bidder, done)
279
- } else {
280
- doBidderSync(type, url, bidder, done)
279
+ url = s2sConfig.syncUrlModifier[bidder](type, url, bidder);
281
280
  }
281
+ doBidderSync(type, url, bidder, done, s2sConfig.syncTimeout)
282
282
  }
283
283
 
284
284
  /**
@@ -288,17 +288,18 @@ function doPreBidderSync(type, url, bidder, done, s2sConfig) {
288
288
  * @param {string} url the url to sync
289
289
  * @param {string} bidder name of bidder doing sync for
290
290
  * @param {function} done an exit callback; to signify this pixel has either: finished rendering or something went wrong
291
+ * @param {number} timeout: maximum time to wait for rendering in milliseconds
291
292
  */
292
- function doBidderSync(type, url, bidder, done) {
293
+ function doBidderSync(type, url, bidder, done, timeout) {
293
294
  if (!url) {
294
295
  logError(`No sync url for bidder "${bidder}": ${url}`);
295
296
  done();
296
297
  } else if (type === 'image' || type === 'redirect') {
297
298
  logMessage(`Invoking image pixel user sync for bidder: "${bidder}"`);
298
- triggerPixel(url, done);
299
- } else if (type == 'iframe') {
299
+ triggerPixel(url, done, timeout);
300
+ } else if (type === 'iframe') {
300
301
  logMessage(`Invoking iframe user sync for bidder: "${bidder}"`);
301
- insertUserSyncIframe(url, done);
302
+ insertUserSyncIframe(url, done, timeout);
302
303
  } else {
303
304
  logError(`User sync type "${type}" not supported for bidder: "${bidder}"`);
304
305
  done();
@@ -539,10 +540,13 @@ const OPEN_RTB_PROTOCOL = {
539
540
  }
540
541
  if (Array.isArray(params.aspect_ratios)) {
541
542
  // pass aspect_ratios as ext data I guess?
542
- asset.ext = {
543
- aspectratios: params.aspect_ratios.map(
544
- ratio => `${ratio.ratio_width}:${ratio.ratio_height}`
545
- )
543
+ const aspectRatios = params.aspect_ratios
544
+ .filter((ar) => ar.ratio_width && ar.ratio_height)
545
+ .map(ratio => `${ratio.ratio_width}:${ratio.ratio_height}`);
546
+ if (aspectRatios.length > 0) {
547
+ asset.ext = {
548
+ aspectratios: aspectRatios
549
+ }
546
550
  }
547
551
  }
548
552
  assets.push(newAsset({
@@ -731,7 +735,7 @@ const OPEN_RTB_PROTOCOL = {
731
735
  return;
732
736
  }
733
737
  const request = {
734
- id: s2sBidRequest.tid,
738
+ id: firstBidRequest.auctionId,
735
739
  source: {tid: s2sBidRequest.tid},
736
740
  tmax: s2sConfig.timeout,
737
741
  imp: imps,
@@ -751,7 +755,7 @@ const OPEN_RTB_PROTOCOL = {
751
755
  }
752
756
  };
753
757
 
754
- // Sets pbjs version, can be overwritten below if channel exists in s2sConfig.extPrebid
758
+ // This is no longer overwritten unless name and version explicitly overwritten by extPrebid (mergeDeep)
755
759
  request.ext.prebid = Object.assign(request.ext.prebid, {channel: {name: 'pbjs', version: $$PREBID_GLOBAL$$.version}})
756
760
 
757
761
  // set debug flag if in debug mode
@@ -761,7 +765,7 @@ const OPEN_RTB_PROTOCOL = {
761
765
 
762
766
  // s2sConfig video.ext.prebid is passed through openrtb to PBS
763
767
  if (s2sConfig.extPrebid && typeof s2sConfig.extPrebid === 'object') {
764
- request.ext.prebid = Object.assign(request.ext.prebid, s2sConfig.extPrebid);
768
+ request.ext.prebid = mergeDeep(request.ext.prebid, s2sConfig.extPrebid);
765
769
  }
766
770
 
767
771
  /**
@@ -16,7 +16,7 @@ import {
16
16
  } from '../src/utils.js';
17
17
 
18
18
  const BIDDER_VERSION = '1.1.0';
19
- const BASE_URL = 'https://ortb.adpearl.io';
19
+ const BASE_URL = 'https://auction.adpearl.io';
20
20
 
21
21
  export const spec = {
22
22
  code: 'pubgenius',
@@ -11,6 +11,7 @@ const USER_SYNC_URL_IFRAME = 'https://ads.pubmatic.com/AdServer/js/user_sync.htm
11
11
  const USER_SYNC_URL_IMAGE = 'https://image8.pubmatic.com/AdServer/ImgSync?p=';
12
12
  const DEFAULT_CURRENCY = 'USD';
13
13
  const AUCTION_TYPE = 1;
14
+ const GROUPM_ALIAS = {code: 'groupm', gvlid: 98};
14
15
  const UNDEFINED = undefined;
15
16
  const DEFAULT_WIDTH = 0;
16
17
  const DEFAULT_HEIGHT = 0;
@@ -866,10 +867,10 @@ function _handleEids(payload, validBidRequests) {
866
867
 
867
868
  function _checkMediaType(bid, newBid) {
868
869
  // Create a regex here to check the strings
869
- if (bid.ext && bid.ext['BidType'] != undefined) {
870
- newBid.mediaType = MEDIATYPE[bid.ext.BidType];
870
+ if (bid.ext && bid.ext['bidtype'] != undefined) {
871
+ newBid.mediaType = MEDIATYPE[bid.ext.bidtype];
871
872
  } else {
872
- logInfo(LOG_WARN_PREFIX + 'bid.ext.BidType does not exist, checking alternatively for mediaType')
873
+ logInfo(LOG_WARN_PREFIX + 'bid.ext.bidtype does not exist, checking alternatively for mediaType')
873
874
  var adm = bid.adm;
874
875
  var admStr = '';
875
876
  var videoRegex = new RegExp(/VAST\s+version/);
@@ -1005,6 +1006,7 @@ export const spec = {
1005
1006
  code: BIDDER_CODE,
1006
1007
  gvlid: 76,
1007
1008
  supportedMediaTypes: [BANNER, VIDEO, NATIVE],
1009
+ aliases: [GROUPM_ALIAS],
1008
1010
  /**
1009
1011
  * Determines whether or not the given bid request is valid. Valid bid request must have placementId and hbid
1010
1012
  *
@@ -21,6 +21,14 @@ let events = {
21
21
  deviceDetail: {}
22
22
  };
23
23
 
24
+ function getStorage() {
25
+ try {
26
+ return window.top['sessionStorage'];
27
+ } catch (e) {
28
+ return null;
29
+ }
30
+ }
31
+
24
32
  var pubxaiAnalyticsAdapter = Object.assign(adapter(
25
33
  {
26
34
  emptyUrl,
@@ -132,6 +140,7 @@ pubxaiAnalyticsAdapter.shouldFireEventRequest = function (samplingRate = 1) {
132
140
  function send(data, status) {
133
141
  if (pubxaiAnalyticsAdapter.shouldFireEventRequest(initOptions.samplingRate)) {
134
142
  let location = getWindowLocation();
143
+ const storage = getStorage();
135
144
  data.initOptions = initOptions;
136
145
  if (typeof data !== 'undefined' && typeof data.auctionInit !== 'undefined') {
137
146
  Object.assign(data.pageDetail, {
@@ -142,6 +151,13 @@ function send(data, status) {
142
151
  });
143
152
  data.initOptions.auctionId = data.auctionInit.auctionId;
144
153
  delete data.auctionInit;
154
+
155
+ data.pmcDetail = {}
156
+ Object.assign(data.pmcDetail, {
157
+ bidDensity: storage ? storage.getItem('pbx:dpbid') : null,
158
+ maxBid: storage ? storage.getItem('pbx:mxbid') : null,
159
+ auctionId: storage ? storage.getItem('pbx:aucid') : null,
160
+ });
145
161
  }
146
162
  data.deviceDetail = {};
147
163
  Object.assign(data.deviceDetail, {
@@ -150,6 +166,7 @@ function send(data, status) {
150
166
  deviceOS: getOS(),
151
167
  browser: getBrowser()
152
168
  });
169
+
153
170
  let pubxaiAnalyticsRequestUrl = buildUrl({
154
171
  protocol: 'https',
155
172
  hostname: (initOptions && initOptions.hostName) || defaultHost,
@@ -6,7 +6,7 @@ import { getStorageManager } from '../src/storageManager.js';
6
6
 
7
7
  const BIDDER_CODE = 'relaido';
8
8
  const BIDDER_DOMAIN = 'api.relaido.jp';
9
- const ADAPTER_VERSION = '1.0.6';
9
+ const ADAPTER_VERSION = '1.0.7';
10
10
  const DEFAULT_TTL = 300;
11
11
  const UUID_KEY = 'relaido_uuid';
12
12
 
@@ -31,14 +31,14 @@ function isBidRequestValid(bid) {
31
31
  }
32
32
 
33
33
  function buildRequests(validBidRequests, bidderRequest) {
34
- let bidRequests = [];
34
+ const bids = [];
35
+ let imuid = null;
36
+ let bidDomain = null;
37
+ let bidder = null;
38
+ let count = null;
35
39
 
36
40
  for (let i = 0; i < validBidRequests.length; i++) {
37
41
  const bidRequest = validBidRequests[i];
38
- const placementId = getBidIdParameter('placementId', bidRequest.params);
39
- const bidDomain = bidRequest.params.domain || BIDDER_DOMAIN;
40
- const bidUrl = `https://${bidDomain}/bid/v1/prebid/${placementId}`;
41
- const uuid = getUuid();
42
42
  let mediaType = '';
43
43
  let width = 0;
44
44
  let height = 0;
@@ -55,46 +55,63 @@ function buildRequests(validBidRequests, bidderRequest) {
55
55
  mediaType = BANNER;
56
56
  }
57
57
 
58
- let payload = {
59
- version: ADAPTER_VERSION,
60
- timeout_ms: bidderRequest.timeout,
61
- ad_unit_code: bidRequest.adUnitCode,
62
- auction_id: bidRequest.auctionId,
63
- bidder: bidRequest.bidder,
64
- bidder_request_id: bidRequest.bidderRequestId,
65
- bid_requests_count: bidRequest.bidRequestsCount,
66
- bid_id: bidRequest.bidId,
67
- transaction_id: bidRequest.transactionId,
68
- media_type: mediaType,
69
- uuid: uuid,
70
- width: width,
71
- height: height,
72
- pv: '$prebid.version$'
73
- };
58
+ if (!imuid) {
59
+ const pickImuid = deepAccess(bidRequest, 'userId.imuid');
60
+ if (pickImuid) {
61
+ imuid = pickImuid;
62
+ }
63
+ }
64
+
65
+ if (!bidDomain) {
66
+ bidDomain = bidRequest.params.domain;
67
+ }
68
+
69
+ if (!bidder) {
70
+ bidder = bidRequest.bidder
71
+ }
72
+
73
+ if (!bidder) {
74
+ bidder = bidRequest.bidder
75
+ }
74
76
 
75
- const imuid = deepAccess(bidRequest, 'userId.imuid');
76
- if (imuid) {
77
- payload.imuid = imuid;
77
+ if (!count) {
78
+ count = bidRequest.bidRequestsCount;
78
79
  }
79
80
 
80
- // It may not be encoded, so add it at the end of the payload
81
- payload.ref = bidderRequest.refererInfo.referer;
82
-
83
- bidRequests.push({
84
- method: 'GET',
85
- url: bidUrl,
86
- data: payload,
87
- options: {
88
- withCredentials: true
89
- },
90
- bidId: bidRequest.bidId,
81
+ bids.push({
82
+ bid_id: bidRequest.bidId,
83
+ placement_id: getBidIdParameter('placementId', bidRequest.params),
84
+ transaction_id: bidRequest.transactionId,
85
+ bidder_request_id: bidRequest.bidderRequestId,
86
+ ad_unit_code: bidRequest.adUnitCode,
87
+ auction_id: bidRequest.auctionId,
91
88
  player: bidRequest.params.player,
92
- width: payload.width,
93
- height: payload.height,
94
- mediaType: payload.media_type
89
+ width: width,
90
+ height: height,
91
+ media_type: mediaType
95
92
  });
96
93
  }
97
- return bidRequests;
94
+
95
+ const data = JSON.stringify({
96
+ version: ADAPTER_VERSION,
97
+ bids: bids,
98
+ timeout_ms: bidderRequest.timeout,
99
+ bidder: bidder,
100
+ bid_requests_count: count,
101
+ uuid: getUuid(),
102
+ pv: '$prebid.version$',
103
+ imuid: imuid,
104
+ ref: bidderRequest.refererInfo.referer
105
+ })
106
+
107
+ return {
108
+ method: 'POST',
109
+ url: `https://${bidDomain || BIDDER_DOMAIN}/bid/v1/sprebid`,
110
+ options: {
111
+ withCredentials: true
112
+ },
113
+ data: data
114
+ };
98
115
  }
99
116
 
100
117
  function interpretResponse(serverResponse, bidRequest) {
@@ -105,34 +122,38 @@ function interpretResponse(serverResponse, bidRequest) {
105
122
  }
106
123
 
107
124
  const playerUrl = bidRequest.player || body.playerUrl;
108
- const mediaType = bidRequest.mediaType || VIDEO;
109
-
110
- let bidResponse = {
111
- requestId: bidRequest.bidId,
112
- width: bidRequest.width,
113
- height: bidRequest.height,
114
- cpm: body.price,
115
- currency: body.currency,
116
- creativeId: body.creativeId,
117
- dealId: body.dealId || '',
118
- ttl: body.ttl || DEFAULT_TTL,
119
- netRevenue: true,
120
- mediaType: mediaType,
121
- meta: {
122
- advertiserDomains: body.adomain || [],
123
- mediaType: VIDEO
125
+
126
+ for (const res of body.ads) {
127
+ let bidResponse = {
128
+ requestId: res.bidId,
129
+ width: res.width,
130
+ height: res.height,
131
+ cpm: res.price,
132
+ currency: res.currency,
133
+ creativeId: res.creativeId,
134
+ dealId: body.dealId || '',
135
+ ttl: body.ttl || DEFAULT_TTL,
136
+ netRevenue: true,
137
+ mediaType: res.mediaType || VIDEO,
138
+ meta: {
139
+ advertiserDomains: res.adomain || [],
140
+ mediaType: VIDEO
141
+ }
142
+ };
143
+
144
+ if (bidResponse.mediaType === VIDEO) {
145
+ bidResponse.vastXml = res.vast;
146
+ bidResponse.renderer = newRenderer(res.bidId, playerUrl);
147
+ } else {
148
+ const playerTag = createPlayerTag(playerUrl);
149
+ const renderTag = createRenderTag(res.width, res.height, res.vast);
150
+ bidResponse.ad = `<div id="rop-prebid">${playerTag}${renderTag}</div>`;
124
151
  }
125
- };
126
- if (mediaType === VIDEO) {
127
- bidResponse.vastXml = body.vast;
128
- bidResponse.renderer = newRenderer(bidRequest.bidId, playerUrl);
129
- } else {
130
- const playerTag = createPlayerTag(playerUrl);
131
- const renderTag = createRenderTag(bidRequest.width, bidRequest.height, body.vast);
132
- bidResponse.ad = `<div id="rop-prebid">${playerTag}${renderTag}</div>`;
152
+ bidResponses.push(bidResponse);
133
153
  }
134
- bidResponses.push(bidResponse);
135
154
 
155
+ // eslint-disable-next-line no-console
156
+ console.log(JSON.stringify(bidResponses));
136
157
  return bidResponses;
137
158
  }
138
159
 
@@ -58,11 +58,10 @@ export const spec = {
58
58
  REFERER = (typeof bidderRequest.refererInfo.referer != 'undefined' ? encodeURIComponent(bidderRequest.refererInfo.referer) : null)
59
59
 
60
60
  payload.gdpr_consent = '';
61
- payload.gdpr = null;
61
+ payload.gdpr = bidderRequest.gdprConsent.gdprApplies;
62
62
 
63
63
  if (bidderRequest && bidderRequest.gdprConsent) {
64
64
  payload.gdpr_consent = bidderRequest.gdprConsent.consentString;
65
- payload.gdpr = bidderRequest.gdprConsent.gdprApplies;
66
65
  }
67
66
 
68
67
  var payloadString = JSON.stringify(payload);
@@ -296,7 +295,7 @@ function raiGetFloor(bid, config) {
296
295
  } else if (typeof bid.getFloor == 'function') {
297
296
  let floorSpec = bid.getFloor({
298
297
  currency: config.getConfig('currency.adServerCurrency'),
299
- mediaType: bid.mediaType.banner ? 'banner' : 'video',
298
+ mediaType: typeof bid.mediaTypes['banner'] == 'object' ? 'banner' : 'video',
300
299
  size: '*'
301
300
  })
302
301
 
@@ -98,6 +98,15 @@
98
98
  * @param {UserConsentData} userConsent
99
99
  */
100
100
 
101
+ /**
102
+ * @function?
103
+ * @summary on bid requested event
104
+ * @name RtdSubmodule#onBidRequestEvent
105
+ * @param {Object} data
106
+ * @param {SubmoduleConfig} config
107
+ * @param {UserConsentData} userConsent
108
+ */
109
+
101
110
  /**
102
111
  * @interface ModuleConfig
103
112
  */
@@ -143,7 +152,7 @@
143
152
 
144
153
  import {config} from '../../src/config.js';
145
154
  import {module} from '../../src/hook.js';
146
- import { logError, logWarn } from '../../src/utils.js';
155
+ import {logError, logWarn} from '../../src/utils.js';
147
156
  import events from '../../src/events.js';
148
157
  import CONSTANTS from '../../src/constants.json';
149
158
  import {gdprDataHandler, uspDataHandler} from '../../src/adapterManager.js';
@@ -164,13 +173,50 @@ let _dataProviders = [];
164
173
  let _userConsent;
165
174
 
166
175
  /**
167
- * enable submodule in User ID
176
+ * Register a RTD submodule.
177
+ *
168
178
  * @param {RtdSubmodule} submodule
179
+ * @returns {function()} a de-registration function that will unregister the module when called.
169
180
  */
170
181
  export function attachRealTimeDataProvider(submodule) {
171
182
  registeredSubModules.push(submodule);
183
+ return function detach() {
184
+ const idx = registeredSubModules.indexOf(submodule)
185
+ if (idx >= 0) {
186
+ registeredSubModules.splice(idx, 1);
187
+ initSubModules();
188
+ }
189
+ }
172
190
  }
173
191
 
192
+ /**
193
+ * call each sub module event function by config order
194
+ */
195
+ const setEventsListeners = (function () {
196
+ let registered = false;
197
+ return function setEventsListeners() {
198
+ if (!registered) {
199
+ Object.entries({
200
+ [CONSTANTS.EVENTS.AUCTION_INIT]: 'onAuctionInitEvent',
201
+ [CONSTANTS.EVENTS.AUCTION_END]: 'onAuctionEndEvent',
202
+ [CONSTANTS.EVENTS.BID_RESPONSE]: 'onBidResponseEvent',
203
+ [CONSTANTS.EVENTS.BID_REQUESTED]: 'onBidRequestEvent'
204
+ }).forEach(([ev, handler]) => {
205
+ events.on(ev, (args) => {
206
+ subModules.forEach(sm => {
207
+ try {
208
+ sm[handler] && sm[handler](args, sm.config, _userConsent)
209
+ } catch (e) {
210
+ logError(`RTD provider '${sm.name}': error in '${handler}':`, e);
211
+ }
212
+ });
213
+ })
214
+ });
215
+ registered = true;
216
+ }
217
+ }
218
+ })();
219
+
174
220
  export function init(config) {
175
221
  const confListener = config.getConfig(MODULE_NAME, ({realTimeData}) => {
176
222
  if (!realTimeData.dataProviders) {
@@ -211,22 +257,6 @@ function initSubModules() {
211
257
  subModules = subModulesByOrder;
212
258
  }
213
259
 
214
- /**
215
- * call each sub module event function by config order
216
- */
217
- function setEventsListeners() {
218
- events.on(CONSTANTS.EVENTS.AUCTION_INIT, (args) => {
219
- subModules.forEach(sm => { sm.onAuctionInitEvent && sm.onAuctionInitEvent(args, sm.config, _userConsent) })
220
- });
221
- events.on(CONSTANTS.EVENTS.AUCTION_END, (args) => {
222
- getAdUnitTargeting(args);
223
- subModules.forEach(sm => { sm.onAuctionEndEvent && sm.onAuctionEndEvent(args, sm.config, _userConsent) })
224
- });
225
- events.on(CONSTANTS.EVENTS.BID_RESPONSE, (args) => {
226
- subModules.forEach(sm => { sm.onBidResponseEvent && sm.onBidResponseEvent(args, sm.config, _userConsent) })
227
- });
228
- }
229
-
230
260
  /**
231
261
  * loop through configured data providers If the data provider has registered getBidRequestData,
232
262
  * call it, providing reqBidsConfigObj, consent data and module params