prebid.js 7.4.0 → 7.7.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 (239) hide show
  1. package/.circleci/config.yml +11 -6
  2. package/dist/1plusXRtdProvider.js +1 -0
  3. package/dist/33acrossBidAdapter.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/adnuntiusBidAdapter.js +1 -1
  8. package/dist/adoceanBidAdapter.js +1 -1
  9. package/dist/adotBidAdapter.js +1 -1
  10. package/dist/adrelevantisBidAdapter.js +1 -1
  11. package/dist/adrinoBidAdapter.js +1 -1
  12. package/dist/adtelligentBidAdapter.js +1 -1
  13. package/dist/adxcgBidAdapter.js +1 -1
  14. package/dist/ajaBidAdapter.js +1 -1
  15. package/dist/amxBidAdapter.js +1 -1
  16. package/dist/amxIdSystem.js +1 -1
  17. package/dist/appierAnalyticsAdapter.js +1 -1
  18. package/dist/appnexusBidAdapter.js +1 -1
  19. package/dist/asoBidAdapter.js +1 -1
  20. package/dist/atsAnalyticsAdapter.js +1 -1
  21. package/dist/axonixBidAdapter.js +1 -1
  22. package/dist/bidglassBidAdapter.js +1 -1
  23. package/dist/big-richmediaBidAdapter.js +1 -1
  24. package/dist/bliinkBidAdapter.js +1 -1
  25. package/dist/bridgewellBidAdapter.js +1 -1
  26. package/dist/brightMountainMediaBidAdapter.js +1 -1
  27. package/dist/byDataAnalyticsAdapter.js +1 -1
  28. package/dist/concertBidAdapter.js +1 -1
  29. package/dist/connectadBidAdapter.js +1 -1
  30. package/dist/consumableBidAdapter.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/currency.js +1 -1
  35. package/dist/dspxBidAdapter.js +1 -1
  36. package/dist/eplanningBidAdapter.js +1 -1
  37. package/dist/finativeBidAdapter.js +1 -1
  38. package/dist/gdprEnforcement.js +1 -1
  39. package/dist/glimpseBidAdapter.js +1 -1
  40. package/dist/gmosspBidAdapter.js +1 -1
  41. package/dist/goldbachBidAdapter.js +1 -1
  42. package/dist/gridBidAdapter.js +1 -1
  43. package/dist/gridNMBidAdapter.js +1 -1
  44. package/dist/gumgumBidAdapter.js +1 -1
  45. package/dist/h12mediaBidAdapter.js +1 -1
  46. package/dist/hadronIdSystem.js +1 -1
  47. package/dist/hadronRtdProvider.js +1 -1
  48. package/dist/id5IdSystem.js +1 -1
  49. package/dist/imRtdProvider.js +1 -1
  50. package/dist/impactifyBidAdapter.js +1 -1
  51. package/dist/improvedigitalBidAdapter.js +1 -1
  52. package/dist/inmarBidAdapter.js +1 -1
  53. package/dist/insticatorBidAdapter.js +1 -1
  54. package/dist/ixBidAdapter.js +1 -1
  55. package/dist/jixieBidAdapter.js +1 -1
  56. package/dist/justpremiumBidAdapter.js +1 -1
  57. package/dist/kargoAnalyticsAdapter.js +1 -1
  58. package/dist/konduitAnalyticsAdapter.js +1 -1
  59. package/dist/kueezBidAdapter.js +1 -1
  60. package/dist/lassoBidAdapter.js +1 -1
  61. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  62. package/dist/logicadBidAdapter.js +1 -1
  63. package/dist/loglyliftBidAdapter.js +1 -1
  64. package/dist/malltvAnalyticsAdapter.js +1 -1
  65. package/dist/marsmediaBidAdapter.js +1 -1
  66. package/dist/mediafuseBidAdapter.js +1 -1
  67. package/dist/mediasquareBidAdapter.js +1 -1
  68. package/dist/mgidBidAdapter.js +1 -1
  69. package/dist/minutemediaBidAdapter.js +1 -1
  70. package/dist/naveggIdSystem.js +1 -1
  71. package/dist/newspassidBidAdapter.js +1 -0
  72. package/dist/nextMillenniumBidAdapter.js +1 -1
  73. package/dist/not-for-prod/prebid.js +131 -128
  74. package/dist/oguryBidAdapter.js +1 -1
  75. package/dist/onetagBidAdapter.js +1 -1
  76. package/dist/ooloAnalyticsAdapter.js +1 -1
  77. package/dist/outbrainBidAdapter.js +1 -1
  78. package/dist/parrableIdSystem.js +1 -1
  79. package/dist/pixfutureBidAdapter.js +1 -1
  80. package/dist/prebid-core.js +1 -1
  81. package/dist/prebidServerBidAdapter.js +1 -1
  82. package/dist/priceFloors.js +1 -1
  83. package/dist/pubCommonId.js +1 -1
  84. package/dist/publinkIdSystem.js +1 -1
  85. package/dist/pubmaticBidAdapter.js +1 -1
  86. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  87. package/dist/pubxaiAnalyticsAdapter.js +1 -1
  88. package/dist/pxyzBidAdapter.js +1 -1
  89. package/dist/quantcastBidAdapter.js +1 -1
  90. package/dist/rasBidAdapter.js +1 -0
  91. package/dist/readpeakBidAdapter.js +1 -1
  92. package/dist/relaidoBidAdapter.js +1 -1
  93. package/dist/rhythmoneBidAdapter.js +1 -1
  94. package/dist/riseBidAdapter.js +1 -1
  95. package/dist/rubiconAnalyticsAdapter.js +1 -1
  96. package/dist/rubiconBidAdapter.js +1 -1
  97. package/dist/seedingAllianceBidAdapter.js +1 -1
  98. package/dist/seedtagBidAdapter.js +1 -1
  99. package/dist/sharedIdSystem.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/smilewantedBidAdapter.js +1 -1
  107. package/dist/sonobiBidAdapter.js +1 -1
  108. package/dist/sovrnAnalyticsAdapter.js +1 -1
  109. package/dist/sovrnBidAdapter.js +1 -1
  110. package/dist/sspBCBidAdapter.js +1 -1
  111. package/dist/sublimeBidAdapter.js +1 -1
  112. package/dist/synacormediaBidAdapter.js +1 -1
  113. package/dist/taboolaBidAdapter.js +1 -1
  114. package/dist/targetVideoBidAdapter.js +1 -1
  115. package/dist/teadsBidAdapter.js +1 -1
  116. package/dist/trionBidAdapter.js +1 -1
  117. package/dist/tripleliftBidAdapter.js +1 -1
  118. package/dist/ttdBidAdapter.js +1 -1
  119. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  120. package/dist/underdogmediaBidAdapter.js +1 -1
  121. package/dist/undertoneBidAdapter.js +1 -1
  122. package/dist/userId.js +1 -1
  123. package/dist/vidazooBidAdapter.js +1 -1
  124. package/dist/videobyteBidAdapter.js +1 -1
  125. package/dist/visxBidAdapter.js +1 -1
  126. package/dist/vuukleBidAdapter.js +1 -1
  127. package/dist/widespaceBidAdapter.js +1 -1
  128. package/dist/winrBidAdapter.js +1 -1
  129. package/dist/yahoosspBidAdapter.js +1 -1
  130. package/dist/yieldmoBidAdapter.js +1 -1
  131. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  132. package/integrationExamples/gpt/1plusXRtdProviderExample.html +112 -0
  133. package/karma.conf.maker.js +3 -1
  134. package/modules/.submodules.json +2 -1
  135. package/modules/1plusXRtdProvider.js +251 -0
  136. package/modules/1plusXRtdProvider.md +65 -0
  137. package/modules/adgenerationBidAdapter.js +24 -1
  138. package/modules/adnuntiusBidAdapter.js +26 -8
  139. package/modules/adoceanBidAdapter.js +10 -3
  140. package/modules/adotBidAdapter.js +13 -4
  141. package/modules/adrinoBidAdapter.js +10 -2
  142. package/modules/adrinoBidAdapter.md +6 -0
  143. package/modules/adtelligentBidAdapter.js +2 -1
  144. package/modules/appnexusBidAdapter.js +3 -3
  145. package/modules/atsAnalyticsAdapter.js +4 -5
  146. package/modules/big-richmediaBidAdapter.js +3 -3
  147. package/modules/bliinkBidAdapter.js +120 -193
  148. package/modules/bliinkBidAdapter.md +2 -5
  149. package/modules/byDataAnalyticsAdapter.js +172 -74
  150. package/modules/byDataAnalyticsAdapter.md +5 -6
  151. package/modules/consumableBidAdapter.js +21 -1
  152. package/modules/criteoBidAdapter.js +7 -1
  153. package/modules/currency.js +2 -2
  154. package/modules/cwireBidAdapter.md +1 -1
  155. package/modules/eplanningBidAdapter.js +82 -97
  156. package/modules/gdprEnforcement.js +8 -14
  157. package/modules/gridNMBidAdapter.js +45 -4
  158. package/modules/hadronAnalyticsAdapter.md +5 -5
  159. package/modules/hadronIdSystem.js +18 -5
  160. package/modules/hadronIdSystem.md +15 -11
  161. package/modules/hadronRtdProvider.js +14 -1
  162. package/modules/hadronRtdProvider.md +17 -13
  163. package/modules/imRtdProvider.js +0 -8
  164. package/modules/impactifyBidAdapter.js +6 -2
  165. package/modules/ixBidAdapter.js +133 -23
  166. package/modules/ixBidAdapter.md +2 -5
  167. package/modules/jixieBidAdapter.js +10 -10
  168. package/modules/kargoAnalyticsAdapter.js +88 -6
  169. package/modules/kargoAnalyticsAdapter.md +33 -0
  170. package/modules/minutemediaBidAdapter.js +1 -0
  171. package/modules/naveggIdSystem.js +1 -12
  172. package/modules/newspassidBidAdapter.js +649 -0
  173. package/modules/nextMillenniumBidAdapter.js +17 -1
  174. package/modules/nextMillenniumBidAdapter.md +1 -1
  175. package/modules/oguryBidAdapter.js +2 -0
  176. package/modules/onetagBidAdapter.js +44 -7
  177. package/modules/prebidServerBidAdapter/index.js +7 -0
  178. package/modules/priceFloors.js +1 -1
  179. package/modules/pubCommonId.js +1 -2
  180. package/modules/pubxaiAnalyticsAdapter.js +6 -1
  181. package/modules/rasBidAdapter.js +149 -0
  182. package/modules/rasBidAdapter.md +50 -0
  183. package/modules/rubiconBidAdapter.js +5 -0
  184. package/modules/seedingAllianceBidAdapter.js +3 -0
  185. package/modules/seedtagBidAdapter.js +37 -1
  186. package/modules/sharedIdSystem.js +11 -5
  187. package/modules/sharethroughBidAdapter.js +9 -24
  188. package/modules/taboolaBidAdapter.js +1 -1
  189. package/modules/taboolaBidAdapter.md +3 -3
  190. package/modules/targetVideoBidAdapter.js +18 -0
  191. package/modules/userId/index.js +39 -21
  192. package/package.json +1 -1
  193. package/src/auction.js +6 -5
  194. package/src/consentHandler.js +11 -11
  195. package/src/debugging.js +5 -3
  196. package/src/hook.js +2 -2
  197. package/src/storageManager.js +4 -5
  198. package/src/utils/promise.js +96 -21
  199. package/src/utils.js +3 -2
  200. package/test/helpers/consentData.js +2 -1
  201. package/test/spec/auctionmanager_spec.js +1 -6
  202. package/test/spec/debugging_spec.js +2 -2
  203. package/test/spec/modules/1plusXRtdProvider_spec.js +430 -0
  204. package/test/spec/modules/adgenerationBidAdapter_spec.js +52 -4
  205. package/test/spec/modules/adnuntiusBidAdapter_spec.js +126 -14
  206. package/test/spec/modules/adoceanBidAdapter_spec.js +4 -1
  207. package/test/spec/modules/adotBidAdapter_spec.js +12 -9
  208. package/test/spec/modules/adrinoBidAdapter_spec.js +22 -0
  209. package/test/spec/modules/appnexusBidAdapter_spec.js +165 -156
  210. package/test/spec/modules/bliinkBidAdapter_spec.js +323 -136
  211. package/test/spec/modules/byDataAnalyticsAdapter_spec.js +74 -24
  212. package/test/spec/modules/consumableBidAdapter_spec.js +122 -1
  213. package/test/spec/modules/criteoBidAdapter_spec.js +15 -5
  214. package/test/spec/modules/eplanningBidAdapter_spec.js +58 -18
  215. package/test/spec/modules/gdprEnforcement_spec.js +53 -100
  216. package/test/spec/modules/gridNMBidAdapter_spec.js +32 -0
  217. package/test/spec/modules/hadronIdSystem_spec.js +2 -2
  218. package/test/spec/modules/idxIdSystem_spec.js +1 -1
  219. package/test/spec/modules/imRtdProvider_spec.js +0 -1
  220. package/test/spec/modules/ixBidAdapter_spec.js +212 -5
  221. package/test/spec/modules/jixieBidAdapter_spec.js +8 -8
  222. package/test/spec/modules/kargoAnalyticsAdapter_spec.js +42 -0
  223. package/test/spec/modules/minutemediaBidAdapter_spec.js +3 -0
  224. package/test/spec/modules/newspassidBidAdapter_spec.js +1793 -0
  225. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +20 -0
  226. package/test/spec/modules/onetagBidAdapter_spec.js +53 -4
  227. package/test/spec/modules/parrableIdSystem_spec.js +2 -1
  228. package/test/spec/modules/prebidServerBidAdapter_spec.js +20 -0
  229. package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +5 -0
  230. package/test/spec/modules/rasBidAdapter_spec.js +190 -0
  231. package/test/spec/modules/rubiconBidAdapter_spec.js +27 -0
  232. package/test/spec/modules/seedtagBidAdapter_spec.js +29 -0
  233. package/test/spec/modules/sharethroughBidAdapter_spec.js +4 -4
  234. package/test/spec/modules/taboolaBidAdapter_spec.js +1 -1
  235. package/test/spec/modules/targetVideoBidAdapter_spec.js +43 -0
  236. package/test/spec/modules/userId_spec.js +15 -2
  237. package/test/spec/unit/pbjs_api_spec.js +1 -5
  238. package/test/spec/unit/utils/promise_spec.js +283 -38
  239. package/test/helpers/syncPromise.js +0 -71
@@ -49,19 +49,22 @@ function tryParse(data) {
49
49
  * @returns {Site|null} Formatted Site OpenRtb object or null
50
50
  */
51
51
  function getOpenRTBSiteObject(bidderRequest) {
52
- if (!bidderRequest || !bidderRequest.refererInfo) return null;
52
+ const refererInfo = (bidderRequest && bidderRequest.refererInfo) || null;
53
53
 
54
- const domain = bidderRequest.refererInfo.domain;
54
+ const domain = refererInfo ? refererInfo.domain : window.location.hostname;
55
55
  const publisherId = config.getConfig('adot.publisherId');
56
56
 
57
57
  if (!domain) return null;
58
58
 
59
59
  return {
60
- page: bidderRequest.refererInfo.page,
60
+ page: refererInfo ? refererInfo.page : window.location.href,
61
61
  domain: domain,
62
62
  name: domain,
63
63
  publisher: {
64
64
  id: publisherId
65
+ },
66
+ ext: {
67
+ schain: bidderRequest.schain
65
68
  }
66
69
  };
67
70
  }
@@ -83,7 +86,13 @@ function getOpenRTBDeviceObject() {
83
86
  */
84
87
  function getOpenRTBUserObject(bidderRequest) {
85
88
  if (!bidderRequest || !bidderRequest.gdprConsent || !isStr(bidderRequest.gdprConsent.consentString)) return null;
86
- return { ext: { consent: bidderRequest.gdprConsent.consentString } };
89
+
90
+ return {
91
+ ext: {
92
+ consent: bidderRequest.gdprConsent.consentString,
93
+ pubProvidedId: bidderRequest.userId && bidderRequest.userId.pubProvidedId,
94
+ },
95
+ };
87
96
  }
88
97
 
89
98
  /**
@@ -1,6 +1,7 @@
1
1
  import {registerBidder} from '../src/adapters/bidderFactory.js';
2
2
  import {triggerPixel} from '../src/utils.js';
3
3
  import {NATIVE} from '../src/mediaTypes.js';
4
+ import {config} from '../src/config.js';
4
5
 
5
6
  const BIDDER_CODE = 'adrino';
6
7
  const REQUEST_METHOD = 'POST';
@@ -12,6 +13,10 @@ export const spec = {
12
13
  gvlid: GVLID,
13
14
  supportedMediaTypes: [NATIVE],
14
15
 
16
+ getBidderConfig: function (property) {
17
+ return config.getConfig(`${BIDDER_CODE}.${property}`);
18
+ },
19
+
15
20
  isBidRequestValid: function (bid) {
16
21
  return !!(bid.bidId) &&
17
22
  !!(bid.params) &&
@@ -26,6 +31,8 @@ export const spec = {
26
31
  const bidRequests = [];
27
32
 
28
33
  for (let i = 0; i < validBidRequests.length; i++) {
34
+ let host = this.getBidderConfig('host') || BIDDER_HOST;
35
+
29
36
  let requestData = {
30
37
  bidId: validBidRequests[i].bidId,
31
38
  nativeParams: validBidRequests[i].nativeParams,
@@ -44,7 +51,7 @@ export const spec = {
44
51
 
45
52
  bidRequests.push({
46
53
  method: REQUEST_METHOD,
47
- url: BIDDER_HOST + '/bidder/bid/',
54
+ url: host + '/bidder/bid/',
48
55
  data: requestData,
49
56
  options: {
50
57
  contentType: 'application/json',
@@ -67,7 +74,8 @@ export const spec = {
67
74
 
68
75
  onBidWon: function (bid) {
69
76
  if (bid['requestId']) {
70
- triggerPixel(BIDDER_HOST + '/bidder/won/' + bid['requestId']);
77
+ let host = this.getBidderConfig('host') || BIDDER_HOST;
78
+ triggerPixel(host + '/bidder/won/' + bid['requestId']);
71
79
  }
72
80
  }
73
81
  };
@@ -13,6 +13,12 @@ Module connects to Adrino bidder to fetch bids. Only native format is supported.
13
13
  # Test Parameters
14
14
 
15
15
  ```
16
+ pbjs.setConfig({
17
+ adrino: {
18
+ host: 'https://custom-domain.adrino.io'
19
+ }
20
+ });
21
+
16
22
  var adUnits = [
17
23
  code: '/12345678/prebid_native_example_1',
18
24
  mediaTypes: {
@@ -37,7 +37,8 @@ const syncsCache = {};
37
37
  export const spec = {
38
38
  code: BIDDER_CODE,
39
39
  gvlid: 410,
40
- aliases: ['onefiftytwomedia', 'selectmedia', 'appaloosa', 'bidsxchange', 'streamkey', 'janet',
40
+ aliases: ['onefiftytwomedia', 'appaloosa', 'bidsxchange', 'streamkey', 'janet',
41
+ { code: 'selectmedia', gvlid: 775 },
41
42
  { code: 'navelix', gvlid: 380 },
42
43
  'pgam'
43
44
  ],
@@ -447,7 +447,7 @@ export const spec = {
447
447
  * @param {Bid} bid
448
448
  */
449
449
  onBidWon: function (bid) {
450
- if (bid.native) {
450
+ if (FEATURES.NATIVE && bid.native) {
451
451
  reloadViewabilityScriptWithCorrectParameters(bid);
452
452
  }
453
453
  }
@@ -715,7 +715,7 @@ function newBid(serverBid, rtbBid, bidderRequest) {
715
715
  bid.vastUrl = rtbBid.notify_url + '&redir=' + encodeURIComponent(rtbBid.rtb.video.asset_url);
716
716
  break;
717
717
  }
718
- } else if (rtbBid.rtb[NATIVE]) {
718
+ } else if (FEATURES.NATIVE && rtbBid.rtb[NATIVE]) {
719
719
  const nativeAd = rtbBid.rtb[NATIVE];
720
720
 
721
721
  // setting up the jsTracker:
@@ -853,7 +853,7 @@ function bidToTag(bid) {
853
853
  tag.gpid = gpid;
854
854
  }
855
855
 
856
- if (bid.mediaType === NATIVE || deepAccess(bid, `mediaTypes.${NATIVE}`)) {
856
+ if (FEATURES.NATIVE && (bid.mediaType === NATIVE || deepAccess(bid, `mediaTypes.${NATIVE}`))) {
857
857
  tag.ad_types.push(NATIVE);
858
858
  if (tag.sizes.length === 0) {
859
859
  tag.sizes = transformSizes([1, 1]);
@@ -267,7 +267,7 @@ function sendDataToAnalytic (events) {
267
267
  }
268
268
 
269
269
  // preflight request, to check did publisher have permission to send data to analytics endpoint
270
- function preflightRequest (envelopeSourceCookieValue, events) {
270
+ function preflightRequest (events) {
271
271
  logInfo('ATS Analytics - preflight request!');
272
272
  ajax(preflightUrl + atsAnalyticsAdapter.context.pid,
273
273
  {
@@ -277,7 +277,7 @@ function preflightRequest (envelopeSourceCookieValue, events) {
277
277
  let samplingRate = samplingRateObject.samplingRate;
278
278
  atsAnalyticsAdapter.setSamplingCookie(samplingRate);
279
279
  let samplingRateNumber = Number(samplingRate);
280
- if (data && samplingRate && atsAnalyticsAdapter.shouldFireRequest(samplingRateNumber) && envelopeSourceCookieValue != null) {
280
+ if (data && samplingRate && atsAnalyticsAdapter.shouldFireRequest(samplingRateNumber)) {
281
281
  logInfo('ATS Analytics - events to send: ', events);
282
282
  sendDataToAnalytic(events);
283
283
  }
@@ -377,12 +377,11 @@ atsAnalyticsAdapter.callHandler = function (evtype, args) {
377
377
  }
378
378
  // check should we send data to analytics or not, check first cookie value _lr_sampling_rate
379
379
  try {
380
- let envelopeSourceCookieValue = storage.getCookie('_lr_env_src_ats');
381
380
  let samplingRateCookie = storage.getCookie('_lr_sampling_rate');
382
381
  if (!samplingRateCookie) {
383
- preflightRequest(envelopeSourceCookieValue, events);
382
+ preflightRequest(events);
384
383
  } else {
385
- if (atsAnalyticsAdapter.shouldFireRequest(parseInt(samplingRateCookie)) && envelopeSourceCookieValue != null) {
384
+ if (atsAnalyticsAdapter.shouldFireRequest(parseInt(samplingRateCookie))) {
386
385
  logInfo('ATS Analytics - events to send: ', events);
387
386
  sendDataToAnalytic(events);
388
387
  }
@@ -8,7 +8,7 @@ const BIDDER_CODE = 'big-richmedia';
8
8
  const metadataByRequestId = {};
9
9
 
10
10
  export const spec = {
11
- version: '1.5.0',
11
+ version: '1.5.1',
12
12
  code: BIDDER_CODE,
13
13
  gvlid: baseAdapter.GVLID, // use base adapter gvlid
14
14
  supportedMediaTypes: [ BANNER, VIDEO ],
@@ -82,8 +82,8 @@ export const spec = {
82
82
  // This is a workaround needed for the rendering step (so that the adserver iframe does not get resized to 1800x1000
83
83
  // when there is skin demand
84
84
  if (format === 'skin') {
85
- renderParams.width = 1
86
- renderParams.height = 1
85
+ bid.width = 1
86
+ bid.height = 1
87
87
  }
88
88
 
89
89
  const encoded = window.btoa(JSON.stringify(renderParams));
@@ -1,10 +1,12 @@
1
1
  // eslint-disable-next-line prebid/validate-imports
2
2
  // eslint-disable-next-line prebid/validate-imports
3
- import {registerBidder} from '../src/adapters/bidderFactory.js'
3
+ import { registerBidder } from '../src/adapters/bidderFactory.js'
4
+ import { config } from '../src/config.js'
5
+ import {_each, deepAccess, deepSetValue} from '../src/utils.js'
4
6
  export const BIDDER_CODE = 'bliink'
5
- export const BLIINK_ENDPOINT_ENGINE = 'https://engine.bliink.io/delivery'
6
- export const BLIINK_ENDPOINT_ENGINE_VAST = 'https://engine.bliink.io/vast'
7
- export const BLIINK_ENDPOINT_COOKIE_SYNC = 'https://cookiesync.api.bliink.io'
7
+ export const BLIINK_ENDPOINT_ENGINE = 'https://engine.bliink.io/prebid'
8
+
9
+ export const BLIINK_ENDPOINT_COOKIE_SYNC_IFRAME = 'https://tag.bliink.io/usersync.html'
8
10
  export const META_KEYWORDS = 'keywords'
9
11
  export const META_DESCRIPTION = 'description'
10
12
 
@@ -14,6 +16,13 @@ const BANNER = 'banner'
14
16
  const supportedMediaTypes = [BANNER, VIDEO]
15
17
  const aliasBidderCode = ['bk']
16
18
 
19
+ /**
20
+ * @description get coppa value from config
21
+ */
22
+ function getCoppa() {
23
+ return config.getConfig('coppa') === true ? 1 : 0;
24
+ }
25
+
17
26
  export function getMetaList(name) {
18
27
  if (!name || name.length === 0) return []
19
28
 
@@ -52,7 +61,7 @@ export function getOneMetaValue(query) {
52
61
  return metaEl.content
53
62
  }
54
63
 
55
- return null
64
+ return null;
56
65
  }
57
66
 
58
67
  export function getMetaValue(name) {
@@ -75,79 +84,51 @@ export function getKeywords() {
75
84
  ]
76
85
 
77
86
  if (keywords && keywords.length > 0) {
78
- return keywords
79
- .filter((value) => value)
80
- .map((value) => value.trim())
87
+ return keywords.filter((value) => value).map((value) => value.trim());
81
88
  }
82
89
  }
83
90
 
84
- return []
85
- }
86
-
87
- export const parseXML = (content) => {
88
- if (typeof content !== 'string' || content.length === 0) return null
89
-
90
- const parser = new DOMParser()
91
- let xml;
92
-
93
- try {
94
- xml = parser.parseFromString(content, 'text/xml')
95
- } catch (e) {}
96
-
97
- if (xml &&
98
- xml.getElementsByTagName('VAST')[0] &&
99
- xml.getElementsByTagName('VAST')[0].tagName === 'VAST') {
100
- return xml
101
- }
102
-
103
- return null
91
+ return [];
104
92
  }
105
93
 
106
94
  /**
107
95
  * @param bidRequest
108
- * @param bliinkCreative
109
- * @return {{cpm, netRevenue: boolean, requestId, width: (*|number), currency, ttl: number, creativeId, height: (*|number)} & {mediaType: string, vastXml}}
96
+ * @return {({cpm, netRevenue: boolean, requestId, width: number, currency, ttl: number, creativeId, height: number}&{mediaType: string, vastXml})|null}
110
97
  */
111
- export const buildBid = (bidRequest, bliinkCreative) => {
112
- if (!bidRequest && !bliinkCreative) return null
113
-
114
- const body = {
115
- requestId: bidRequest.bidId,
116
- currency: bliinkCreative.currency,
117
- cpm: bliinkCreative.price,
118
- creativeId: bliinkCreative.creativeId,
119
- width: (bidRequest.sizes && bidRequest.sizes[0][0]) || 1,
120
- height: (bidRequest.sizes && bidRequest.sizes[0][1]) || 1,
121
- netRevenue: false,
122
- ttl: 3600,
123
- }
124
-
125
- // eslint-disable-next-line no-mixed-operators
126
- if ((bliinkCreative) && bidRequest &&
127
- // eslint-disable-next-line no-mixed-operators
128
- !bidRequest.bidId ||
129
- !bidRequest.sizes ||
130
- !bidRequest.params ||
131
- !(bidRequest.params.placement)
132
- ) return null
133
-
134
- delete bidRequest['bids']
98
+ export const buildBid = (bidResponse) => {
99
+ const mediaType = deepAccess(bidResponse, 'creative.media_type')
100
+ if (!mediaType) return null;
135
101
 
136
- switch (bliinkCreative.media_type) {
102
+ let bid;
103
+ switch (mediaType) {
137
104
  case VIDEO:
138
- return Object.assign(body, {
139
- mediaType: VIDEO,
140
- vastXml: bliinkCreative.content,
141
- })
105
+ const vastXml = deepAccess(bidResponse, 'creative.video.content');
106
+ bid = {
107
+ vastXml,
108
+ mediaType: 'video',
109
+ vastUrl: 'data:text/xml;charset=utf-8;base64,' + btoa(vastXml.replace(/\\"/g, '"'))
110
+ };
111
+ break;
142
112
  case BANNER:
143
- return Object.assign(body, {
144
- mediaType: BANNER,
145
- ad: (bliinkCreative && bliinkCreative.content && bliinkCreative.content.creative && bliinkCreative.content.creative.adm) || '',
146
- })
147
- default:
113
+ bid = {
114
+ ad: deepAccess(bidResponse, 'creative.banner.adm'),
115
+ mediaType: 'banner',
116
+ };
148
117
  break;
118
+ default:
119
+ return null;
149
120
  }
150
- }
121
+ return Object.assign(bid, {
122
+ cpm: bidResponse.price,
123
+ currency: bidResponse.currency || 'EUR',
124
+ creativeId: deepAccess(bidResponse, 'extras.deal_id'),
125
+ requestId: deepAccess(bidResponse, 'extras.transaction_id'),
126
+ width: deepAccess(bidResponse, `creative.${bid.mediaType}.width`) || 1,
127
+ height: deepAccess(bidResponse, `creative.${bid.mediaType}.height`) || 1,
128
+ ttl: 3600,
129
+ netRevenue: true,
130
+ });
131
+ };
151
132
 
152
133
  /**
153
134
  * @description Verify the the AdUnits.bids, respond with true (valid) or false (invalid).
@@ -156,61 +137,58 @@ export const buildBid = (bidRequest, bliinkCreative) => {
156
137
  * @return boolean
157
138
  */
158
139
  export const isBidRequestValid = (bid) => {
159
- return !(!bid || !bid.params || !bid.params.placement || !bid.params.tagId)
160
- }
140
+ return !!deepAccess(bid, 'params.tagId');
141
+ };
161
142
 
162
143
  /**
163
144
  * @description Takes an array of valid bid requests, all of which are guaranteed to have passed the isBidRequestValid() test.
164
145
  *
165
- * @param _[]
146
+ * @param validBidRequests
166
147
  * @param bidderRequest
167
- * @return {{ method: string, url: string } | null}
148
+ * @returns {null|{method: string, data: {gdprConsent: string, keywords: string, pageTitle: string, pageDescription: (*|string), pageUrl, gdpr: boolean, tags: *}, url: string}}
168
149
  */
169
- export const buildRequests = (_, bidderRequest) => {
170
- if (!bidderRequest) return null
150
+ export const buildRequests = (validBidRequests, bidderRequest) => {
151
+ if (!validBidRequests || !bidderRequest || !bidderRequest.bids) return null
171
152
 
172
- let data = {
173
- pageUrl: bidderRequest.refererInfo.page,
153
+ const tags = bidderRequest.bids.map((bid) => {
154
+ return {
155
+ sizes: bid.sizes.map((size) => ({ w: size[0], h: size[1] })),
156
+ id: bid.params.tagId,
157
+ transactionId: bid.bidId,
158
+ mediaTypes: Object.keys(bid.mediaTypes),
159
+ imageUrl: deepAccess(bid, 'params.imageUrl', ''),
160
+ };
161
+ });
162
+
163
+ let request = {
164
+ tags,
165
+ pageTitle: document.title,
166
+ pageUrl: deepAccess(bidderRequest, 'refererInfo.page'),
174
167
  pageDescription: getMetaValue(META_DESCRIPTION),
175
168
  keywords: getKeywords().join(','),
176
- gdpr: false,
177
- gdpr_consent: '',
178
- pageTitle: document.title,
169
+ };
170
+ const schain = deepAccess(validBidRequests[0], 'schain')
171
+ if (schain) {
172
+ request.schain = schain
179
173
  }
180
-
181
- const endPoint = bidderRequest.bids[0].params.placement === VIDEO ? BLIINK_ENDPOINT_ENGINE_VAST : BLIINK_ENDPOINT_ENGINE
182
-
183
- const params = {
184
- bidderRequestId: bidderRequest.bidderRequestId,
185
- bidderCode: bidderRequest.bidderCode,
186
- bids: bidderRequest.bids,
187
- // TODO: please do not send internal data structures over the network
188
- refererInfo: bidderRequest.refererInfo.legacy,
174
+ const gdprConsent = deepAccess(bidderRequest, 'gdprConsent');
175
+ if (!!gdprConsent && gdprConsent.gdprApplies) {
176
+ request.gdpr = true
177
+ deepSetValue(request, 'gdprConsent', gdprConsent.consentString);
189
178
  }
190
-
191
- if (bidderRequest.gdprConsent) {
192
- data = Object.assign(data, {
193
- gdpr: bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies,
194
- gdpr_consent: bidderRequest.gdprConsent.consentString
195
- })
179
+ if (config.getConfig('coppa')) {
180
+ request.coppa = 1
196
181
  }
197
-
198
- if (bidderRequest.bids && bidderRequest.bids.length > 0 && bidderRequest.bids[0].sizes && bidderRequest.bids[0].sizes[0]) {
199
- data = Object.assign(data, {
200
- width: bidderRequest.bids[0].sizes[0][0],
201
- height: bidderRequest.bids[0].sizes[0][1]
202
- })
203
-
204
- return {
205
- method: 'GET',
206
- url: `${endPoint}/${bidderRequest.bids[0].params.tagId}`,
207
- data: data,
208
- params: params,
209
- }
182
+ if (bidderRequest.uspConsent) {
183
+ deepSetValue(request, 'uspConsent', bidderRequest.uspConsent);
210
184
  }
211
185
 
212
- return null
213
- }
186
+ return {
187
+ method: 'POST',
188
+ url: BLIINK_ENDPOINT_ENGINE,
189
+ data: request,
190
+ };
191
+ };
214
192
 
215
193
  /**
216
194
  * @description Parse the response (from buildRequests) and generate one or more bid objects.
@@ -219,51 +197,15 @@ export const buildRequests = (_, bidderRequest) => {
219
197
  * @param request
220
198
  * @return
221
199
  */
222
- const interpretResponse = (serverResponse, request) => {
223
- if ((serverResponse && serverResponse.mode === 'no-ad')) {
224
- return []
225
- }
226
-
227
- const body = serverResponse.body
228
- const serverBody = request.params
229
-
230
- const xml = parseXML(body)
231
-
232
- let creative;
233
-
234
- switch (serverBody.bids[0].params.placement) {
235
- case xml && VIDEO:
236
- const price = xml.getElementsByTagName('Price') && xml.getElementsByTagName('Price')[0]
237
- const currency = xml.getElementsByTagName('Currency') && xml.getElementsByTagName('Currency')[0]
238
- const creativeId = xml.getElementsByTagName('CreativeId') && xml.getElementsByTagName('CreativeId')[0]
239
-
240
- creative = {
241
- content: body,
242
- price: (price && price.textContent) || 0,
243
- currency: (currency && currency.textContent) || 'EUR',
244
- creativeId: creativeId || 0,
245
- media_type: 'video',
246
- }
247
-
248
- return buildBid(serverBody.bids[0], creative)
249
- case BANNER:
250
- if (body) {
251
- creative = {
252
- content: body,
253
- price: body.price,
254
- currency: body.currency,
255
- creativeId: 0,
256
- media_type: 'banner',
257
- }
258
-
259
- return buildBid(serverBody.bids[0], creative)
260
- }
261
-
262
- break
263
- default:
264
- break
265
- }
266
- }
200
+ const interpretResponse = (serverResponse) => {
201
+ const bodyResponse = deepAccess(serverResponse, 'body.bids')
202
+ if (!serverResponse.body || !bodyResponse) return []
203
+ const bidResponses = [];
204
+ _each(bodyResponse, function (response) {
205
+ return bidResponses.push(buildBid(response));
206
+ });
207
+ return bidResponses.filter(bid => !!bid)
208
+ };
267
209
 
268
210
  /**
269
211
  * @description If the publisher allows user-sync activity, the platform will call this function and the adapter may register pixels and/or iframe user syncs. For more information, see Registering User Syncs below
@@ -272,54 +214,39 @@ const interpretResponse = (serverResponse, request) => {
272
214
  * @param gdprConsent
273
215
  * @return {[{type: string, url: string}]|*[]}
274
216
  */
275
- const getUserSyncs = (syncOptions, serverResponses, gdprConsent) => {
276
- let syncs = []
277
-
217
+ const getUserSyncs = (syncOptions, serverResponses, gdprConsent, uspConsent) => {
218
+ let syncs = [];
278
219
  if (syncOptions.pixelEnabled && serverResponses.length > 0) {
220
+ let gdprParams = ''
221
+ let uspConsentStr = ''
222
+ let apiVersion
223
+ let gdpr = false
279
224
  if (gdprConsent) {
280
- const gdprParams = `consentString=${gdprConsent.consentString}`
281
- const smartCallbackURL = encodeURIComponent(`${BLIINK_ENDPOINT_COOKIE_SYNC}/cookiesync?partner=smart&uid=[sas_uid]`)
282
- const azerionCallbackURL = encodeURIComponent(`${BLIINK_ENDPOINT_COOKIE_SYNC}/cookiesync?partner=azerion&uid={PUB_USER_ID}`)
283
- const appnexusCallbackURL = encodeURIComponent(`${BLIINK_ENDPOINT_COOKIE_SYNC}/cookiesync?partner=azerion&uid=$UID`)
284
- return [
285
- {
286
- type: 'script',
287
- url: 'https://prg.smartadserver.com/ac?out=js&nwid=3392&siteid=305791&pgname=rg&fmtid=81127&tgt=[sas_target]&visit=m&tmstp=[timestamp]&clcturl=[countgo]'
288
- },
289
- {
290
- type: 'image',
291
- url: `https://sync.smartadserver.com/getuid?nwid=3392&${gdprParams}&url=${smartCallbackURL}`,
292
- },
293
- {
294
- type: 'image',
295
- url: `https://ad.360yield.com/server_match?partner_id=1531&${gdprParams}&r=${azerionCallbackURL}`,
296
- },
297
- {
298
- type: 'image',
299
- url: `https://ads.stickyadstv.com/auto-user-sync?${gdprParams}`,
300
- },
301
- {
302
- type: 'image',
303
- url: `https://cookiesync.api.bliink.io/getuid?url=https%3A%2F%2Fvisitor.omnitagjs.com%2Fvisitor%2Fsync%3Fuid%3D1625272249969090bb9d544bd6d8d645%26name%3DBLIINK%26visitor%3D%24UID%26external%3Dtrue&${gdprParams}`,
304
- },
305
- {
306
- type: 'image',
307
- url: `https://cookiesync.api.bliink.io/getuid?url=https://pixel.advertising.com/ups/58444/sync?&gdpr=1&gdpr_consent=${gdprConsent.consentString}&redir=true&uid=$UID`,
308
- },
309
- {
310
- type: 'image',
311
- url: `https://ups.analytics.yahoo.com/ups/58499/occ?gdpr=1&gdpr_consent=${gdprConsent.consentString}`,
312
- },
225
+ gdprParams = `&gdprConsent=${gdprConsent.consentString}`;
226
+ apiVersion = `&apiVersion=${gdprConsent.apiVersion}`
227
+ gdpr = Number(
228
+ gdprConsent.gdprApplies)
229
+ }
230
+ if (uspConsent) {
231
+ uspConsentStr = `&uspConsent=${uspConsent}`;
232
+ }
233
+ let sync;
234
+ if (syncOptions.iframeEnabled) {
235
+ sync = [
313
236
  {
314
- type: 'image',
315
- url: `https://secure.adnxs.com/getuid?${appnexusCallbackURL}`,
237
+ type: 'iframe',
238
+ url: `${BLIINK_ENDPOINT_COOKIE_SYNC_IFRAME}?gdpr=${gdpr}&coppa=${getCoppa()}${uspConsentStr}${gdprParams}${apiVersion}`,
316
239
  },
317
- ]
240
+ ];
241
+ } else {
242
+ sync = deepAccess(serverResponses[0], 'body.userSyncs');
318
243
  }
244
+
245
+ return sync;
319
246
  }
320
247
 
321
248
  return syncs;
322
- }
249
+ };
323
250
 
324
251
  /**
325
252
  * @type {{interpretResponse: interpretResponse, code: string, aliases: string[], getUserSyncs: getUserSyncs, buildRequests: buildRequests, onTimeout: onTimeout, onSetTargeting: onSetTargeting, isBidRequestValid: isBidRequestValid, onBidWon: onBidWon}}
@@ -332,6 +259,6 @@ export const spec = {
332
259
  buildRequests,
333
260
  interpretResponse,
334
261
  getUserSyncs,
335
- }
262
+ };
336
263
 
337
- registerBidder(spec)
264
+ registerBidder(spec);
@@ -3,10 +3,10 @@
3
3
  ```
4
4
  Module Name: BLIINK Bidder Adapter
5
5
  Module Type: Bidder Adapter
6
- Maintainer: samuel@bliink.io | jonathan@bliink.io
6
+ Maintainer: samuel@bliink.io | ibrahima@bliink.io
7
7
  gdpr_supported: true
8
8
  tcf2_supported: true
9
- media_types: banner, native, video
9
+ media_types: banner, video
10
10
  ```
11
11
 
12
12
  # Description
@@ -30,7 +30,6 @@ const adUnits = [
30
30
  {
31
31
  bidder: 'bliink',
32
32
  params: {
33
- placement: 'banner',
34
33
  tagId: '41'
35
34
  }
36
35
  }
@@ -58,7 +57,6 @@ const adUnits = [
58
57
  bidder: 'bliink',
59
58
  params: {
60
59
  tagId: '41',
61
- placement: 'video',
62
60
  }
63
61
  }
64
62
  ]
@@ -85,7 +83,6 @@ const adUnits = [
85
83
  bidder: 'bliink',
86
84
  params: {
87
85
  tagId: '41',
88
- placement: 'video',
89
86
  }
90
87
  }
91
88
  ]