prebid.js 6.2.0 → 6.6.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 (169) hide show
  1. package/.circleci/config.yml +1 -1
  2. package/gulpfile.js +87 -82
  3. package/integrationExamples/gpt/weboramaRtdProvider_example.html +23 -14
  4. package/karma.conf.maker.js +1 -1
  5. package/modules/.submodules.json +2 -1
  6. package/modules/33acrossBidAdapter.js +189 -102
  7. package/modules/adagioBidAdapter.js +1 -1
  8. package/modules/addefendBidAdapter.js +1 -0
  9. package/modules/adkernelBidAdapter.js +148 -62
  10. package/modules/adlooxAdServerVideo.js +2 -2
  11. package/modules/adlooxAnalyticsAdapter.js +4 -4
  12. package/modules/admanBidAdapter.js +11 -4
  13. package/modules/admixerBidAdapter.js +1 -1
  14. package/modules/adnuntiusBidAdapter.js +3 -1
  15. package/modules/adomikAnalyticsAdapter.js +27 -9
  16. package/modules/adqueryIdSystem.js +103 -0
  17. package/modules/adqueryIdSystem.md +35 -0
  18. package/modules/adxcgBidAdapter.js +311 -359
  19. package/modules/adxcgBidAdapter.md +22 -21
  20. package/modules/adyoulikeBidAdapter.js +13 -9
  21. package/modules/aniviewBidAdapter.js +1 -1
  22. package/modules/appnexusBidAdapter.js +0 -1
  23. package/modules/beopBidAdapter.js +6 -4
  24. package/modules/bidViewability.js +3 -3
  25. package/modules/bidViewabilityIO.js +3 -3
  26. package/modules/bliinkBidAdapter.js +3 -2
  27. package/modules/colossussspBidAdapter.js +7 -0
  28. package/modules/compassBidAdapter.js +208 -0
  29. package/modules/compassBidAdapter.md +79 -0
  30. package/modules/consentManagement.js +7 -1
  31. package/modules/criteoBidAdapter.js +1 -1
  32. package/modules/criteoIdSystem.js +29 -7
  33. package/modules/currency.js +2 -2
  34. package/modules/cwireBidAdapter.js +3 -0
  35. package/modules/dailyhuntBidAdapter.js +435 -0
  36. package/modules/dailyhuntBidAdapter.md +4 -0
  37. package/modules/docereeBidAdapter.js +10 -1
  38. package/modules/docereeBidAdapter.md +2 -0
  39. package/modules/dspxBidAdapter.js +1 -1
  40. package/modules/engageyaBidAdapter.js +1 -1
  41. package/modules/feedadBidAdapter.js +2 -2
  42. package/modules/feedadBidAdapter.md +4 -2
  43. package/modules/futureads.md +48 -0
  44. package/modules/glimpseBidAdapter.js +82 -47
  45. package/modules/gptPreAuction.js +55 -7
  46. package/modules/gridBidAdapter.js +4 -3
  47. package/modules/gumgumBidAdapter.js +2 -2
  48. package/modules/idImportLibrary.js +45 -8
  49. package/modules/idImportLibrary.md +4 -0
  50. package/modules/improvedigitalBidAdapter.js +42 -4
  51. package/modules/instreamTracking.js +4 -4
  52. package/modules/invibesBidAdapter.js +49 -5
  53. package/modules/invibesBidAdapter.md +2 -1
  54. package/modules/ixBidAdapter.js +53 -18
  55. package/modules/kinessoIdSystem.js +1 -1
  56. package/modules/limelightDigitalBidAdapter.js +2 -1
  57. package/modules/livewrappedAnalyticsAdapter.js +3 -1
  58. package/modules/livewrappedBidAdapter.js +8 -2
  59. package/modules/loglyliftBidAdapter.js +79 -0
  60. package/modules/loglyliftBidAdapter.md +55 -0
  61. package/modules/lotamePanoramaIdSystem.js +80 -8
  62. package/modules/mediasquareBidAdapter.js +1 -9
  63. package/modules/nextMillenniumBidAdapter.js +39 -7
  64. package/modules/oguryBidAdapter.js +9 -2
  65. package/modules/onetagBidAdapter.js +4 -2
  66. package/modules/optimeraRtdProvider.js +8 -1
  67. package/modules/ozoneBidAdapter.js +21 -64
  68. package/modules/prebidServerBidAdapter/index.js +16 -12
  69. package/modules/proxistoreBidAdapter.js +0 -2
  70. package/modules/pubgeniusBidAdapter.js +1 -1
  71. package/modules/pubmaticAnalyticsAdapter.js +16 -0
  72. package/modules/pubxaiAnalyticsAdapter.js +17 -0
  73. package/modules/richaudienceBidAdapter.js +4 -4
  74. package/modules/riseBidAdapter.js +1 -1
  75. package/modules/rtbhouseBidAdapter.js +14 -4
  76. package/modules/rtdModule/index.js +49 -18
  77. package/modules/rubiconBidAdapter.js +31 -19
  78. package/modules/sharedIdSystem.js +27 -1
  79. package/modules/showheroes-bsBidAdapter.js +13 -2
  80. package/modules/tappxBidAdapter.js +8 -5
  81. package/modules/targetVideoBidAdapter.js +187 -0
  82. package/modules/targetVideoBidAdapter.md +34 -0
  83. package/modules/teadsBidAdapter.js +1 -2
  84. package/modules/telariaBidAdapter.js +2 -2
  85. package/modules/trustxBidAdapter.js +8 -16
  86. package/modules/userId/eids.js +7 -1
  87. package/modules/userId/userId.md +8 -0
  88. package/modules/vidoomyBidAdapter.js +16 -10
  89. package/modules/weboramaRtdProvider.js +288 -73
  90. package/modules/weboramaRtdProvider.md +27 -10
  91. package/modules/welectBidAdapter.js +106 -0
  92. package/modules/yahoosspBidAdapter.js +5 -1
  93. package/modules/yieldmoBidAdapter.js +23 -5
  94. package/modules/zetaSspBidAdapter.md +33 -1
  95. package/modules/zeta_global_sspAnalyticsAdapter.js +97 -0
  96. package/modules/zeta_global_sspAnalyticsAdapter.md +24 -0
  97. package/modules/zeta_global_sspBidAdapter.js +22 -1
  98. package/package.json +1 -1
  99. package/plugins/pbjsGlobals.js +28 -1
  100. package/src/auction.js +2 -2
  101. package/src/config.js +27 -3
  102. package/src/hook.js +5 -1
  103. package/src/prebid.js +21 -6
  104. package/src/targeting.js +22 -1
  105. package/src/utils.js +46 -8
  106. package/test/helpers/prebidGlobal.js +1 -0
  107. package/test/spec/config_spec.js +279 -0
  108. package/test/spec/modules/33acrossBidAdapter_spec.js +300 -78
  109. package/test/spec/modules/adlooxAnalyticsAdapter_spec.js +6 -6
  110. package/test/spec/modules/admanBidAdapter_spec.js +2 -2
  111. package/test/spec/modules/adnuntiusBidAdapter_spec.js +17 -0
  112. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +9 -1
  113. package/test/spec/modules/adqueryIdSystem_spec.js +74 -0
  114. package/test/spec/modules/adxcgBidAdapter_spec.js +820 -571
  115. package/test/spec/modules/adyoulikeBidAdapter_spec.js +49 -0
  116. package/test/spec/modules/beopBidAdapter_spec.js +1 -1
  117. package/test/spec/modules/bidViewabilityIO_spec.js +2 -2
  118. package/test/spec/modules/bidViewability_spec.js +4 -4
  119. package/test/spec/modules/bliinkBidAdapter_spec.js +2 -0
  120. package/test/spec/modules/colossussspBidAdapter_spec.js +9 -0
  121. package/test/spec/modules/compassBidAdapter_spec.js +398 -0
  122. package/test/spec/modules/consentManagement_spec.js +20 -0
  123. package/test/spec/modules/criteoIdSystem_spec.js +6 -3
  124. package/test/spec/modules/cwireBidAdapter_spec.js +10 -8
  125. package/test/spec/modules/dailyhuntBidAdapter_spec.js +404 -0
  126. package/test/spec/modules/docereeBidAdapter_spec.js +9 -1
  127. package/test/spec/modules/eids_spec.js +15 -0
  128. package/test/spec/modules/feedadBidAdapter_spec.js +15 -0
  129. package/test/spec/modules/glimpseBidAdapter_spec.js +0 -18
  130. package/test/spec/modules/gptPreAuction_spec.js +177 -2
  131. package/test/spec/modules/idImportLibrary_spec.js +197 -10
  132. package/test/spec/modules/improvedigitalBidAdapter_spec.js +45 -1
  133. package/test/spec/modules/invibesBidAdapter_spec.js +119 -0
  134. package/test/spec/modules/ixBidAdapter_spec.js +112 -62
  135. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +75 -17
  136. package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +22 -0
  137. package/test/spec/modules/livewrappedBidAdapter_spec.js +31 -0
  138. package/test/spec/modules/loglyliftBidAdapter_spec.js +172 -0
  139. package/test/spec/modules/lotamePanoramaIdSystem_spec.js +227 -0
  140. package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -4
  141. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +26 -1
  142. package/test/spec/modules/oguryBidAdapter_spec.js +10 -2
  143. package/test/spec/modules/optimeraRtdProvider_spec.js +14 -1
  144. package/test/spec/modules/ozoneBidAdapter_spec.js +43 -31
  145. package/test/spec/modules/prebidServerBidAdapter_spec.js +43 -0
  146. package/test/spec/modules/pubgeniusBidAdapter_spec.js +3 -3
  147. package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +13 -1
  148. package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +11 -0
  149. package/test/spec/modules/realTimeDataModule_spec.js +147 -48
  150. package/test/spec/modules/richaudienceBidAdapter_spec.js +42 -2
  151. package/test/spec/modules/riseBidAdapter_spec.js +1 -1
  152. package/test/spec/modules/rtbhouseBidAdapter_spec.js +20 -0
  153. package/test/spec/modules/rubiconBidAdapter_spec.js +65 -9
  154. package/test/spec/modules/sharedIdSystem_spec.js +52 -6
  155. package/test/spec/modules/showheroes-bsBidAdapter_spec.js +2 -0
  156. package/test/spec/modules/tappxBidAdapter_spec.js +0 -19
  157. package/test/spec/modules/targetVideoBidAdapter_spec.js +96 -0
  158. package/test/spec/modules/teadsBidAdapter_spec.js +14 -59
  159. package/test/spec/modules/userId_spec.js +68 -19
  160. package/test/spec/modules/weboramaRtdProvider_spec.js +408 -214
  161. package/test/spec/modules/welectBidAdapter_spec.js +211 -0
  162. package/test/spec/modules/yahoosspBidAdapter_spec.js +28 -1
  163. package/test/spec/modules/zeta_global_sspAnalyticsAdapter_spec.js +427 -0
  164. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +33 -1
  165. package/test/spec/unit/core/targeting_spec.js +72 -0
  166. package/test/spec/unit/pbjs_api_spec.js +3 -1
  167. package/test/spec/utils_spec.js +38 -0
  168. package/test/test_deps.js +3 -0
  169. package/test/test_index.js +1 -3
@@ -69,8 +69,6 @@ var validBidRequestsMulti = [
69
69
  transactionId: '2e63c0ed-b10c-4008-aed5-84582cecfe87'
70
70
  }
71
71
  ];
72
- // use 'pubcid', 'tdid', 'id5id', 'parrableId', 'idl_env', 'criteoId'
73
- // see http://prebid.org/dev-docs/modules/userId.html
74
72
  var validBidRequestsWithUserIdData = [
75
73
  {
76
74
  adUnitCode: 'div-gpt-ad-1460505748561-0',
@@ -291,7 +289,6 @@ var validBidRequests1OutstreamVideo2020 = [
291
289
  }
292
290
  ];
293
291
 
294
- // WHEN sent as bidderRequest to buildRequests you should send the child: .bidderRequest
295
292
  var validBidderRequest1OutstreamVideo2020 = {
296
293
  bidderRequest: {
297
294
  auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99',
@@ -394,7 +391,6 @@ var validBidderRequest1OutstreamVideo2020 = {
394
391
  timeout: 3000
395
392
  }
396
393
  };
397
- // WHEN sent as bidderRequest to buildRequests you should send the child: .bidderRequest
398
394
  var validBidderRequest = {
399
395
  bidderRequest: {
400
396
  auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99',
@@ -419,11 +415,6 @@ var validBidderRequest = {
419
415
  }
420
416
  };
421
417
 
422
- // bidder request with GDPR - change the values for testing:
423
- // gdprConsent.gdprApplies (true/false)
424
- // gdprConsent.vendorData.purposeConsents (make empty, make null, remove it)
425
- // gdprConsent.vendorData.vendorConsents (remove 524, remove all, make the element null, remove it)
426
- // WHEN sent as bidderRequest to buildRequests you should send the child: .bidderRequest
427
418
  var bidderRequestWithFullGdpr = {
428
419
  bidderRequest: {
429
420
  auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99',
@@ -512,7 +503,6 @@ var gdpr1 = {
512
503
  'gdprApplies': true
513
504
  };
514
505
 
515
- // simulating the Mirror
516
506
  var bidderRequestWithPartialGdpr = {
517
507
  bidderRequest: {
518
508
  auctionId: '27dcb421-95c6-4024-a624-3c03816c5f99',
@@ -558,7 +548,6 @@ var bidderRequestWithPartialGdpr = {
558
548
  }
559
549
  };
560
550
 
561
- // make sure the impid matches the request bidId
562
551
  var validResponse = {
563
552
  'body': {
564
553
  'id': 'd6198807-7a53-4141-b2db-d2cb754d68ba',
@@ -1113,7 +1102,6 @@ var multiRequest1 = [
1113
1102
  }
1114
1103
  ];
1115
1104
 
1116
- // WHEN sent as bidderRequest to buildRequests you should send the child: .bidderRequest
1117
1105
  var multiBidderRequest1 = {
1118
1106
  bidderRequest: {
1119
1107
  'bidderCode': 'ozone',
@@ -1507,7 +1495,6 @@ var multiResponse1 = {
1507
1495
 
1508
1496
  describe('ozone Adapter', function () {
1509
1497
  describe('isBidRequestValid', function () {
1510
- // A test ad unit that will consistently return test creatives
1511
1498
  let validBidReq = {
1512
1499
  bidder: BIDDER_CODE,
1513
1500
  params: {
@@ -1941,7 +1928,6 @@ describe('ozone Adapter', function () {
1941
1928
  const request = spec.buildRequests(validBidRequestsNoSizes, validBidderRequest.bidderRequest);
1942
1929
  expect(request).to.be.a('array');
1943
1930
  expect(request[0]).to.have.all.keys(['bidderRequest', 'data', 'method', 'url']);
1944
- // need to reset the singleRequest config flag:
1945
1931
  config.setConfig({'ozone': {'singleRequest': true}});
1946
1932
  });
1947
1933
 
@@ -1965,7 +1951,6 @@ describe('ozone Adapter', function () {
1965
1951
  expect(payload.user.ext.consent).to.equal(consentString);
1966
1952
  });
1967
1953
 
1968
- // mirror
1969
1954
  it('should add gdpr consent information to the request when vendorData is missing vendorConsents (Mirror)', function () {
1970
1955
  let consentString = 'BOcocyaOcocyaAfEYDENCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NphLgA==';
1971
1956
  let bidderRequest = validBidderRequest.bidderRequest;
@@ -2018,7 +2003,6 @@ describe('ozone Adapter', function () {
2018
2003
  };
2019
2004
 
2020
2005
  let bidRequests = validBidRequests;
2021
- // values from http://prebid.org/dev-docs/modules/userId.html#pubcommon-id
2022
2006
  bidRequests[0]['userId'] = {
2023
2007
  'digitrustid': {data: {id: 'DTID', keyv: 4, privacy: {optout: false}, producer: 'ABC', version: 2}},
2024
2008
  'id5id': { uid: '1111', ext: { linkType: 2, abTestingControlGroup: false } },
@@ -2038,13 +2022,11 @@ describe('ozone Adapter', function () {
2038
2022
 
2039
2023
  it('should pick up the value of pubcid when built using the pubCommonId module (not userId)', function () {
2040
2024
  let bidRequests = validBidRequests;
2041
- // values from http://prebid.org/dev-docs/modules/userId.html#pubcommon-id
2042
2025
  bidRequests[0]['userId'] = {
2043
2026
  'digitrustid': {data: {id: 'DTID', keyv: 4, privacy: {optout: false}, producer: 'ABC', version: 2}},
2044
2027
  'id5id': { uid: '1111', ext: { linkType: 2, abTestingControlGroup: false } },
2045
2028
  'idl_env': '3333',
2046
2029
  'parrableid': 'eidVersion.encryptionKeyReference.encryptedValue',
2047
- // 'pubcid': '5555', // remove pubcid from here to emulate the OLD module & cause the failover code to kick in
2048
2030
  'tdid': '6666',
2049
2031
  'sharedid': {'id': '01EAJWWNEPN3CYMM5N8M5VXY22', 'third': '01EAJWWNEPN3CYMM5N8M5VXY22'}
2050
2032
  };
@@ -2170,7 +2152,6 @@ describe('ozone Adapter', function () {
2170
2152
  });
2171
2153
  it('should use oztestmode GET value if set', function() {
2172
2154
  var specMock = utils.deepClone(spec);
2173
- // mock the getGetParametersAsObject function to simulate GET parameters for oztestmode:
2174
2155
  specMock.getGetParametersAsObject = function() {
2175
2156
  return {'oztestmode': 'mytestvalue_123'};
2176
2157
  };
@@ -2181,7 +2162,6 @@ describe('ozone Adapter', function () {
2181
2162
  });
2182
2163
  it('should pass through GET params if present: ozf, ozpf, ozrp, ozip', function() {
2183
2164
  var specMock = utils.deepClone(spec);
2184
- // mock the getGetParametersAsObject function to simulate GET parameters :
2185
2165
  specMock.getGetParametersAsObject = function() {
2186
2166
  return {ozf: '1', ozpf: '0', ozrp: '2', ozip: '123'};
2187
2167
  };
@@ -2194,7 +2174,6 @@ describe('ozone Adapter', function () {
2194
2174
  });
2195
2175
  it('should pass through GET params if present: ozf, ozpf, ozrp, ozip with alternative values', function() {
2196
2176
  var specMock = utils.deepClone(spec);
2197
- // mock the getGetParametersAsObject function to simulate GET parameters :
2198
2177
  specMock.getGetParametersAsObject = function() {
2199
2178
  return {ozf: 'false', ozpf: 'true', ozrp: 'xyz', ozip: 'hello'};
2200
2179
  };
@@ -2207,7 +2186,6 @@ describe('ozone Adapter', function () {
2207
2186
  });
2208
2187
  it('should use oztestmode GET value if set, even if there is no customdata in config', function() {
2209
2188
  var specMock = utils.deepClone(spec);
2210
- // mock the getGetParametersAsObject function to simulate GET parameters for oztestmode:
2211
2189
  specMock.getGetParametersAsObject = function() {
2212
2190
  return {'oztestmode': 'mytestvalue_123'};
2213
2191
  };
@@ -2217,7 +2195,6 @@ describe('ozone Adapter', function () {
2217
2195
  expect(data.imp[0].ext.ozone.customData[0].targeting.oztestmode).to.equal('mytestvalue_123');
2218
2196
  });
2219
2197
  it('should use GET values auction=dev & cookiesync=dev if set', function() {
2220
- // mock the getGetParametersAsObject function to simulate GET parameters for oztestmode:
2221
2198
  var specMock = utils.deepClone(spec);
2222
2199
  specMock.getGetParametersAsObject = function() {
2223
2200
  return {};
@@ -2228,8 +2205,6 @@ describe('ozone Adapter', function () {
2228
2205
  let cookieUrl = specMock.getCookieSyncUrl();
2229
2206
  expect(cookieUrl).to.equal('https://elb.the-ozone-project.com/static/load-cookie.html');
2230
2207
 
2231
- // now mock the response from getGetParametersAsObject & do the request again
2232
-
2233
2208
  specMock = utils.deepClone(spec);
2234
2209
  specMock.getGetParametersAsObject = function() {
2235
2210
  return {'auction': 'dev', 'cookiesync': 'dev'};
@@ -2241,7 +2216,6 @@ describe('ozone Adapter', function () {
2241
2216
  expect(cookieUrl).to.equal('https://test.ozpr.net/static/load-cookie.html');
2242
2217
  });
2243
2218
  it('should use a valid ozstoredrequest GET value if set to override the placementId values, and set oz_rw if we find it', function() {
2244
- // mock the getGetParametersAsObject function to simulate GET parameters for ozstoredrequest:
2245
2219
  var specMock = utils.deepClone(spec);
2246
2220
  specMock.getGetParametersAsObject = function() {
2247
2221
  return {'ozstoredrequest': '1122334455'}; // 10 digits are valid
@@ -2252,7 +2226,6 @@ describe('ozone Adapter', function () {
2252
2226
  expect(data.imp[0].ext.prebid.storedrequest.id).to.equal('1122334455');
2253
2227
  });
2254
2228
  it('should NOT use an invalid ozstoredrequest GET value if set to override the placementId values, and set oz_rw to 0', function() {
2255
- // mock the getGetParametersAsObject function to simulate GET parameters for ozstoredrequest:
2256
2229
  var specMock = utils.deepClone(spec);
2257
2230
  specMock.getGetParametersAsObject = function() {
2258
2231
  return {'ozstoredrequest': 'BADVAL'}; // 10 digits are valid
@@ -2424,6 +2397,26 @@ describe('ozone Adapter', function () {
2424
2397
  expect(utils.deepAccess(payload, 'imp.0.floor.banner.floor')).to.equal(0.8);
2425
2398
  config.resetConfig();
2426
2399
  });
2400
+
2401
+ it('handles schain object in each bidrequest (will be the same in each br)', function () {
2402
+ let br = JSON.parse(JSON.stringify(validBidRequests));
2403
+ let schainConfigObject = {
2404
+ 'ver': '1.0',
2405
+ 'complete': 1,
2406
+ 'nodes': [
2407
+ {
2408
+ 'asi': 'bidderA.com',
2409
+ 'sid': '00001',
2410
+ 'hp': 1
2411
+ }
2412
+ ]
2413
+ };
2414
+ br[0]['schain'] = schainConfigObject;
2415
+ const request = spec.buildRequests(br, validBidderRequest.bidderRequest);
2416
+ const data = JSON.parse(request.data);
2417
+ expect(data.source.ext).to.haveOwnProperty('schain');
2418
+ expect(data.source.ext.schain).to.deep.equal(schainConfigObject); // .deep.equal() : Target object deeply (but not strictly) equals `{a: 1}`
2419
+ });
2427
2420
  });
2428
2421
 
2429
2422
  describe('interpretResponse', function () {
@@ -2624,7 +2617,6 @@ describe('ozone Adapter', function () {
2624
2617
  expect(result[1]['impid']).to.equal('3025f169863b7f8');
2625
2618
  expect(result[1]['id']).to.equal('18552976939844999');
2626
2619
  expect(result[1]['adserverTargeting']['oz_ozappnexus_adId']).to.equal('3025f169863b7f8-0-oz-2');
2627
- // change the bid values so a different second bid for an impid by the same bidder gets dropped
2628
2620
  validres = JSON.parse(JSON.stringify(multiResponse1));
2629
2621
  validres.body.seatbid[0].bid[1].price = 1.1;
2630
2622
  validres.body.seatbid[0].bid[1].cpm = 1.1;
@@ -2647,7 +2639,6 @@ describe('ozone Adapter', function () {
2647
2639
  expect(result).to.be.empty;
2648
2640
  });
2649
2641
  it('should append the various values if they exist', function() {
2650
- // get the cookie bag populated
2651
2642
  spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
2652
2643
  const result = spec.getUserSyncs({iframeEnabled: true}, 'good server response', gdpr1);
2653
2644
  expect(result).to.be.an('array');
@@ -2657,14 +2648,12 @@ describe('ozone Adapter', function () {
2657
2648
  expect(result[0].url).to.include('gdpr_consent=BOh7mtYOh7mtYAcABBENCU-AAAAncgPIXJiiAoao0PxBFkgCAC8ACIAAQAQQAAIAAAIAAAhBGAAAQAQAEQgAAAAAAABAAAAAAAAAAAAAAACAAAAAAAACgAAAAABAAAAQAAAAAAA');
2658
2649
  });
2659
2650
  it('should append ccpa (usp data)', function() {
2660
- // get the cookie bag populated
2661
2651
  spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
2662
2652
  const result = spec.getUserSyncs({iframeEnabled: true}, 'good server response', gdpr1, '1YYN');
2663
2653
  expect(result).to.be.an('array');
2664
2654
  expect(result[0].url).to.include('usp_consent=1YYN');
2665
2655
  });
2666
2656
  it('should use "" if no usp is sent to cookieSync', function() {
2667
- // get the cookie bag populated
2668
2657
  spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
2669
2658
  const result = spec.getUserSyncs({iframeEnabled: true}, 'good server response', gdpr1);
2670
2659
  expect(result).to.be.an('array');
@@ -2887,4 +2876,27 @@ describe('ozone Adapter', function () {
2887
2876
  expect(response[1].bid.length).to.equal(2);
2888
2877
  });
2889
2878
  });
2879
+ /**
2880
+ * spec.getWhitelabelConfigItem test - get a config value for a whitelabelled bidder,
2881
+ * from a standard ozone.oz_xxxx_yyy string
2882
+ */
2883
+ describe('getWhitelabelConfigItem', function() {
2884
+ it('should fetch the whitelabelled equivalent config value correctly', function () {
2885
+ var specMock = utils.deepClone(spec);
2886
+ config.setConfig({'ozone': {'oz_omp_floor': 'ozone-floor-value'}});
2887
+ config.setConfig({'markbidder': {'mb_omp_floor': 'markbidder-floor-value'}});
2888
+ specMock.propertyBag.whitelabel = {bidder: 'ozone', keyPrefix: 'oz'};
2889
+ let testKey = 'ozone.oz_omp_floor';
2890
+ let ozone_value = specMock.getWhitelabelConfigItem(testKey);
2891
+ expect(ozone_value).to.equal('ozone-floor-value');
2892
+ specMock.propertyBag.whitelabel = {bidder: 'markbidder', keyPrefix: 'mb'};
2893
+ let markbidder_config = specMock.getWhitelabelConfigItem(testKey);
2894
+ expect(markbidder_config).to.equal('markbidder-floor-value');
2895
+ config.setConfig({'markbidder': {'singleRequest': 'markbidder-singlerequest-value'}});
2896
+ let testKey2 = 'ozone.singleRequest';
2897
+ let markbidder_config2 = specMock.getWhitelabelConfigItem(testKey2);
2898
+ expect(markbidder_config2).to.equal('markbidder-singlerequest-value');
2899
+ config.resetConfig();
2900
+ });
2901
+ });
2890
2902
  });
@@ -8,6 +8,7 @@ import events from 'src/events.js';
8
8
  import CONSTANTS from 'src/constants.json';
9
9
  import { server } from 'test/mocks/xhr.js';
10
10
  import { createEidsArray } from 'modules/userId/eids.js';
11
+ import {deepAccess, deepClone} from 'src/utils.js';
11
12
 
12
13
  let CONFIG = {
13
14
  accountId: '1',
@@ -1092,6 +1093,18 @@ describe('S2S Adapter', function () {
1092
1093
  });
1093
1094
  });
1094
1095
 
1096
+ it('should not include ext.aspectratios if adunit\'s aspect_ratios do not define radio_width and ratio_height', () => {
1097
+ const req = deepClone(REQUEST);
1098
+ req.ad_units[0].mediaTypes.native.icon.aspect_ratios[0] = {'min_width': 1, 'min_height': 2};
1099
+ adapter.callBids(req, BID_REQUESTS, addBidResponse, done, ajax);
1100
+ const nativeReq = JSON.parse(JSON.parse(server.requests[0].requestBody).imp[0].native.request);
1101
+ const icons = nativeReq.assets.map((a) => a.img).filter((img) => img && img.type === 1);
1102
+ expect(icons).to.have.length(1);
1103
+ expect(icons[0].hmin).to.equal(2);
1104
+ expect(icons[0].wmin).to.equal(1);
1105
+ expect(deepAccess(icons[0], 'ext.aspectratios')).to.be.undefined;
1106
+ })
1107
+
1095
1108
  it('adds site if app is not present', function () {
1096
1109
  const _config = {
1097
1110
  s2sConfig: CONFIG,
@@ -2420,6 +2433,36 @@ describe('S2S Adapter', function () {
2420
2433
 
2421
2434
  utils.getBidRequest.restore();
2422
2435
  });
2436
+
2437
+ describe('on sync requested with no cookie', () => {
2438
+ let cfg, req, csRes;
2439
+
2440
+ beforeEach(() => {
2441
+ cfg = utils.deepClone(CONFIG);
2442
+ req = utils.deepClone(REQUEST);
2443
+ cfg.syncEndpoint = { p1Consent: 'https://prebid.adnxs.com/pbs/v1/cookie_sync' };
2444
+ req.s2sConfig = cfg;
2445
+ config.setConfig({ s2sConfig: cfg });
2446
+ csRes = utils.deepClone(RESPONSE_NO_COOKIE);
2447
+ });
2448
+
2449
+ afterEach(() => {
2450
+ resetSyncedStatus();
2451
+ })
2452
+
2453
+ Object.entries({
2454
+ iframe: () => utils.insertUserSyncIframe,
2455
+ image: () => utils.triggerPixel,
2456
+ }).forEach(([type, syncer]) => {
2457
+ it(`passes timeout to ${type} syncs`, () => {
2458
+ cfg.syncTimeout = 123;
2459
+ csRes.bidder_status[0].usersync.type = type;
2460
+ adapter.callBids(req, BID_REQUESTS, addBidResponse, done, ajax);
2461
+ server.requests[0].respond(200, {}, JSON.stringify(csRes));
2462
+ expect(syncer().args[0]).to.include.members([123]);
2463
+ });
2464
+ });
2465
+ });
2423
2466
  });
2424
2467
 
2425
2468
  describe('bid won events', function () {
@@ -173,7 +173,7 @@ describe('pubGENIUS adapter', () => {
173
173
 
174
174
  expectedRequest = {
175
175
  method: 'POST',
176
- url: 'https://ortb.adpearl.io/prebid/auction',
176
+ url: 'https://auction.adpearl.io/prebid/auction',
177
177
  data: {
178
178
  id: 'fake-auction-id',
179
179
  imp: [
@@ -493,7 +493,7 @@ describe('pubGENIUS adapter', () => {
493
493
  };
494
494
  expectedSync = {
495
495
  type: 'iframe',
496
- url: 'https://ortb.adpearl.io/usersync/pixels.html?',
496
+ url: 'https://auction.adpearl.io/usersync/pixels.html?',
497
497
  };
498
498
  });
499
499
 
@@ -551,7 +551,7 @@ describe('pubGENIUS adapter', () => {
551
551
  onTimeout(timeoutData);
552
552
 
553
553
  expect(server.requests[0].method).to.equal('POST');
554
- expect(server.requests[0].url).to.equal('https://ortb.adpearl.io/prebid/events?type=timeout');
554
+ expect(server.requests[0].url).to.equal('https://auction.adpearl.io/prebid/events?type=timeout');
555
555
  expect(JSON.parse(server.requests[0].requestBody)).to.deep.equal(timeoutData);
556
556
  });
557
557
  });
@@ -95,6 +95,9 @@ const BID2 = Object.assign({}, BID, {
95
95
  'hb_pb': '1.500',
96
96
  'hb_size': '728x90',
97
97
  'hb_source': 'server'
98
+ },
99
+ meta: {
100
+ advertiserDomains: ['example.com']
98
101
  }
99
102
  });
100
103
 
@@ -382,6 +385,7 @@ describe('pubmatic analytics adapter', function () {
382
385
  expect(data.s[1].ps[0].di).to.equal('the-deal-id');
383
386
  expect(data.s[1].ps[0].dc).to.equal('PMP');
384
387
  expect(data.s[1].ps[0].mi).to.equal('matched-impression');
388
+ expect(data.s[1].ps[0].adv).to.equal('example.com');
385
389
  expect(data.s[1].ps[0].l1).to.equal(3214);
386
390
  expect(data.s[1].ps[0].l2).to.equal(0);
387
391
  expect(data.s[1].ps[0].ss).to.equal(1);
@@ -651,6 +655,7 @@ describe('pubmatic analytics adapter', function () {
651
655
  expect(data.s[1].ps[0].di).to.equal('the-deal-id');
652
656
  expect(data.s[1].ps[0].dc).to.equal('PMP');
653
657
  expect(data.s[1].ps[0].mi).to.equal('matched-impression');
658
+ expect(data.s[1].ps[0].adv).to.equal('example.com');
654
659
  expect(data.s[1].ps[0].l1).to.equal(3214);
655
660
  expect(data.s[1].ps[0].l2).to.equal(0);
656
661
  expect(data.s[1].ps[0].ss).to.equal(1);
@@ -708,6 +713,7 @@ describe('pubmatic analytics adapter', function () {
708
713
  expect(data.s[1].ps[0].di).to.equal('the-deal-id');
709
714
  expect(data.s[1].ps[0].dc).to.equal('PMP');
710
715
  expect(data.s[1].ps[0].mi).to.equal('matched-impression');
716
+ expect(data.s[1].ps[0].adv).to.equal('example.com');
711
717
  expect(data.s[1].ps[0].l1).to.equal(3214);
712
718
  expect(data.s[1].ps[0].l2).to.equal(0);
713
719
  expect(data.s[1].ps[0].ss).to.equal(1);
@@ -754,6 +760,7 @@ describe('pubmatic analytics adapter', function () {
754
760
  expect(data.s[1].ps[0].di).to.equal('the-deal-id');
755
761
  expect(data.s[1].ps[0].dc).to.equal('PMP');
756
762
  expect(data.s[1].ps[0].mi).to.equal('matched-impression');
763
+ expect(data.s[1].ps[0].adv).to.equal('example.com');
757
764
  expect(data.s[1].ps[0].l1).to.equal(3214);
758
765
  expect(data.s[1].ps[0].l2).to.equal(0);
759
766
  expect(data.s[1].ps[0].ss).to.equal(1);
@@ -771,9 +778,10 @@ describe('pubmatic analytics adapter', function () {
771
778
  expect(data.kgpv).to.equal('*');
772
779
  });
773
780
 
774
- it('Logger: regexPattern in bid.bidResponse', function() {
781
+ it('Logger: regexPattern in bid.bidResponse and url in adomain', function() {
775
782
  const BID2_COPY = utils.deepClone(BID2);
776
783
  BID2_COPY.regexPattern = '*';
784
+ BID2_COPY.meta.advertiserDomains = ['https://www.example.com/abc/223']
777
785
  events.emit(AUCTION_INIT, MOCK.AUCTION_INIT);
778
786
  events.emit(AUCTION_INIT, MOCK.AUCTION_INIT);
779
787
  events.emit(BID_REQUESTED, MOCK.BID_REQUESTED);
@@ -808,6 +816,7 @@ describe('pubmatic analytics adapter', function () {
808
816
  expect(data.s[1].ps[0].di).to.equal('the-deal-id');
809
817
  expect(data.s[1].ps[0].dc).to.equal('PMP');
810
818
  expect(data.s[1].ps[0].mi).to.equal('matched-impression');
819
+ expect(data.s[1].ps[0].adv).to.equal('example.com');
811
820
  expect(data.s[1].ps[0].l1).to.equal(3214);
812
821
  expect(data.s[1].ps[0].l2).to.equal(0);
813
822
  expect(data.s[1].ps[0].ss).to.equal(1);
@@ -859,6 +868,7 @@ describe('pubmatic analytics adapter', function () {
859
868
  expect(data.s[1].ps[0].di).to.equal('the-deal-id');
860
869
  expect(data.s[1].ps[0].dc).to.equal('PMP');
861
870
  expect(data.s[1].ps[0].mi).to.equal('matched-impression');
871
+ expect(data.s[1].ps[0].adv).to.equal('example.com');
862
872
  expect(data.s[1].ps[0].l1).to.equal(3214);
863
873
  expect(data.s[1].ps[0].l2).to.equal(0);
864
874
  expect(data.s[1].ps[0].ss).to.equal(1);
@@ -912,6 +922,7 @@ describe('pubmatic analytics adapter', function () {
912
922
  expect(data.s[1].ps[0].di).to.equal('the-deal-id');
913
923
  expect(data.s[1].ps[0].dc).to.equal('PMP');
914
924
  expect(data.s[1].ps[0].mi).to.equal('matched-impression');
925
+ expect(data.s[1].ps[0].adv).to.equal('example.com');
915
926
  expect(data.s[1].ps[0].l1).to.equal(3214);
916
927
  expect(data.s[1].ps[0].l2).to.equal(0);
917
928
  expect(data.s[1].ps[0].ss).to.equal(1);
@@ -1011,6 +1022,7 @@ describe('pubmatic analytics adapter', function () {
1011
1022
  expect(data.s[1].ps[0].di).to.equal('the-deal-id');
1012
1023
  expect(data.s[1].ps[0].dc).to.equal('PMP');
1013
1024
  expect(data.s[1].ps[0].mi).to.equal('matched-impression');
1025
+ expect(data.s[1].ps[0].adv).to.equal('example.com');
1014
1026
  expect(data.s[1].ps[0].l1).to.equal(3214);
1015
1027
  expect(data.s[1].ps[0].l2).to.equal(0);
1016
1028
  expect(data.s[1].ps[0].ss).to.equal(1);
@@ -28,6 +28,7 @@ describe('pubxai analytics adapter', function() {
28
28
  };
29
29
 
30
30
  let location = utils.getWindowLocation();
31
+ let storage = window.top['sessionStorage'];
31
32
 
32
33
  let prebidEvent = {
33
34
  'auctionInit': {
@@ -514,6 +515,11 @@ describe('pubxai analytics adapter', function() {
514
515
  'path': location.pathname,
515
516
  'search': location.search
516
517
  },
518
+ 'pmcDetail': {
519
+ 'bidDensity': storage.getItem('pbx:dpbid'),
520
+ 'maxBid': storage.getItem('pbx:mxbid'),
521
+ 'auctionId': storage.getItem('pbx:aucid')
522
+ }
517
523
  };
518
524
 
519
525
  let expectedAfterBid = {
@@ -577,6 +583,11 @@ describe('pubxai analytics adapter', function() {
577
583
  'deviceOS': getOS(),
578
584
  'browser': getBrowser()
579
585
  },
586
+ 'pmcDetail': {
587
+ 'bidDensity': storage.getItem('pbx:dpbid'),
588
+ 'maxBid': storage.getItem('pbx:mxbid'),
589
+ 'auctionId': storage.getItem('pbx:aucid')
590
+ },
580
591
  'initOptions': initOptions
581
592
  };
582
593
 
@@ -1,6 +1,9 @@
1
1
  import * as rtdModule from 'modules/rtdModule/index.js';
2
- import { config } from 'src/config.js';
2
+ import {config} from 'src/config.js';
3
3
  import * as sinon from 'sinon';
4
+ import {default as CONSTANTS} from '../../../src/constants.json';
5
+ import {default as events} from '../../../src/events.js';
6
+ import 'src/prebid.js';
4
7
 
5
8
  const getBidRequestDataSpy = sinon.spy();
6
9
 
@@ -58,33 +61,87 @@ const conf = {
58
61
  };
59
62
 
60
63
  describe('Real time module', function () {
61
- before(function () {
62
- rtdModule.attachRealTimeDataProvider(validSM);
63
- rtdModule.attachRealTimeDataProvider(invalidSM);
64
- rtdModule.attachRealTimeDataProvider(failureSM);
65
- rtdModule.attachRealTimeDataProvider(nonConfSM);
66
- rtdModule.attachRealTimeDataProvider(validSMWait);
67
- });
64
+ let eventHandlers;
65
+ let sandbox;
68
66
 
69
- after(function () {
70
- config.resetConfig();
71
- });
67
+ function mockEmitEvent(event, ...args) {
68
+ (eventHandlers[event] || []).forEach((h) => h(...args));
69
+ }
72
70
 
73
- beforeEach(function () {
74
- config.setConfig(conf);
71
+ before(() => {
72
+ eventHandlers = {};
73
+ sandbox = sinon.sandbox.create();
74
+ sandbox.stub(events, 'on').callsFake((event, handler) => {
75
+ if (!eventHandlers.hasOwnProperty(event)) {
76
+ eventHandlers[event] = [];
77
+ }
78
+ eventHandlers[event].push(handler);
79
+ });
75
80
  });
76
81
 
77
- it('should use only valid modules', function () {
78
- rtdModule.init(config);
79
- expect(rtdModule.subModules).to.eql([validSMWait, validSM]);
82
+ after(() => {
83
+ sandbox.restore();
80
84
  });
81
85
 
82
- it('should be able to modify bid request', function (done) {
83
- rtdModule.setBidRequestsData(() => {
84
- assert(getBidRequestDataSpy.calledTwice);
85
- assert(getBidRequestDataSpy.calledWith({bidRequest: {}}));
86
+ describe('', () => {
87
+ const PROVIDERS = [validSM, invalidSM, failureSM, nonConfSM, validSMWait];
88
+ let _detachers;
89
+
90
+ beforeEach(function () {
91
+ _detachers = PROVIDERS.map(rtdModule.attachRealTimeDataProvider);
92
+ rtdModule.init(config);
93
+ config.setConfig(conf);
94
+ });
95
+
96
+ afterEach(function () {
97
+ _detachers.forEach((f) => f());
98
+ config.resetConfig();
99
+ });
100
+
101
+ it('should use only valid modules', function () {
102
+ expect(rtdModule.subModules).to.eql([validSMWait, validSM]);
103
+ });
104
+
105
+ it('should be able to modify bid request', function (done) {
106
+ rtdModule.setBidRequestsData(() => {
107
+ assert(getBidRequestDataSpy.calledTwice);
108
+ assert(getBidRequestDataSpy.calledWith({bidRequest: {}}));
109
+ done();
110
+ }, {bidRequest: {}})
111
+ });
112
+
113
+ it('sould place targeting on adUnits', function (done) {
114
+ const auction = {
115
+ adUnitCodes: ['ad1', 'ad2'],
116
+ adUnits: [
117
+ {
118
+ code: 'ad1'
119
+ },
120
+ {
121
+ code: 'ad2',
122
+ adserverTargeting: {preKey: 'preValue'}
123
+ }
124
+ ]
125
+ };
126
+
127
+ const expectedAdUnits = [
128
+ {
129
+ code: 'ad1',
130
+ adserverTargeting: {key: 'validSMWait'}
131
+ },
132
+ {
133
+ code: 'ad2',
134
+ adserverTargeting: {
135
+ preKey: 'preValue',
136
+ key: 'validSM'
137
+ }
138
+ }
139
+ ];
140
+
141
+ const adUnits = rtdModule.getAdUnitTargeting(auction);
142
+ assert.deepEqual(expectedAdUnits, adUnits)
86
143
  done();
87
- }, {bidRequest: {}})
144
+ })
88
145
  });
89
146
 
90
147
  it('deep merge object', function () {
@@ -125,36 +182,78 @@ describe('Real time module', function () {
125
182
  assert.deepEqual(expected, merged);
126
183
  });
127
184
 
128
- it('sould place targeting on adUnits', function (done) {
129
- const auction = {
130
- adUnitCodes: ['ad1', 'ad2'],
131
- adUnits: [
132
- {
133
- code: 'ad1'
134
- },
135
- {
136
- code: 'ad2',
137
- adserverTargeting: {preKey: 'preValue'}
138
- }
139
- ]
185
+ describe('event', () => {
186
+ const EVENTS = {
187
+ [CONSTANTS.EVENTS.AUCTION_INIT]: 'onAuctionInitEvent',
188
+ [CONSTANTS.EVENTS.AUCTION_END]: 'onAuctionEndEvent',
189
+ [CONSTANTS.EVENTS.BID_RESPONSE]: 'onBidResponseEvent',
190
+ [CONSTANTS.EVENTS.BID_REQUESTED]: 'onBidRequestEvent'
191
+ }
192
+ const conf = {
193
+ 'realTimeData': {
194
+ dataProviders: [
195
+ {
196
+ 'name': 'tp1',
197
+ },
198
+ {
199
+ 'name': 'tp2',
200
+ }
201
+ ]
202
+ }
140
203
  };
204
+ let providers;
205
+ let _detachers;
141
206
 
142
- const expectedAdUnits = [
143
- {
144
- code: 'ad1',
145
- adserverTargeting: {key: 'validSMWait'}
146
- },
147
- {
148
- code: 'ad2',
149
- adserverTargeting: {
150
- preKey: 'preValue',
151
- key: 'validSM'
152
- }
207
+ function eventHandlingProvider(name) {
208
+ const provider = {
209
+ name: name,
210
+ init: () => true,
153
211
  }
154
- ];
212
+ Object.values(EVENTS).forEach((ev) => provider[ev] = sinon.spy());
213
+ return provider;
214
+ }
215
+
216
+ beforeEach(() => {
217
+ providers = [eventHandlingProvider('tp1'), eventHandlingProvider('tp2')];
218
+ _detachers = providers.map(rtdModule.attachRealTimeDataProvider);
219
+ rtdModule.init(config);
220
+ config.setConfig(conf);
221
+ });
222
+
223
+ afterEach(() => {
224
+ _detachers.forEach((d) => d())
225
+ config.resetConfig();
226
+ });
227
+
228
+ it('should set targeting for auctionEnd', () => {
229
+ providers.forEach(p => p.getTargetingData = sinon.spy());
230
+ const auction = {
231
+ adUnitCodes: ['a1'],
232
+ adUnits: [{code: 'a1'}]
233
+ };
234
+ mockEmitEvent(CONSTANTS.EVENTS.AUCTION_END, auction);
235
+ providers.forEach(p => {
236
+ expect(p.getTargetingData.calledWith(auction.adUnitCodes)).to.be.true;
237
+ });
238
+ });
239
+
240
+ Object.entries(EVENTS).forEach(([event, hook]) => {
241
+ it(`'${event}' should be propagated to providers through '${hook}'`, () => {
242
+ const eventArg = {};
243
+ mockEmitEvent(event, eventArg);
244
+ providers.forEach((provider) => {
245
+ const providerConf = conf.realTimeData.dataProviders.find((cfg) => cfg.name === provider.name);
246
+ expect(provider[hook].called).to.be.true;
247
+ expect(provider[hook].args).to.have.length(1);
248
+ expect(provider[hook].args[0]).to.include.members([eventArg, providerConf])
249
+ })
250
+ });
155
251
 
156
- const adUnits = rtdModule.getAdUnitTargeting(auction);
157
- assert.deepEqual(expectedAdUnits, adUnits)
158
- done();
252
+ it(`${event} should not fail to propagate elsewhere if a provider throws in its event handler`, () => {
253
+ providers[0][hook] = function () { throw new Error() };
254
+ mockEmitEvent(event);
255
+ expect(providers[1][hook].called).to.be.true;
256
+ });
257
+ });
159
258
  })
160
259
  });