prebid.js 8.0.0 → 8.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/.devcontainer/devcontainer.json +3 -1
  2. package/dist/33acrossBidAdapter.js +1 -1
  3. package/dist/33acrossIdSystem.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/admanBidAdapter.js +1 -1
  8. package/dist/adqueryBidAdapter.js +1 -1
  9. package/dist/adrelevantisBidAdapter.js +1 -1
  10. package/dist/adtrgtmeBidAdapter.js +1 -1
  11. package/dist/adxcgBidAdapter.js +1 -1
  12. package/dist/adyoulikeBidAdapter.js +1 -1
  13. package/dist/ajaBidAdapter.js +1 -1
  14. package/dist/amxBidAdapter.js +1 -1
  15. package/dist/amxIdSystem.js +1 -1
  16. package/dist/appierAnalyticsAdapter.js +1 -1
  17. package/dist/appnexusBidAdapter.js +1 -1
  18. package/dist/asoBidAdapter.js +1 -1
  19. package/dist/axonixBidAdapter.js +1 -1
  20. package/dist/bedigitechBidAdapter.js +1 -1
  21. package/dist/beopBidAdapter.js +1 -1
  22. package/dist/bidglassBidAdapter.js +1 -1
  23. package/dist/bidwatchAnalyticsAdapter.js +1 -1
  24. package/dist/big-richmediaBidAdapter.js +1 -1
  25. package/dist/bridBidAdapter.js +1 -0
  26. package/dist/bridgewellBidAdapter.js +1 -1
  27. package/dist/brightMountainMediaBidAdapter.js +1 -1
  28. package/dist/carodaBidAdapter.js +1 -1
  29. package/dist/categoryTranslation.js +1 -1
  30. package/dist/chtnwBidAdapter.js +1 -1
  31. package/dist/cmp.js +1 -0
  32. package/dist/colossussspBidAdapter.js +1 -1
  33. package/dist/conceptxBidAdapter.js +1 -1
  34. package/dist/concertBidAdapter.js +1 -1
  35. package/dist/connectadBidAdapter.js +1 -1
  36. package/dist/consentManagement.js +1 -1
  37. package/dist/consentManagementGpp.js +1 -1
  38. package/dist/consentManagementUsp.js +1 -1
  39. package/dist/consumableBidAdapter.js +1 -1
  40. package/dist/conversantAnalyticsAdapter.js +1 -1
  41. package/dist/conversantBidAdapter.js +1 -1
  42. package/dist/craftBidAdapter.js +1 -1
  43. package/dist/criteoBidAdapter.js +1 -1
  44. package/dist/cwireBidAdapter.js +1 -1
  45. package/dist/dependencies.json +15 -0
  46. package/dist/dspxBidAdapter.js +1 -1
  47. package/dist/eplanningBidAdapter.js +1 -1
  48. package/dist/euidIdSystem.js +1 -1
  49. package/dist/feedadBidAdapter.js +1 -1
  50. package/dist/finativeBidAdapter.js +1 -1
  51. package/dist/freepassBidAdapter.js +1 -0
  52. package/dist/freewheel-sspBidAdapter.js +1 -1
  53. package/dist/gmosspBidAdapter.js +1 -1
  54. package/dist/goldbachBidAdapter.js +1 -1
  55. package/dist/gppControl_usnat.js +1 -0
  56. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  57. package/dist/greenbidsRtdProvider.js +1 -1
  58. package/dist/gridBidAdapter.js +1 -1
  59. package/dist/gumgumBidAdapter.js +1 -1
  60. package/dist/h12mediaBidAdapter.js +1 -1
  61. package/dist/hypelabBidAdapter.js +1 -1
  62. package/dist/id5IdSystem.js +1 -1
  63. package/dist/imdsBidAdapter.js +1 -1
  64. package/dist/improvedigitalBidAdapter.js +1 -1
  65. package/dist/insticatorBidAdapter.js +1 -1
  66. package/dist/intentIqIdSystem.js +1 -1
  67. package/dist/ixBidAdapter.js +1 -1
  68. package/dist/justpremiumBidAdapter.js +1 -1
  69. package/dist/kargoBidAdapter.js +1 -1
  70. package/dist/kiviadsBidAdapter.js +1 -0
  71. package/dist/konduitAnalyticsAdapter.js +1 -1
  72. package/dist/kueezBidAdapter.js +1 -1
  73. package/dist/kueezRtbBidAdapter.js +1 -1
  74. package/dist/kulturemediaBidAdapter.js +1 -1
  75. package/dist/lassoBidAdapter.js +1 -1
  76. package/dist/lifestreetBidAdapter.js +1 -1
  77. package/dist/liveIntentIdSystem.js +1 -1
  78. package/dist/logicadBidAdapter.js +1 -1
  79. package/dist/loglyliftBidAdapter.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/mediafuseBidAdapter.js +1 -1
  84. package/dist/mediasquareBidAdapter.js +1 -1
  85. package/dist/mgidBidAdapter.js +1 -1
  86. package/dist/mgidXBidAdapter.js +1 -0
  87. package/dist/minutemediaBidAdapter.js +1 -1
  88. package/dist/minutemediaplusBidAdapter.js +1 -1
  89. package/dist/mspa.js +1 -0
  90. package/dist/nexx360BidAdapter.js +1 -1
  91. package/dist/not-for-prod/prebid.js +146 -139
  92. package/dist/oguryBidAdapter.js +1 -1
  93. package/dist/onetagBidAdapter.js +1 -1
  94. package/dist/ooloAnalyticsAdapter.js +1 -1
  95. package/dist/optidigitalBidAdapter.js +1 -1
  96. package/dist/outbrainBidAdapter.js +1 -1
  97. package/dist/oxxionAnalyticsAdapter.js +1 -1
  98. package/dist/oxxionRtdProvider.js +1 -1
  99. package/dist/parrableIdSystem.js +1 -1
  100. package/dist/pixfutureBidAdapter.js +1 -1
  101. package/dist/prebid-core.js +1 -1
  102. package/dist/publinkIdSystem.js +1 -1
  103. package/dist/pubmaticBidAdapter.js +1 -1
  104. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  105. package/dist/pxyzBidAdapter.js +1 -1
  106. package/dist/quantcastBidAdapter.js +1 -1
  107. package/dist/readpeakBidAdapter.js +1 -1
  108. package/dist/relaidoBidAdapter.js +1 -1
  109. package/dist/retailspotBidAdapter.js +1 -1
  110. package/dist/rhythmoneBidAdapter.js +1 -1
  111. package/dist/riseBidAdapter.js +1 -1
  112. package/dist/rtbhouseBidAdapter.js +1 -1
  113. package/dist/rubiconBidAdapter.js +1 -1
  114. package/dist/seedingAllianceBidAdapter.js +1 -1
  115. package/dist/seedtagBidAdapter.js +1 -1
  116. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  117. package/dist/sharethroughBidAdapter.js +1 -1
  118. package/dist/shinezBidAdapter.js +1 -1
  119. package/dist/smaatoBidAdapter.js +1 -1
  120. package/dist/smartadserverBidAdapter.js +1 -1
  121. package/dist/smartxBidAdapter.js +1 -1
  122. package/dist/smilewantedBidAdapter.js +1 -1
  123. package/dist/sonobiBidAdapter.js +1 -1
  124. package/dist/sovrnAnalyticsAdapter.js +1 -1
  125. package/dist/sovrnBidAdapter.js +1 -1
  126. package/dist/sspBCBidAdapter.js +1 -1
  127. package/dist/stvBidAdapter.js +1 -1
  128. package/dist/sublimeBidAdapter.js +1 -1
  129. package/dist/targetVideoBidAdapter.js +1 -1
  130. package/dist/teadsBidAdapter.js +1 -1
  131. package/dist/trionBidAdapter.js +1 -1
  132. package/dist/tripleliftBidAdapter.js +1 -1
  133. package/dist/ttdBidAdapter.js +1 -1
  134. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  135. package/dist/uid2IdSystem.js +1 -1
  136. package/dist/underdogmediaBidAdapter.js +1 -1
  137. package/dist/undertoneBidAdapter.js +1 -1
  138. package/dist/userId.js +1 -1
  139. package/dist/vidazooBidAdapter.js +1 -1
  140. package/dist/videobyteBidAdapter.js +1 -1
  141. package/dist/visxBidAdapter.js +1 -1
  142. package/dist/vuukleBidAdapter.js +1 -1
  143. package/dist/widespaceBidAdapter.js +1 -1
  144. package/dist/winrBidAdapter.js +1 -1
  145. package/dist/yahoosspBidAdapter.js +1 -1
  146. package/dist/yieldmoBidAdapter.js +1 -1
  147. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  148. package/libraries/cmp/cmpClient.js +139 -0
  149. package/libraries/mspa/activityControls.js +91 -0
  150. package/modules/admanBidAdapter.js +5 -0
  151. package/modules/amxBidAdapter.js +11 -12
  152. package/modules/bedigitechBidAdapter.js +15 -12
  153. package/modules/bedigitechBidAdapter.md +2 -2
  154. package/modules/beopBidAdapter.js +0 -4
  155. package/modules/bidwatchAnalyticsAdapter.js +33 -5
  156. package/modules/bridBidAdapter.js +223 -0
  157. package/modules/categoryTranslation.js +3 -2
  158. package/modules/colossussspBidAdapter.js +9 -0
  159. package/modules/conceptxBidAdapter.js +6 -3
  160. package/modules/consentManagement.js +12 -86
  161. package/modules/consentManagementGpp.js +47 -126
  162. package/modules/consentManagementUsp.js +19 -97
  163. package/modules/freepassBidAdapter.js +98 -0
  164. package/modules/freepassBidAdapter.md +31 -0
  165. package/modules/freepassIdSystem.md +1 -1
  166. package/modules/gppControl_usnat.js +11 -0
  167. package/modules/greenbidsAnalyticsAdapter.js +7 -13
  168. package/modules/gridBidAdapter.js +3 -4
  169. package/modules/intentIqIdSystem.js +11 -9
  170. package/modules/ixBidAdapter.js +284 -55
  171. package/modules/kiviadsBidAdapter.js +212 -0
  172. package/modules/kiviadsBidAdapter.md +79 -0
  173. package/modules/liveIntentIdSystem.js +8 -3
  174. package/modules/mediasquareBidAdapter.js +19 -23
  175. package/modules/mgidXBidAdapter.js +263 -0
  176. package/modules/mgidXBidAdapter.md +79 -0
  177. package/modules/oxxionAnalyticsAdapter.js +33 -5
  178. package/modules/oxxionRtdProvider.js +124 -11
  179. package/modules/oxxionRtdProvider.md +19 -4
  180. package/modules/pubmaticBidAdapter.js +18 -2
  181. package/modules/rtbhouseBidAdapter.js +9 -2
  182. package/modules/rtbhouseBidAdapter.md +27 -8
  183. package/modules/rubiconBidAdapter.js +13 -1
  184. package/modules/sharethroughBidAdapter.js +14 -0
  185. package/modules/sonobiBidAdapter.js +4 -7
  186. package/modules/tripleliftBidAdapter.js +21 -1
  187. package/modules/userId/eids.js +29 -0
  188. package/modules/userId/eids.md +19 -2
  189. package/modules/userId/index.js +78 -29
  190. package/modules/userId/userId.md +3 -0
  191. package/package.json +1 -1
  192. package/src/activities/params.js +4 -1
  193. package/test/spec/libraries/cmp/cmpClient_spec.js +233 -0
  194. package/test/spec/libraries/mspa/activityControls_spec.js +315 -0
  195. package/test/spec/modules/admanBidAdapter_spec.js +8 -2
  196. package/test/spec/modules/adqueryBidAdapter_spec.js +5 -1
  197. package/test/spec/modules/amxBidAdapter_spec.js +6 -3
  198. package/test/spec/modules/bedigitechBidAdapter_spec.js +25 -36
  199. package/test/spec/modules/bidwatchAnalyticsAdapter_spec.js +21 -1
  200. package/test/spec/modules/bridBidAdapter_spec.js +129 -0
  201. package/test/spec/modules/byDataAnalyticsAdapter_spec.js +9 -7
  202. package/test/spec/modules/chtnwBidAdapter_spec.js +4 -1
  203. package/test/spec/modules/colossussspBidAdapter_spec.js +29 -0
  204. package/test/spec/modules/consentManagementGpp_spec.js +84 -7
  205. package/test/spec/modules/consentManagement_spec.js +8 -18
  206. package/test/spec/modules/datablocksBidAdapter_spec.js +7 -3
  207. package/test/spec/modules/eids_spec.js +87 -0
  208. package/test/spec/modules/freepassBidAdapter_spec.js +161 -0
  209. package/test/spec/modules/greenbidsAnalyticsAdapter_spec.js +0 -15
  210. package/test/spec/modules/gridBidAdapter_spec.js +29 -28
  211. package/test/spec/modules/insticatorBidAdapter_spec.js +6 -2
  212. package/test/spec/modules/intentIqIdSystem_spec.js +36 -2
  213. package/test/spec/modules/ixBidAdapter_spec.js +785 -15
  214. package/test/spec/modules/kiviadsBidAdapter_spec.js +404 -0
  215. package/test/spec/modules/lassoBidAdapter_spec.js +6 -4
  216. package/test/spec/modules/liveIntentIdMinimalSystem_spec.js +17 -2
  217. package/test/spec/modules/liveIntentIdSystem_spec.js +11 -6
  218. package/test/spec/modules/mediasquareBidAdapter_spec.js +3 -0
  219. package/test/spec/modules/mgidXBidAdapter_spec.js +426 -0
  220. package/test/spec/modules/onetagBidAdapter_spec.js +81 -75
  221. package/test/spec/modules/orbidderBidAdapter_spec.js +6 -3
  222. package/test/spec/modules/oxxionAnalyticsAdapter_spec.js +21 -2
  223. package/test/spec/modules/oxxionRtdProvider_spec.js +113 -1
  224. package/test/spec/modules/pubmaticBidAdapter_spec.js +25 -0
  225. package/test/spec/modules/relaidoBidAdapter_spec.js +4 -3
  226. package/test/spec/modules/rtbhouseBidAdapter_spec.js +35 -0
  227. package/test/spec/modules/rubiconBidAdapter_spec.js +41 -0
  228. package/test/spec/modules/sharethroughBidAdapter_spec.js +75 -0
  229. package/test/spec/modules/sonobiBidAdapter_spec.js +15 -15
  230. package/test/spec/modules/tripleliftBidAdapter_spec.js +20 -1
  231. package/test/spec/modules/ucfunnelBidAdapter_spec.js +37 -16
  232. package/test/spec/modules/userId_spec.js +393 -6
@@ -0,0 +1,79 @@
1
+ # Overview
2
+
3
+ ```
4
+ Module Name: KiviAds Bidder Adapter
5
+ Module Type: KiviAds Bidder Adapter
6
+ Maintainer: prebid@kiviads.com
7
+ ```
8
+
9
+ # Description
10
+
11
+ Connects to Kivi Ads exchange for bids.
12
+ KiviJS bid adapter supports Banner, Video (instream and outstream) and Native.
13
+
14
+ # Test Parameters
15
+ ```
16
+ var adUnits = [
17
+ // Will return static test banner
18
+ {
19
+ code: 'adunit1',
20
+ mediaTypes: {
21
+ banner: {
22
+ sizes: [ [300, 250], [320, 50] ],
23
+ }
24
+ },
25
+ bids: [
26
+ {
27
+ bidder: 'kiviads',
28
+ params: {
29
+ placementId: 'testBanner',
30
+ }
31
+ }
32
+ ]
33
+ },
34
+ {
35
+ code: 'addunit2',
36
+ mediaTypes: {
37
+ video: {
38
+ playerSize: [ [640, 480] ],
39
+ context: 'instream',
40
+ minduration: 5,
41
+ maxduration: 60,
42
+ }
43
+ },
44
+ bids: [
45
+ {
46
+ bidder: 'kiviads',
47
+ params: {
48
+ placementId: 'testVideo',
49
+ }
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ code: 'addunit3',
55
+ mediaTypes: {
56
+ native: {
57
+ title: {
58
+ required: true
59
+ },
60
+ body: {
61
+ required: true
62
+ },
63
+ icon: {
64
+ required: true,
65
+ size: [64, 64]
66
+ }
67
+ }
68
+ },
69
+ bids: [
70
+ {
71
+ bidder: 'kiviads',
72
+ params: {
73
+ placementId: 'testNative',
74
+ }
75
+ }
76
+ ]
77
+ }
78
+ ];
79
+ ```
@@ -14,6 +14,7 @@ import {MODULE_TYPE_UID} from '../src/activities/modules.js';
14
14
 
15
15
  const EVENTS_TOPIC = 'pre_lips'
16
16
  const MODULE_NAME = 'liveIntentId';
17
+ const LI_PROVIDER_DOMAIN = 'liveintent.com';
17
18
  export const storage = getStorageManager({moduleType: MODULE_TYPE_UID, moduleName: MODULE_NAME});
18
19
  const defaultRequestedAttributes = {'nonId': true}
19
20
  const calls = {
@@ -189,15 +190,19 @@ export const liveIntentIdSubmodule = {
189
190
  // As adapters are applied in lexicographical order, we will always
190
191
  // be overwritten by the 'proper' uid2 module if it is present.
191
192
  if (value.uid2) {
192
- result.uid2 = { 'id': value.uid2 }
193
+ result.uid2 = { 'id': value.uid2, ext: { provider: LI_PROVIDER_DOMAIN } }
193
194
  }
194
195
 
195
196
  if (value.bidswitch) {
196
- result.bidswitch = { 'id': value.bidswitch }
197
+ result.bidswitch = { 'id': value.bidswitch, ext: { provider: LI_PROVIDER_DOMAIN } }
197
198
  }
198
199
 
199
200
  if (value.medianet) {
200
- result.medianet = { 'id': value.medianet }
201
+ result.medianet = { 'id': value.medianet, ext: { provider: LI_PROVIDER_DOMAIN } }
202
+ }
203
+
204
+ if (value.magnite) {
205
+ result.magnite = { 'id': value.magnite, ext: { provider: LI_PROVIDER_DOMAIN } }
201
206
  }
202
207
 
203
208
  return result
@@ -120,23 +120,17 @@ export const spec = {
120
120
  netRevenue: value['net_revenue'],
121
121
  ttl: value['ttl'],
122
122
  ad: value['ad'],
123
- mediasquare: {
124
- 'bidder': value['bidder'],
125
- 'code': value['code']
126
- },
123
+ mediasquare: {},
127
124
  meta: {
128
125
  'advertiserDomains': value['adomain']
129
126
  }
130
127
  };
131
- if ('context' in value) {
132
- bidResponse['mediasquare']['context'] = value['context'];
133
- }
134
- if ('match' in value) {
135
- bidResponse['mediasquare']['match'] = value['match'];
136
- }
137
- if ('hasConsent' in value) {
138
- bidResponse['mediasquare']['hasConsent'] = value['hasConsent'];
139
- }
128
+ let paramsToSearchFor = ['bidder', 'code', 'match', 'hasConsent', 'context', 'increment'];
129
+ paramsToSearchFor.forEach(param => {
130
+ if (param in value) {
131
+ bidResponse['mediasquare'][param] = value[param];
132
+ }
133
+ });
140
134
  if ('native' in value) {
141
135
  bidResponse['native'] = value['native'];
142
136
  bidResponse['mediaType'] = 'native';
@@ -180,21 +174,23 @@ export const spec = {
180
174
  }
181
175
  let params = { pbjs: '$prebid.version$', referer: encodeURIComponent(getRefererInfo().page || getRefererInfo().topmostLocation) };
182
176
  let endpoint = document.location.search.match(/msq_test=true/) ? BIDDER_URL_TEST : BIDDER_URL_PROD;
183
- let paramsToSearchFor = ['bidder', 'code', 'match', 'hasConsent', 'context'];
177
+ let paramsToSearchFor = ['bidder', 'code', 'match', 'hasConsent', 'context', 'increment'];
184
178
  if (bid.hasOwnProperty('mediasquare')) {
185
- for (let i = 0; i < paramsToSearchFor.length; i++) {
186
- if (bid['mediasquare'].hasOwnProperty(paramsToSearchFor[i])) {
187
- params[paramsToSearchFor[i]] = bid['mediasquare'][paramsToSearchFor[i]];
179
+ paramsToSearchFor.forEach(param => {
180
+ if (bid['mediasquare'].hasOwnProperty(param)) {
181
+ params[param] = bid['mediasquare'][param];
188
182
  }
189
- }
183
+ });
190
184
  };
191
185
  paramsToSearchFor = ['cpm', 'size', 'mediaType', 'currency', 'creativeId', 'adUnitCode', 'timeToRespond', 'requestId', 'auctionId', 'originalCpm', 'originalCurrency'];
192
- for (let i = 0; i < paramsToSearchFor.length; i++) {
193
- if (bid.hasOwnProperty(paramsToSearchFor[i])) {
194
- params[paramsToSearchFor[i]] = bid[paramsToSearchFor[i]];
195
- if (typeof params[paramsToSearchFor[i]] == 'number') { params[paramsToSearchFor[i]] = params[paramsToSearchFor[i]].toString() }
186
+ paramsToSearchFor.forEach(param => {
187
+ if (bid.hasOwnProperty(param)) {
188
+ params[param] = bid[param];
189
+ if (typeof params[param] == 'number') {
190
+ params[param] = params[param].toString();
191
+ }
196
192
  }
197
- }
193
+ });
198
194
  ajax(endpoint + BIDDER_ENDPOINT_WINNING, null, JSON.stringify(params), {method: 'POST', withCredentials: true});
199
195
  return true;
200
196
  }
@@ -0,0 +1,263 @@
1
+ import {
2
+ isFn,
3
+ deepAccess,
4
+ logMessage,
5
+ logError,
6
+ isPlainObject,
7
+ isNumber,
8
+ isArray,
9
+ isStr
10
+ } from '../src/utils.js';
11
+ import { convertOrtbRequestToProprietaryNative } from '../src/native.js';
12
+
13
+ import { registerBidder } from '../src/adapters/bidderFactory.js';
14
+ import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
15
+ import { config } from '../src/config.js';
16
+ import { USERSYNC_DEFAULT_CONFIG } from '../src/userSync.js';
17
+
18
+ const BIDDER_CODE = 'mgidX';
19
+ const GVLID = 358;
20
+ const AD_URL = 'https://us-east-x.mgid.com/pbjs';
21
+ const PIXEL_SYNC_URL = 'https://cm.mgid.com/i.gif';
22
+ const IFRAME_SYNC_URL = 'https://cm.mgid.com/i.html';
23
+
24
+ function isBidResponseValid(bid) {
25
+ if (!bid.requestId || !bid.cpm || !bid.creativeId || !bid.ttl || !bid.currency) {
26
+ return false;
27
+ }
28
+
29
+ switch (bid.mediaType) {
30
+ case BANNER:
31
+ return Boolean(bid.width && bid.height && bid.ad);
32
+ case VIDEO:
33
+ return Boolean(bid.vastUrl || bid.vastXml);
34
+ case NATIVE:
35
+ return Boolean(bid.native && bid.native.impressionTrackers && bid.native.impressionTrackers.length);
36
+ default:
37
+ return false;
38
+ }
39
+ }
40
+
41
+ function getPlacementReqData(bid) {
42
+ const { params, bidId, mediaTypes } = bid;
43
+ const schain = bid.schain || {};
44
+ const { placementId, endpointId } = params;
45
+ const bidfloor = getBidFloor(bid);
46
+
47
+ const placement = {
48
+ bidId,
49
+ schain,
50
+ bidfloor
51
+ };
52
+
53
+ if (placementId) {
54
+ placement.placementId = placementId;
55
+ placement.type = 'publisher';
56
+ } else if (endpointId) {
57
+ placement.endpointId = endpointId;
58
+ placement.type = 'network';
59
+ }
60
+
61
+ if (mediaTypes && mediaTypes[BANNER]) {
62
+ placement.adFormat = BANNER;
63
+ placement.sizes = mediaTypes[BANNER].sizes;
64
+ } else if (mediaTypes && mediaTypes[VIDEO]) {
65
+ placement.adFormat = VIDEO;
66
+ placement.playerSize = mediaTypes[VIDEO].playerSize;
67
+ placement.minduration = mediaTypes[VIDEO].minduration;
68
+ placement.maxduration = mediaTypes[VIDEO].maxduration;
69
+ placement.mimes = mediaTypes[VIDEO].mimes;
70
+ placement.protocols = mediaTypes[VIDEO].protocols;
71
+ placement.startdelay = mediaTypes[VIDEO].startdelay;
72
+ placement.placement = mediaTypes[VIDEO].placement;
73
+ placement.skip = mediaTypes[VIDEO].skip;
74
+ placement.skipafter = mediaTypes[VIDEO].skipafter;
75
+ placement.minbitrate = mediaTypes[VIDEO].minbitrate;
76
+ placement.maxbitrate = mediaTypes[VIDEO].maxbitrate;
77
+ placement.delivery = mediaTypes[VIDEO].delivery;
78
+ placement.playbackmethod = mediaTypes[VIDEO].playbackmethod;
79
+ placement.api = mediaTypes[VIDEO].api;
80
+ placement.linearity = mediaTypes[VIDEO].linearity;
81
+ } else if (mediaTypes && mediaTypes[NATIVE]) {
82
+ placement.native = mediaTypes[NATIVE];
83
+ placement.adFormat = NATIVE;
84
+ }
85
+
86
+ return placement;
87
+ }
88
+
89
+ function getBidFloor(bid) {
90
+ if (!isFn(bid.getFloor)) {
91
+ return deepAccess(bid, 'params.bidfloor', 0);
92
+ }
93
+
94
+ try {
95
+ const bidFloor = bid.getFloor({
96
+ currency: 'USD',
97
+ mediaType: '*',
98
+ size: '*',
99
+ });
100
+ return bidFloor.floor;
101
+ } catch (err) {
102
+ logError(err);
103
+ return 0;
104
+ }
105
+ }
106
+
107
+ export const spec = {
108
+ code: BIDDER_CODE,
109
+ gvlid: GVLID,
110
+ supportedMediaTypes: [BANNER, VIDEO, NATIVE],
111
+
112
+ isBidRequestValid: (bid = {}) => {
113
+ const { params, bidId, mediaTypes } = bid;
114
+ let valid = Boolean(bidId && params && (params.placementId || params.endpointId));
115
+
116
+ if (mediaTypes && mediaTypes[BANNER]) {
117
+ valid = valid && Boolean(mediaTypes[BANNER] && mediaTypes[BANNER].sizes);
118
+ } else if (mediaTypes && mediaTypes[VIDEO]) {
119
+ valid = valid && Boolean(mediaTypes[VIDEO] && mediaTypes[VIDEO].playerSize);
120
+ } else if (mediaTypes && mediaTypes[NATIVE]) {
121
+ valid = valid && Boolean(mediaTypes[NATIVE]);
122
+ } else {
123
+ valid = false;
124
+ }
125
+ return valid;
126
+ },
127
+
128
+ buildRequests: (validBidRequests = [], bidderRequest = {}) => {
129
+ // convert Native ORTB definition to old-style prebid native definition
130
+ validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
131
+
132
+ let deviceWidth = 0;
133
+ let deviceHeight = 0;
134
+
135
+ let winLocation;
136
+ try {
137
+ const winTop = window.top;
138
+ deviceWidth = winTop.screen.width;
139
+ deviceHeight = winTop.screen.height;
140
+ winLocation = winTop.location;
141
+ } catch (e) {
142
+ logMessage(e);
143
+ winLocation = window.location;
144
+ }
145
+
146
+ const refferUrl = bidderRequest.refererInfo && bidderRequest.refererInfo.page;
147
+ let refferLocation;
148
+ try {
149
+ refferLocation = refferUrl && new URL(refferUrl);
150
+ } catch (e) {
151
+ logMessage(e);
152
+ }
153
+ let location = refferLocation || winLocation;
154
+ const language = (navigator && navigator.language) ? navigator.language.split('-')[0] : '';
155
+ const host = location.host;
156
+ const page = location.pathname;
157
+ const secure = location.protocol === 'https:' ? 1 : 0;
158
+ const placements = [];
159
+ const request = {
160
+ deviceWidth,
161
+ deviceHeight,
162
+ language,
163
+ secure,
164
+ host,
165
+ page,
166
+ placements,
167
+ coppa: config.getConfig('coppa') === true ? 1 : 0,
168
+ ccpa: bidderRequest.uspConsent || undefined,
169
+ gdpr: bidderRequest.gdprConsent || undefined,
170
+ tmax: config.getConfig('bidderTimeout')
171
+ };
172
+
173
+ const len = validBidRequests.length;
174
+ for (let i = 0; i < len; i++) {
175
+ const bid = validBidRequests[i];
176
+ placements.push(getPlacementReqData(bid));
177
+ }
178
+
179
+ return {
180
+ method: 'POST',
181
+ url: AD_URL,
182
+ data: request
183
+ };
184
+ },
185
+
186
+ interpretResponse: (serverResponse) => {
187
+ let response = [];
188
+ for (let i = 0; i < serverResponse.body.length; i++) {
189
+ let resItem = serverResponse.body[i];
190
+ if (isBidResponseValid(resItem)) {
191
+ const advertiserDomains = resItem.adomain && resItem.adomain.length ? resItem.adomain : [];
192
+ resItem.meta = { ...resItem.meta, advertiserDomains };
193
+
194
+ response.push(resItem);
195
+ }
196
+ }
197
+ return response;
198
+ },
199
+
200
+ getUserSyncs: (syncOptions, serverResponses, gdprConsent, uspConsent, gppConsent) => {
201
+ const spb = isPlainObject(config.getConfig('userSync')) &&
202
+ isNumber(config.getConfig('userSync').syncsPerBidder)
203
+ ? config.getConfig('userSync').syncsPerBidder : USERSYNC_DEFAULT_CONFIG.syncsPerBidder;
204
+
205
+ if (spb > 0 && isPlainObject(syncOptions) && (syncOptions.iframeEnabled || syncOptions.pixelEnabled)) {
206
+ let pixels = [];
207
+ if (serverResponses &&
208
+ isArray(serverResponses) &&
209
+ serverResponses.length > 0 &&
210
+ isPlainObject(serverResponses[0].body) &&
211
+ isPlainObject(serverResponses[0].body.ext) &&
212
+ isArray(serverResponses[0].body.ext.cm) &&
213
+ serverResponses[0].body.ext.cm.length > 0) {
214
+ pixels = serverResponses[0].body.ext.cm;
215
+ }
216
+
217
+ const syncs = [];
218
+ const query = [];
219
+ query.push('cbuster={cbuster}');
220
+ query.push('gdpr_consent=' + encodeURIComponent(isPlainObject(gdprConsent) && isStr(gdprConsent?.consentString) ? gdprConsent.consentString : ''));
221
+ if (isPlainObject(gdprConsent) && typeof gdprConsent?.gdprApplies === 'boolean' && gdprConsent.gdprApplies) {
222
+ query.push('gdpr=1');
223
+ } else {
224
+ query.push('gdpr=0');
225
+ }
226
+ if (isPlainObject(uspConsent) && uspConsent?.consentString) {
227
+ query.push(`us_privacy=${encodeURIComponent(uspConsent?.consentString)}`);
228
+ }
229
+ if (isPlainObject(gppConsent) && gppConsent?.gppString) {
230
+ query.push(`gppString=${encodeURIComponent(gppConsent?.gppString)}`);
231
+ }
232
+ if (config.getConfig('coppa')) {
233
+ query.push('coppa=1')
234
+ }
235
+ const q = query.join('&')
236
+ if (syncOptions.iframeEnabled) {
237
+ syncs.push({
238
+ type: 'iframe',
239
+ url: IFRAME_SYNC_URL + '?' + q.replace('{cbuster}', Math.round(new Date().getTime()))
240
+ });
241
+ } else if (syncOptions.pixelEnabled) {
242
+ if (pixels.length === 0) {
243
+ for (let i = 0; i < spb; i++) {
244
+ syncs.push({
245
+ type: 'image',
246
+ url: PIXEL_SYNC_URL + '?' + q.replace('{cbuster}', Math.round(new Date().getTime())) // randomly selects partner if sync required
247
+ });
248
+ }
249
+ } else {
250
+ for (let i = 0; i < spb && i < pixels.length; i++) {
251
+ syncs.push({
252
+ type: 'image',
253
+ url: pixels[i] + (pixels[i].indexOf('?') > 0 ? '&' : '?') + q.replace('{cbuster}', Math.round(new Date().getTime()))
254
+ });
255
+ }
256
+ }
257
+ }
258
+ return syncs;
259
+ }
260
+ }
261
+ };
262
+
263
+ registerBidder(spec);
@@ -0,0 +1,79 @@
1
+ # Overview
2
+
3
+ ```
4
+ Module Name: MgidX Bidder Adapter
5
+ Module Type: MgidX Bidder Adapter
6
+ Maintainer: prebid@mgid.com
7
+ ```
8
+
9
+ # Description
10
+
11
+ One of the easiest way to gain access to MGID demand sources - MGIDX header bidding adapter.
12
+ MGIDX header bidding adapter connects with MGID demand sources to fetch bids for display placements
13
+
14
+ # Test Parameters
15
+ ```
16
+ var adUnits = [
17
+ // Will return static test banner
18
+ {
19
+ code: 'adunit1',
20
+ mediaTypes: {
21
+ banner: {
22
+ sizes: [ [300, 250], [320, 50] ],
23
+ }
24
+ },
25
+ bids: [
26
+ {
27
+ bidder: 'mgidX',
28
+ params: {
29
+ placementId: 'testBanner',
30
+ }
31
+ }
32
+ ]
33
+ },
34
+ {
35
+ code: 'addunit2',
36
+ mediaTypes: {
37
+ video: {
38
+ playerSize: [ [640, 480] ],
39
+ context: 'instream',
40
+ minduration: 5,
41
+ maxduration: 60,
42
+ }
43
+ },
44
+ bids: [
45
+ {
46
+ bidder: 'mgidX',
47
+ params: {
48
+ placementId: 'testVideo',
49
+ }
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ code: 'addunit3',
55
+ mediaTypes: {
56
+ native: {
57
+ title: {
58
+ required: true
59
+ },
60
+ body: {
61
+ required: true
62
+ },
63
+ icon: {
64
+ required: true,
65
+ size: [64, 64]
66
+ }
67
+ }
68
+ },
69
+ bids: [
70
+ {
71
+ bidder: 'mgidX',
72
+ params: {
73
+ placementId: 'testNative',
74
+ }
75
+ }
76
+ ]
77
+ }
78
+ ];
79
+ ```
@@ -77,7 +77,8 @@ function cleanAuctionEnd(args) {
77
77
  }
78
78
 
79
79
  function cleanCreatives(args) {
80
- return filterAttributes(args, false);
80
+ let stringArgs = JSON.parse(dereferenceWithoutRenderer(args));
81
+ return filterAttributes(stringArgs, false);
81
82
  }
82
83
 
83
84
  function enhanceMediaType(arg) {
@@ -93,7 +94,7 @@ function enhanceMediaType(arg) {
93
94
 
94
95
  function addBidResponse(args) {
95
96
  let eventType = BID_RESPONSE;
96
- let argsCleaned = cleanCreatives(JSON.parse(JSON.stringify(args))); ;
97
+ let argsCleaned = cleanCreatives(args); ;
97
98
  if (allEvents[eventType] == undefined) { allEvents[eventType] = [] }
98
99
  allEvents[eventType].push(argsCleaned);
99
100
  }
@@ -110,7 +111,9 @@ function addTimeout(args) {
110
111
  if (saveEvents[eventType] == undefined) { saveEvents[eventType] = [] }
111
112
  saveEvents[eventType].push(args);
112
113
  let argsCleaned = [];
113
- let argsDereferenced = JSON.parse(JSON.stringify(args));
114
+ let argsDereferenced = {};
115
+ let stringArgs = JSON.parse(dereferenceWithoutRenderer(args));
116
+ argsDereferenced = stringArgs;
114
117
  argsDereferenced.forEach((attr) => {
115
118
  argsCleaned.push(filterAttributes(JSON.parse(JSON.stringify(attr)), false));
116
119
  });
@@ -118,17 +121,42 @@ function addTimeout(args) {
118
121
  auctionEnd[eventType].push(argsCleaned);
119
122
  }
120
123
 
124
+ export const dereferenceWithoutRenderer = function(args) {
125
+ if (args.renderer) {
126
+ let tmp = args.renderer;
127
+ delete args.renderer;
128
+ let stringified = JSON.stringify(args);
129
+ args['renderer'] = tmp;
130
+ return stringified;
131
+ }
132
+ if (args.bidsReceived) {
133
+ let tmp = {}
134
+ for (let key in args.bidsReceived) {
135
+ if (args.bidsReceived[key].renderer) {
136
+ tmp[key] = args.bidsReceived[key].renderer;
137
+ delete args.bidsReceived[key].renderer;
138
+ }
139
+ }
140
+ let stringified = JSON.stringify(args);
141
+ for (let key in tmp) {
142
+ args.bidsReceived[key].renderer = tmp[key];
143
+ }
144
+ return stringified;
145
+ }
146
+ return JSON.stringify(args);
147
+ }
148
+
121
149
  function addAuctionEnd(args) {
122
150
  let eventType = AUCTION_END;
123
151
  if (saveEvents[eventType] == undefined) { saveEvents[eventType] = [] }
124
152
  saveEvents[eventType].push(args);
125
- let argsCleaned = cleanAuctionEnd(JSON.parse(JSON.stringify(args)));
153
+ let argsCleaned = cleanAuctionEnd(JSON.parse(dereferenceWithoutRenderer(args)));
126
154
  if (auctionEnd[eventType] == undefined) { auctionEnd[eventType] = [] }
127
155
  auctionEnd[eventType].push(argsCleaned);
128
156
  }
129
157
 
130
158
  function handleBidWon(args) {
131
- args = enhanceMediaType(filterAttributes(JSON.parse(JSON.stringify(args)), true));
159
+ args = enhanceMediaType(filterAttributes(JSON.parse(dereferenceWithoutRenderer(args)), true));
132
160
  let increment = args['cpm'];
133
161
  if (typeof saveEvents['auctionEnd'] == 'object') {
134
162
  saveEvents['auctionEnd'].forEach((auction) => {