prebid.js 8.3.0 → 8.4.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 (203) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/33acrossIdSystem.js +1 -1
  3. package/dist/adagioBidAdapter.js +1 -1
  4. package/dist/adbookpspBidAdapter.js +1 -1
  5. package/dist/adgenerationBidAdapter.js +1 -1
  6. package/dist/admanBidAdapter.js +1 -1
  7. package/dist/adqueryBidAdapter.js +1 -1
  8. package/dist/adrelevantisBidAdapter.js +1 -1
  9. package/dist/adtrgtmeBidAdapter.js +1 -1
  10. package/dist/adxcgBidAdapter.js +1 -1
  11. package/dist/adyoulikeBidAdapter.js +1 -1
  12. package/dist/ajaBidAdapter.js +1 -1
  13. package/dist/amxBidAdapter.js +1 -1
  14. package/dist/amxIdSystem.js +1 -1
  15. package/dist/appierAnalyticsAdapter.js +1 -1
  16. package/dist/appnexusBidAdapter.js +1 -1
  17. package/dist/asoBidAdapter.js +1 -1
  18. package/dist/axonixBidAdapter.js +1 -1
  19. package/dist/bidglassBidAdapter.js +1 -1
  20. package/dist/big-richmediaBidAdapter.js +1 -1
  21. package/dist/brandmetricsRtdProvider.js +1 -1
  22. package/dist/bridBidAdapter.js +1 -1
  23. package/dist/bridgewellBidAdapter.js +1 -1
  24. package/dist/brightMountainMediaBidAdapter.js +1 -1
  25. package/dist/carodaBidAdapter.js +1 -1
  26. package/dist/chtnwBidAdapter.js +1 -1
  27. package/dist/concertBidAdapter.js +1 -1
  28. package/dist/connectadBidAdapter.js +1 -1
  29. package/dist/consumableBidAdapter.js +1 -1
  30. package/dist/conversantAnalyticsAdapter.js +1 -1
  31. package/dist/conversantBidAdapter.js +1 -1
  32. package/dist/craftBidAdapter.js +1 -1
  33. package/dist/criteoBidAdapter.js +1 -1
  34. package/dist/cwireBidAdapter.js +1 -1
  35. package/dist/dependencies.json +3 -0
  36. package/dist/dspxBidAdapter.js +1 -1
  37. package/dist/eplanningBidAdapter.js +1 -1
  38. package/dist/euidIdSystem.js +1 -1
  39. package/dist/feedadBidAdapter.js +1 -1
  40. package/dist/finativeBidAdapter.js +1 -1
  41. package/dist/freewheel-sspBidAdapter.js +1 -1
  42. package/dist/gdprEnforcement.js +1 -1
  43. package/dist/gmosspBidAdapter.js +1 -1
  44. package/dist/goldbachBidAdapter.js +1 -1
  45. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  46. package/dist/greenbidsRtdProvider.js +1 -1
  47. package/dist/gridBidAdapter.js +1 -1
  48. package/dist/gumgumBidAdapter.js +1 -1
  49. package/dist/h12mediaBidAdapter.js +1 -1
  50. package/dist/hypelabBidAdapter.js +1 -1
  51. package/dist/id5IdSystem.js +1 -1
  52. package/dist/imdsBidAdapter.js +1 -1
  53. package/dist/improvedigitalBidAdapter.js +1 -1
  54. package/dist/insticatorBidAdapter.js +1 -1
  55. package/dist/ixBidAdapter.js +1 -1
  56. package/dist/justpremiumBidAdapter.js +1 -1
  57. package/dist/kargoBidAdapter.js +1 -1
  58. package/dist/konduitAnalyticsAdapter.js +1 -1
  59. package/dist/kueezBidAdapter.js +1 -1
  60. package/dist/kueezRtbBidAdapter.js +1 -1
  61. package/dist/kulturemediaBidAdapter.js +1 -1
  62. package/dist/lassoBidAdapter.js +1 -1
  63. package/dist/lifestreetBidAdapter.js +1 -1
  64. package/dist/logicadBidAdapter.js +1 -1
  65. package/dist/loglyliftBidAdapter.js +1 -1
  66. package/dist/magniteAnalyticsAdapter.js +1 -1
  67. package/dist/malltvAnalyticsAdapter.js +1 -1
  68. package/dist/marsmediaBidAdapter.js +1 -1
  69. package/dist/mediafuseBidAdapter.js +1 -1
  70. package/dist/mediasquareBidAdapter.js +1 -1
  71. package/dist/mgidBidAdapter.js +1 -1
  72. package/dist/minutemediaBidAdapter.js +1 -1
  73. package/dist/minutemediaplusBidAdapter.js +1 -1
  74. package/dist/nexx360BidAdapter.js +1 -1
  75. package/dist/not-for-prod/prebid.js +135 -135
  76. package/dist/oguryBidAdapter.js +1 -1
  77. package/dist/onetagBidAdapter.js +1 -1
  78. package/dist/ooloAnalyticsAdapter.js +1 -1
  79. package/dist/optidigitalBidAdapter.js +1 -1
  80. package/dist/outbrainBidAdapter.js +1 -1
  81. package/dist/parrableIdSystem.js +1 -1
  82. package/dist/pixfutureBidAdapter.js +1 -1
  83. package/dist/prebid-core.js +2 -2
  84. package/dist/publinkIdSystem.js +1 -1
  85. package/dist/pubmaticBidAdapter.js +1 -1
  86. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  87. package/dist/pulsepointBidAdapter.js +1 -1
  88. package/dist/pxyzBidAdapter.js +1 -1
  89. package/dist/quantcastBidAdapter.js +1 -1
  90. package/dist/readpeakBidAdapter.js +1 -1
  91. package/dist/relaidoBidAdapter.js +1 -1
  92. package/dist/retailspotBidAdapter.js +1 -1
  93. package/dist/rhythmoneBidAdapter.js +1 -1
  94. package/dist/riseBidAdapter.js +1 -1
  95. package/dist/rubiconBidAdapter.js +1 -1
  96. package/dist/seedingAllianceBidAdapter.js +1 -1
  97. package/dist/seedtagBidAdapter.js +1 -1
  98. package/dist/sharedIdSystem.js +1 -1
  99. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  100. package/dist/sharethroughBidAdapter.js +1 -1
  101. package/dist/shinezBidAdapter.js +1 -1
  102. package/dist/smaatoBidAdapter.js +1 -1
  103. package/dist/smartadserverBidAdapter.js +1 -1
  104. package/dist/smartxBidAdapter.js +1 -1
  105. package/dist/smilewantedBidAdapter.js +1 -1
  106. package/dist/sonobiBidAdapter.js +1 -1
  107. package/dist/sovrnAnalyticsAdapter.js +1 -1
  108. package/dist/sovrnBidAdapter.js +1 -1
  109. package/dist/sspBCBidAdapter.js +1 -1
  110. package/dist/stroeerCoreBidAdapter.js +1 -1
  111. package/dist/stvBidAdapter.js +1 -1
  112. package/dist/sublimeBidAdapter.js +1 -1
  113. package/dist/targetVideoBidAdapter.js +1 -1
  114. package/dist/teadsBidAdapter.js +1 -1
  115. package/dist/topicsFpdModule.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/uid2IdSystem.js +1 -1
  121. package/dist/underdogmediaBidAdapter.js +1 -1
  122. package/dist/undertoneBidAdapter.js +1 -1
  123. package/dist/userId.js +1 -1
  124. package/dist/vidazooBidAdapter.js +1 -1
  125. package/dist/videobyteBidAdapter.js +1 -1
  126. package/dist/visxBidAdapter.js +1 -1
  127. package/dist/voxBidAdapter.js +1 -1
  128. package/dist/vuukleBidAdapter.js +1 -1
  129. package/dist/widespaceBidAdapter.js +1 -1
  130. package/dist/winrBidAdapter.js +1 -1
  131. package/dist/yahoosspBidAdapter.js +1 -1
  132. package/dist/yandexBidAdapter.js +1 -1
  133. package/dist/yieldmoBidAdapter.js +1 -1
  134. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  135. package/integrationExamples/videoModule/jwplayer/bidMarkedAsUsed.html +1 -1
  136. package/integrationExamples/videoModule/jwplayer/eventListeners.html +2 -2
  137. package/integrationExamples/videoModule/jwplayer/eventsUI.html +1 -1
  138. package/integrationExamples/videoModule/jwplayer/gamAdServerMediation.html +1 -1
  139. package/integrationExamples/videoModule/jwplayer/mediaMetadata.html +1 -1
  140. package/integrationExamples/videoModule/jwplayer/playlist.html +1 -1
  141. package/integrationExamples/videoModule/videojs/bidMarkedAsUsed.html +1 -1
  142. package/integrationExamples/videoModule/videojs/bidRequestScheduling.html +1 -1
  143. package/integrationExamples/videoModule/videojs/eventListeners.html +1 -1
  144. package/integrationExamples/videoModule/videojs/eventsUI.html +1 -1
  145. package/integrationExamples/videoModule/videojs/gamAdServerMediation.html +1 -1
  146. package/integrationExamples/videoModule/videojs/mediaMetadata.html +1 -1
  147. package/integrationExamples/videoModule/videojs/playlist.html +1 -1
  148. package/modules/33acrossBidAdapter.js +24 -14
  149. package/modules/33acrossIdSystem.js +15 -4
  150. package/modules/adagioBidAdapter.js +0 -1
  151. package/modules/admanBidAdapter.js +4 -0
  152. package/modules/brandmetricsRtdProvider.js +36 -2
  153. package/modules/brandmetricsRtdProvider.md +17 -2
  154. package/modules/gdprEnforcement.js +27 -22
  155. package/modules/gridBidAdapter.js +19 -0
  156. package/modules/ixBidAdapter.js +40 -2
  157. package/modules/kargoBidAdapter.js +4 -0
  158. package/modules/minutemediaBidAdapter.js +17 -2
  159. package/modules/oguryBidAdapter.js +29 -16
  160. package/modules/pubmaticBidAdapter.js +16 -1
  161. package/modules/pulsepointBidAdapter.js +63 -424
  162. package/modules/pulsepointBidAdapter.md +39 -45
  163. package/modules/sharedIdSystem.js +1 -1
  164. package/modules/sovrnBidAdapter.js +5 -1
  165. package/modules/stroeerCoreBidAdapter.js +2 -3
  166. package/modules/teadsBidAdapter.js +2 -0
  167. package/modules/topicsFpdModule.js +4 -1
  168. package/modules/topicsFpdModule.md +4 -0
  169. package/modules/userId/index.js +2 -2
  170. package/modules/vidazooBidAdapter.js +5 -7
  171. package/modules/voxBidAdapter.js +16 -5
  172. package/modules/yahoosspBidAdapter.js +38 -33
  173. package/modules/yahoosspBidAdapter.md +96 -95
  174. package/modules/yandexBidAdapter.js +12 -15
  175. package/package.json +1 -1
  176. package/src/activities/redactor.js +1 -1
  177. package/src/auction.js +24 -2
  178. package/src/constants.json +3 -1
  179. package/src/fpd/sua.js +8 -2
  180. package/test/spec/auctionmanager_spec.js +29 -1
  181. package/test/spec/fpd/enrichment_spec.js +7 -1
  182. package/test/spec/fpd/sua_spec.js +12 -0
  183. package/test/spec/modules/33acrossBidAdapter_spec.js +188 -35
  184. package/test/spec/modules/33acrossIdSystem_spec.js +122 -27
  185. package/test/spec/modules/adagioBidAdapter_spec.js +0 -1
  186. package/test/spec/modules/brandmetricsRtdProvider_spec.js +69 -7
  187. package/test/spec/modules/gdprEnforcement_spec.js +43 -2
  188. package/test/spec/modules/gridBidAdapter_spec.js +42 -0
  189. package/test/spec/modules/ixBidAdapter_spec.js +72 -0
  190. package/test/spec/modules/kargoBidAdapter_spec.js +121 -106
  191. package/test/spec/modules/minutemediaBidAdapter_spec.js +36 -5
  192. package/test/spec/modules/oguryBidAdapter_spec.js +208 -108
  193. package/test/spec/modules/pubmaticBidAdapter_spec.js +119 -0
  194. package/test/spec/modules/pulsepointBidAdapter_spec.js +225 -486
  195. package/test/spec/modules/sovrnBidAdapter_spec.js +24 -4
  196. package/test/spec/modules/stroeerCoreBidAdapter_spec.js +8 -5
  197. package/test/spec/modules/teadsBidAdapter_spec.js +70 -21
  198. package/test/spec/modules/topicsFpdModule_spec.js +10 -4
  199. package/test/spec/modules/vidazooBidAdapter_spec.js +0 -5
  200. package/test/spec/modules/voxBidAdapter_spec.js +93 -0
  201. package/test/spec/modules/yahoosspBidAdapter_spec.js +402 -314
  202. package/test/spec/modules/yandexBidAdapter_spec.js +21 -3
  203. package/integrationExamples/gpt/inskin_example.html +0 -100
package/src/auction.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * In Prebid 0.x, $$PREBID_GLOBAL$$ had _bidsRequested and _bidsReceived as public properties.
5
5
  * Starting 1.0, Prebid will support concurrent auctions. Each auction instance will store private properties, bidsRequested and bidsReceived.
6
6
  *
7
- * AuctionManager will create instance of auction and will store all the auctions.
7
+ * AuctionManager will create an instance of auction and will store all the auctions.
8
8
  *
9
9
  */
10
10
 
@@ -820,6 +820,16 @@ export const getPriceByGranularity = (granularity) => {
820
820
  }
821
821
  }
822
822
 
823
+ /**
824
+ * This function returns a function to get crid from bid response
825
+ * @returns {function}
826
+ */
827
+ export const getCreativeId = () => {
828
+ return (bid) => {
829
+ return (bid.creativeId) ? bid.creativeId : '';
830
+ }
831
+ }
832
+
823
833
  /**
824
834
  * This function returns a function to get first advertiser domain from bid response meta
825
835
  * @returns {function}
@@ -830,6 +840,16 @@ export const getAdvertiserDomain = () => {
830
840
  }
831
841
  }
832
842
 
843
+ /**
844
+ * This function returns a function to get dsp name or id from bid response meta
845
+ * @returns {function}
846
+ */
847
+ export const getDSP = () => {
848
+ return (bid) => {
849
+ return (bid.meta && (bid.meta.networkId || bid.meta.networkName)) ? deepAccess(bid, 'meta.networkName') || deepAccess(bid, 'meta.networkId') : '';
850
+ }
851
+ }
852
+
833
853
  /**
834
854
  * This function returns a function to get the primary category id from bid response meta
835
855
  * @returns {function}
@@ -866,6 +886,8 @@ function defaultAdserverTargeting() {
866
886
  createKeyVal(TARGETING_KEYS.FORMAT, 'mediaType'),
867
887
  createKeyVal(TARGETING_KEYS.ADOMAIN, getAdvertiserDomain()),
868
888
  createKeyVal(TARGETING_KEYS.ACAT, getPrimaryCatId()),
889
+ createKeyVal(TARGETING_KEYS.DSP, getDSP()),
890
+ createKeyVal(TARGETING_KEYS.CRID, getCreativeId()),
869
891
  ]
870
892
  }
871
893
 
@@ -957,7 +979,7 @@ function setKeys(keyValues, bidderSettings, custBidObj, bidReq) {
957
979
 
958
980
  if (
959
981
  ((typeof bidderSettings.suppressEmptyKeys !== 'undefined' && bidderSettings.suppressEmptyKeys === true) ||
960
- key === CONSTANTS.TARGETING_KEYS.DEAL || key === CONSTANTS.TARGETING_KEYS.ACAT) && // hb_deal & hb_acat are suppressed automatically if not set
982
+ key === CONSTANTS.TARGETING_KEYS.DEAL || key === CONSTANTS.TARGETING_KEYS.ACAT || key === CONSTANTS.TARGETING_KEYS.DSP || key === CONSTANTS.TARGETING_KEYS.CRID) && // hb_deal & hb_acat are suppressed automatically if not set
961
983
  (
962
984
  isEmptyStr(value) ||
963
985
  value === null ||
@@ -77,7 +77,9 @@
77
77
  "CACHE_ID": "hb_cache_id",
78
78
  "CACHE_HOST": "hb_cache_host",
79
79
  "ADOMAIN": "hb_adomain",
80
- "ACAT": "hb_acat"
80
+ "ACAT": "hb_acat",
81
+ "CRID": "hb_crid",
82
+ "DSP": "hb_dsp"
81
83
  },
82
84
  "DEFAULT_TARGETING_KEYS": {
83
85
  "BIDDER": "hb_bidder",
package/src/fpd/sua.js CHANGED
@@ -15,6 +15,12 @@ export const HIGH_ENTROPY_HINTS = [
15
15
  'fullVersionList'
16
16
  ]
17
17
 
18
+ export const LOW_ENTROPY_HINTS = [
19
+ 'brands',
20
+ 'mobile',
21
+ 'platform'
22
+ ]
23
+
18
24
  /**
19
25
  * Returns low entropy UA client hints encoded as an ortb2.6 device.sua object; or null if no UA client hints are available.
20
26
  */
@@ -32,7 +38,7 @@ export const getLowEntropySUA = lowEntropySUAAccessor();
32
38
  export const getHighEntropySUA = highEntropySUAAccessor();
33
39
 
34
40
  export function lowEntropySUAAccessor(uaData = window.navigator?.userAgentData) {
35
- const sua = isEmpty(uaData) ? null : Object.freeze(uaDataToSUA(SUA_SOURCE_LOW_ENTROPY, uaData));
41
+ const sua = (uaData && LOW_ENTROPY_HINTS.some(h => typeof uaData[h] !== 'undefined')) ? Object.freeze(uaDataToSUA(SUA_SOURCE_LOW_ENTROPY, uaData)) : null;
36
42
  return function () {
37
43
  return sua;
38
44
  }
@@ -85,7 +91,7 @@ export function uaDataToSUA(source, uaData) {
85
91
  if (uaData.fullVersionList || uaData.brands) {
86
92
  sua.browsers = (uaData.fullVersionList || uaData.brands).map(({brand, version}) => toBrandVersion(brand, version));
87
93
  }
88
- if (uaData.hasOwnProperty('mobile')) {
94
+ if (typeof uaData['mobile'] !== 'undefined') {
89
95
  sua.mobile = uaData.mobile ? 1 : 0;
90
96
  }
91
97
  ['model', 'bitness', 'architecture'].forEach(prop => {
@@ -185,9 +185,11 @@ describe('auctionmanager.js', function () {
185
185
  adId: '1adId',
186
186
  source: 'client',
187
187
  mediaType: 'banner',
188
+ creativeId: 'monkeys',
188
189
  meta: {
189
190
  advertiserDomains: ['adomain'],
190
- primaryCatId: 'IAB-test'
191
+ primaryCatId: 'IAB-test',
192
+ networkId: '123987'
191
193
  }
192
194
  };
193
195
 
@@ -202,6 +204,8 @@ describe('auctionmanager.js', function () {
202
204
  expected[ CONSTANTS.TARGETING_KEYS.FORMAT ] = bid.mediaType;
203
205
  expected[ CONSTANTS.TARGETING_KEYS.ADOMAIN ] = bid.meta.advertiserDomains[0];
204
206
  expected[ CONSTANTS.TARGETING_KEYS.ACAT ] = bid.meta.primaryCatId;
207
+ expected[ CONSTANTS.TARGETING_KEYS.DSP ] = bid.meta.networkId;
208
+ expected[ CONSTANTS.TARGETING_KEYS.CRID ] = bid.creativeId;
205
209
  if (bid.mediaType === 'video') {
206
210
  expected[ CONSTANTS.TARGETING_KEYS.UUID ] = bid.videoCacheKey;
207
211
  expected[ CONSTANTS.TARGETING_KEYS.CACHE_ID ] = bid.videoCacheKey;
@@ -304,6 +308,18 @@ describe('auctionmanager.js', function () {
304
308
  return bidResponse.meta.advertiserDomains[0];
305
309
  }
306
310
  },
311
+ {
312
+ key: CONSTANTS.TARGETING_KEYS.CRID,
313
+ val: function (bidResponse) {
314
+ return bidResponse.creativeId;
315
+ }
316
+ },
317
+ {
318
+ key: CONSTANTS.TARGETING_KEYS.DSP,
319
+ val: function (bidResponse) {
320
+ return bidResponse.meta.networkId;
321
+ }
322
+ },
307
323
  {
308
324
  key: CONSTANTS.TARGETING_KEYS.ACAT,
309
325
  val: function (bidResponse) {
@@ -388,6 +404,18 @@ describe('auctionmanager.js', function () {
388
404
  return bidResponse.meta.advertiserDomains[0];
389
405
  }
390
406
  },
407
+ {
408
+ key: CONSTANTS.TARGETING_KEYS.CRID,
409
+ val: function (bidResponse) {
410
+ return bidResponse.creativeId;
411
+ }
412
+ },
413
+ {
414
+ key: CONSTANTS.TARGETING_KEYS.DSP,
415
+ val: function (bidResponse) {
416
+ return bidResponse.meta.networkId;
417
+ }
418
+ },
391
419
  {
392
420
  key: CONSTANTS.TARGETING_KEYS.ACAT,
393
421
  val: function (bidResponse) {
@@ -275,7 +275,13 @@ describe('FPD enrichment', () => {
275
275
 
276
276
  describe('sua', () => {
277
277
  it('does not set device.sua if resolved sua is null', () => {
278
- sandbox.stub(dep, 'getHighEntropySUA').returns(Promise.resolve())
278
+ sandbox.stub(dep, 'getHighEntropySUA').returns(Promise.resolve());
279
+ // Add hints so it will attempt to retrieve high entropy values
280
+ config.setConfig({
281
+ firstPartyData: {
282
+ uaHints: ['bitness'],
283
+ }
284
+ });
279
285
  return fpd().then(ortb2 => {
280
286
  expect(ortb2.device.sua).to.not.exist;
281
287
  })
@@ -165,6 +165,14 @@ describe('uaDataToSUA', () => {
165
165
  });
166
166
 
167
167
  describe('lowEntropySUAAccessor', () => {
168
+ // Set up a mock data with readonly property
169
+ class MockUserAgentData {}
170
+ Object.defineProperty(MockUserAgentData.prototype, 'mobile', {
171
+ value: false,
172
+ writable: false,
173
+ enumerable: true
174
+ });
175
+
168
176
  function getSUA(uaData) {
169
177
  return lowEntropySUAAccessor(uaData)();
170
178
  }
@@ -181,6 +189,10 @@ describe('lowEntropySUAAccessor', () => {
181
189
  it('should return null if uaData is empty', () => {
182
190
  expect(getSUA({})).to.eql(null);
183
191
  })
192
+
193
+ it('should return mobile and source', () => {
194
+ expect(getSUA(new MockUserAgentData())).to.eql({mobile: 0, source: 1})
195
+ })
184
196
  });
185
197
 
186
198
  describe('highEntropySUAAccessor', () => {
@@ -200,6 +200,29 @@ describe('33acrossBidAdapter:', function () {
200
200
  return this;
201
201
  };
202
202
 
203
+ this.withCoppa = coppaValue => {
204
+ Object.assign(ttxRequest.regs, {
205
+ coppa: coppaValue
206
+ });
207
+
208
+ return this;
209
+ };
210
+
211
+ this.withGppConsent = (consentString, applicableSections) => {
212
+ Object.assign(ttxRequest, {
213
+ regs: {
214
+ gpp: consentString,
215
+ gpp_sid: applicableSections,
216
+ ext: Object.assign(
217
+ {},
218
+ ttxRequest.regs.ext
219
+ )
220
+ }
221
+ });
222
+
223
+ return this;
224
+ };
225
+
203
226
  this.withSite = site => {
204
227
  Object.assign(ttxRequest, { site });
205
228
  return this;
@@ -1049,11 +1072,11 @@ describe('33acrossBidAdapter:', function () {
1049
1072
  });
1050
1073
 
1051
1074
  it('returns corresponding test server requests with gdpr consent data', function() {
1052
- sandbox.stub(config, 'getConfig').callsFake(() => {
1053
- return {
1075
+ sandbox.stub(config, 'getConfig')
1076
+ .withArgs('ttxSettings')
1077
+ .returns({
1054
1078
  'url': 'https://foo.com/hb/'
1055
- }
1056
- });
1079
+ });
1057
1080
 
1058
1081
  const ttxRequest = new TtxRequestBuilder()
1059
1082
  .withBanner()
@@ -1085,11 +1108,11 @@ describe('33acrossBidAdapter:', function () {
1085
1108
  });
1086
1109
 
1087
1110
  it('returns corresponding test server requests with default gdpr consent data', function() {
1088
- sandbox.stub(config, 'getConfig').callsFake(() => {
1089
- return {
1111
+ sandbox.stub(config, 'getConfig')
1112
+ .withArgs('ttxSettings')
1113
+ .returns({
1090
1114
  'url': 'https://foo.com/hb/'
1091
- }
1092
- });
1115
+ });
1093
1116
 
1094
1117
  const ttxRequest = new TtxRequestBuilder()
1095
1118
  .withBanner()
@@ -1128,11 +1151,11 @@ describe('33acrossBidAdapter:', function () {
1128
1151
  });
1129
1152
 
1130
1153
  it('returns corresponding test server requests with us_privacy consent data', function() {
1131
- sandbox.stub(config, 'getConfig').callsFake(() => {
1132
- return {
1154
+ sandbox.stub(config, 'getConfig')
1155
+ .withArgs('ttxSettings')
1156
+ .returns({
1133
1157
  'url': 'https://foo.com/hb/'
1134
- }
1135
- });
1158
+ });
1136
1159
 
1137
1160
  const ttxRequest = new TtxRequestBuilder()
1138
1161
  .withBanner()
@@ -1164,15 +1187,102 @@ describe('33acrossBidAdapter:', function () {
1164
1187
  });
1165
1188
 
1166
1189
  it('returns corresponding test server requests with default us_privacy consent data', function() {
1167
- sandbox.stub(config, 'getConfig').callsFake(() => {
1168
- return {
1190
+ sandbox.stub(config, 'getConfig')
1191
+ .withArgs('ttxSettings')
1192
+ .returns({
1169
1193
  'url': 'https://foo.com/hb/'
1194
+ });
1195
+
1196
+ const ttxRequest = new TtxRequestBuilder()
1197
+ .withBanner()
1198
+ .withProduct()
1199
+ .build();
1200
+ const serverRequest = new ServerRequestBuilder()
1201
+ .withData(ttxRequest)
1202
+ .withUrl('https://foo.com/hb/')
1203
+ .build();
1204
+ const [ builtServerRequest ] = spec.buildRequests(bidRequests, bidderRequest);
1205
+
1206
+ validateBuiltServerRequest(builtServerRequest, serverRequest);
1207
+ });
1208
+ });
1209
+
1210
+ context('when coppa has been enabled', function() {
1211
+ beforeEach(function() {
1212
+ sandbox.stub(config, 'getConfig').withArgs('coppa').returns(true);
1213
+ });
1214
+
1215
+ it('returns corresponding server requests with coppa: 1', function() {
1216
+ const ttxRequest = new TtxRequestBuilder()
1217
+ .withBanner()
1218
+ .withProduct()
1219
+ .withCoppa(1)
1220
+ .build();
1221
+
1222
+ const serverRequest = new ServerRequestBuilder()
1223
+ .withData(ttxRequest)
1224
+ .build();
1225
+ const [ builtServerRequest ] = spec.buildRequests(bidRequests, bidderRequest);
1226
+
1227
+ validateBuiltServerRequest(builtServerRequest, serverRequest);
1228
+ });
1229
+ });
1230
+
1231
+ context('when coppa has been disabled', function() {
1232
+ beforeEach(function() {
1233
+ sandbox.stub(config, 'getConfig').withArgs('coppa').returns(false);
1234
+ });
1235
+
1236
+ it('returns corresponding server requests with coppa: 0', function() {
1237
+ const ttxRequest = new TtxRequestBuilder()
1238
+ .withBanner()
1239
+ .withProduct()
1240
+ .withCoppa(0)
1241
+ .build();
1242
+ const serverRequest = new ServerRequestBuilder()
1243
+ .withData(ttxRequest)
1244
+ .build();
1245
+ const [ builtServerRequest ] = spec.buildRequests(bidRequests, bidderRequest);
1246
+
1247
+ validateBuiltServerRequest(builtServerRequest, serverRequest);
1248
+ });
1249
+ });
1250
+
1251
+ context('when GPP consent data exists', function() {
1252
+ beforeEach(function() {
1253
+ bidderRequest = {
1254
+ ...bidderRequest,
1255
+ gppConsent: {
1256
+ gppString: 'foo',
1257
+ applicableSections: '123'
1170
1258
  }
1171
- });
1259
+ }
1260
+ });
1172
1261
 
1262
+ it('returns corresponding server requests with GPP consent data', function() {
1173
1263
  const ttxRequest = new TtxRequestBuilder()
1174
1264
  .withBanner()
1175
1265
  .withProduct()
1266
+ .withGppConsent('foo', '123')
1267
+ .build();
1268
+ const serverRequest = new ServerRequestBuilder()
1269
+ .withData(ttxRequest)
1270
+ .build();
1271
+ const [ builtServerRequest ] = spec.buildRequests(bidRequests, bidderRequest);
1272
+
1273
+ validateBuiltServerRequest(builtServerRequest, serverRequest);
1274
+ });
1275
+
1276
+ it('returns corresponding test server requests with GPP consent data', function() {
1277
+ sandbox.stub(config, 'getConfig').withArgs('ttxSettings')
1278
+ .returns({
1279
+ 'url': 'https://foo.com/hb/'
1280
+ });
1281
+
1282
+ const ttxRequest = new TtxRequestBuilder()
1283
+ .withBanner()
1284
+ .withProduct()
1285
+ .withGppConsent('foo', '123')
1176
1286
  .build();
1177
1287
  const serverRequest = new ServerRequestBuilder()
1178
1288
  .withData(ttxRequest)
@@ -1747,11 +1857,11 @@ describe('33acrossBidAdapter:', function () {
1747
1857
 
1748
1858
  context('when SRA mode is enabled', function() {
1749
1859
  it('builds a single request with multiple imps corresponding to each group {siteId, productId}', function() {
1750
- sandbox.stub(config, 'getConfig').callsFake(() => {
1751
- return {
1860
+ sandbox.stub(config, 'getConfig')
1861
+ .withArgs('ttxSettings')
1862
+ .returns({
1752
1863
  enableSRAMode: true
1753
- }
1754
- });
1864
+ });
1755
1865
 
1756
1866
  const bidRequests = new BidRequestsBuilder()
1757
1867
  .addBid()
@@ -2219,11 +2329,11 @@ describe('33acrossBidAdapter:', function () {
2219
2329
  const expectedSyncs = [
2220
2330
  {
2221
2331
  type: 'iframe',
2222
- url: `${syncs[0].url}&gdpr_consent=undefined&us_privacy=undefined`
2332
+ url: `${syncs[0].url}&gdpr_consent=undefined&us_privacy=undefined&gpp=&gpp_sid=`
2223
2333
  },
2224
2334
  {
2225
2335
  type: 'iframe',
2226
- url: `${syncs[1].url}&gdpr_consent=undefined&us_privacy=undefined`
2336
+ url: `${syncs[1].url}&gdpr_consent=undefined&us_privacy=undefined&gpp=&gpp_sid=`
2227
2337
  }
2228
2338
  ]
2229
2339
 
@@ -2239,11 +2349,11 @@ describe('33acrossBidAdapter:', function () {
2239
2349
  const expectedSyncs = [
2240
2350
  {
2241
2351
  type: 'iframe',
2242
- url: `${syncs[0].url}&gdpr_consent=undefined&us_privacy=undefined&gdpr=1`
2352
+ url: `${syncs[0].url}&gdpr_consent=undefined&us_privacy=undefined&gpp=&gpp_sid=&gdpr=1`
2243
2353
  },
2244
2354
  {
2245
2355
  type: 'iframe',
2246
- url: `${syncs[1].url}&gdpr_consent=undefined&us_privacy=undefined&gdpr=1`
2356
+ url: `${syncs[1].url}&gdpr_consent=undefined&us_privacy=undefined&gpp=&gpp_sid=&gdpr=1`
2247
2357
  }
2248
2358
  ];
2249
2359
 
@@ -2259,11 +2369,11 @@ describe('33acrossBidAdapter:', function () {
2259
2369
  const expectedSyncs = [
2260
2370
  {
2261
2371
  type: 'iframe',
2262
- url: `${syncs[0].url}&gdpr_consent=consent123A&us_privacy=undefined&gdpr=1`
2372
+ url: `${syncs[0].url}&gdpr_consent=consent123A&us_privacy=undefined&gpp=&gpp_sid=&gdpr=1`
2263
2373
  },
2264
2374
  {
2265
2375
  type: 'iframe',
2266
- url: `${syncs[1].url}&gdpr_consent=consent123A&us_privacy=undefined&gdpr=1`
2376
+ url: `${syncs[1].url}&gdpr_consent=consent123A&us_privacy=undefined&gpp=&gpp_sid=&gdpr=1`
2267
2377
  }
2268
2378
  ];
2269
2379
 
@@ -2279,11 +2389,11 @@ describe('33acrossBidAdapter:', function () {
2279
2389
  const expectedSyncs = [
2280
2390
  {
2281
2391
  type: 'iframe',
2282
- url: `${syncs[0].url}&gdpr_consent=undefined&us_privacy=undefined&gdpr=0`
2392
+ url: `${syncs[0].url}&gdpr_consent=undefined&us_privacy=undefined&gpp=&gpp_sid=&gdpr=0`
2283
2393
  },
2284
2394
  {
2285
2395
  type: 'iframe',
2286
- url: `${syncs[1].url}&gdpr_consent=undefined&us_privacy=undefined&gdpr=0`
2396
+ url: `${syncs[1].url}&gdpr_consent=undefined&us_privacy=undefined&gpp=&gpp_sid=&gdpr=0`
2287
2397
  }
2288
2398
  ];
2289
2399
  expect(syncResults).to.deep.equal(expectedSyncs);
@@ -2298,11 +2408,11 @@ describe('33acrossBidAdapter:', function () {
2298
2408
  const expectedSyncs = [
2299
2409
  {
2300
2410
  type: 'iframe',
2301
- url: `${syncs[0].url}&gdpr_consent=consent123A&us_privacy=undefined`
2411
+ url: `${syncs[0].url}&gdpr_consent=consent123A&us_privacy=undefined&gpp=&gpp_sid=`
2302
2412
  },
2303
2413
  {
2304
2414
  type: 'iframe',
2305
- url: `${syncs[1].url}&gdpr_consent=consent123A&us_privacy=undefined`
2415
+ url: `${syncs[1].url}&gdpr_consent=consent123A&us_privacy=undefined&gpp=&gpp_sid=`
2306
2416
  }
2307
2417
  ];
2308
2418
  expect(syncResults).to.deep.equal(expectedSyncs);
@@ -2317,11 +2427,11 @@ describe('33acrossBidAdapter:', function () {
2317
2427
  const expectedSyncs = [
2318
2428
  {
2319
2429
  type: 'iframe',
2320
- url: `${syncs[0].url}&gdpr_consent=consent123A&us_privacy=undefined&gdpr=0`
2430
+ url: `${syncs[0].url}&gdpr_consent=consent123A&us_privacy=undefined&gpp=&gpp_sid=&gdpr=0`
2321
2431
  },
2322
2432
  {
2323
2433
  type: 'iframe',
2324
- url: `${syncs[1].url}&gdpr_consent=consent123A&us_privacy=undefined&gdpr=0`
2434
+ url: `${syncs[1].url}&gdpr_consent=consent123A&us_privacy=undefined&gpp=&gpp_sid=&gdpr=0`
2325
2435
  }
2326
2436
  ];
2327
2437
  expect(syncResults).to.deep.equal(expectedSyncs);
@@ -2336,11 +2446,11 @@ describe('33acrossBidAdapter:', function () {
2336
2446
  const expectedSyncs = [
2337
2447
  {
2338
2448
  type: 'iframe',
2339
- url: `${syncs[0].url}&gdpr_consent=undefined&us_privacy=undefined`
2449
+ url: `${syncs[0].url}&gdpr_consent=undefined&us_privacy=undefined&gpp=&gpp_sid=`
2340
2450
  },
2341
2451
  {
2342
2452
  type: 'iframe',
2343
- url: `${syncs[1].url}&gdpr_consent=undefined&us_privacy=undefined`
2453
+ url: `${syncs[1].url}&gdpr_consent=undefined&us_privacy=undefined&gpp=&gpp_sid=`
2344
2454
  }
2345
2455
  ]
2346
2456
 
@@ -2356,11 +2466,54 @@ describe('33acrossBidAdapter:', function () {
2356
2466
  const expectedSyncs = [
2357
2467
  {
2358
2468
  type: 'iframe',
2359
- url: `${syncs[0].url}&gdpr_consent=undefined&us_privacy=foo`
2469
+ url: `${syncs[0].url}&gdpr_consent=undefined&us_privacy=foo&gpp=&gpp_sid=`
2470
+ },
2471
+ {
2472
+ type: 'iframe',
2473
+ url: `${syncs[1].url}&gdpr_consent=undefined&us_privacy=foo&gpp=&gpp_sid=`
2474
+ }
2475
+ ];
2476
+
2477
+ expect(syncResults).to.deep.equal(expectedSyncs);
2478
+ });
2479
+ });
2480
+
2481
+ context('when there is no GPP data', function() {
2482
+ it('returns sync urls with empty GPP params', function() {
2483
+ spec.buildRequests(bidRequests);
2484
+
2485
+ const syncResults = spec.getUserSyncs(syncOptions, {});
2486
+ const expectedSyncs = [
2487
+ {
2488
+ type: 'iframe',
2489
+ url: `${syncs[0].url}&gdpr_consent=undefined&us_privacy=undefined&gpp=&gpp_sid=`
2490
+ },
2491
+ {
2492
+ type: 'iframe',
2493
+ url: `${syncs[1].url}&gdpr_consent=undefined&us_privacy=undefined&gpp=&gpp_sid=`
2494
+ }
2495
+ ]
2496
+
2497
+ expect(syncResults).to.deep.equal(expectedSyncs);
2498
+ })
2499
+ });
2500
+
2501
+ context('when there is GPP data', function() {
2502
+ it('returns sync urls with GPP consent string & GPP Section ID as params', function() {
2503
+ spec.buildRequests(bidRequests);
2504
+
2505
+ const syncResults = spec.getUserSyncs(syncOptions, {}, {}, undefined, {
2506
+ gppString: 'foo',
2507
+ applicableSections: ['123', '456']
2508
+ });
2509
+ const expectedSyncs = [
2510
+ {
2511
+ type: 'iframe',
2512
+ url: `${syncs[0].url}&gdpr_consent=undefined&us_privacy=undefined&gpp=foo&gpp_sid=123%2C456`
2360
2513
  },
2361
2514
  {
2362
2515
  type: 'iframe',
2363
- url: `${syncs[1].url}&gdpr_consent=undefined&us_privacy=foo`
2516
+ url: `${syncs[1].url}&gdpr_consent=undefined&us_privacy=undefined&gpp=foo&gpp_sid=123%2C456`
2364
2517
  }
2365
2518
  ];
2366
2519