prebid.js 7.2.0 → 7.5.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 (251) hide show
  1. package/.circleci/config.yml +11 -6
  2. package/.github/dependabot.yml +6 -0
  3. package/.github/workflows/issue_tracker.yml +5 -0
  4. package/.github/workflows/release-drafter.yml +6 -0
  5. package/README.md +35 -0
  6. package/dist/33acrossBidAdapter.js +1 -1
  7. package/dist/adagioBidAdapter.js +1 -1
  8. package/dist/adbookpspBidAdapter.js +1 -1
  9. package/dist/adgenerationBidAdapter.js +1 -1
  10. package/dist/adkernelBidAdapter.js +1 -1
  11. package/dist/adotBidAdapter.js +1 -1
  12. package/dist/adpod.js +1 -1
  13. package/dist/adqueryBidAdapter.js +1 -1
  14. package/dist/adrelevantisBidAdapter.js +1 -1
  15. package/dist/adxcgBidAdapter.js +1 -1
  16. package/dist/adyoulikeBidAdapter.js +1 -1
  17. package/dist/ajaBidAdapter.js +1 -1
  18. package/dist/amxBidAdapter.js +1 -1
  19. package/dist/amxIdSystem.js +1 -1
  20. package/dist/appierAnalyticsAdapter.js +1 -1
  21. package/dist/appnexusBidAdapter.js +1 -1
  22. package/dist/asoBidAdapter.js +1 -1
  23. package/dist/audiencerunBidAdapter.js +1 -1
  24. package/dist/axonixBidAdapter.js +1 -1
  25. package/dist/bidglassBidAdapter.js +1 -1
  26. package/dist/big-richmediaBidAdapter.js +1 -1
  27. package/dist/bluebillywigBidAdapter.js +1 -1
  28. package/dist/bridgewellBidAdapter.js +1 -1
  29. package/dist/brightMountainMediaBidAdapter.js +1 -1
  30. package/dist/concertBidAdapter.js +1 -1
  31. package/dist/connectadBidAdapter.js +1 -1
  32. package/dist/consumableBidAdapter.js +1 -1
  33. package/dist/conversantBidAdapter.js +1 -1
  34. package/dist/cpexIdSystem.js +1 -1
  35. package/dist/craftBidAdapter.js +1 -1
  36. package/dist/criteoBidAdapter.js +1 -1
  37. package/dist/debugging-standalone.js +1 -1
  38. package/dist/debugging.js +1 -1
  39. package/dist/dianomiBidAdapter.js +1 -0
  40. package/dist/dspxBidAdapter.js +1 -1
  41. package/dist/eplanningBidAdapter.js +1 -1
  42. package/dist/finativeBidAdapter.js +1 -0
  43. package/dist/fpdModule.js +1 -1
  44. package/dist/gdprEnforcement.js +1 -1
  45. package/dist/glimpseBidAdapter.js +1 -1
  46. package/dist/gmosspBidAdapter.js +1 -1
  47. package/dist/goldbachBidAdapter.js +1 -1
  48. package/dist/gridBidAdapter.js +1 -1
  49. package/dist/gridNMBidAdapter.js +1 -1
  50. package/dist/gumgumBidAdapter.js +1 -1
  51. package/dist/h12mediaBidAdapter.js +1 -1
  52. package/dist/hadronIdSystem.js +1 -1
  53. package/dist/hadronRtdProvider.js +1 -1
  54. package/dist/id5IdSystem.js +1 -1
  55. package/dist/impactifyBidAdapter.js +1 -1
  56. package/dist/improvedigitalBidAdapter.js +1 -1
  57. package/dist/inmarBidAdapter.js +1 -1
  58. package/dist/insticatorBidAdapter.js +1 -1
  59. package/dist/ixBidAdapter.js +1 -1
  60. package/dist/jixieBidAdapter.js +1 -1
  61. package/dist/justpremiumBidAdapter.js +1 -1
  62. package/dist/kargoAnalyticsAdapter.js +1 -1
  63. package/dist/kargoBidAdapter.js +1 -1
  64. package/dist/konduitAnalyticsAdapter.js +1 -1
  65. package/dist/kueezBidAdapter.js +1 -1
  66. package/dist/lassoBidAdapter.js +1 -0
  67. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  68. package/dist/logicadBidAdapter.js +1 -1
  69. package/dist/loglyliftBidAdapter.js +1 -1
  70. package/dist/malltvAnalyticsAdapter.js +1 -1
  71. package/dist/marsmediaBidAdapter.js +1 -1
  72. package/dist/mediafuseBidAdapter.js +1 -1
  73. package/dist/mediakeysBidAdapter.js +1 -1
  74. package/dist/medianetBidAdapter.js +1 -1
  75. package/dist/mediasquareBidAdapter.js +1 -1
  76. package/dist/mgidBidAdapter.js +1 -1
  77. package/dist/minutemediaBidAdapter.js +1 -1
  78. package/dist/missenaBidAdapter.js +1 -1
  79. package/dist/nativoBidAdapter.js +1 -1
  80. package/dist/not-for-prod/prebid.js +137 -131
  81. package/dist/oguryBidAdapter.js +1 -1
  82. package/dist/onetagBidAdapter.js +1 -1
  83. package/dist/ooloAnalyticsAdapter.js +1 -1
  84. package/dist/openxOrtbBidAdapter.js +1 -0
  85. package/dist/outbrainBidAdapter.js +1 -1
  86. package/dist/parrableIdSystem.js +1 -1
  87. package/dist/pixfutureBidAdapter.js +1 -1
  88. package/dist/prebid-core.js +2 -2
  89. package/dist/pubCommonId.js +1 -1
  90. package/dist/publinkIdSystem.js +1 -1
  91. package/dist/pubmaticBidAdapter.js +1 -1
  92. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  93. package/dist/pxyzBidAdapter.js +1 -1
  94. package/dist/quantcastBidAdapter.js +1 -1
  95. package/dist/readpeakBidAdapter.js +1 -1
  96. package/dist/relaidoBidAdapter.js +1 -1
  97. package/dist/rhythmoneBidAdapter.js +1 -1
  98. package/dist/riseBidAdapter.js +1 -1
  99. package/dist/rubiconAnalyticsAdapter.js +1 -1
  100. package/dist/rubiconBidAdapter.js +1 -1
  101. package/dist/seedingAllianceBidAdapter.js +1 -1
  102. package/dist/seedtagBidAdapter.js +1 -1
  103. package/dist/sharedIdSystem.js +1 -1
  104. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  105. package/dist/sharethroughBidAdapter.js +1 -1
  106. package/dist/shinezBidAdapter.js +1 -0
  107. package/dist/sizeMappingV2.js +1 -1
  108. package/dist/smaatoBidAdapter.js +1 -1
  109. package/dist/smartadserverBidAdapter.js +1 -1
  110. package/dist/smartxBidAdapter.js +1 -1
  111. package/dist/smilewantedBidAdapter.js +1 -1
  112. package/dist/sonobiBidAdapter.js +1 -1
  113. package/dist/sovrnAnalyticsAdapter.js +1 -1
  114. package/dist/sovrnBidAdapter.js +1 -1
  115. package/dist/sspBCBidAdapter.js +1 -1
  116. package/dist/sublimeBidAdapter.js +1 -1
  117. package/dist/synacormediaBidAdapter.js +1 -1
  118. package/dist/taboolaBidAdapter.js +1 -1
  119. package/dist/targetVideoBidAdapter.js +1 -1
  120. package/dist/teadsBidAdapter.js +1 -1
  121. package/dist/tncIdSystem.js +1 -0
  122. package/dist/trionBidAdapter.js +1 -1
  123. package/dist/tripleliftBidAdapter.js +1 -1
  124. package/dist/ttdBidAdapter.js +1 -1
  125. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  126. package/dist/underdogmediaBidAdapter.js +1 -1
  127. package/dist/undertoneBidAdapter.js +1 -1
  128. package/dist/userId.js +1 -1
  129. package/dist/ventesBidAdapter.js +1 -1
  130. package/dist/vidazooBidAdapter.js +1 -1
  131. package/dist/videobyteBidAdapter.js +1 -1
  132. package/dist/visxBidAdapter.js +1 -1
  133. package/dist/vrtcalBidAdapter.js +1 -1
  134. package/dist/vuukleBidAdapter.js +1 -1
  135. package/dist/widespaceBidAdapter.js +1 -1
  136. package/dist/winrBidAdapter.js +1 -1
  137. package/dist/yahoosspBidAdapter.js +1 -1
  138. package/dist/yieldlabBidAdapter.js +1 -1
  139. package/dist/yieldmoBidAdapter.js +1 -1
  140. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  141. package/dist/yieldoneBidAdapter.js +1 -1
  142. package/governance.md +5 -11
  143. package/gulpHelpers.js +1 -1
  144. package/gulpfile.js +1 -1
  145. package/karma.conf.maker.js +3 -1
  146. package/modules/.submodules.json +1 -0
  147. package/modules/33acrossBidAdapter.js +5 -1
  148. package/modules/adkernelBidAdapter.js +2 -1
  149. package/modules/adotBidAdapter.js +3 -3
  150. package/modules/adqueryBidAdapter.js +5 -1
  151. package/modules/appnexusBidAdapter.js +3 -3
  152. package/modules/cpexIdSystem.js +7 -8
  153. package/modules/criteoBidAdapter.js +7 -1
  154. package/modules/cwireBidAdapter.md +1 -1
  155. package/modules/debugging/bidInterceptor.js +1 -1
  156. package/modules/debugging/index.js +2 -1
  157. package/modules/dianomiBidAdapter.js +369 -0
  158. package/modules/dianomiBidAdapter.md +73 -0
  159. package/modules/finativeBidAdapter.js +235 -0
  160. package/modules/finativeBidAdapter.md +45 -0
  161. package/modules/fpdModule/index.js +6 -5
  162. package/modules/gdprEnforcement.js +8 -14
  163. package/modules/gumgumBidAdapter.js +2 -0
  164. package/modules/gumgumBidAdapter.md +19 -1
  165. package/modules/hadronAnalyticsAdapter.md +5 -5
  166. package/modules/hadronIdSystem.js +18 -5
  167. package/modules/hadronIdSystem.md +15 -11
  168. package/modules/hadronRtdProvider.js +14 -1
  169. package/modules/hadronRtdProvider.md +17 -13
  170. package/modules/insticatorBidAdapter.js +9 -0
  171. package/modules/ixBidAdapter.js +457 -57
  172. package/modules/ixBidAdapter.md +95 -5
  173. package/modules/kargoAnalyticsAdapter.js +88 -6
  174. package/modules/kargoAnalyticsAdapter.md +33 -0
  175. package/modules/kargoBidAdapter.js +1 -2
  176. package/modules/lassoBidAdapter.js +133 -0
  177. package/modules/lassoBidAdapter.md +29 -0
  178. package/modules/medianetBidAdapter.js +9 -5
  179. package/modules/missenaBidAdapter.js +20 -2
  180. package/modules/nativoBidAdapter.js +19 -7
  181. package/modules/openxBidAdapter.md +3 -1
  182. package/modules/openxOrtbBidAdapter.js +349 -0
  183. package/modules/openxOrtbBidAdapter.md +105 -0
  184. package/modules/pubCommonId.js +1 -2
  185. package/modules/readpeakBidAdapter.js +15 -6
  186. package/modules/relaidoBidAdapter.js +19 -4
  187. package/modules/riseBidAdapter.js +1 -0
  188. package/modules/seedtagBidAdapter.js +33 -1
  189. package/modules/sharedIdSystem.js +11 -5
  190. package/modules/sharethroughBidAdapter.js +9 -24
  191. package/modules/shinezBidAdapter.js +435 -0
  192. package/modules/shinezBidAdapter.md +76 -0
  193. package/modules/sonobiBidAdapter.js +28 -9
  194. package/modules/sovrnBidAdapter.js +16 -10
  195. package/modules/taboolaBidAdapter.js +1 -1
  196. package/modules/taboolaBidAdapter.md +3 -3
  197. package/modules/tncIdSystem.js +63 -0
  198. package/modules/tncIdSystem.md +33 -0
  199. package/modules/userId/eids.js +12 -0
  200. package/modules/userId/eids.md +7 -0
  201. package/modules/userId/userId.md +17 -0
  202. package/modules/ventesBidAdapter.js +1 -1
  203. package/modules/ventesBidAdapter.md +1 -1
  204. package/modules/vrtcalBidAdapter.js +35 -0
  205. package/modules/yieldlabBidAdapter.js +4 -0
  206. package/modules/yieldmoBidAdapter.js +20 -2
  207. package/modules/yieldoneBidAdapter.js +12 -1
  208. package/package.json +1 -1
  209. package/plugins/pbjsGlobals.js +2 -1
  210. package/src/adloader.js +1 -0
  211. package/src/prebid.js +4 -1
  212. package/src/storageManager.js +4 -5
  213. package/test/spec/modules/33acrossBidAdapter_spec.js +39 -0
  214. package/test/spec/modules/appnexusBidAdapter_spec.js +165 -156
  215. package/test/spec/modules/cpexIdSystem_spec.js +5 -5
  216. package/test/spec/modules/criteoBidAdapter_spec.js +15 -5
  217. package/test/spec/modules/debugging_mod_spec.js +7 -0
  218. package/test/spec/modules/dianomiBidAdapter_spec.js +1223 -0
  219. package/test/spec/modules/eids_spec.js +26 -1
  220. package/test/spec/modules/finativeBidAdapter_spec.js +186 -0
  221. package/test/spec/modules/fpdModule_spec.js +28 -1
  222. package/test/spec/modules/gdprEnforcement_spec.js +53 -100
  223. package/test/spec/modules/gumgumBidAdapter_spec.js +5 -0
  224. package/test/spec/modules/hadronIdSystem_spec.js +2 -2
  225. package/test/spec/modules/insticatorBidAdapter_spec.js +22 -1
  226. package/test/spec/modules/ixBidAdapter_spec.js +429 -10
  227. package/test/spec/modules/kargoAnalyticsAdapter_spec.js +42 -0
  228. package/test/spec/modules/kargoBidAdapter_spec.js +1 -0
  229. package/test/spec/modules/lassoBidAdapter_spec.js +177 -0
  230. package/test/spec/modules/medianetBidAdapter_spec.js +24 -1
  231. package/test/spec/modules/missenaBidAdapter_spec.js +36 -14
  232. package/test/spec/modules/nativoBidAdapter_spec.js +67 -17
  233. package/test/spec/modules/openxOrtbBidAdapter_spec.js +1303 -0
  234. package/test/spec/modules/readpeakBidAdapter_spec.js +1 -0
  235. package/test/spec/modules/relaidoBidAdapter_spec.js +29 -2
  236. package/test/spec/modules/riseBidAdapter_spec.js +3 -0
  237. package/test/spec/modules/seedtagBidAdapter_spec.js +4 -0
  238. package/test/spec/modules/sharethroughBidAdapter_spec.js +4 -4
  239. package/test/spec/modules/shinezBidAdapter_spec.js +479 -0
  240. package/test/spec/modules/sonobiBidAdapter_spec.js +38 -23
  241. package/test/spec/modules/sovrnBidAdapter_spec.js +39 -5
  242. package/test/spec/modules/taboolaBidAdapter_spec.js +1 -1
  243. package/test/spec/modules/tncIdSystem_spec.js +109 -0
  244. package/test/spec/modules/userId_spec.js +6 -3
  245. package/test/spec/modules/ventesBidAdapter_spec.js +2 -2
  246. package/test/spec/modules/vrtcalBidAdapter_spec.js +17 -0
  247. package/test/spec/modules/yieldlabBidAdapter_spec.js +4 -0
  248. package/test/spec/modules/yieldmoBidAdapter_spec.js +15 -2
  249. package/test/spec/modules/yieldoneBidAdapter_spec.js +43 -2
  250. package/test/spec/unit/pbjs_api_spec.js +23 -0
  251. package/webpack.conf.js +1 -1
@@ -0,0 +1,349 @@
1
+ import {config} from '../src/config.js';
2
+ import {registerBidder} from '../src/adapters/bidderFactory.js';
3
+ import * as utils from '../src/utils.js';
4
+ import {BANNER, VIDEO} from '../src/mediaTypes.js';
5
+ import {includes} from '../src/polyfill.js';
6
+
7
+ const bidderConfig = 'hb_pb_ortb';
8
+ const bidderVersion = '1.0';
9
+ const VIDEO_TARGETING = ['startdelay', 'mimes', 'minduration', 'maxduration', 'delivery',
10
+ 'startdelay', 'skip', 'playbackmethod', 'api', 'protocol', 'boxingallowed', 'maxextended',
11
+ 'linearity', 'delivery', 'protocols', 'placement', 'minbitrate', 'maxbitrate', 'battr', 'ext'];
12
+ export const REQUEST_URL = 'https://rtb.openx.net/openrtbb/prebidjs';
13
+ export const SYNC_URL = 'https://u.openx.net/w/1.0/pd';
14
+ export const DEFAULT_PH = '2d1251ae-7f3a-47cf-bd2a-2f288854a0ba';
15
+ export const spec = {
16
+ code: 'openx',
17
+ supportedMediaTypes: [BANNER, VIDEO],
18
+ isBidRequestValid,
19
+ buildRequests,
20
+ interpretResponse,
21
+ getUserSyncs,
22
+ transformBidParams
23
+ };
24
+
25
+ registerBidder(spec);
26
+
27
+ function transformBidParams(params, isOpenRtb) {
28
+ return utils.convertTypes({
29
+ 'unit': 'string',
30
+ 'customFloor': 'number'
31
+ }, params);
32
+ }
33
+
34
+ function isBidRequestValid(bidRequest) {
35
+ const hasDelDomainOrPlatform = bidRequest.params.delDomain ||
36
+ bidRequest.params.platform;
37
+
38
+ if (utils.deepAccess(bidRequest, 'mediaTypes.banner') &&
39
+ hasDelDomainOrPlatform) {
40
+ return !!bidRequest.params.unit ||
41
+ utils.deepAccess(bidRequest, 'mediaTypes.banner.sizes.length') > 0;
42
+ }
43
+
44
+ return !!(bidRequest.params.unit && hasDelDomainOrPlatform);
45
+ }
46
+
47
+ function buildRequests(bids, bidderRequest) {
48
+ let videoBids = bids.filter(bid => isVideoBid(bid));
49
+ let bannerBids = bids.filter(bid => isBannerBid(bid));
50
+ let requests = bannerBids.length ? [createBannerRequest(bannerBids, bidderRequest)] : [];
51
+ videoBids.forEach(bid => {
52
+ requests.push(createVideoRequest(bid, bidderRequest));
53
+ });
54
+ return requests;
55
+ }
56
+
57
+ function createBannerRequest(bids, bidderRequest) {
58
+ let data = getBaseRequest(bids[0], bidderRequest);
59
+ data.imp = bids.map(bid => {
60
+ const floor = getFloor(bid, BANNER);
61
+ let imp = {
62
+ id: bid.bidId,
63
+ tagid: bid.params.unit,
64
+ banner: {
65
+ format: toFormat(bid.mediaTypes.banner.sizes),
66
+ topframe: utils.inIframe() ? 0 : 1
67
+ },
68
+ ext: {divid: bid.adUnitCode}
69
+ };
70
+ enrichImp(imp, bid, floor);
71
+ return imp;
72
+ });
73
+ return {
74
+ method: 'POST',
75
+ url: REQUEST_URL,
76
+ data: data
77
+ }
78
+ }
79
+
80
+ function toFormat(sizes) {
81
+ return sizes.map((s) => {
82
+ return { w: s[0], h: s[1] };
83
+ });
84
+ }
85
+
86
+ function enrichImp(imp, bid, floor) {
87
+ if (bid.params.customParams) {
88
+ utils.deepSetValue(imp, 'ext.customParams', bid.params.customParams);
89
+ }
90
+ if (floor > 0) {
91
+ imp.bidfloor = floor;
92
+ imp.bidfloorcur = 'USD';
93
+ } else if (bid.params.customFloor) {
94
+ imp.bidfloor = bid.params.customFloor;
95
+ }
96
+ if (bid.ortb2Imp && bid.ortb2Imp.ext && bid.ortb2Imp.ext.data) {
97
+ imp.ext.data = bid.ortb2Imp.ext.data;
98
+ }
99
+ }
100
+
101
+ function createVideoRequest(bid, bidderRequest) {
102
+ let width;
103
+ let height;
104
+ const videoMediaType = utils.deepAccess(bid, `mediaTypes.video`);
105
+ const playerSize = utils.deepAccess(bid, 'mediaTypes.video.playerSize');
106
+ const context = utils.deepAccess(bid, 'mediaTypes.video.context');
107
+ const floor = getFloor(bid, VIDEO);
108
+
109
+ // normalize config for video size
110
+ if (utils.isArray(bid.sizes) && bid.sizes.length === 2 && !utils.isArray(bid.sizes[0])) {
111
+ width = parseInt(bid.sizes[0], 10);
112
+ height = parseInt(bid.sizes[1], 10);
113
+ } else if (utils.isArray(bid.sizes) && utils.isArray(bid.sizes[0]) && bid.sizes[0].length === 2) {
114
+ width = parseInt(bid.sizes[0][0], 10);
115
+ height = parseInt(bid.sizes[0][1], 10);
116
+ } else if (utils.isArray(playerSize) && playerSize.length === 2) {
117
+ width = parseInt(playerSize[0], 10);
118
+ height = parseInt(playerSize[1], 10);
119
+ }
120
+
121
+ let data = getBaseRequest(bid, bidderRequest);
122
+ data.imp = [{
123
+ id: bid.bidId,
124
+ tagid: bid.params.unit,
125
+ video: {
126
+ w: width,
127
+ h: height,
128
+ topframe: utils.inIframe() ? 0 : 1
129
+ },
130
+ ext: {divid: bid.adUnitCode}
131
+ }];
132
+
133
+ enrichImp(data.imp[0], bid, floor);
134
+
135
+ if (context) {
136
+ if (context === 'instream') {
137
+ data.imp[0].video.placement = 1;
138
+ } else if (context === 'outstream') {
139
+ data.imp[0].video.placement = 4;
140
+ }
141
+ }
142
+
143
+ // backward compatability for video params
144
+ let videoParams = bid.params.video || bid.params.openrtb || {};
145
+ if (utils.isArray(videoParams.imp)) {
146
+ videoParams = videoParams[0].video;
147
+ }
148
+
149
+ Object.keys(videoParams)
150
+ .filter(param => includes(VIDEO_TARGETING, param))
151
+ .forEach(param => data.imp[0].video[param] = videoParams[param]);
152
+ Object.keys(videoMediaType)
153
+ .filter(param => includes(VIDEO_TARGETING, param))
154
+ .forEach(param => data.imp[0].video[param] = videoMediaType[param]);
155
+
156
+ return {
157
+ method: 'POST',
158
+ url: REQUEST_URL,
159
+ data: data
160
+ }
161
+ }
162
+
163
+ function getBaseRequest(bid, bidderRequest) {
164
+ let req = {
165
+ id: bidderRequest.auctionId,
166
+ cur: [config.getConfig('currency.adServerCurrency') || 'USD'],
167
+ at: 1,
168
+ tmax: config.getConfig('bidderTimeout'),
169
+ site: {
170
+ page: config.getConfig('pageUrl') || bidderRequest.refererInfo.referer
171
+ },
172
+ regs: {
173
+ coppa: (config.getConfig('coppa') === true || bid.params.coppa) ? 1 : 0,
174
+ },
175
+ device: {
176
+ dnt: (utils.getDNT() || bid.params.doNotTrack) ? 1 : 0,
177
+ h: screen.height,
178
+ w: screen.width,
179
+ ua: window.navigator.userAgent,
180
+ language: window.navigator.language.split('-').shift()
181
+ },
182
+ ext: {
183
+ bc: `${bidderConfig}_${bidderVersion}`
184
+ }
185
+ };
186
+
187
+ if (bid.params.platform) {
188
+ utils.deepSetValue(req, 'ext.platform', bid.params.platform);
189
+ }
190
+ if (bid.params.delDomain) {
191
+ utils.deepSetValue(req, 'ext.delDomain', bid.params.delDomain);
192
+ }
193
+ if (bid.params.test) {
194
+ req.test = 1
195
+ }
196
+ if (bidderRequest.gdprConsent) {
197
+ if (bidderRequest.gdprConsent.gdprApplies !== undefined) {
198
+ utils.deepSetValue(req, 'regs.ext.gdpr', bidderRequest.gdprConsent.gdprApplies === true ? 1 : 0);
199
+ }
200
+ if (bidderRequest.gdprConsent.consentString !== undefined) {
201
+ utils.deepSetValue(req, 'user.ext.consent', bidderRequest.gdprConsent.consentString);
202
+ }
203
+ if (bidderRequest.gdprConsent.addtlConsent !== undefined) {
204
+ utils.deepSetValue(req, 'user.ext.ConsentedProvidersSettings.consented_providers', bidderRequest.gdprConsent.addtlConsent);
205
+ }
206
+ }
207
+ if (bidderRequest.uspConsent) {
208
+ utils.deepSetValue(req, 'regs.ext.us_privacy', bidderRequest.uspConsent);
209
+ }
210
+ if (bid.schain) {
211
+ utils.deepSetValue(req, 'source.ext.schain', bid.schain);
212
+ }
213
+ if (bid.userIdAsEids) {
214
+ utils.deepSetValue(req, 'user.ext.eids', bid.userIdAsEids);
215
+ }
216
+ const commonFpd = bidderRequest.ortb2 || {};
217
+ if (commonFpd.site) {
218
+ utils.mergeDeep(req, {site: commonFpd.site});
219
+ }
220
+ if (commonFpd.user) {
221
+ utils.mergeDeep(req, {user: commonFpd.user});
222
+ }
223
+ return req;
224
+ }
225
+
226
+ function isVideoBid(bid) {
227
+ return utils.deepAccess(bid, 'mediaTypes.video');
228
+ }
229
+
230
+ function isBannerBid(bid) {
231
+ return utils.deepAccess(bid, 'mediaTypes.banner') || !isVideoBid(bid);
232
+ }
233
+
234
+ function getFloor(bid, mediaType) {
235
+ let floor = 0;
236
+
237
+ if (typeof bid.getFloor === 'function') {
238
+ const floorInfo = bid.getFloor({
239
+ currency: 'USD',
240
+ mediaType: mediaType,
241
+ size: '*'
242
+ });
243
+
244
+ if (typeof floorInfo === 'object' &&
245
+ floorInfo.currency === 'USD' &&
246
+ !isNaN(parseFloat(floorInfo.floor))) {
247
+ floor = Math.max(floor, parseFloat(floorInfo.floor));
248
+ }
249
+ }
250
+
251
+ return floor;
252
+ }
253
+
254
+ function interpretResponse(resp, req) {
255
+ // pass these from request to the responses for use in userSync
256
+ if (req.data.ext) {
257
+ if (req.data.ext.delDomain) {
258
+ utils.deepSetValue(resp, 'body.ext.delDomain', req.data.ext.delDomain);
259
+ }
260
+ if (req.data.ext.platform) {
261
+ utils.deepSetValue(resp, 'body.ext.platform', req.data.ext.platform);
262
+ }
263
+ }
264
+
265
+ const respBody = resp.body;
266
+ if ('nbr' in respBody) {
267
+ return [];
268
+ }
269
+
270
+ let bids = [];
271
+ respBody.seatbid.forEach(seatbid => {
272
+ bids = [...bids, ...seatbid.bid.map(bid => {
273
+ let response = {
274
+ requestId: bid.impid,
275
+ cpm: bid.price,
276
+ width: bid.w,
277
+ height: bid.h,
278
+ creativeId: bid.crid,
279
+ dealId: bid.dealid,
280
+ currency: respBody.cur || 'USD',
281
+ netRevenue: true,
282
+ ttl: 300,
283
+ mediaType: 'banner' in req.data.imp[0] ? BANNER : VIDEO,
284
+ meta: { advertiserDomains: bid.adomain }
285
+ };
286
+
287
+ if (response.mediaType === VIDEO) {
288
+ if (bid.nurl) {
289
+ response.vastUrl = bid.nurl;
290
+ } else {
291
+ response.vastXml = bid.adm;
292
+ }
293
+ } else {
294
+ response.ad = bid.adm;
295
+ }
296
+
297
+ if (bid.ext) {
298
+ response.meta.networkId = bid.ext.dsp_id;
299
+ response.meta.advertiserId = bid.ext.buyer_id;
300
+ response.meta.brandId = bid.ext.brand_id;
301
+ }
302
+
303
+ if (respBody.ext && respBody.ext.paf) {
304
+ response.meta.paf = respBody.ext.paf;
305
+ response.meta.paf.content_id = utils.deepAccess(bid, 'ext.paf.content_id');
306
+ }
307
+
308
+ return response
309
+ })];
310
+ });
311
+
312
+ return bids;
313
+ }
314
+
315
+ /**
316
+ * @param syncOptions
317
+ * @param responses
318
+ * @param gdprConsent
319
+ * @param uspConsent
320
+ * @return {{type: (string), url: (*|string)}[]}
321
+ */
322
+ function getUserSyncs(syncOptions, responses, gdprConsent, uspConsent) {
323
+ if (syncOptions.iframeEnabled || syncOptions.pixelEnabled) {
324
+ let pixelType = syncOptions.iframeEnabled ? 'iframe' : 'image';
325
+ let queryParamStrings = [];
326
+ let syncUrl = SYNC_URL;
327
+ if (gdprConsent) {
328
+ queryParamStrings.push('gdpr=' + (gdprConsent.gdprApplies ? 1 : 0));
329
+ queryParamStrings.push('gdpr_consent=' + encodeURIComponent(gdprConsent.consentString || ''));
330
+ }
331
+ if (uspConsent) {
332
+ queryParamStrings.push('us_privacy=' + encodeURIComponent(uspConsent));
333
+ }
334
+ if (responses.length > 0 && responses[0].body && responses[0].body.ext) {
335
+ const ext = responses[0].body.ext;
336
+ if (ext.delDomain) {
337
+ syncUrl = `https://${ext.delDomain}/w/1.0/pd`
338
+ } else if (ext.platform) {
339
+ queryParamStrings.push('ph=' + ext.platform)
340
+ }
341
+ } else {
342
+ queryParamStrings.push('ph=' + DEFAULT_PH)
343
+ }
344
+ return [{
345
+ type: pixelType,
346
+ url: `${syncUrl}${queryParamStrings.length > 0 ? '?' + queryParamStrings.join('&') : ''}`
347
+ }];
348
+ }
349
+ }
@@ -0,0 +1,105 @@
1
+ # Overview
2
+
3
+ ```
4
+ Module Name: OpenX OpenRTB Bidder Adapter
5
+ Module Type: Bidder Adapter
6
+ Maintainer: team-openx@openx.com
7
+ ```
8
+
9
+ # Description
10
+
11
+ This is an updated version of the OpenX bid adapter which calls our new serving architecture.
12
+ Publishers are welcome to test this adapter and give feedback. Please note you should only include either openxBidAdapter or openxOrtbBidAdapter in your build.
13
+
14
+ # Bid Parameters
15
+ ## Banner
16
+
17
+ | Name | Scope | Type | Description | Example
18
+ | ---- | ----- | ---- | ----------- | -------
19
+ | `delDomain` or `platform` | required | String | OpenX delivery domain or platform id provided by your OpenX representative. | "PUBLISHER-d.openx.net" or "555not5a-real-plat-form-id0123456789"
20
+ | `unit` | required | String | OpenX ad unit ID provided by your OpenX representative. | "1611023122"
21
+ | `customParams` | optional | Object | User-defined targeting key-value pairs. customParams applies to a specific unit. | `{key1: "v1", key2: ["v2","v3"]}`
22
+ | `customFloor` | optional | Number | Minimum price in USD. customFloor applies to a specific unit. For example, use the following value to set a $1.50 floor: 1.50 <br/><br/> **WARNING:**<br/> Misuse of this parameter can impact revenue | 1.50
23
+ | `doNotTrack` | optional | Boolean | Prevents advertiser from using data for this user. <br/><br/> **WARNING:**<br/> Request-level setting. May impact revenue. | true
24
+ | `coppa` | optional | Boolean | Enables Child's Online Privacy Protection Act (COPPA) regulations. | true
25
+
26
+ ## Video
27
+
28
+ | Name | Scope | Type | Description | Example
29
+ | ---- | ----- | ---- | ----------- | -------
30
+ | `unit` | required | String | OpenX ad unit ID provided by your OpenX representative. | "1611023122"
31
+ | `delDomain` | required | String | OpenX delivery domain provided by your OpenX representative. | "PUBLISHER-d.openx.net"
32
+ | `video` | optional | OpenRTB video subtypes | Alternatively can be added under adUnit.mediaTypes.video | `{ video: {mimes: ['video/mp4']}`
33
+
34
+
35
+ # Example
36
+ ```javascript
37
+ var adUnits = [
38
+ {
39
+ code: 'test-div',
40
+ sizes: [[728, 90]], // a display size
41
+ mediaTypes: {'banner': {}},
42
+ bids: [
43
+ {
44
+ bidder: 'openx',
45
+ params: {
46
+ unit: '539439964',
47
+ delDomain: 'se-demo-d.openx.net',
48
+ customParams: {
49
+ key1: 'v1',
50
+ key2: ['v2', 'v3']
51
+ },
52
+ }
53
+ }, {
54
+ bidder: 'openx',
55
+ params: {
56
+ unit: '539439964',
57
+ platform: 'a3aece0c-9e80-4316-8deb-faf804779bd1',
58
+ customParams: {
59
+ key1: 'v1',
60
+ key2: ['v2', 'v3']
61
+ },
62
+ }
63
+ }
64
+ ]
65
+ },
66
+ {
67
+ code: 'video1',
68
+ mediaTypes: {
69
+ video: {
70
+ playerSize: [640, 480],
71
+ context: 'instream'
72
+ }
73
+ },
74
+ bids: [{
75
+ bidder: 'openx',
76
+ params: {
77
+ unit: '1611023124',
78
+ delDomain: 'PUBLISHER-d.openx.net',
79
+ video: {
80
+ mimes: ['video/x-ms-wmv, video/mp4']
81
+ }
82
+ }
83
+ }]
84
+ }
85
+ ];
86
+ ```
87
+
88
+ # Configuration
89
+ Add the following code to enable user syncing. By default, Prebid.js version 0.34.0+ turns off user syncing through iframes.
90
+ OpenX strongly recommends enabling user syncing through iframes. This functionality improves DSP user match rates and increases the
91
+ OpenX bid rate and bid price. Be sure to call `pbjs.setConfig()` only once.
92
+
93
+ ```javascript
94
+ pbjs.setConfig({
95
+ userSync: {
96
+ iframeEnabled: true
97
+ }
98
+ });
99
+ ```
100
+
101
+ # Additional Details
102
+ [Banner Ads](https://docs.openx.com/publishers/prebid-adapter-web/)
103
+
104
+ [Video Ads](https://docs.openx.com/publishers/prebid-adapter-video/)
105
+
@@ -9,8 +9,7 @@ import * as events from '../src/events.js';
9
9
  import CONSTANTS from '../src/constants.json';
10
10
  import { getStorageManager } from '../src/storageManager.js';
11
11
 
12
- const MODULE_TYPE = 'fpid-module';
13
- const storage = getStorageManager({moduleType: MODULE_TYPE});
12
+ const storage = getStorageManager();
14
13
 
15
14
  const ID_NAME = '_pubcid';
16
15
  const OPTOUT_NAME = '_pubcid_optout';
@@ -1,7 +1,7 @@
1
- import {logError, replaceAuctionPrice} from '../src/utils.js';
2
- import {registerBidder} from '../src/adapters/bidderFactory.js';
3
- import {config} from '../src/config.js';
4
- import {BANNER, NATIVE} from '../src/mediaTypes.js';
1
+ import { logError, replaceAuctionPrice, triggerPixel, isStr } from '../src/utils.js';
2
+ import { registerBidder } from '../src/adapters/bidderFactory.js';
3
+ import { config } from '../src/config.js';
4
+ import { NATIVE, BANNER } from '../src/mediaTypes.js';
5
5
 
6
6
  export const ENDPOINT = 'https://app.readpeak.com/header/prebid';
7
7
 
@@ -64,8 +64,16 @@ export const spec = {
64
64
  };
65
65
  },
66
66
 
67
- interpretResponse: (response, request) =>
68
- bidResponseAvailable(request, response)
67
+ interpretResponse: (response, request) => {
68
+ return bidResponseAvailable(request, response)
69
+ },
70
+
71
+ onBidWon: (bid) => {
72
+ if (bid.burl && isStr(bid.burl)) {
73
+ bid.burl = replaceAuctionPrice(bid.burl, bid.cpm);
74
+ triggerPixel(bid.burl);
75
+ }
76
+ },
69
77
  };
70
78
 
71
79
  function bidResponseAvailable(bidRequest, bidResponse) {
@@ -103,6 +111,7 @@ function bidResponseAvailable(bidRequest, bidResponse) {
103
111
  bid.ad = idToBidMap[id].adm
104
112
  bid.width = idToBidMap[id].w
105
113
  bid.height = idToBidMap[id].h
114
+ bid.burl = idToBidMap[id].burl
106
115
  }
107
116
  if (idToBidMap[id].adomain) {
108
117
  bid.meta = {
@@ -1,4 +1,4 @@
1
- import { deepAccess, logWarn, getBidIdParameter, parseQueryStringParameters, triggerPixel, generateUUID, isArray } from '../src/utils.js';
1
+ import { deepAccess, logWarn, getBidIdParameter, parseQueryStringParameters, triggerPixel, generateUUID, isArray, isNumber } from '../src/utils.js';
2
2
  import { registerBidder } from '../src/adapters/bidderFactory.js';
3
3
  import { BANNER, VIDEO } from '../src/mediaTypes.js';
4
4
  import { Renderer } from '../src/Renderer.js';
@@ -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.7';
9
+ const ADAPTER_VERSION = '1.0.8';
10
10
  const DEFAULT_TTL = 300;
11
11
  const UUID_KEY = 'relaido_uuid';
12
12
 
@@ -44,7 +44,10 @@ function buildRequests(validBidRequests, bidderRequest) {
44
44
  let height = 0;
45
45
 
46
46
  if (hasVideoMediaType(bidRequest) && isVideoValid(bidRequest)) {
47
- const playerSize = getValidSizes(deepAccess(bidRequest, 'mediaTypes.video.playerSize'));
47
+ let playerSize = getValidSizes(deepAccess(bidRequest, 'mediaTypes.video.playerSize'));
48
+ if (playerSize.length === 0) {
49
+ playerSize = getValidSizes(deepAccess(bidRequest, 'params.video.playerSize'));
50
+ }
48
51
  width = playerSize[0][0];
49
52
  height = playerSize[0][1];
50
53
  mediaType = VIDEO;
@@ -253,7 +256,10 @@ function isBannerValid(bid) {
253
256
  }
254
257
 
255
258
  function isVideoValid(bid) {
256
- const playerSize = getValidSizes(deepAccess(bid, 'mediaTypes.video.playerSize'));
259
+ let playerSize = getValidSizes(deepAccess(bid, 'mediaTypes.video.playerSize'));
260
+ if (playerSize.length === 0) {
261
+ playerSize = getValidSizes(deepAccess(bid, 'params.video.playerSize'));
262
+ }
257
263
  if (playerSize.length > 0) {
258
264
  const context = deepAccess(bid, 'mediaTypes.video.context');
259
265
  if (context && context === 'outstream') {
@@ -300,6 +306,15 @@ function getValidSizes(sizes) {
300
306
  if ((width >= 300 && height >= 250)) {
301
307
  result.push([width, height]);
302
308
  }
309
+ } else if (isNumber(sizes[i])) {
310
+ const width = sizes[0];
311
+ const height = sizes[1];
312
+ if (width == 1 && height == 1) {
313
+ return [[1, 1]];
314
+ }
315
+ if ((width >= 300 && height >= 250)) {
316
+ return [[width, height]];
317
+ }
303
318
  }
304
319
  }
305
320
  }
@@ -287,6 +287,7 @@ function generateBidParameters(bid, bidderRequest) {
287
287
  floorPrice: Math.max(getFloor(bid, mediaType), params.floorPrice),
288
288
  bidId: getBidIdParameter('bidId', bid),
289
289
  bidderRequestId: getBidIdParameter('bidderRequestId', bid),
290
+ loop: getBidIdParameter('bidderRequestsCount', bid),
290
291
  transactionId: getBidIdParameter('transactionId', bid),
291
292
  };
292
293
 
@@ -147,6 +147,36 @@ function buildBidResponse(seedtagBid) {
147
147
  return bid;
148
148
  }
149
149
 
150
+ /**
151
+ *
152
+ * @returns Measure time to first byte implementation
153
+ * @see https://web.dev/ttfb/
154
+ * https://developer.mozilla.org/en-US/docs/Web/API/Navigation_timing_API
155
+ */
156
+ function ttfb() {
157
+ const ttfb = (() => {
158
+ // Timing API V2
159
+ try {
160
+ const entry = performance.getEntriesByType('navigation')[0];
161
+ return Math.round(entry.responseStart - entry.startTime);
162
+ } catch (e) {
163
+ // Timing API V1
164
+ try {
165
+ const entry = performance.timing;
166
+ return Math.round(entry.responseStart - entry.fetchStart);
167
+ } catch (e) {
168
+ // Timing API not available
169
+ return 0;
170
+ }
171
+ }
172
+ })();
173
+
174
+ // prevent negative or excessive value
175
+ // @see https://github.com/googleChrome/web-vitals/issues/162
176
+ // https://github.com/googleChrome/web-vitals/issues/137
177
+ return ttfb >= 0 && ttfb <= performance.now() ? ttfb : 0;
178
+ }
179
+
150
180
  export function getTimeoutUrl (data) {
151
181
  let queryParams = '';
152
182
  if (
@@ -195,7 +225,9 @@ export const spec = {
195
225
  timeout: bidderRequest.timeout,
196
226
  version: '$prebid.version$',
197
227
  connectionType: getConnectionType(),
198
- bidRequests: _map(validBidRequests, buildBidRequest)
228
+ auctionStart: bidderRequest.auctionStart || Date.now(),
229
+ ttfb: ttfb(),
230
+ bidRequests: _map(validBidRequests, buildBidRequest),
199
231
  };
200
232
 
201
233
  if (payload.cmp) {
@@ -5,13 +5,13 @@
5
5
  * @requires module:modules/userId
6
6
  */
7
7
 
8
- import {buildUrl, generateUUID, hasDeviceAccess, logInfo, parseUrl, triggerPixel} from '../src/utils.js';
8
+ import { parseUrl, buildUrl, triggerPixel, logInfo, hasDeviceAccess, generateUUID } from '../src/utils.js';
9
9
  import {submodule} from '../src/hook.js';
10
- import {coppaDataHandler} from '../src/adapterManager.js';
10
+ import { coppaDataHandler } from '../src/adapterManager.js';
11
11
  import {getStorageManager} from '../src/storageManager.js';
12
12
 
13
- const MODULE_TYPE = 'fpid-module';
14
- export const storage = getStorageManager({moduleName: 'pubCommonId', moduleType: MODULE_TYPE});
13
+ const GVLID = 887;
14
+ export const storage = getStorageManager({gvlid: GVLID, moduleName: 'pubCommonId'});
15
15
  const COOKIE = 'cookie';
16
16
  const LOCAL_STORAGE = 'html5';
17
17
  const OPTOUT_NAME = '_pubcid_optout';
@@ -74,6 +74,11 @@ export const sharedIdSystemSubmodule = {
74
74
  */
75
75
  name: 'sharedId',
76
76
  aliasName: 'pubCommonId',
77
+ /**
78
+ * Vendor id of prebid
79
+ * @type {Number}
80
+ */
81
+ gvlid: GVLID,
77
82
 
78
83
  /**
79
84
  * decode the stored id value for passing to bid requests
@@ -88,7 +93,8 @@ export const sharedIdSystemSubmodule = {
88
93
  return undefined;
89
94
  }
90
95
  logInfo(' Decoded value PubCommonId ' + value);
91
- return {'pubcid': value};
96
+ const idObj = {'pubcid': value};
97
+ return idObj;
92
98
  },
93
99
  /**
94
100
  * performs action to obtain id