prebid.js 7.8.0 → 7.9.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 (118) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/adagioBidAdapter.js +1 -1
  3. package/dist/adbookpspBidAdapter.js +1 -1
  4. package/dist/adgenerationBidAdapter.js +1 -1
  5. package/dist/adrelevantisBidAdapter.js +1 -1
  6. package/dist/adxcgBidAdapter.js +1 -1
  7. package/dist/ajaBidAdapter.js +1 -1
  8. package/dist/amxBidAdapter.js +1 -1
  9. package/dist/amxIdSystem.js +1 -1
  10. package/dist/andBeyondMediaBidAdapter.js +1 -0
  11. package/dist/appierAnalyticsAdapter.js +1 -1
  12. package/dist/appnexusBidAdapter.js +1 -1
  13. package/dist/asoBidAdapter.js +1 -1
  14. package/dist/axonixBidAdapter.js +1 -1
  15. package/dist/bidglassBidAdapter.js +1 -1
  16. package/dist/bidwatchAnalyticsAdapter.js +1 -1
  17. package/dist/big-richmediaBidAdapter.js +1 -1
  18. package/dist/bridgewellBidAdapter.js +1 -1
  19. package/dist/brightMountainMediaBidAdapter.js +1 -1
  20. package/dist/c1xBidAdapter.js +1 -0
  21. package/dist/concertBidAdapter.js +1 -1
  22. package/dist/connectadBidAdapter.js +1 -1
  23. package/dist/consumableBidAdapter.js +1 -1
  24. package/dist/conversantBidAdapter.js +1 -1
  25. package/dist/craftBidAdapter.js +1 -1
  26. package/dist/criteoBidAdapter.js +1 -1
  27. package/dist/dspxBidAdapter.js +1 -1
  28. package/dist/eplanningBidAdapter.js +1 -1
  29. package/dist/finativeBidAdapter.js +1 -1
  30. package/dist/glimpseBidAdapter.js +1 -1
  31. package/dist/gmosspBidAdapter.js +1 -1
  32. package/dist/goldbachBidAdapter.js +1 -1
  33. package/dist/gridBidAdapter.js +1 -1
  34. package/dist/gridNMBidAdapter.js +1 -1
  35. package/dist/gumgumBidAdapter.js +1 -1
  36. package/dist/h12mediaBidAdapter.js +1 -1
  37. package/dist/id5IdSystem.js +1 -1
  38. package/dist/improvedigitalBidAdapter.js +1 -1
  39. package/dist/inmarBidAdapter.js +1 -1
  40. package/dist/insticatorBidAdapter.js +1 -1
  41. package/dist/ixBidAdapter.js +1 -1
  42. package/dist/justpremiumBidAdapter.js +1 -1
  43. package/dist/konduitAnalyticsAdapter.js +1 -1
  44. package/dist/kueezBidAdapter.js +1 -1
  45. package/dist/lassoBidAdapter.js +1 -1
  46. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  47. package/dist/logicadBidAdapter.js +1 -1
  48. package/dist/loglyliftBidAdapter.js +1 -1
  49. package/dist/malltvAnalyticsAdapter.js +1 -1
  50. package/dist/marsmediaBidAdapter.js +1 -1
  51. package/dist/mediafuseBidAdapter.js +1 -1
  52. package/dist/mediasquareBidAdapter.js +1 -1
  53. package/dist/mgidBidAdapter.js +1 -1
  54. package/dist/minutemediaBidAdapter.js +1 -1
  55. package/dist/not-for-prod/prebid.js +106 -104
  56. package/dist/oguryBidAdapter.js +1 -1
  57. package/dist/onetagBidAdapter.js +1 -1
  58. package/dist/ooloAnalyticsAdapter.js +1 -1
  59. package/dist/outbrainBidAdapter.js +1 -1
  60. package/dist/parrableIdSystem.js +1 -1
  61. package/dist/pixfutureBidAdapter.js +1 -1
  62. package/dist/prebid-core.js +1 -1
  63. package/dist/publinkIdSystem.js +1 -1
  64. package/dist/pubmaticBidAdapter.js +1 -1
  65. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  66. package/dist/pxyzBidAdapter.js +1 -1
  67. package/dist/quantcastBidAdapter.js +1 -1
  68. package/dist/readpeakBidAdapter.js +1 -1
  69. package/dist/relaidoBidAdapter.js +1 -1
  70. package/dist/rhythmoneBidAdapter.js +1 -1
  71. package/dist/riseBidAdapter.js +1 -1
  72. package/dist/rubiconAnalyticsAdapter.js +1 -1
  73. package/dist/rubiconBidAdapter.js +1 -1
  74. package/dist/seedingAllianceBidAdapter.js +1 -1
  75. package/dist/seedtagBidAdapter.js +1 -1
  76. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  77. package/dist/sharethroughBidAdapter.js +1 -1
  78. package/dist/shinezBidAdapter.js +1 -1
  79. package/dist/smaatoBidAdapter.js +1 -1
  80. package/dist/smartadserverBidAdapter.js +1 -1
  81. package/dist/smartxBidAdapter.js +1 -1
  82. package/dist/smilewantedBidAdapter.js +1 -1
  83. package/dist/sonobiBidAdapter.js +1 -1
  84. package/dist/sovrnAnalyticsAdapter.js +1 -1
  85. package/dist/sovrnBidAdapter.js +1 -1
  86. package/dist/sspBCBidAdapter.js +1 -1
  87. package/dist/sublimeBidAdapter.js +1 -1
  88. package/dist/synacormediaBidAdapter.js +1 -1
  89. package/dist/targetVideoBidAdapter.js +1 -1
  90. package/dist/teadsBidAdapter.js +1 -1
  91. package/dist/trionBidAdapter.js +1 -1
  92. package/dist/tripleliftBidAdapter.js +1 -1
  93. package/dist/ttdBidAdapter.js +1 -1
  94. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  95. package/dist/underdogmediaBidAdapter.js +1 -1
  96. package/dist/undertoneBidAdapter.js +1 -1
  97. package/dist/vidazooBidAdapter.js +1 -1
  98. package/dist/videobyteBidAdapter.js +1 -1
  99. package/dist/visxBidAdapter.js +1 -1
  100. package/dist/vuukleBidAdapter.js +1 -1
  101. package/dist/widespaceBidAdapter.js +1 -1
  102. package/dist/winrBidAdapter.js +1 -1
  103. package/dist/yahoosspBidAdapter.js +1 -1
  104. package/dist/yieldmoBidAdapter.js +1 -1
  105. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  106. package/modules/andBeyondMediaBidAdapter.js +202 -0
  107. package/modules/andBeyondMediaBidAdapter.md +79 -0
  108. package/modules/bidwatchAnalyticsAdapter.js +70 -11
  109. package/modules/c1xBidAdapter.js +209 -0
  110. package/modules/c1xBidAdapter.md +70 -0
  111. package/modules/improvedigitalBidAdapter.js +3 -0
  112. package/modules/tripleliftBidAdapter.js +45 -19
  113. package/package.json +1 -1
  114. package/test/spec/modules/andBeyondMediaBidAdapter_spec.js +400 -0
  115. package/test/spec/modules/bidwatchAnalyticsAdapter_spec.js +17 -1
  116. package/test/spec/modules/c1xBidAdapter_spec.js +189 -0
  117. package/test/spec/modules/improvedigitalBidAdapter_spec.js +4 -4
  118. package/test/spec/modules/tripleliftBidAdapter_spec.js +378 -10
@@ -0,0 +1,209 @@
1
+ import { registerBidder } from '../src/adapters/bidderFactory.js';
2
+ import { logInfo, logError } from '../src/utils.js';
3
+ import { BANNER } from '../src/mediaTypes.js';
4
+
5
+ const BIDDER_CODE = 'c1x';
6
+ const URL = 'https://hb-stg.c1exchange.com/ht';
7
+ // const PIXEL_ENDPOINT = '//px.c1exchange.com/pubpixel/';
8
+ const LOG_MSG = {
9
+ invalidBid: 'C1X: [ERROR] bidder returns an invalid bid',
10
+ noSite: 'C1X: [ERROR] no site id supplied',
11
+ noBid: 'C1X: [INFO] creating a NO bid for Adunit: ',
12
+ bidWin: 'C1X: [INFO] creating a bid for Adunit: '
13
+ };
14
+
15
+ /**
16
+ * Adapter for requesting bids from C1X header tag server.
17
+ * v3.1 (c) C1X Inc., 2018
18
+ */
19
+
20
+ export const c1xAdapter = {
21
+ code: BIDDER_CODE,
22
+ supportedMediaTypes: [BANNER],
23
+
24
+ /**
25
+ * Determines whether or not the given bid request is valid.
26
+ *
27
+ * @param {object} bid The bid to validate.
28
+ * @return boolean True if this is a valid bid, and false otherwise.
29
+ */
30
+ // check the bids sent to c1x bidder
31
+ isBidRequestValid: function (bid) {
32
+ if (bid.bidder !== BIDDER_CODE || typeof bid.params === 'undefined') {
33
+ return false;
34
+ }
35
+ if (typeof bid.params.placementId === 'undefined') {
36
+ return false;
37
+ }
38
+ return true;
39
+ },
40
+
41
+ /**
42
+ * Make a server request from the list of BidRequests.
43
+ *
44
+ * @param {BidRequest[]} validBidRequests A non-empty list of valid bid requests that should be sent to the Server.
45
+ * @return ServerRequest Info describing the request to the server.
46
+ */
47
+ buildRequests: function (validBidRequests, bidderRequest) {
48
+ let payload = {};
49
+ let tagObj = {};
50
+ let bidRequest = [];
51
+ const adunits = validBidRequests.length;
52
+ const rnd = new Date().getTime();
53
+ const c1xTags = validBidRequests.map(bidToTag);
54
+ const bidIdTags = validBidRequests.map(bidToShortTag); // include only adUnitCode and bidId from request obj
55
+
56
+ // flattened tags in a tag object
57
+ tagObj = c1xTags.reduce((current, next) => Object.assign(current, next));
58
+
59
+ payload = {
60
+ adunits: adunits.toString(),
61
+ rnd: rnd.toString(),
62
+ response: 'json',
63
+ compress: 'gzip'
64
+ };
65
+
66
+ // for GDPR support
67
+ if (bidderRequest && bidderRequest.gdprConsent) {
68
+ payload['consent_string'] = bidderRequest.gdprConsent.consentString;
69
+ payload['consent_required'] = (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') ? bidderRequest.gdprConsent.gdprApplies.toString() : 'true'
70
+ ;
71
+ }
72
+
73
+ Object.assign(payload, tagObj);
74
+ let payloadString = stringifyPayload(payload);
75
+ // ServerRequest object
76
+ bidRequest.push({
77
+ method: 'GET',
78
+ url: URL,
79
+ data: payloadString,
80
+ bids: bidIdTags
81
+ })
82
+ return bidRequest;
83
+ },
84
+
85
+ interpretResponse: function (serverResponse, requests) {
86
+ serverResponse = serverResponse.body;
87
+ requests = requests.bids || [];
88
+ const currency = 'USD';
89
+ const bidResponses = [];
90
+ let netRevenue = false;
91
+
92
+ if (!serverResponse || serverResponse.error) {
93
+ let errorMessage = serverResponse.error;
94
+ logError(LOG_MSG.invalidBid + errorMessage);
95
+ return bidResponses;
96
+ } else {
97
+ serverResponse.forEach(bid => {
98
+ logInfo(bid)
99
+ if (bid.bid) {
100
+ if (bid.bidType === 'NET_BID') {
101
+ netRevenue = !netRevenue;
102
+ }
103
+ const curBid = {
104
+ requestId: bid.bidId,
105
+ width: bid.width,
106
+ height: bid.height,
107
+ cpm: bid.cpm,
108
+ ad: bid.ad,
109
+ creativeId: bid.crid,
110
+ currency: currency,
111
+ ttl: 300,
112
+ netRevenue: netRevenue
113
+ };
114
+
115
+ if (bid.dealId) {
116
+ curBid['dealId'] = bid.dealId
117
+ }
118
+
119
+ for (let i = 0; i < requests.length; i++) {
120
+ if (bid.adId === requests[i].adUnitCode) {
121
+ curBid.requestId = requests[i].bidId;
122
+ }
123
+ }
124
+ logInfo(LOG_MSG.bidWin + bid.adId + ' size: ' + curBid.width + 'x' + curBid.height);
125
+ bidResponses.push(curBid);
126
+ } else {
127
+ // no bid
128
+ logInfo(LOG_MSG.noBid + bid.adId);
129
+ }
130
+ });
131
+ }
132
+
133
+ return bidResponses;
134
+ }
135
+
136
+ }
137
+
138
+ function bidToTag(bid, index) {
139
+ const tag = {};
140
+ const adIndex = 'a' + (index + 1).toString(); // ad unit id for c1x
141
+ const sizeKey = adIndex + 's';
142
+ const priceKey = adIndex + 'p';
143
+ const dealKey = adIndex + 'd';
144
+ // TODO: Multiple Floor Prices
145
+
146
+ const sizesArr = bid.sizes;
147
+ const floorPriceMap = getBidFloor(bid);
148
+
149
+ const dealId = bid.params.dealId || '';
150
+
151
+ if (dealId) {
152
+ tag[dealKey] = dealId;
153
+ }
154
+
155
+ tag[adIndex] = bid.adUnitCode;
156
+ tag[sizeKey] = sizesArr.reduce((prev, current) => prev + (prev === '' ? '' : ',') + current.join('x'), '');
157
+ const newSizeArr = tag[sizeKey].split(',');
158
+ if (floorPriceMap) {
159
+ newSizeArr.forEach(size => {
160
+ if (size in floorPriceMap) {
161
+ tag[priceKey] = floorPriceMap[size].toString();
162
+ } // we only accept one cpm price in floorPriceMap
163
+ });
164
+ }
165
+ if (bid.params.pageurl) {
166
+ tag['pageurl'] = bid.params.pageurl;
167
+ }
168
+
169
+ return tag;
170
+ }
171
+
172
+ function getBidFloor(bidRequest) {
173
+ let floorInfo = {};
174
+
175
+ if (typeof bidRequest.getFloor === 'function') {
176
+ floorInfo = bidRequest.getFloor({
177
+ currency: 'USD',
178
+ mediaType: 'banner',
179
+ size: '*',
180
+ });
181
+ }
182
+
183
+ let floor =
184
+ floorInfo.floor ||
185
+ bidRequest.params.bidfloor ||
186
+ bidRequest.params.floorPriceMap ||
187
+ 0;
188
+
189
+ return floor;
190
+ }
191
+
192
+ function bidToShortTag(bid) {
193
+ const tag = {};
194
+ tag.adUnitCode = bid.adUnitCode;
195
+ tag.bidId = bid.bidId;
196
+ return tag;
197
+ }
198
+
199
+ function stringifyPayload(payload) {
200
+ let payloadString = [];
201
+ for (var key in payload) {
202
+ if (payload.hasOwnProperty(key)) {
203
+ payloadString.push(key + '=' + payload[key]);
204
+ }
205
+ }
206
+ return payloadString.join('&');
207
+ }
208
+
209
+ registerBidder(c1xAdapter);
@@ -0,0 +1,70 @@
1
+ # Overview
2
+
3
+ Module Name: C1X Bidder Adapter
4
+ Module Type: Bidder Adapter
5
+ Maintainer: vishnu@c1exchange.com
6
+
7
+ # Description
8
+
9
+ Module that connects to C1X's demand sources
10
+
11
+ # Test Parameters
12
+ ```
13
+ var adUnits = [{
14
+ code: 'test-div-1',
15
+ mediaTypes: {
16
+ banner: {
17
+ sizes: [[750, 200]],
18
+ }
19
+ },
20
+ bids: [{
21
+ bidder: 'c1x',
22
+ params: {
23
+ placementId: 'div-gpt-ad-1654594619717-0',
24
+ 'floorPriceMap': {
25
+ '300x250': 4.35
26
+ }
27
+ }
28
+ }]
29
+ }, {
30
+ code: 'test-div-2',
31
+ mediaTypes: {
32
+ banner: {
33
+ sizes: [[300, 250], [750, 200]],
34
+ }
35
+ },
36
+ bids: [{
37
+ bidder: 'c1x',
38
+ params: {
39
+ placementId: 'div-gpt-ad-1654940683355-0',
40
+ 'floorPriceMap': {
41
+ '300x250': 4.35
42
+ }
43
+ dealId: '1233' // optional parameter
44
+ }
45
+ }]
46
+ }];
47
+
48
+
49
+ pbjs.bidderSettings = {
50
+ c1x: {
51
+ siteId: 999,
52
+ adserverTargeting: [{
53
+ key: "hb_bidder",
54
+ val: function(bidResponse) {
55
+ return bidResponse.bidderCode;
56
+ }
57
+ }, {
58
+ key: "hb_adid",
59
+ val: function(bidResponse) {
60
+ return bidResponse.adId;
61
+ }
62
+ }, {
63
+ key: "hb_pb",
64
+ val: function(bidResponse) {
65
+ return bidResponse.pbLg;
66
+ }
67
+ }]
68
+ }
69
+ }
70
+ ```
@@ -434,6 +434,9 @@ const ID_REQUEST = {
434
434
  return null;
435
435
  }
436
436
  const request = {
437
+ eventtrackers: [
438
+ {event: 1, methods: [1, 2]}
439
+ ],
437
440
  assets: [],
438
441
  }
439
442
  for (let i of Object.keys(nativeParams)) {
@@ -8,7 +8,7 @@ const GVLID = 28;
8
8
  const BIDDER_CODE = 'triplelift';
9
9
  const STR_ENDPOINT = 'https://tlx.3lift.com/header/auction?';
10
10
  const BANNER_TIME_TO_LIVE = 300;
11
- const INSTREAM_TIME_TO_LIVE = 3600;
11
+ const VIDEO_TIME_TO_LIVE = 3600;
12
12
  let gdprApplies = true;
13
13
  let consentString = null;
14
14
  export const storage = getStorageManager({gvlid: GVLID, bidderCode: BIDDER_CODE});
@@ -120,12 +120,15 @@ function _buildPostBody(bidRequests, bidderRequest) {
120
120
  tagid: bidRequest.params.inventoryCode,
121
121
  floor: _getFloor(bidRequest)
122
122
  };
123
- // remove the else to support multi-imp
124
- if (_isInstreamBidRequest(bidRequest)) {
123
+ // Check for video bidrequest
124
+ if (_isVideoBidRequest(bidRequest)) {
125
125
  imp.video = _getORTBVideo(bidRequest);
126
- } else if (bidRequest.mediaTypes.banner) {
126
+ }
127
+ // append banner if applicable and request is not for instream
128
+ if (bidRequest.mediaTypes.banner && !_isInstream(bidRequest)) {
127
129
  imp.banner = { format: _sizes(bidRequest.sizes) };
128
- };
130
+ }
131
+
129
132
  if (!isEmpty(bidRequest.ortb2Imp)) {
130
133
  imp.fpd = _getAdUnitFpd(bidRequest.ortb2Imp);
131
134
  }
@@ -153,22 +156,41 @@ function _buildPostBody(bidRequests, bidderRequest) {
153
156
  return data;
154
157
  }
155
158
 
156
- function _isInstreamBidRequest(bidRequest) {
157
- if (!bidRequest.mediaTypes.video) return false;
158
- if (!bidRequest.mediaTypes.video.context) return false;
159
- if (bidRequest.mediaTypes.video.context.toLowerCase() === 'instream') {
160
- return true;
161
- } else {
162
- return false;
163
- }
159
+ function _isVideoBidRequest(bidRequest) {
160
+ return _isValidVideoObject(bidRequest) && (_isInstream(bidRequest) || _isOutstream(bidRequest));
161
+ }
162
+
163
+ function _isOutstream(bidRequest) {
164
+ return _isValidVideoObject(bidRequest) && bidRequest.mediaTypes.video.context.toLowerCase() === 'outstream';
165
+ }
166
+
167
+ function _isInstream(bidRequest) {
168
+ return _isValidVideoObject(bidRequest) && bidRequest.mediaTypes.video.context.toLowerCase() === 'instream';
169
+ }
170
+
171
+ function _isValidVideoObject(bidRequest) {
172
+ return bidRequest.mediaTypes.video && bidRequest.mediaTypes.video.context;
164
173
  }
165
174
 
166
175
  function _getORTBVideo(bidRequest) {
167
176
  // give precedent to mediaTypes.video
168
177
  let video = { ...bidRequest.params.video, ...bidRequest.mediaTypes.video };
169
- if (!video.w) video.w = video.playerSize[0][0];
170
- if (!video.h) video.h = video.playerSize[0][1];
178
+ try {
179
+ if (!video.w) video.w = video.playerSize[0][0];
180
+ if (!video.h) video.h = video.playerSize[0][1];
181
+ } catch (err) {
182
+ logWarn('Video size not defined', err);
183
+ }
171
184
  if (video.context === 'instream') video.placement = 1;
185
+ if (video.context === 'outstream') {
186
+ if (!video.placement) {
187
+ video.placement = 3
188
+ } else if ([3, 4, 5].indexOf(video.placement) === -1) {
189
+ logMessage(`video.placement value of ${video.placement} is invalid for outstream context. Setting placement to 3`)
190
+ video.placement = 3
191
+ }
192
+ }
193
+
172
194
  // clean up oRTB object
173
195
  delete video.playerSize;
174
196
  return video;
@@ -180,7 +202,7 @@ function _getFloor (bid) {
180
202
  try {
181
203
  const floorInfo = bid.getFloor({
182
204
  currency: 'USD',
183
- mediaType: _isInstreamBidRequest(bid) ? 'video' : 'banner',
205
+ mediaType: _isVideoBidRequest(bid) ? 'video' : 'banner',
184
206
  size: '*'
185
207
  });
186
208
  if (typeof floorInfo === 'object' &&
@@ -366,10 +388,10 @@ function _buildResponseObject(bidderRequest, bid) {
366
388
  meta: {}
367
389
  };
368
390
 
369
- if (_isInstreamBidRequest(breq)) {
391
+ if (_isVideoBidRequest(breq) && bid.media_type === 'video') {
370
392
  bidResponse.vastXml = bid.ad;
371
393
  bidResponse.mediaType = 'video';
372
- bidResponse.ttl = INSTREAM_TIME_TO_LIVE;
394
+ bidResponse.ttl = VIDEO_TIME_TO_LIVE;
373
395
  };
374
396
 
375
397
  if (bid.advertiser_name) {
@@ -381,7 +403,11 @@ function _buildResponseObject(bidderRequest, bid) {
381
403
  }
382
404
 
383
405
  if (bid.tl_source && bid.tl_source == 'hdx') {
384
- bidResponse.meta.mediaType = 'banner';
406
+ if (_isVideoBidRequest(breq) && bid.media_type === 'video') {
407
+ bidResponse.meta.mediaType = 'video'
408
+ } else {
409
+ bidResponse.meta.mediaType = 'banner'
410
+ }
385
411
  }
386
412
 
387
413
  if (bid.tl_source && bid.tl_source == 'tlx') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prebid.js",
3
- "version": "7.8.0",
3
+ "version": "7.9.0",
4
4
  "description": "Header Bidding Management Library",
5
5
  "main": "src/prebid.js",
6
6
  "scripts": {