prebid.js 8.2.0 → 8.3.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 (157) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/33acrossIdSystem.js +1 -1
  3. package/dist/adagioBidAdapter.js +1 -1
  4. package/dist/adbookpspBidAdapter.js +1 -1
  5. package/dist/adgenerationBidAdapter.js +1 -1
  6. package/dist/adqueryBidAdapter.js +1 -1
  7. package/dist/adrelevantisBidAdapter.js +1 -1
  8. package/dist/adtelligentBidAdapter.js +1 -1
  9. package/dist/adtrgtmeBidAdapter.js +1 -1
  10. package/dist/adxcgBidAdapter.js +1 -1
  11. package/dist/adyoulikeBidAdapter.js +1 -1
  12. package/dist/ajaBidAdapter.js +1 -1
  13. package/dist/amxBidAdapter.js +1 -1
  14. package/dist/amxIdSystem.js +1 -1
  15. package/dist/appierAnalyticsAdapter.js +1 -1
  16. package/dist/appnexusBidAdapter.js +1 -1
  17. package/dist/asoBidAdapter.js +1 -1
  18. package/dist/axonixBidAdapter.js +1 -1
  19. package/dist/beopBidAdapter.js +1 -1
  20. package/dist/bidglassBidAdapter.js +1 -1
  21. package/dist/big-richmediaBidAdapter.js +1 -1
  22. package/dist/bridBidAdapter.js +1 -1
  23. package/dist/bridgewellBidAdapter.js +1 -1
  24. package/dist/brightMountainMediaBidAdapter.js +1 -1
  25. package/dist/carodaBidAdapter.js +1 -1
  26. package/dist/chtnwBidAdapter.js +1 -1
  27. package/dist/concertBidAdapter.js +1 -1
  28. package/dist/connectadBidAdapter.js +1 -1
  29. package/dist/consumableBidAdapter.js +1 -1
  30. package/dist/conversantAnalyticsAdapter.js +1 -1
  31. package/dist/conversantBidAdapter.js +1 -1
  32. package/dist/craftBidAdapter.js +1 -1
  33. package/dist/criteoBidAdapter.js +1 -1
  34. package/dist/cwireBidAdapter.js +1 -1
  35. package/dist/dependencies.json +3 -0
  36. package/dist/discoveryBidAdapter.js +1 -1
  37. package/dist/dspxBidAdapter.js +1 -1
  38. package/dist/eplanningBidAdapter.js +1 -1
  39. package/dist/euidIdSystem.js +1 -1
  40. package/dist/feedadBidAdapter.js +1 -1
  41. package/dist/finativeBidAdapter.js +1 -1
  42. package/dist/freewheel-sspBidAdapter.js +1 -1
  43. package/dist/gmosspBidAdapter.js +1 -1
  44. package/dist/goldbachBidAdapter.js +1 -1
  45. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  46. package/dist/greenbidsRtdProvider.js +1 -1
  47. package/dist/gridBidAdapter.js +1 -1
  48. package/dist/gumgumBidAdapter.js +1 -1
  49. package/dist/h12mediaBidAdapter.js +1 -1
  50. package/dist/holidBidAdapter.js +1 -1
  51. package/dist/hypelabBidAdapter.js +1 -1
  52. package/dist/id5IdSystem.js +1 -1
  53. package/dist/imdsBidAdapter.js +1 -1
  54. package/dist/improvedigitalBidAdapter.js +1 -1
  55. package/dist/insticatorBidAdapter.js +1 -1
  56. package/dist/ixBidAdapter.js +1 -1
  57. package/dist/justpremiumBidAdapter.js +1 -1
  58. package/dist/kargoBidAdapter.js +1 -1
  59. package/dist/konduitAnalyticsAdapter.js +1 -1
  60. package/dist/kueezBidAdapter.js +1 -1
  61. package/dist/kueezRtbBidAdapter.js +1 -1
  62. package/dist/kulturemediaBidAdapter.js +1 -1
  63. package/dist/lassoBidAdapter.js +1 -1
  64. package/dist/lifestreetBidAdapter.js +1 -1
  65. package/dist/livewrappedAnalyticsAdapter.js +1 -1
  66. package/dist/logicadBidAdapter.js +1 -1
  67. package/dist/loglyliftBidAdapter.js +1 -1
  68. package/dist/magniteAnalyticsAdapter.js +1 -1
  69. package/dist/malltvAnalyticsAdapter.js +1 -1
  70. package/dist/marsmediaBidAdapter.js +1 -1
  71. package/dist/mediafuseBidAdapter.js +1 -1
  72. package/dist/mediagoBidAdapter.js +1 -1
  73. package/dist/mediasquareBidAdapter.js +1 -1
  74. package/dist/mgidBidAdapter.js +1 -1
  75. package/dist/minutemediaBidAdapter.js +1 -1
  76. package/dist/minutemediaplusBidAdapter.js +1 -1
  77. package/dist/nexx360BidAdapter.js +1 -1
  78. package/dist/not-for-prod/prebid.js +132 -132
  79. package/dist/oguryBidAdapter.js +1 -1
  80. package/dist/onetagBidAdapter.js +1 -1
  81. package/dist/ooloAnalyticsAdapter.js +1 -1
  82. package/dist/optidigitalBidAdapter.js +1 -1
  83. package/dist/outbrainBidAdapter.js +1 -1
  84. package/dist/parrableIdSystem.js +1 -1
  85. package/dist/pixfutureBidAdapter.js +1 -1
  86. package/dist/prebid-core.js +1 -1
  87. package/dist/publinkIdSystem.js +1 -1
  88. package/dist/pubmaticBidAdapter.js +1 -1
  89. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  90. package/dist/pxyzBidAdapter.js +1 -1
  91. package/dist/quantcastBidAdapter.js +1 -1
  92. package/dist/readpeakBidAdapter.js +1 -1
  93. package/dist/relaidoBidAdapter.js +1 -1
  94. package/dist/retailspotBidAdapter.js +1 -1
  95. package/dist/rhythmoneBidAdapter.js +1 -1
  96. package/dist/riseBidAdapter.js +1 -1
  97. package/dist/rubiconBidAdapter.js +1 -1
  98. package/dist/seedingAllianceBidAdapter.js +1 -1
  99. package/dist/seedtagBidAdapter.js +1 -1
  100. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  101. package/dist/sharethroughBidAdapter.js +1 -1
  102. package/dist/shinezBidAdapter.js +1 -1
  103. package/dist/smaatoBidAdapter.js +1 -1
  104. package/dist/smartadserverBidAdapter.js +1 -1
  105. package/dist/smartxBidAdapter.js +1 -1
  106. package/dist/smartyadsBidAdapter.js +1 -1
  107. package/dist/smilewantedBidAdapter.js +1 -1
  108. package/dist/sonobiBidAdapter.js +1 -1
  109. package/dist/sovrnAnalyticsAdapter.js +1 -1
  110. package/dist/sovrnBidAdapter.js +1 -1
  111. package/dist/sspBCBidAdapter.js +1 -1
  112. package/dist/stvBidAdapter.js +1 -1
  113. package/dist/sublimeBidAdapter.js +1 -1
  114. package/dist/targetVideoBidAdapter.js +1 -1
  115. package/dist/teadsBidAdapter.js +1 -1
  116. package/dist/trafficgateBidAdapter.js +1 -1
  117. package/dist/trionBidAdapter.js +1 -1
  118. package/dist/tripleliftBidAdapter.js +1 -1
  119. package/dist/ttdBidAdapter.js +1 -1
  120. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  121. package/dist/uid2IdSystem.js +1 -1
  122. package/dist/underdogmediaBidAdapter.js +1 -1
  123. package/dist/undertoneBidAdapter.js +1 -1
  124. package/dist/vidazooBidAdapter.js +1 -1
  125. package/dist/videobyteBidAdapter.js +1 -1
  126. package/dist/visxBidAdapter.js +1 -1
  127. package/dist/vuukleBidAdapter.js +1 -1
  128. package/dist/widespaceBidAdapter.js +1 -1
  129. package/dist/winrBidAdapter.js +1 -1
  130. package/dist/yahoosspBidAdapter.js +1 -1
  131. package/dist/yieldmoBidAdapter.js +1 -1
  132. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  133. package/modules/adagioBidAdapter.js +2 -1
  134. package/modules/adtelligentBidAdapter.js +8 -0
  135. package/modules/beopBidAdapter.js +6 -6
  136. package/modules/beopBidAdapter.md +35 -1
  137. package/modules/cadentApertureMXBidAdapter.md +2 -2
  138. package/modules/discoveryBidAdapter.js +1 -1
  139. package/modules/holidBidAdapter.js +49 -30
  140. package/modules/ixBidAdapter.js +2 -1
  141. package/modules/livewrappedAnalyticsAdapter.js +33 -33
  142. package/modules/mediagoBidAdapter.js +1 -0
  143. package/modules/smartyadsBidAdapter.js +6 -3
  144. package/modules/sovrnBidAdapter.js +5 -0
  145. package/modules/trafficgateBidAdapter.js +126 -72
  146. package/modules/vidazooBidAdapter.js +68 -16
  147. package/package.json +1 -1
  148. package/test/spec/modules/adagioBidAdapter_spec.js +2 -1
  149. package/test/spec/modules/adtelligentBidAdapter_spec.js +8 -0
  150. package/test/spec/modules/beopBidAdapter_spec.js +18 -2
  151. package/test/spec/modules/cadentApertureMXBidAdapter_spec.js +1 -1
  152. package/test/spec/modules/holidBidAdapter_spec.js +26 -6
  153. package/test/spec/modules/ixBidAdapter_spec.js +12 -6
  154. package/test/spec/modules/smartyadsBidAdapter_spec.js +1 -1
  155. package/test/spec/modules/sovrnBidAdapter_spec.js +34 -0
  156. package/test/spec/modules/trafficgateBidAdapter_spec.js +1349 -199
  157. package/test/spec/modules/vidazooBidAdapter_spec.js +131 -0
@@ -9,13 +9,14 @@
9
9
  Module that connects to BeOp's demand sources
10
10
 
11
11
  # Test Parameters
12
+
12
13
  ```
13
14
  var adUnits = [
14
15
  {
15
16
  code: 'in-article',
16
17
  mediaTypes: {
17
18
  banner: {
18
- sizes: [[1,1]],
19
+ sizes: [[1,1]],
19
20
  }
20
21
  },
21
22
  bids: [
@@ -31,3 +32,36 @@ Module that connects to BeOp's demand sources
31
32
  ];
32
33
  ```
33
34
 
35
+ # Custom Bidder data
36
+
37
+ If you want to pass your first party data to BeOp, you can set your bidder `config.ortb2` object with
38
+
39
+ ```json
40
+ {
41
+ "site": {
42
+ "ext": {
43
+ "bpsegs": ["Your", 1, "ST", "party", "data"],
44
+ "data": {
45
+ "bpsegs": ["Your", 1, "ST", "party", "data"]
46
+ }
47
+ }
48
+ },
49
+ "user": {
50
+ "ext": {
51
+ "bpsegs": ["Your", 1, "ST", "party", "data"],
52
+ "data": {
53
+ "bpsegs": ["Your", 1, "ST", "party", "data"]
54
+ }
55
+ }
56
+ }
57
+ }
58
+ ```
59
+
60
+ You can choose the location between:
61
+
62
+ - `site.ext`
63
+ - `site.ext.data`
64
+ - `user.ext`
65
+ - `user.ext.data`
66
+
67
+ and our BidAdapter will be able to find them
@@ -3,14 +3,14 @@
3
3
  ```
4
4
  Module Name: Cadent Aperture MX Adapter
5
5
  Module Type: Bidder Adapter
6
- Maintainer: git@emxdigital.com
6
+ Maintainer: contactaperturemx@cadent.tv
7
7
  ```
8
8
 
9
9
  # Description
10
10
 
11
11
  The Cadent Aperture MX adapter provides publishers with access to the Cadent Aperture MX SSP. The adapter is GDPR compliant. Please note that the adapter supports Banner and Video (Instream & Outstream) media types.
12
12
 
13
- Note: The Cadent Aperture MX adapter requires approval and implementation guidelines from the Cadent team, including existing publishers that work with Cadent. Please reach out to your account manager or prebid@emxdigital.com for more information.
13
+ Note: The Cadent Aperture MX adapter requires approval and implementation guidelines from the Cadent team, including existing publishers that work with Cadent. Please reach out to your account manager or contactaperturemx@cadent.tv for more information.
14
14
 
15
15
  The bidder code should be ```cadent_aperture_mx```
16
16
  The params used by the bidder are :
@@ -258,7 +258,7 @@ function getItems(validBidRequests, bidderRequest) {
258
258
  format: sizes,
259
259
  },
260
260
  ext: {},
261
- tagid: globals['tagid'],
261
+ tagid: req.params && req.params.tagid
262
262
  };
263
263
  }
264
264
  itemMaps[id] = {
@@ -1,4 +1,11 @@
1
- import {deepAccess, getBidIdParameter, isStr, logMessage, triggerPixel, } from '../src/utils.js';
1
+ import {
2
+ deepAccess,
3
+ deepSetValue,
4
+ getBidIdParameter,
5
+ isStr,
6
+ logMessage,
7
+ triggerPixel,
8
+ } from '../src/utils.js';
2
9
  import * as events from '../src/events.js';
3
10
  import CONSTANTS from '../src/constants.json';
4
11
  import {BANNER} from '../src/mediaTypes.js';
@@ -10,6 +17,7 @@ const GVLID = 1177
10
17
  const ENDPOINT = 'https://helloworld.holid.io/openrtb2/auction'
11
18
  const COOKIE_SYNC_ENDPOINT = 'https://null.holid.io/sync.html'
12
19
  const TIME_TO_LIVE = 300
20
+ const TMAX = 500
13
21
  let wurlMap = {}
14
22
 
15
23
  events.on(CONSTANTS.EVENTS.BID_WON, bidWonHandler)
@@ -23,12 +31,19 @@ export const spec = {
23
31
  return !!bid.params.adUnitID
24
32
  },
25
33
 
26
- buildRequests: function (validBidRequests, _bidderRequest) {
34
+ buildRequests: function (validBidRequests, bidderRequest) {
27
35
  return validBidRequests.map((bid) => {
28
36
  const requestData = {
29
37
  ...bid.ortb2,
30
- id: _bidderRequest.bidderRequestId,
38
+ source: {schain: bid.schain},
39
+ id: bidderRequest.bidderRequestId,
31
40
  imp: [getImp(bid)],
41
+ tmax: TMAX,
42
+ ...buildStoredRequest(bid)
43
+ }
44
+
45
+ if (bid.userIdAsEids) {
46
+ deepSetValue(requestData, 'user.ext.eids', bid.userIdAsEids)
32
47
  }
33
48
 
34
49
  return {
@@ -50,8 +65,6 @@ export const spec = {
50
65
  serverResponse.body.seatbid.map((response) => {
51
66
  response.bid.map((bid) => {
52
67
  const requestId = bidRequest.bidId
53
- // TODO: fix auctionId leak: https://github.com/prebid/Prebid.js/issues/9781
54
- const auctionId = bidRequest.auctionId
55
68
  const wurl = deepAccess(bid, 'ext.prebid.events.win')
56
69
  const bidResponse = {
57
70
  requestId,
@@ -65,7 +78,7 @@ export const spec = {
65
78
  ttl: TIME_TO_LIVE,
66
79
  }
67
80
 
68
- addWurl({ auctionId, requestId, wurl })
81
+ addWurl(requestId, wurl)
69
82
 
70
83
  bidResponses.push(bidResponse)
71
84
  })
@@ -75,11 +88,15 @@ export const spec = {
75
88
  },
76
89
 
77
90
  getUserSyncs(optionsType, serverResponse, gdprConsent, uspConsent) {
91
+ const syncs = [{
92
+ type: 'image',
93
+ url: 'https://track.adform.net/Serving/TrackPoint/?pm=2992097&lid=132720821'
94
+ }]
95
+
78
96
  if (!serverResponse || serverResponse.length === 0) {
79
- return []
97
+ return syncs
80
98
  }
81
99
 
82
- const syncs = []
83
100
  const bidders = getBidders(serverResponse)
84
101
 
85
102
  if (optionsType.iframeEnabled && bidders) {
@@ -100,24 +117,14 @@ export const spec = {
100
117
  type: 'iframe',
101
118
  url: COOKIE_SYNC_ENDPOINT + strQueryParams + '&type=iframe',
102
119
  })
103
-
104
- return syncs
105
120
  }
106
121
 
107
- return []
122
+ return syncs
108
123
  },
109
124
  }
110
125
 
111
126
  function getImp(bid) {
112
- const imp = {
113
- ext: {
114
- prebid: {
115
- storedrequest: {
116
- id: getBidIdParameter('adUnitID', bid.params),
117
- },
118
- },
119
- },
120
- }
127
+ const imp = buildStoredRequest(bid)
121
128
  const sizes =
122
129
  bid.sizes && !Array.isArray(bid.sizes[0]) ? [bid.sizes] : bid.sizes
123
130
 
@@ -132,6 +139,18 @@ function getImp(bid) {
132
139
  return imp
133
140
  }
134
141
 
142
+ function buildStoredRequest(bid) {
143
+ return {
144
+ ext: {
145
+ prebid: {
146
+ storedrequest: {
147
+ id: getBidIdParameter('adUnitID', bid.params),
148
+ },
149
+ },
150
+ },
151
+ }
152
+ }
153
+
135
154
  function getBidders(serverResponse) {
136
155
  const bidders = serverResponse
137
156
  .map((res) => Object.keys(res.body.ext.responsetimemillis || []))
@@ -142,28 +161,28 @@ function getBidders(serverResponse) {
142
161
  }
143
162
  }
144
163
 
145
- function addWurl(auctionId, adId, wurl) {
146
- if ([auctionId, adId].every(isStr)) {
147
- wurlMap[`${auctionId}${adId}`] = wurl
164
+ function addWurl(requestId, wurl) {
165
+ if (isStr(requestId)) {
166
+ wurlMap[requestId] = wurl
148
167
  }
149
168
  }
150
169
 
151
- function removeWurl(auctionId, adId) {
152
- delete wurlMap[`${auctionId}${adId}`]
170
+ function removeWurl(requestId) {
171
+ delete wurlMap[requestId]
153
172
  }
154
173
 
155
- function getWurl(auctionId, adId) {
156
- if ([auctionId, adId].every(isStr)) {
157
- return wurlMap[`${auctionId}${adId}`]
174
+ function getWurl(requestId) {
175
+ if (isStr(requestId)) {
176
+ return wurlMap[requestId]
158
177
  }
159
178
  }
160
179
 
161
180
  function bidWonHandler(bid) {
162
- const wurl = getWurl(bid.auctionId, bid.adId)
181
+ const wurl = getWurl(bid.requestId)
163
182
  if (wurl) {
164
183
  logMessage(`Invoking image pixel for wurl on BID_WIN: "${wurl}"`)
165
184
  triggerPixel(wurl)
166
- removeWurl(bid.auctionId, bid.adId)
185
+ removeWurl(bid.requestId)
167
186
  }
168
187
  }
169
188
 
@@ -76,7 +76,8 @@ const SOURCE_RTI_MAPPING = {
76
76
  'audigent.com': '', // Hadron ID from Audigent, hadronId
77
77
  'pubcid.org': '', // SharedID, pubcid
78
78
  'utiq.com': '', // Utiq
79
- 'intimatemerger.com': ''
79
+ 'intimatemerger.com': '',
80
+ '33across.com': ''
80
81
  };
81
82
  const PROVIDERS = [
82
83
  'britepoolid',
@@ -168,7 +168,7 @@ livewrappedAnalyticsAdapter.sendEvents = function() {
168
168
  requests: sentRequests.sentRequests,
169
169
  responses: getResponses(sentRequests.gdpr, sentRequests.auctionIds),
170
170
  wins: getWins(sentRequests.gdpr, sentRequests.auctionIds),
171
- timeouts: getTimeouts(sentRequests.auctionIds),
171
+ timeouts: getTimeouts(sentRequests.gdpr, sentRequests.auctionIds),
172
172
  bidAdUnits: getbidAdUnits(),
173
173
  rf: getAdRenderFailed(sentRequests.auctionIds),
174
174
  rcv: getAdblockerRecovered()
@@ -237,27 +237,9 @@ function getResponses(gdpr, auctionIds) {
237
237
  if (bid.readyToSend && !(bid.sendStatus & RESPONSESENT) && !bid.timeout) {
238
238
  bid.sendStatus |= RESPONSESENT;
239
239
 
240
- responses.push({
241
- timeStamp: auction.timeStamp,
242
- adUnit: bid.adUnit,
243
- adUnitId: bid.adUnitId,
244
- bidder: bid.bidder,
245
- width: bid.width,
246
- height: bid.height,
247
- cpm: bid.cpm,
248
- orgCpm: bid.originalCpm,
249
- ttr: bid.ttr,
250
- IsBid: bid.isBid,
251
- mediaType: bid.mediaType,
252
- gdpr: gdprPos,
253
- floor: bid.lwFloor ? bid.lwFloor : (bid.floorData ? bid.floorData.floorValue : undefined),
254
- floorCur: bid.floorData ? bid.floorData.floorCurrency : undefined,
255
- auctionId: auctionIdPos,
256
- auc: bid.auc,
257
- buc: bid.buc,
258
- lw: bid.lw,
259
- meta: bid.meta
260
- });
240
+ let response = getResponseObject(auction, bid, gdprPos, auctionIdPos);
241
+
242
+ responses.push(response);
261
243
  }
262
244
  });
263
245
  });
@@ -337,27 +319,45 @@ function getAuctionIdPos(auctionIds, auctionId) {
337
319
  return auctionIdPos;
338
320
  }
339
321
 
340
- function getTimeouts(auctionIds) {
322
+ function getResponseObject(auction, bid, gdprPos, auctionIdPos) {
323
+ return {
324
+ timeStamp: auction.timeStamp,
325
+ adUnit: bid.adUnit,
326
+ adUnitId: bid.adUnitId,
327
+ bidder: bid.bidder,
328
+ width: bid.width,
329
+ height: bid.height,
330
+ cpm: bid.cpm,
331
+ orgCpm: bid.originalCpm,
332
+ ttr: bid.ttr,
333
+ IsBid: bid.isBid,
334
+ mediaType: bid.mediaType,
335
+ gdpr: gdprPos,
336
+ floor: bid.lwFloor ? bid.lwFloor : (bid.floorData ? bid.floorData.floorValue : undefined),
337
+ floorCur: bid.floorData ? bid.floorData.floorCurrency : undefined,
338
+ auctionId: auctionIdPos,
339
+ auc: bid.auc,
340
+ buc: bid.buc,
341
+ lw: bid.lw,
342
+ meta: bid.meta
343
+ };
344
+ }
345
+
346
+ function getTimeouts(gdpr, auctionIds) {
341
347
  var timeouts = [];
342
348
 
343
349
  Object.keys(cache.auctions).forEach(auctionId => {
344
350
  let auctionIdPos = getAuctionIdPos(auctionIds, auctionId);
345
351
  Object.keys(cache.auctions[auctionId].bids).forEach(bidId => {
346
352
  let auction = cache.auctions[auctionId];
353
+ let gdprPos = getGdprPos(gdpr, auction);
347
354
  let bid = auction.bids[bidId];
348
355
  if (!(bid.sendStatus & TIMEOUTSENT) && bid.timeout) {
349
356
  bid.sendStatus |= TIMEOUTSENT;
350
357
 
351
- timeouts.push({
352
- bidder: bid.bidder,
353
- adUnit: bid.adUnit,
354
- adUnitId: bid.adUnitId,
355
- timeStamp: auction.timeStamp,
356
- auctionId: auctionIdPos,
357
- auc: bid.auc,
358
- buc: bid.buc,
359
- lw: bid.lw
360
- });
358
+ let timeout = getResponseObject(auction, bid, gdprPos, auctionIdPos);
359
+
360
+ timeouts.push(timeout);
361
361
  }
362
362
  });
363
363
  });
@@ -242,6 +242,7 @@ function getItems(validBidRequests, bidderRequest) {
242
242
  ext: {
243
243
  // gpid: gpid, // 加入后无法返回广告
244
244
  },
245
+ tagid: req.params && req.params.tagid,
245
246
  };
246
247
  itemMaps[id] = {
247
248
  req,
@@ -66,6 +66,9 @@ export const spec = {
66
66
  if (bidderRequest.gdprConsent) {
67
67
  request.gdpr = bidderRequest.gdprConsent
68
68
  }
69
+ if (bidderRequest.gppConsent) {
70
+ request.gpp = bidderRequest.gppConsent;
71
+ }
69
72
  }
70
73
  const len = validBidRequests.length;
71
74
 
@@ -102,19 +105,19 @@ export const spec = {
102
105
  return response;
103
106
  },
104
107
 
105
- getUserSyncs: (syncOptions, serverResponses = [], gdprConsent = {}, uspConsent = '') => {
108
+ getUserSyncs: (syncOptions, serverResponses = [], gdprConsent = {}, uspConsent = '', gppConsent = '') => {
106
109
  let syncs = [];
107
110
  let { gdprApplies, consentString = '' } = gdprConsent;
108
111
 
109
112
  if (syncOptions.iframeEnabled) {
110
113
  syncs.push({
111
114
  type: 'iframe',
112
- url: `${URL_SYNC}&gdpr=${gdprApplies ? 1 : 0}&gdpr_consent=${consentString}&type=iframe&us_privacy=${uspConsent}`
115
+ url: `${URL_SYNC}&gdpr=${gdprApplies ? 1 : 0}&gdpr_consent=${consentString}&type=iframe&us_privacy=${uspConsent}&gpp=${gppConsent}`
113
116
  });
114
117
  } else {
115
118
  syncs.push({
116
119
  type: 'image',
117
- url: `${URL_SYNC}&gdpr=${gdprApplies ? 1 : 0}&gdpr_consent=${consentString}&type=image&us_privacy=${uspConsent}`
120
+ url: `${URL_SYNC}&gdpr=${gdprApplies ? 1 : 0}&gdpr_consent=${consentString}&type=image&us_privacy=${uspConsent}&gpp=${gppConsent}`
118
121
  });
119
122
  }
120
123
 
@@ -169,6 +169,11 @@ export const spec = {
169
169
  };
170
170
  }
171
171
 
172
+ const tid = deepAccess(bidderRequest, 'ortb2.source.tid')
173
+ if (tid) {
174
+ deepSetValue(sovrnBidReq, 'source.tid', tid)
175
+ }
176
+
172
177
  if (bidderRequest.gdprConsent) {
173
178
  deepSetValue(sovrnBidReq, 'regs.ext.gdpr', +bidderRequest.gdprConsent.gdprApplies);
174
179
  deepSetValue(sovrnBidReq, 'user.ext.consent', bidderRequest.gdprConsent.consentString)
@@ -1,95 +1,149 @@
1
- import { getWindowLocation, deepAccess } from '../src/utils.js';
2
- import { registerBidder } from '../src/adapters/bidderFactory.js';
3
- import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
4
- import { convertOrtbRequestToProprietaryNative } from '../src/native.js';
1
+ import {registerBidder} from '../src/adapters/bidderFactory.js';
2
+ import {BANNER, VIDEO} from '../src/mediaTypes.js';
3
+ import {ortbConverter} from '../libraries/ortbConverter/converter.js';
4
+ import {deepAccess, mergeDeep, convertTypes} from '../src/utils.js';
5
5
 
6
6
  const BIDDER_CODE = 'trafficgate';
7
- const URL = 'https://[HOST].bc-plugin.com/?c=o&m=multi'
7
+ const URL = 'https://[HOST].bc-plugin.com/prebidjs'
8
8
 
9
9
  export const spec = {
10
10
  code: BIDDER_CODE,
11
- supportedMediaTypes: [BANNER, VIDEO, NATIVE],
11
+ supportedMediaTypes: [BANNER, VIDEO],
12
+ isBidRequestValid,
13
+ buildRequests,
14
+ interpretResponse,
15
+ transformBidParams,
16
+ isBannerBid
17
+ };
12
18
 
13
- isBidRequestValid: function (bid) {
14
- return !!(bid.bidId && bid.params && parseInt(bid.params.placementId) && bid.params.host)
15
- },
16
- /**
17
- * Make a server request from the list of BidRequests.
18
- *
19
- * @param {BidRequest[]} validBidRequests A non-empty list of valid bid requests that should be sent to the Server.
20
- * @return ServerRequest Info describing the request to the server.
21
- */
22
- buildRequests: function (validBidRequests) {
23
- // convert Native ORTB definition to old-style prebid native definition
24
- validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
25
- if (validBidRequests && validBidRequests.length === 0) return [];
26
-
27
- const location = getWindowLocation()
28
- const placements = []
29
-
30
- validBidRequests.forEach((bidReq) => {
31
- placements.push({
32
- placementId: bidReq.params.placementId,
33
- bidId: bidReq.bidId,
34
- traffic: getMediatype(bidReq)
35
- })
36
- })
19
+ registerBidder(spec)
37
20
 
38
- return {
39
- method: 'POST',
40
- url: URL.replace('[HOST]', validBidRequests[0].params.host),
41
- data: {
42
- language: (navigator && navigator.language) ? navigator.language : '',
43
- secure: +(location.protocol === 'https:'),
44
- host: location.hostname,
45
- page: location.pathname,
46
- placements: placements
21
+ const converter = ortbConverter({
22
+ context: {
23
+ netRevenue: true,
24
+ ttl: 300
25
+ },
26
+ imp(buildImp, bidRequest, context) {
27
+ const imp = buildImp(bidRequest, context);
28
+ mergeDeep(imp, {
29
+ ext: {
30
+ bidder: {
31
+ placementId: bidRequest.params.placementId,
32
+ host: bidRequest.params.host
33
+ }
47
34
  }
35
+ });
36
+ if (bidRequest.params.customFloor && !imp.bidfloor) {
37
+ imp.bidfloor = bidRequest.params.customFloor;
48
38
  }
39
+ return imp;
49
40
  },
50
-
51
- interpretResponse: function (opts) {
52
- const body = opts.body
53
- const response = []
54
-
55
- for (let i = 0; i < body.length; i++) {
56
- const item = body[i]
57
- if (isBidResponseValid(item)) {
58
- response.push(item)
41
+ request(buildRequest, imps, bidderRequest, context) {
42
+ const req = buildRequest(imps, bidderRequest, context);
43
+ mergeDeep(req, {
44
+ at: 1,
45
+ })
46
+ const bid = context.bidRequests[0];
47
+ if (bid.params.test) {
48
+ req.test = 1
49
+ }
50
+ return req;
51
+ },
52
+ bidResponse(buildBidResponse, bid, context) {
53
+ const bidResponse = buildBidResponse(bid, context);
54
+ if (bid.ext) {
55
+ bidResponse.meta.networkId = bid.ext.networkId;
56
+ bidResponse.meta.advertiserDomains = bid.ext.advertiserDomains;
57
+ }
58
+ return bidResponse;
59
+ },
60
+ response(buildResponse, bidResponses, ortbResponse, context) {
61
+ const response = buildResponse(bidResponses, ortbResponse, context);
62
+ return response.bids
63
+ },
64
+ overrides: {
65
+ imp: {
66
+ bidfloor(setBidFloor, imp, bidRequest, context) {
67
+ const floor = {};
68
+ setBidFloor(floor, bidRequest, {...context, currency: 'USD'});
69
+ if (floor.bidfloorcur === 'USD') {
70
+ Object.assign(imp, floor);
71
+ }
72
+ },
73
+ video(orig, imp, bidRequest, context) {
74
+ if (FEATURES.VIDEO) {
75
+ let videoParams = bidRequest.mediaTypes[VIDEO];
76
+ if (videoParams) {
77
+ videoParams = Object.assign({}, videoParams, bidRequest.params.video);
78
+ bidRequest = {...bidRequest, mediaTypes: {[VIDEO]: videoParams}}
79
+ }
80
+ orig(imp, bidRequest, context);
81
+ if (imp.video && videoParams?.context === 'outstream') {
82
+ imp.video.placement = imp.video.placement || 4;
83
+ }
84
+ }
59
85
  }
60
86
  }
61
-
62
- return response
63
87
  }
64
- }
88
+ });
65
89
 
66
- registerBidder(spec)
90
+ function transformBidParams(params, isOpenRtb) {
91
+ return convertTypes({
92
+ 'customFloor': 'number',
93
+ 'placementId': 'number',
94
+ 'host': 'string'
95
+ }, params);
96
+ }
67
97
 
68
- function isBidResponseValid (bid) {
69
- if (!bid.requestId || !bid.cpm || !bid.creativeId ||
70
- !bid.ttl || !bid.currency) {
98
+ function isBidRequestValid(bidRequest) {
99
+ const isValid = bidRequest.params.placementId && bidRequest.params.host;
100
+ if (!isValid) {
71
101
  return false
72
102
  }
73
- switch (bid['mediaType']) {
74
- case BANNER:
75
- return Boolean(bid.width && bid.height && bid.ad)
76
- case VIDEO:
77
- return Boolean(bid.vastUrl)
78
- case NATIVE:
79
- return Boolean(bid.title && bid.image && bid.impressionTrackers)
80
- default:
81
- return false
103
+ if (isBannerBid(bidRequest)) {
104
+ return deepAccess(bidRequest, 'mediaTypes.banner.sizes.length') > 0;
82
105
  }
106
+ return true
83
107
  }
84
108
 
85
- function getMediatype(bidRequest) {
86
- if (deepAccess(bidRequest, 'mediaTypes.banner')) {
87
- return BANNER;
88
- }
89
- if (deepAccess(bidRequest, 'mediaTypes.video')) {
90
- return VIDEO;
109
+ function buildRequests(bids, bidderRequest) {
110
+ let videoBids = bids.filter(bid => isVideoBid(bid));
111
+ let bannerBids = bids.filter(bid => isBannerBid(bid));
112
+ let requests = bannerBids.length ? [createRequest(bannerBids, bidderRequest, BANNER)] : [];
113
+ videoBids.forEach(bid => {
114
+ requests.push(createRequest([bid], bidderRequest, VIDEO));
115
+ });
116
+ return requests;
117
+ }
118
+
119
+ function createRequest(bidRequests, bidderRequest, mediaType) {
120
+ return {
121
+ method: 'POST',
122
+ url: URL.replace('[HOST]', bidRequests[0].params.host),
123
+ data: converter.toORTB({bidRequests, bidderRequest, context: {mediaType}})
91
124
  }
92
- if (deepAccess(bidRequest, 'mediaTypes.native')) {
93
- return NATIVE;
125
+ }
126
+
127
+ function isVideoBid(bid) {
128
+ return !!deepAccess(bid, 'mediaTypes.video');
129
+ }
130
+
131
+ function isBannerBid(bid) {
132
+ return !!deepAccess(bid, 'mediaTypes.banner');
133
+ }
134
+
135
+ function interpretResponse(resp, req) {
136
+ if (!resp.body) {
137
+ resp.body = {nbr: 0};
94
138
  }
139
+ return converter.fromORTB({request: req.data, response: resp.body});
140
+ }
141
+
142
+ export const spec2 = {
143
+ code: BIDDER_CODE,
144
+ supportedMediaTypes: [BANNER, VIDEO],
145
+
146
+ isBidRequestValid: function (bid) {
147
+ return !!(bid.bidId && bid.params && parseInt(bid.params.placementId) && bid.params.host)
148
+ },
95
149
  }