prebid.js 7.44.0 → 7.45.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 (254) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/33acrossIdSystem.js +1 -1
  3. package/dist/acuityAdsBidAdapter.js +1 -1
  4. package/dist/adagioBidAdapter.js +1 -1
  5. package/dist/adbookpspBidAdapter.js +1 -1
  6. package/dist/adgenerationBidAdapter.js +1 -1
  7. package/dist/adrelevantisBidAdapter.js +1 -1
  8. package/dist/adtrgtmeBidAdapter.js +1 -1
  9. package/dist/adxcgBidAdapter.js +1 -1
  10. package/dist/adyoulikeBidAdapter.js +1 -1
  11. package/dist/ajaBidAdapter.js +1 -1
  12. package/dist/amxBidAdapter.js +1 -1
  13. package/dist/amxIdSystem.js +1 -1
  14. package/dist/appierAnalyticsAdapter.js +1 -1
  15. package/dist/appnexusBidAdapter.js +1 -1
  16. package/dist/appushBidAdapter.js +1 -1
  17. package/dist/asoBidAdapter.js +1 -1
  18. package/dist/axonixBidAdapter.js +1 -1
  19. package/dist/beyondmediaBidAdapter.js +1 -1
  20. package/dist/bidglassBidAdapter.js +1 -1
  21. package/dist/big-richmediaBidAdapter.js +1 -1
  22. package/dist/braveBidAdapter.js +1 -1
  23. package/dist/bridgewellBidAdapter.js +1 -1
  24. package/dist/brightMountainMediaBidAdapter.js +1 -1
  25. package/dist/brightcomBidAdapter.js +1 -1
  26. package/dist/brightcomSSPBidAdapter.js +1 -1
  27. package/dist/carodaBidAdapter.js +1 -1
  28. package/dist/chtnwBidAdapter.js +1 -1
  29. package/dist/coinzillaBidAdapter.js +1 -1
  30. package/dist/compassBidAdapter.js +1 -1
  31. package/dist/concertBidAdapter.js +1 -1
  32. package/dist/connectIdSystem.js +1 -1
  33. package/dist/connectadBidAdapter.js +1 -1
  34. package/dist/consumableBidAdapter.js +1 -1
  35. package/dist/contentexchangeBidAdapter.js +1 -1
  36. package/dist/conversantAnalyticsAdapter.js +1 -1
  37. package/dist/conversantBidAdapter.js +1 -1
  38. package/dist/craftBidAdapter.js +1 -1
  39. package/dist/criteoBidAdapter.js +1 -1
  40. package/dist/cwireBidAdapter.js +1 -1
  41. package/dist/dependencies.json +12 -0
  42. package/dist/domainOverrideToRootDomain.js +1 -0
  43. package/dist/dspxBidAdapter.js +1 -1
  44. package/dist/eplanningBidAdapter.js +1 -1
  45. package/dist/feedadBidAdapter.js +1 -1
  46. package/dist/finativeBidAdapter.js +1 -1
  47. package/dist/freewheel-sspBidAdapter.js +1 -1
  48. package/dist/glimpseBidAdapter.js +1 -1
  49. package/dist/globalsunBidAdapter.js +1 -1
  50. package/dist/gmosspBidAdapter.js +1 -1
  51. package/dist/goldbachBidAdapter.js +1 -1
  52. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  53. package/dist/gridBidAdapter.js +1 -1
  54. package/dist/gridNMBidAdapter.js +1 -1
  55. package/dist/growthCodeIdSystem.js +1 -1
  56. package/dist/gumgumBidAdapter.js +1 -1
  57. package/dist/h12mediaBidAdapter.js +1 -1
  58. package/dist/id5IdSystem.js +1 -1
  59. package/dist/improvedigitalBidAdapter.js +1 -1
  60. package/dist/inmarBidAdapter.js +1 -1
  61. package/dist/insticatorBidAdapter.js +1 -1
  62. package/dist/iqzoneBidAdapter.js +1 -1
  63. package/dist/ivsBidAdapter.js +1 -0
  64. package/dist/ixBidAdapter.js +1 -1
  65. package/dist/justpremiumBidAdapter.js +1 -1
  66. package/dist/jwplayerVideoProvider.js +1 -1
  67. package/dist/kargoBidAdapter.js +1 -1
  68. package/dist/koblerBidAdapter.js +1 -1
  69. package/dist/konduitAnalyticsAdapter.js +1 -1
  70. package/dist/kueezBidAdapter.js +1 -1
  71. package/dist/kueezRtbBidAdapter.js +1 -1
  72. package/dist/kulturemediaBidAdapter.js +1 -1
  73. package/dist/lassoBidAdapter.js +1 -1
  74. package/dist/lifestreetBidAdapter.js +1 -1
  75. package/dist/liveIntentIdSystem.js +1 -1
  76. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  77. package/dist/logicadBidAdapter.js +1 -1
  78. package/dist/loglyliftBidAdapter.js +1 -1
  79. package/dist/luponmediaBidAdapter.js +1 -1
  80. package/dist/magniteAnalyticsAdapter.js +1 -1
  81. package/dist/malltvAnalyticsAdapter.js +1 -1
  82. package/dist/marsmediaBidAdapter.js +1 -1
  83. package/dist/mathildeadsBidAdapter.js +1 -1
  84. package/dist/mediafuseBidAdapter.js +1 -1
  85. package/dist/medianetBidAdapter.js +1 -1
  86. package/dist/mediasquareBidAdapter.js +1 -1
  87. package/dist/mgidBidAdapter.js +1 -1
  88. package/dist/minutemediaBidAdapter.js +1 -1
  89. package/dist/minutemediaplusBidAdapter.js +1 -1
  90. package/dist/nexx360BidAdapter.js +1 -1
  91. package/dist/not-for-prod/prebid.js +158 -156
  92. package/dist/oguryBidAdapter.js +1 -1
  93. package/dist/onetagBidAdapter.js +1 -1
  94. package/dist/onomagicBidAdapter.js +1 -1
  95. package/dist/ooloAnalyticsAdapter.js +1 -1
  96. package/dist/openxBidAdapter.js +1 -1
  97. package/dist/openxOrtbBidAdapter.js +1 -1
  98. package/dist/operaadsBidAdapter.js +1 -1
  99. package/dist/optidigitalBidAdapter.js +1 -1
  100. package/dist/outbrainBidAdapter.js +1 -1
  101. package/dist/parrableIdSystem.js +1 -1
  102. package/dist/pixfutureBidAdapter.js +1 -1
  103. package/dist/prebid-core.js +1 -1
  104. package/dist/publinkIdSystem.js +1 -1
  105. package/dist/pubmaticBidAdapter.js +1 -1
  106. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  107. package/dist/pubxBidAdapter.js +1 -1
  108. package/dist/pxyzBidAdapter.js +1 -1
  109. package/dist/quantcastBidAdapter.js +1 -1
  110. package/dist/readpeakBidAdapter.js +1 -1
  111. package/dist/relaidoBidAdapter.js +1 -1
  112. package/dist/rhythmoneBidAdapter.js +1 -1
  113. package/dist/riseBidAdapter.js +1 -1
  114. package/dist/rubiconAnalyticsAdapter.js +1 -1
  115. package/dist/rubiconBidAdapter.js +1 -1
  116. package/dist/seedingAllianceBidAdapter.js +1 -1
  117. package/dist/seedtagBidAdapter.js +1 -1
  118. package/dist/sharedIdSystem.js +1 -1
  119. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  120. package/dist/sharethroughBidAdapter.js +1 -1
  121. package/dist/shinezBidAdapter.js +1 -1
  122. package/dist/smaatoBidAdapter.js +1 -1
  123. package/dist/smartadserverBidAdapter.js +1 -1
  124. package/dist/smarthubBidAdapter.js +1 -1
  125. package/dist/smartxBidAdapter.js +1 -1
  126. package/dist/smilewantedBidAdapter.js +1 -1
  127. package/dist/sonobiBidAdapter.js +1 -1
  128. package/dist/sovrnAnalyticsAdapter.js +1 -1
  129. package/dist/sovrnBidAdapter.js +1 -1
  130. package/dist/sspBCBidAdapter.js +1 -1
  131. package/dist/stvBidAdapter.js +1 -1
  132. package/dist/sublimeBidAdapter.js +1 -1
  133. package/dist/synacormediaBidAdapter.js +1 -1
  134. package/dist/targetVideoBidAdapter.js +1 -1
  135. package/dist/teadsBidAdapter.js +1 -1
  136. package/dist/trionBidAdapter.js +1 -1
  137. package/dist/tripleliftBidAdapter.js +1 -1
  138. package/dist/truereachBidAdapter.js +1 -1
  139. package/dist/ttdBidAdapter.js +1 -1
  140. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  141. package/dist/uid2IdSystem.js +1 -1
  142. package/dist/underdogmediaBidAdapter.js +1 -1
  143. package/dist/undertoneBidAdapter.js +1 -1
  144. package/dist/userId.js +1 -1
  145. package/dist/vidazooBidAdapter.js +1 -1
  146. package/dist/videobyteBidAdapter.js +1 -1
  147. package/dist/videoheroesBidAdapter.js +1 -1
  148. package/dist/vidoomyBidAdapter.js +1 -1
  149. package/dist/visiblemeasuresBidAdapter.js +1 -1
  150. package/dist/visxBidAdapter.js +1 -1
  151. package/dist/vrtcalBidAdapter.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/yieldoneBidAdapter.js +1 -1
  159. package/libraries/domainOverrideToRootDomain/index.js +39 -0
  160. package/modules/acuityAdsBidAdapter.js +1 -1
  161. package/modules/amxBidAdapter.js +1 -1
  162. package/modules/amxIdSystem.js +23 -20
  163. package/modules/amxIdSystem.md +7 -7
  164. package/modules/appushBidAdapter.js +1 -1
  165. package/modules/beyondmediaBidAdapter.js +1 -1
  166. package/modules/braveBidAdapter.js +1 -1
  167. package/modules/brightcomBidAdapter.js +1 -1
  168. package/modules/brightcomSSPBidAdapter.js +1 -1
  169. package/modules/coinzillaBidAdapter.js +1 -2
  170. package/modules/compassBidAdapter.js +1 -1
  171. package/modules/connectIdSystem.js +96 -21
  172. package/modules/connectIdSystem.md +6 -5
  173. package/modules/contentexchangeBidAdapter.js +1 -1
  174. package/modules/freewheel-sspBidAdapter.js +8 -0
  175. package/modules/glimpseBidAdapter.js +1 -2
  176. package/modules/globalsunBidAdapter.js +1 -1
  177. package/modules/gridBidAdapter.js +1 -1
  178. package/modules/gridNMBidAdapter.js +1 -1
  179. package/modules/growthCodeIdSystem.js +18 -15
  180. package/modules/gumgumBidAdapter.js +1 -1
  181. package/modules/iqzoneBidAdapter.js +1 -1
  182. package/modules/ivsBidAdapter.js +85 -0
  183. package/modules/ivsBidAdapter.md +34 -0
  184. package/modules/ixBidAdapter.js +42 -105
  185. package/modules/jwplayerVideoProvider.js +25 -32
  186. package/modules/koblerBidAdapter.js +1 -2
  187. package/modules/kueezBidAdapter.js +1 -1
  188. package/modules/liveIntentIdSystem.js +8 -0
  189. package/modules/luponmediaBidAdapter.js +1 -1
  190. package/modules/magniteAnalyticsAdapter.js +76 -3
  191. package/modules/mathildeadsBidAdapter.js +1 -1
  192. package/modules/medianetBidAdapter.js +1 -1
  193. package/modules/mgidBidAdapter.js +178 -26
  194. package/modules/minutemediaBidAdapter.js +1 -1
  195. package/modules/oguryBidAdapter.js +3 -2
  196. package/modules/onomagicBidAdapter.js +1 -2
  197. package/modules/openxBidAdapter.js +192 -563
  198. package/modules/openxBidAdapter.md +22 -20
  199. package/modules/openxOrtbBidAdapter.js +13 -11
  200. package/modules/openxOrtbBidAdapter.md +5 -3
  201. package/modules/operaadsBidAdapter.js +1 -1
  202. package/modules/pubmaticBidAdapter.js +1 -1
  203. package/modules/pubxBidAdapter.js +5 -2
  204. package/modules/riseBidAdapter.js +1 -1
  205. package/modules/sharedIdSystem.js +4 -27
  206. package/modules/sharethroughBidAdapter.js +1 -1
  207. package/modules/shinezBidAdapter.js +1 -1
  208. package/modules/smarthubBidAdapter.js +1 -1
  209. package/modules/synacormediaBidAdapter.js +1 -3
  210. package/modules/truereachBidAdapter.js +1 -2
  211. package/modules/userId/eids.js +18 -0
  212. package/modules/userId/eids.md +16 -0
  213. package/modules/videoheroesBidAdapter.js +1 -1
  214. package/modules/vidoomyBidAdapter.js +22 -1
  215. package/modules/visiblemeasuresBidAdapter.js +1 -1
  216. package/modules/vrtcalBidAdapter.js +1 -1
  217. package/modules/yieldoneBidAdapter.js +1 -1
  218. package/package.json +1 -1
  219. package/src/Renderer.js +2 -1
  220. package/src/native.js +5 -1
  221. package/test/spec/auctionmanager_spec.js +2 -2
  222. package/test/spec/libraries/domainOverrideToRootDomain/index_spec.js +77 -0
  223. package/test/spec/modules/acuityAdsBidAdapter_spec.js +2 -1
  224. package/test/spec/modules/amxIdSystem_spec.js +13 -26
  225. package/test/spec/modules/appushBidAdapter_spec.js +2 -1
  226. package/test/spec/modules/beyondmediaBidAdapter_spec.js +2 -1
  227. package/test/spec/modules/compassBidAdapter_spec.js +2 -1
  228. package/test/spec/modules/connectIdSystem_spec.js +420 -242
  229. package/test/spec/modules/contentexchangeBidAdapter_spec.js +2 -1
  230. package/test/spec/modules/eids_spec.js +30 -0
  231. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +37 -0
  232. package/test/spec/modules/globalsunBidAdapter_spec.js +2 -1
  233. package/test/spec/modules/iqzoneBidAdapter_spec.js +2 -1
  234. package/test/spec/modules/ivsBidAdapter_spec.js +197 -0
  235. package/test/spec/modules/ixBidAdapter_spec.js +84 -71
  236. package/test/spec/modules/koblerBidAdapter_spec.js +0 -20
  237. package/test/spec/modules/liveIntentIdSystem_spec.js +10 -0
  238. package/test/spec/modules/luponmediaBidAdapter_spec.js +1 -1
  239. package/test/spec/modules/magniteAnalyticsAdapter_spec.js +129 -1
  240. package/test/spec/modules/mathildeadsBidAdapter_spec.js +2 -1
  241. package/test/spec/modules/mgidBidAdapter_spec.js +184 -36
  242. package/test/spec/modules/oguryBidAdapter_spec.js +19 -4
  243. package/test/spec/modules/openxBidAdapter_spec.js +1157 -1936
  244. package/test/spec/modules/openxOrtbBidAdapter_spec.js +12 -39
  245. package/test/spec/modules/pubxBidAdapter_spec.js +10 -2
  246. package/test/spec/modules/sharedIdSystem_spec.js +0 -46
  247. package/test/spec/modules/sharethroughBidAdapter_spec.js +2 -1
  248. package/test/spec/modules/smarthubBidAdapter_spec.js +2 -1
  249. package/test/spec/modules/synacormediaBidAdapter_spec.js +0 -26
  250. package/test/spec/modules/videoModule/submodules/jwplayerVideoProvider_spec.js +17 -4
  251. package/test/spec/modules/vidoomyBidAdapter_spec.js +35 -0
  252. package/test/spec/modules/visiblemeasuresBidAdapter_spec.js +2 -1
  253. package/test/spec/modules/vrtcalBidAdapter_spec.js +3 -2
  254. package/test/spec/renderer_spec.js +1 -2
@@ -1,609 +1,238 @@
1
- import {
2
- _each,
3
- _map,
4
- convertTypes,
5
- deepAccess,
6
- deepSetValue,
7
- inIframe,
8
- isArray,
9
- parseSizesInput,
10
- parseUrl
11
- } from '../src/utils.js';
12
1
  import {config} from '../src/config.js';
13
2
  import {registerBidder} from '../src/adapters/bidderFactory.js';
3
+ import * as utils from '../src/utils.js';
4
+ import {mergeDeep} from '../src/utils.js';
14
5
  import {BANNER, VIDEO} from '../src/mediaTypes.js';
15
- import {includes} from '../src/polyfill.js';
6
+ import {ortbConverter} from '../libraries/ortbConverter/converter.js';
16
7
 
17
- const SUPPORTED_AD_TYPES = [BANNER, VIDEO];
18
- const VIDEO_TARGETING = ['startdelay', 'mimes', 'minduration', 'maxduration',
19
- 'startdelay', 'skippable', 'playbackmethod', 'api', 'protocols', 'boxingallowed',
20
- 'linearity', 'delivery', 'protocol', 'placement', 'minbitrate', 'maxbitrate'];
21
- const BIDDER_CODE = 'openx';
22
- const BIDDER_CONFIG = 'hb_pb';
23
- const BIDDER_VERSION = '3.0.3';
24
-
25
- const DEFAULT_CURRENCY = 'USD';
26
-
27
- export const USER_ID_CODE_TO_QUERY_ARG = {
28
- britepoolid: 'britepoolid', // BritePool ID
29
- criteoId: 'criteoid', // CriteoID
30
- fabrickId: 'nuestarid', // Fabrick ID by Nuestar
31
- hadronId: 'audigentid', // Hadron ID from Audigent
32
- id5id: 'id5id', // ID5 ID
33
- idl_env: 'lre', // LiveRamp IdentityLink
34
- IDP: 'zeotapid', // zeotapIdPlus ID+
35
- idxId: 'idxid', // idIDx,
36
- intentIqId: 'intentiqid', // IntentIQ ID
37
- lipb: 'lipbid', // LiveIntent ID
38
- lotamePanoramaId: 'lotameid', // Lotame Panorama ID
39
- merkleId: 'merkleid', // Merkle ID
40
- netId: 'netid', // netID
41
- parrableId: 'parrableid', // Parrable ID
42
- pubcid: 'pubcid', // PubCommon ID
43
- quantcastId: 'quantcastid', // Quantcast ID
44
- tapadId: 'tapadid', // Tapad Id
45
- tdid: 'ttduuid', // The Trade Desk Unified ID
46
- uid2: 'uid2', // Unified ID 2.0
47
- admixerId: 'admixerid', // AdMixer ID
48
- deepintentId: 'deepintentid', // DeepIntent ID
49
- dmdId: 'dmdid', // DMD Marketing Corp ID
50
- nextrollId: 'nextrollid', // NextRoll ID
51
- novatiq: 'novatiqid', // Novatiq ID
52
- mwOpenLinkId: 'mwopenlinkid', // MediaWallah OpenLink ID
53
- dapId: 'dapid', // Akamai DAP ID
54
- amxId: 'amxid', // AMX RTB ID
55
- kpuid: 'kpuid', // Kinesso ID
56
- publinkId: 'publinkid', // Publisher Link
57
- naveggId: 'naveggid', // Navegg ID
58
- imuid: 'imuid', // IM-UID by Intimate Merger
59
- adtelligentId: 'adtelligentid' // Adtelligent ID
8
+ const bidderConfig = 'hb_pb_ortb';
9
+ const bidderVersion = '2.0';
10
+ export const REQUEST_URL = 'https://rtb.openx.net/openrtbb/prebidjs';
11
+ export const SYNC_URL = 'https://u.openx.net/w/1.0/pd';
12
+ export const DEFAULT_PH = '2d1251ae-7f3a-47cf-bd2a-2f288854a0ba';
13
+ export const spec = {
14
+ code: 'openx',
15
+ supportedMediaTypes: [BANNER, VIDEO],
16
+ isBidRequestValid,
17
+ buildRequests,
18
+ interpretResponse,
19
+ getUserSyncs,
20
+ transformBidParams
60
21
  };
61
22
 
62
- export const spec = {
63
- code: BIDDER_CODE,
64
- gvlid: 69,
65
- supportedMediaTypes: SUPPORTED_AD_TYPES,
66
- isBidRequestValid: function (bidRequest) {
67
- const hasDelDomainOrPlatform = bidRequest.params.delDomain || bidRequest.params.platform;
68
- if (deepAccess(bidRequest, 'mediaTypes.banner') && hasDelDomainOrPlatform) {
69
- return !!bidRequest.params.unit || deepAccess(bidRequest, 'mediaTypes.banner.sizes.length') > 0;
70
- }
23
+ registerBidder(spec);
71
24
 
72
- return !!(bidRequest.params.unit && hasDelDomainOrPlatform);
25
+ const converter = ortbConverter({
26
+ context: {
27
+ netRevenue: true,
28
+ ttl: 300
73
29
  },
74
- buildRequests: function (bidRequests, bidderRequest) {
75
- if (bidRequests.length === 0) {
76
- return [];
77
- }
78
-
79
- let requests = [];
80
- let [videoBids, bannerBids] = partitionByVideoBids(bidRequests);
81
-
82
- // build banner requests
83
- if (bannerBids.length > 0) {
84
- requests.push(buildOXBannerRequest(bannerBids, bidderRequest));
85
- }
86
- // build video requests
87
- if (videoBids.length > 0) {
88
- videoBids.forEach(videoBid => {
89
- requests.push(buildOXVideoRequest(videoBid, bidderRequest))
90
- });
30
+ imp(buildImp, bidRequest, context) {
31
+ const imp = buildImp(bidRequest, context);
32
+ mergeDeep(imp, {
33
+ tagid: bidRequest.params.unit,
34
+ ext: {
35
+ divid: bidRequest.adUnitCode
36
+ }
37
+ });
38
+ if (bidRequest.params.customParams) {
39
+ utils.deepSetValue(imp, 'ext.customParams', bidRequest.params.customParams);
91
40
  }
92
-
93
- return requests;
94
- },
95
- interpretResponse: function ({body: oxResponseObj}, serverRequest) {
96
- let mediaType = getMediaTypeFromRequest(serverRequest);
97
-
98
- return mediaType === VIDEO ? createVideoBidResponses(oxResponseObj, serverRequest.payload)
99
- : createBannerBidResponses(oxResponseObj, serverRequest.payload);
100
- },
101
- getUserSyncs: function (syncOptions, responses, gdprConsent, uspConsent) {
102
- if (syncOptions.iframeEnabled || syncOptions.pixelEnabled) {
103
- let pixelType = syncOptions.iframeEnabled ? 'iframe' : 'image';
104
- let url = deepAccess(responses, '0.body.ads.pixels') ||
105
- deepAccess(responses, '0.body.pixels') ||
106
- generateDefaultSyncUrl(gdprConsent, uspConsent);
107
-
108
- return [{
109
- type: pixelType,
110
- url: url
111
- }];
41
+ if (bidRequest.params.customFloor && !imp.bidfloor) {
42
+ imp.bidfloor = bidRequest.params.customFloor;
112
43
  }
44
+ return imp;
113
45
  },
114
- transformBidParams: function(params, isOpenRtb) {
115
- return convertTypes({
116
- 'unit': 'string',
117
- 'customFloor': 'number'
118
- }, params);
119
- }
120
- };
121
-
122
- function generateDefaultSyncUrl(gdprConsent, uspConsent) {
123
- let url = 'https://u.openx.net/w/1.0/pd';
124
- let queryParamStrings = [];
125
-
126
- if (gdprConsent) {
127
- queryParamStrings.push('gdpr=' + (gdprConsent.gdprApplies ? 1 : 0));
128
- queryParamStrings.push('gdpr_consent=' + encodeURIComponent(gdprConsent.consentString || ''));
129
- }
130
-
131
- // CCPA
132
- if (uspConsent) {
133
- queryParamStrings.push('us_privacy=' + encodeURIComponent(uspConsent));
134
- }
135
-
136
- return `${url}${queryParamStrings.length > 0 ? '?' + queryParamStrings.join('&') : ''}`;
137
- }
138
-
139
- function isVideoRequest(bidRequest) {
140
- return (deepAccess(bidRequest, 'mediaTypes.video') && !deepAccess(bidRequest, 'mediaTypes.banner')) || bidRequest.mediaType === VIDEO;
141
- }
142
-
143
- function createBannerBidResponses(oxResponseObj, {bids, startTime}) {
144
- let adUnits = oxResponseObj.ads.ad;
145
- let bidResponses = [];
146
- for (let i = 0; i < adUnits.length; i++) {
147
- let adUnit = adUnits[i];
148
- let adUnitIdx = parseInt(adUnit.idx, 10);
149
- let bidResponse = {};
150
-
151
- bidResponse.requestId = bids[adUnitIdx].bidId;
152
-
153
- if (adUnit.pub_rev) {
154
- bidResponse.cpm = Number(adUnit.pub_rev) / 1000;
155
- } else {
156
- // No fill, do not add the bidresponse
157
- continue;
46
+ request(buildRequest, imps, bidderRequest, context) {
47
+ const req = buildRequest(imps, bidderRequest, context);
48
+ mergeDeep(req, {
49
+ at: 1,
50
+ ext: {
51
+ bc: `${bidderConfig}_${bidderVersion}`
52
+ }
53
+ })
54
+ const bid = context.bidRequests[0];
55
+ if (bid.params.coppa) {
56
+ utils.deepSetValue(req, 'regs.coppa', 1);
158
57
  }
159
- let creative = adUnit.creative[0];
160
- if (creative) {
161
- bidResponse.width = creative.width;
162
- bidResponse.height = creative.height;
58
+ if (bid.params.doNotTrack) {
59
+ utils.deepSetValue(req, 'device.dnt', 1);
163
60
  }
164
- bidResponse.creativeId = creative.id;
165
- bidResponse.ad = adUnit.html;
166
- if (adUnit.deal_id) {
167
- bidResponse.dealId = adUnit.deal_id;
61
+ if (bid.params.platform) {
62
+ utils.deepSetValue(req, 'ext.platform', bid.params.platform);
168
63
  }
169
- // default 5 mins
170
- bidResponse.ttl = 300;
171
- // true is net, false is gross
172
- bidResponse.netRevenue = true;
173
- bidResponse.currency = adUnit.currency;
174
-
175
- // additional fields to add
176
- if (adUnit.tbd) {
177
- bidResponse.tbd = adUnit.tbd;
64
+ if (bid.params.delDomain) {
65
+ utils.deepSetValue(req, 'ext.delDomain', bid.params.delDomain);
178
66
  }
179
- bidResponse.ts = adUnit.ts;
180
-
181
- bidResponse.meta = {};
182
- if (adUnit.brand_id) {
183
- bidResponse.meta.brandId = adUnit.brand_id;
67
+ if (bid.params.response_template_name) {
68
+ utils.deepSetValue(req, 'ext.response_template_name', bid.params.response_template_name);
184
69
  }
185
-
186
- if (adUnit.adomain && length(adUnit.adomain) > 0) {
187
- bidResponse.meta.advertiserDomains = adUnit.adomain;
188
- } else {
189
- bidResponse.meta.advertiserDomains = [];
70
+ if (bid.params.test) {
71
+ req.test = 1
190
72
  }
191
-
192
- if (adUnit.adv_id) {
193
- bidResponse.meta.dspid = adUnit.adv_id;
194
- }
195
-
196
- bidResponses.push(bidResponse);
197
- }
198
- return bidResponses;
199
- }
200
-
201
- function getViewportDimensions(isIfr) {
202
- let width;
203
- let height;
204
- let tWin = window;
205
- let tDoc = document;
206
- let docEl = tDoc.documentElement;
207
- let body;
208
-
209
- if (isIfr) {
210
- try {
211
- tWin = window.top;
212
- tDoc = window.top.document;
213
- } catch (e) {
214
- return;
73
+ return req;
74
+ },
75
+ bidResponse(buildBidResponse, bid, context) {
76
+ const bidResponse = buildBidResponse(bid, context);
77
+ if (bid.ext) {
78
+ bidResponse.meta.networkId = bid.ext.dsp_id;
79
+ bidResponse.meta.advertiserId = bid.ext.buyer_id;
80
+ bidResponse.meta.brandId = bid.ext.brand_id;
81
+ }
82
+ const {ortbResponse} = context;
83
+ if (ortbResponse.ext && ortbResponse.ext.paf) {
84
+ bidResponse.meta.paf = Object.assign({}, ortbResponse.ext.paf);
85
+ bidResponse.meta.paf.content_id = utils.deepAccess(bid, 'ext.paf.content_id');
86
+ }
87
+ return bidResponse;
88
+ },
89
+ response(buildResponse, bidResponses, ortbResponse, context) {
90
+ // pass these from request to the responses for use in userSync
91
+ const {ortbRequest} = context;
92
+ if (ortbRequest.ext) {
93
+ if (ortbRequest.ext.delDomain) {
94
+ utils.deepSetValue(ortbResponse, 'ext.delDomain', ortbRequest.ext.delDomain);
95
+ }
96
+ if (ortbRequest.ext.platform) {
97
+ utils.deepSetValue(ortbResponse, 'ext.platform', ortbRequest.ext.platform);
98
+ }
215
99
  }
216
- body = tDoc.body;
217
-
218
- width = tWin.innerWidth || docEl.clientWidth || body.clientWidth;
219
- height = tWin.innerHeight || docEl.clientHeight || body.clientHeight;
220
- } else {
221
- width = tWin.innerWidth || docEl.clientWidth;
222
- height = tWin.innerHeight || docEl.clientHeight;
223
- }
224
-
225
- return `${width}x${height}`;
226
- }
227
-
228
- function formatCustomParms(customKey, customParams) {
229
- let value = customParams[customKey];
230
- if (isArray(value)) {
231
- // if value is an array, join them with commas first
232
- value = value.join(',');
233
- }
234
- // return customKey=customValue format, escaping + to . and / to _
235
- return (customKey.toLowerCase() + '=' + value.toLowerCase()).replace('+', '.').replace('/', '_')
236
- }
237
-
238
- function partitionByVideoBids(bidRequests) {
239
- return bidRequests.reduce(function (acc, bid) {
240
- // Fallback to banner ads if nothing specified
241
- if (isVideoRequest(bid)) {
242
- acc[0].push(bid);
100
+ const response = buildResponse(bidResponses, ortbResponse, context);
101
+ // TODO: we may want to standardize this and move fledge logic to ortbConverter
102
+ let fledgeAuctionConfigs = utils.deepAccess(ortbResponse, 'ext.fledge_auction_configs');
103
+ if (fledgeAuctionConfigs) {
104
+ fledgeAuctionConfigs = Object.entries(fledgeAuctionConfigs).map(([bidId, cfg]) => {
105
+ return {
106
+ bidId,
107
+ config: Object.assign({
108
+ auctionSignals: {},
109
+ }, cfg)
110
+ }
111
+ });
112
+ return {
113
+ bids: response.bids,
114
+ fledgeAuctionConfigs,
115
+ }
243
116
  } else {
244
- acc[1].push(bid);
245
- }
246
- return acc;
247
- }, [[], []]);
248
- }
249
-
250
- function getMediaTypeFromRequest(serverRequest) {
251
- return /avjp$/.test(serverRequest.url) ? VIDEO : BANNER;
252
- }
253
-
254
- function buildCommonQueryParamsFromBids(bids, bidderRequest) {
255
- const isInIframe = inIframe();
256
- let defaultParams;
257
-
258
- defaultParams = {
259
- ju: bidderRequest.refererInfo.page,
260
- ch: document.charSet || document.characterSet,
261
- res: `${screen.width}x${screen.height}x${screen.colorDepth}`,
262
- ifr: isInIframe,
263
- tz: new Date().getTimezoneOffset(),
264
- tws: getViewportDimensions(isInIframe),
265
- be: 1,
266
- bc: bids[0].params.bc || `${BIDDER_CONFIG}_${BIDDER_VERSION}`,
267
- dddid: _map(bids, bid => bid.transactionId).join(','),
268
- nocache: new Date().getTime()
269
- };
270
-
271
- const userAgentClientHints = deepAccess(bidderRequest, 'ortb2.device.sua');
272
- if (userAgentClientHints) {
273
- defaultParams.sua = JSON.stringify(userAgentClientHints);
274
- }
275
-
276
- const userDataSegments = buildFpdQueryParams('user.data', bidderRequest.ortb2);
277
- if (userDataSegments.length > 0) {
278
- defaultParams.sm = userDataSegments;
279
- }
280
-
281
- const siteContentDataSegments = buildFpdQueryParams('site.content.data', bidderRequest.ortb2);
282
- if (siteContentDataSegments.length > 0) {
283
- defaultParams.scsm = siteContentDataSegments;
284
- }
285
-
286
- if (bids[0].params.platform) {
287
- defaultParams.ph = bids[0].params.platform;
288
- }
289
-
290
- if (bidderRequest.gdprConsent) {
291
- let gdprConsentConfig = bidderRequest.gdprConsent;
292
-
293
- if (gdprConsentConfig.consentString !== undefined) {
294
- defaultParams.gdpr_consent = gdprConsentConfig.consentString;
295
- }
296
-
297
- if (gdprConsentConfig.gdprApplies !== undefined) {
298
- defaultParams.gdpr = gdprConsentConfig.gdprApplies ? 1 : 0;
117
+ return response.bids
299
118
  }
300
-
301
- if (config.getConfig('consentManagement.cmpApi') === 'iab') {
302
- defaultParams.x_gdpr_f = 1;
303
- }
304
- }
305
-
306
- if (bidderRequest && bidderRequest.uspConsent) {
307
- defaultParams.us_privacy = bidderRequest.uspConsent;
308
- }
309
-
310
- // normalize publisher common id
311
- if (deepAccess(bids[0], 'crumbs.pubcid')) {
312
- deepSetValue(bids[0], 'userId.pubcid', deepAccess(bids[0], 'crumbs.pubcid'));
313
- }
314
- defaultParams = appendUserIdsToQueryParams(defaultParams, bids[0].userId);
315
-
316
- // supply chain support
317
- if (bids[0].schain) {
318
- defaultParams.schain = serializeSupplyChain(bids[0].schain);
319
- }
320
-
321
- return defaultParams;
322
- }
323
-
324
- function buildFpdQueryParams(fpdPath, ortb2) {
325
- const firstPartyData = deepAccess(ortb2, fpdPath);
326
- if (!Array.isArray(firstPartyData) || !firstPartyData.length) {
327
- return '';
328
- }
329
- const fpd = firstPartyData
330
- .filter(
331
- data => (Array.isArray(data.segment) &&
332
- data.segment.length > 0 &&
333
- data.name !== undefined &&
334
- data.name.length > 0)
335
- )
336
- .reduce((acc, data) => {
337
- const name = typeof data.ext === 'object' && data.ext.segtax ? `${data.name}/${data.ext.segtax}` : data.name;
338
- acc[name] = (acc[name] || []).concat(data.segment.map(seg => seg.id));
339
- return acc;
340
- }, {})
341
- return Object.keys(fpd)
342
- .map((name, _) => name + ':' + fpd[name].join('|'))
343
- .join(',')
344
- }
345
-
346
- function appendUserIdsToQueryParams(queryParams, userIds) {
347
- _each(userIds, (userIdObjectOrValue, userIdProviderKey) => {
348
- const key = USER_ID_CODE_TO_QUERY_ARG[userIdProviderKey];
349
-
350
- if (USER_ID_CODE_TO_QUERY_ARG.hasOwnProperty(userIdProviderKey)) {
351
- switch (userIdProviderKey) {
352
- case 'merkleId':
353
- queryParams[key] = userIdObjectOrValue.id;
354
- break;
355
- case 'uid2':
356
- queryParams[key] = userIdObjectOrValue.id;
357
- break;
358
- case 'lipb':
359
- queryParams[key] = userIdObjectOrValue.lipbid;
360
- if (Array.isArray(userIdObjectOrValue.segments) && userIdObjectOrValue.segments.length > 0) {
361
- const liveIntentSegments = 'liveintent:' + userIdObjectOrValue.segments.join('|');
362
- queryParams.sm = `${queryParams.sm ? queryParams.sm + ',' : ''}${liveIntentSegments}`;
119
+ },
120
+ overrides: {
121
+ imp: {
122
+ bidfloor(setBidFloor, imp, bidRequest, context) {
123
+ // enforce floors should always be in USD
124
+ // TODO: does it make sense that request.cur can be any currency, but request.imp[].bidfloorcur must be USD?
125
+ const floor = {};
126
+ setBidFloor(floor, bidRequest, {...context, currency: 'USD'});
127
+ if (floor.bidfloorcur === 'USD') {
128
+ Object.assign(imp, floor);
129
+ }
130
+ },
131
+ video(orig, imp, bidRequest, context) {
132
+ if (FEATURES.VIDEO) {
133
+ // `orig` is the video imp processor, which looks at bidRequest.mediaTypes[VIDEO]
134
+ // to populate imp.video
135
+ // alter its input `bidRequest` to also pick up parameters from `bidRequest.params`
136
+ let videoParams = bidRequest.mediaTypes[VIDEO];
137
+ if (videoParams) {
138
+ videoParams = Object.assign({}, videoParams, bidRequest.params.video);
139
+ bidRequest = {...bidRequest, mediaTypes: {[VIDEO]: videoParams}}
140
+ }
141
+ orig(imp, bidRequest, context);
142
+ if (imp.video && videoParams?.context === 'outstream') {
143
+ imp.video.placement = imp.video.placement || 4;
363
144
  }
364
- break;
365
- case 'parrableId':
366
- queryParams[key] = userIdObjectOrValue.eid;
367
- break;
368
- case 'id5id':
369
- queryParams[key] = userIdObjectOrValue.uid;
370
- break;
371
- case 'novatiq':
372
- queryParams[key] = userIdObjectOrValue.snowflake;
373
- break;
374
- default:
375
- queryParams[key] = userIdObjectOrValue;
145
+ }
376
146
  }
377
147
  }
378
- });
379
-
380
- return queryParams;
381
- }
382
-
383
- function serializeSupplyChain(supplyChain) {
384
- return `${supplyChain.ver},${supplyChain.complete}!${serializeSupplyChainNodes(supplyChain.nodes)}`;
385
- }
386
-
387
- function serializeSupplyChainNodes(supplyChainNodes) {
388
- const supplyChainNodePropertyOrder = ['asi', 'sid', 'hp', 'rid', 'name', 'domain'];
148
+ }
149
+ });
389
150
 
390
- return supplyChainNodes.map(supplyChainNode => {
391
- return supplyChainNodePropertyOrder.map(property => supplyChainNode[property] || '')
392
- .join(',');
393
- }).join('!');
151
+ function transformBidParams(params, isOpenRtb) {
152
+ return utils.convertTypes({
153
+ 'unit': 'string',
154
+ 'customFloor': 'number'
155
+ }, params);
394
156
  }
395
157
 
396
- function buildOXBannerRequest(bids, bidderRequest) {
397
- let customParamsForAllBids = [];
398
- let hasCustomParam = false;
399
- let queryParams = buildCommonQueryParamsFromBids(bids, bidderRequest);
400
- let auids = _map(bids, bid => bid.params.unit);
158
+ function isBidRequestValid(bidRequest) {
159
+ const hasDelDomainOrPlatform = bidRequest.params.delDomain ||
160
+ bidRequest.params.platform;
401
161
 
402
- queryParams.aus = _map(bids, bid => parseSizesInput(bid.mediaTypes.banner.sizes).join(',')).join('|');
403
- queryParams.divids = _map(bids, bid => encodeURIComponent(bid.adUnitCode)).join(',');
404
- // gpid
405
- queryParams.aucs = _map(bids, function (bid) {
406
- let gpid = deepAccess(bid, 'ortb2Imp.ext.data.pbadslot');
407
- return encodeURIComponent(gpid || '')
408
- }).join(',');
409
-
410
- if (auids.some(auid => auid)) {
411
- queryParams.auid = auids.join(',');
412
- }
413
-
414
- if (bids.some(bid => bid.params.doNotTrack)) {
415
- queryParams.ns = 1;
162
+ if (utils.deepAccess(bidRequest, 'mediaTypes.banner') &&
163
+ hasDelDomainOrPlatform) {
164
+ return !!bidRequest.params.unit ||
165
+ utils.deepAccess(bidRequest, 'mediaTypes.banner.sizes.length') > 0;
416
166
  }
417
167
 
418
- if (config.getConfig('coppa') === true || bids.some(bid => bid.params.coppa)) {
419
- queryParams.tfcd = 1;
420
- }
168
+ return !!(bidRequest.params.unit && hasDelDomainOrPlatform);
169
+ }
421
170
 
422
- bids.forEach(function (bid) {
423
- if (bid.params.customParams) {
424
- let customParamsForBid = _map(Object.keys(bid.params.customParams), customKey => formatCustomParms(customKey, bid.params.customParams));
425
- let formattedCustomParams = window.btoa(customParamsForBid.join('&'));
426
- hasCustomParam = true;
427
- customParamsForAllBids.push(formattedCustomParams);
428
- } else {
429
- customParamsForAllBids.push('');
430
- }
171
+ function buildRequests(bids, bidderRequest) {
172
+ let videoBids = bids.filter(bid => isVideoBid(bid));
173
+ let bannerBids = bids.filter(bid => isBannerBid(bid));
174
+ let requests = bannerBids.length ? [createRequest(bannerBids, bidderRequest, BANNER)] : [];
175
+ videoBids.forEach(bid => {
176
+ requests.push(createRequest([bid], bidderRequest, VIDEO));
431
177
  });
432
- if (hasCustomParam) {
433
- queryParams.tps = customParamsForAllBids.join(',');
434
- }
435
-
436
- enrichQueryWithFloors(queryParams, BANNER, bids);
437
-
438
- let url = queryParams.ph
439
- ? `https://u.openx.net/w/1.0/arj`
440
- : `https://${bids[0].params.delDomain}/w/1.0/arj`;
441
-
442
- return {
443
- method: 'GET',
444
- url: url,
445
- data: queryParams,
446
- payload: {'bids': bids, 'startTime': new Date()}
447
- };
178
+ return requests;
448
179
  }
449
180
 
450
- function buildOXVideoRequest(bid, bidderRequest) {
451
- let oxVideoParams = generateVideoParameters(bid, bidderRequest);
452
- let url = oxVideoParams.ph
453
- ? `https://u.openx.net/v/1.0/avjp`
454
- : `https://${bid.params.delDomain}/v/1.0/avjp`;
181
+ function createRequest(bidRequests, bidderRequest, mediaType) {
455
182
  return {
456
- method: 'GET',
457
- url: url,
458
- data: oxVideoParams,
459
- payload: {'bid': bid, 'startTime': new Date()}
460
- };
461
- }
462
-
463
- function generateVideoParameters(bid, bidderRequest) {
464
- const videoMediaType = deepAccess(bid, `mediaTypes.video`);
465
- let queryParams = buildCommonQueryParamsFromBids([bid], bidderRequest);
466
- let oxVideoConfig = deepAccess(bid, 'params.video') || {};
467
- let context = deepAccess(bid, 'mediaTypes.video.context');
468
- let playerSize = deepAccess(bid, 'mediaTypes.video.playerSize');
469
- let width;
470
- let height;
471
-
472
- // normalize config for video size
473
- if (isArray(bid.sizes) && bid.sizes.length === 2 && !isArray(bid.sizes[0])) {
474
- width = parseInt(bid.sizes[0], 10);
475
- height = parseInt(bid.sizes[1], 10);
476
- } else if (isArray(bid.sizes) && isArray(bid.sizes[0]) && bid.sizes[0].length === 2) {
477
- width = parseInt(bid.sizes[0][0], 10);
478
- height = parseInt(bid.sizes[0][1], 10);
479
- } else if (isArray(playerSize) && playerSize.length === 2) {
480
- width = parseInt(playerSize[0], 10);
481
- height = parseInt(playerSize[1], 10);
482
- }
483
-
484
- let openRtbParams = {w: width, h: height};
485
-
486
- // legacy openrtb params could be in video, openrtb, or video.openrtb
487
- let legacyParams = bid.params.video || bid.params.openrtb || {};
488
- if (legacyParams.openrtb) {
489
- legacyParams = legacyParams.openrtb;
490
- }
491
- // support for video object or full openrtb object
492
- if (isArray(legacyParams.imp)) {
493
- legacyParams = legacyParams.imp[0].video;
183
+ method: 'POST',
184
+ url: config.getConfig('openxOrtbUrl') || REQUEST_URL,
185
+ data: converter.toORTB({bidRequests, bidderRequest, context: {mediaType}})
494
186
  }
495
- Object.keys(legacyParams)
496
- .filter(param => includes(VIDEO_TARGETING, param))
497
- .forEach(param => openRtbParams[param] = legacyParams[param]);
498
-
499
- // 5.0 openrtb video params
500
- Object.keys(videoMediaType)
501
- .filter(param => includes(VIDEO_TARGETING, param))
502
- .forEach(param => openRtbParams[param] = videoMediaType[param]);
503
-
504
- let openRtbReq = {
505
- imp: [
506
- {
507
- video: openRtbParams
508
- }
509
- ]
510
- };
511
-
512
- queryParams['openrtb'] = JSON.stringify(openRtbReq);
513
-
514
- queryParams.auid = bid.params.unit;
515
- // override prebid config with openx config if available
516
- queryParams.vwd = width || oxVideoConfig.vwd;
517
- queryParams.vht = height || oxVideoConfig.vht;
518
-
519
- if (context === 'outstream') {
520
- queryParams.vos = '101';
521
- }
522
-
523
- if (oxVideoConfig.mimes) {
524
- queryParams.vmimes = oxVideoConfig.mimes;
525
- }
526
-
527
- if (bid.params.test) {
528
- queryParams.vtest = 1;
529
- }
530
-
531
- let gpid = deepAccess(bid, 'ortb2Imp.ext.data.pbadslot');
532
- if (gpid) {
533
- queryParams.aucs = encodeURIComponent(gpid);
534
- }
535
-
536
- // each video bid makes a separate request
537
- enrichQueryWithFloors(queryParams, VIDEO, [bid]);
538
-
539
- return queryParams;
540
187
  }
541
188
 
542
- function createVideoBidResponses(response, {bid, startTime}) {
543
- let bidResponses = [];
544
-
545
- if (response !== undefined && response.vastUrl !== '' && response.pub_rev > 0) {
546
- let vastQueryParams = parseUrl(response.vastUrl).search || {};
547
- let bidResponse = {};
548
- bidResponse.requestId = bid.bidId;
549
- if (response.deal_id) {
550
- bidResponse.dealId = response.deal_id;
551
- }
552
- // default 5 mins
553
- bidResponse.ttl = 300;
554
- // true is net, false is gross
555
- bidResponse.netRevenue = true;
556
- bidResponse.currency = response.currency;
557
- bidResponse.cpm = parseInt(response.pub_rev, 10) / 1000;
558
- bidResponse.width = parseInt(response.width, 10);
559
- bidResponse.height = parseInt(response.height, 10);
560
- bidResponse.creativeId = response.adid;
561
- bidResponse.vastUrl = response.vastUrl;
562
- bidResponse.mediaType = VIDEO;
189
+ function isVideoBid(bid) {
190
+ return utils.deepAccess(bid, 'mediaTypes.video');
191
+ }
563
192
 
564
- // enrich adunit with vast parameters
565
- response.ph = vastQueryParams.ph;
566
- response.colo = vastQueryParams.colo;
567
- response.ts = vastQueryParams.ts;
193
+ function isBannerBid(bid) {
194
+ return utils.deepAccess(bid, 'mediaTypes.banner') || !isVideoBid(bid);
195
+ }
568
196
 
569
- bidResponses.push(bidResponse);
197
+ function interpretResponse(resp, req) {
198
+ if (!resp.body) {
199
+ resp.body = {nbr: 0};
570
200
  }
571
-
572
- return bidResponses;
201
+ return converter.fromORTB({request: req.data, response: resp.body});
573
202
  }
574
203
 
575
- function enrichQueryWithFloors(queryParams, mediaType, bids) {
576
- let customFloorsForAllBids = [];
577
- let hasCustomFloor = false;
578
- bids.forEach(function (bid) {
579
- let floor = getBidFloor(bid, mediaType);
580
-
581
- if (floor) {
582
- customFloorsForAllBids.push(floor);
583
- hasCustomFloor = true;
204
+ /**
205
+ * @param syncOptions
206
+ * @param responses
207
+ * @param gdprConsent
208
+ * @param uspConsent
209
+ * @return {{type: (string), url: (*|string)}[]}
210
+ */
211
+ function getUserSyncs(syncOptions, responses, gdprConsent, uspConsent) {
212
+ if (syncOptions.iframeEnabled || syncOptions.pixelEnabled) {
213
+ let pixelType = syncOptions.iframeEnabled ? 'iframe' : 'image';
214
+ let queryParamStrings = [];
215
+ let syncUrl = SYNC_URL;
216
+ if (gdprConsent) {
217
+ queryParamStrings.push('gdpr=' + (gdprConsent.gdprApplies ? 1 : 0));
218
+ queryParamStrings.push('gdpr_consent=' + encodeURIComponent(gdprConsent.consentString || ''));
219
+ }
220
+ if (uspConsent) {
221
+ queryParamStrings.push('us_privacy=' + encodeURIComponent(uspConsent));
222
+ }
223
+ if (responses.length > 0 && responses[0].body && responses[0].body.ext) {
224
+ const ext = responses[0].body.ext;
225
+ if (ext.delDomain) {
226
+ syncUrl = `https://${ext.delDomain}/w/1.0/pd`
227
+ } else if (ext.platform) {
228
+ queryParamStrings.push('ph=' + ext.platform)
229
+ }
584
230
  } else {
585
- customFloorsForAllBids.push(0);
231
+ queryParamStrings.push('ph=' + DEFAULT_PH)
586
232
  }
587
- });
588
- if (hasCustomFloor) {
589
- queryParams.aumfs = customFloorsForAllBids.join(',');
233
+ return [{
234
+ type: pixelType,
235
+ url: `${syncUrl}${queryParamStrings.length > 0 ? '?' + queryParamStrings.join('&') : ''}`
236
+ }];
590
237
  }
591
238
  }
592
-
593
- function getBidFloor(bidRequest, mediaType) {
594
- let floorInfo = {};
595
- const currency = config.getConfig('currency.adServerCurrency') || DEFAULT_CURRENCY;
596
-
597
- if (typeof bidRequest.getFloor === 'function') {
598
- floorInfo = bidRequest.getFloor({
599
- currency: currency,
600
- mediaType: mediaType,
601
- size: '*'
602
- });
603
- }
604
- let floor = floorInfo.floor || bidRequest.params.customFloor || 0;
605
-
606
- return Math.round(floor * 1000); // normalize to micro currency
607
- }
608
-
609
- registerBidder(spec);