prebid.js 5.20.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/.babelrc.js +1 -10
  2. package/README.md +4 -2
  3. package/browsers.json +13 -37
  4. package/gulpfile.js +1 -8
  5. package/integrationExamples/gpt/weboramaRtdProvider_example.html +23 -14
  6. package/karma.conf.maker.js +1 -1
  7. package/modules/33acrossBidAdapter.js +189 -102
  8. package/modules/adagioBidAdapter.js +1 -1
  9. package/modules/addefendBidAdapter.js +1 -0
  10. package/modules/adheseBidAdapter.js +7 -2
  11. package/modules/adkernelBidAdapter.js +1 -0
  12. package/modules/adlivetechBidAdapter.md +61 -0
  13. package/modules/admanBidAdapter.js +1 -0
  14. package/modules/admixerBidAdapter.js +3 -2
  15. package/modules/adnuntiusBidAdapter.js +5 -2
  16. package/modules/adomikAnalyticsAdapter.js +10 -4
  17. package/modules/adplusBidAdapter.js +203 -0
  18. package/modules/adplusBidAdapter.md +39 -0
  19. package/modules/adxcgBidAdapter.js +311 -359
  20. package/modules/adxcgBidAdapter.md +22 -21
  21. package/modules/adyoulikeBidAdapter.js +7 -2
  22. package/modules/appnexusBidAdapter.js +23 -3
  23. package/modules/beachfrontBidAdapter.js +14 -17
  24. package/modules/beopBidAdapter.js +5 -3
  25. package/modules/codefuelBidAdapter.js +1 -3
  26. package/modules/codefuelBidAdapter.md +3 -3
  27. package/modules/colossussspBidAdapter.js +7 -0
  28. package/modules/craftBidAdapter.js +5 -3
  29. package/modules/criteoBidAdapter.js +1 -1
  30. package/modules/cwireBidAdapter.js +3 -0
  31. package/modules/datablocksBidAdapter.js +3 -3
  32. package/modules/dchain.js +149 -0
  33. package/modules/dchain.md +45 -0
  34. package/modules/deepintentBidAdapter.js +1 -1
  35. package/modules/dspxBidAdapter.js +1 -1
  36. package/modules/emx_digitalBidAdapter.js +9 -1
  37. package/modules/engageyaBidAdapter.js +68 -54
  38. package/modules/freewheel-sspBidAdapter.js +6 -0
  39. package/modules/futureads.md +48 -0
  40. package/modules/glimpseBidAdapter.js +44 -16
  41. package/modules/goldbachBidAdapter.js +1176 -0
  42. package/modules/goldbachBidAdapter.md +151 -0
  43. package/modules/gptPreAuction.js +11 -5
  44. package/modules/gridBidAdapter.js +1 -1
  45. package/modules/gumgumBidAdapter.js +7 -3
  46. package/modules/id5IdSystem.md +6 -6
  47. package/modules/imRtdProvider.js +31 -0
  48. package/modules/intersectionRtdProvider.js +114 -0
  49. package/modules/invibesBidAdapter.js +15 -9
  50. package/modules/ipromBidAdapter.js +79 -0
  51. package/modules/ixBidAdapter.js +166 -21
  52. package/modules/kinessoIdSystem.js +1 -1
  53. package/modules/limelightDigitalBidAdapter.js +2 -1
  54. package/modules/lotamePanoramaIdSystem.js +80 -8
  55. package/modules/luponmediaBidAdapter.js +570 -0
  56. package/modules/mediasquareBidAdapter.js +1 -9
  57. package/modules/merkleIdSystem.js +5 -0
  58. package/modules/missenaBidAdapter.js +89 -0
  59. package/modules/nativoBidAdapter.js +27 -1
  60. package/modules/nextMillenniumBidAdapter.js +29 -1
  61. package/modules/oguryBidAdapter.js +2 -1
  62. package/modules/openxBidAdapter.js +6 -1
  63. package/modules/prebidServerBidAdapter/index.js +19 -15
  64. package/modules/pubmaticBidAdapter.js +5 -3
  65. package/modules/relaidoBidAdapter.js +86 -65
  66. package/modules/richaudienceBidAdapter.js +2 -3
  67. package/modules/rtdModule/index.js +48 -18
  68. package/modules/rubiconBidAdapter.js +10 -8
  69. package/modules/saambaaBidAdapter.js +420 -0
  70. package/modules/saambaaBidAdapter.md +65 -68
  71. package/modules/seedtagBidAdapter.js +6 -0
  72. package/modules/sharedIdSystem.js +27 -1
  73. package/modules/smaatoBidAdapter.js +9 -1
  74. package/modules/smartxBidAdapter.js +17 -1
  75. package/modules/sspBCBidAdapter.js +34 -3
  76. package/modules/tappxBidAdapter.js +3 -1
  77. package/modules/targetVideoBidAdapter.js +187 -0
  78. package/modules/targetVideoBidAdapter.md +34 -0
  79. package/modules/trustxBidAdapter.js +10 -1
  80. package/modules/undertoneBidAdapter.js +8 -1
  81. package/modules/userId/index.js +27 -2
  82. package/modules/ventes.md +71 -0
  83. package/modules/ventesBidAdapter.js +104 -64
  84. package/modules/ventesBidAdapter.md +0 -1
  85. package/modules/vidoomyBidAdapter.js +65 -108
  86. package/modules/visxBidAdapter.js +20 -3
  87. package/modules/visxBidAdapter.md +4 -6
  88. package/modules/weboramaRtdProvider.js +288 -73
  89. package/modules/weboramaRtdProvider.md +27 -10
  90. package/modules/yahoosspBidAdapter.js +5 -1
  91. package/modules/yahoosspBidAdapter.md +1 -1
  92. package/modules/yieldlabBidAdapter.js +41 -10
  93. package/modules/yieldlabBidAdapter.md +91 -48
  94. package/modules/yieldoneBidAdapter.js +115 -11
  95. package/modules/zetaSspBidAdapter.md +33 -1
  96. package/modules/zeta_global_sspBidAdapter.js +22 -1
  97. package/package.json +6 -1
  98. package/plugins/pbjsGlobals.js +28 -1
  99. package/src/adapterManager.js +14 -8
  100. package/src/auction.js +3 -2
  101. package/src/prebid.js +1 -2
  102. package/src/targeting.js +24 -3
  103. package/src/utils.js +41 -7
  104. package/test/spec/integration/faker/googletag.js +6 -0
  105. package/test/spec/modules/33acrossBidAdapter_spec.js +300 -78
  106. package/test/spec/modules/adheseBidAdapter_spec.js +27 -1
  107. package/test/spec/modules/adnuntiusBidAdapter_spec.js +35 -0
  108. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
  109. package/test/spec/modules/adplusBidAdapter_spec.js +213 -0
  110. package/test/spec/modules/adxcgBidAdapter_spec.js +820 -571
  111. package/test/spec/modules/adyoulikeBidAdapter_spec.js +26 -0
  112. package/test/spec/modules/appnexusBidAdapter_spec.js +63 -1
  113. package/test/spec/modules/beachfrontBidAdapter_spec.js +65 -1
  114. package/test/spec/modules/codefuelBidAdapter_spec.js +1 -1
  115. package/test/spec/modules/colossussspBidAdapter_spec.js +9 -0
  116. package/test/spec/modules/cwireBidAdapter_spec.js +10 -8
  117. package/test/spec/modules/datablocksBidAdapter_spec.js +3 -3
  118. package/test/spec/modules/dchain_spec.js +329 -0
  119. package/test/spec/modules/emx_digitalBidAdapter_spec.js +10 -0
  120. package/test/spec/modules/engageyaBidAdapter_spec.js +231 -95
  121. package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
  122. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +19 -0
  123. package/test/spec/modules/glimpseBidAdapter_spec.js +33 -0
  124. package/test/spec/modules/goldbachBidAdapter_spec.js +1359 -0
  125. package/test/spec/modules/gptPreAuction_spec.js +58 -4
  126. package/test/spec/modules/gumgumBidAdapter_spec.js +6 -0
  127. package/test/spec/modules/imRtdProvider_spec.js +25 -0
  128. package/test/spec/modules/intersectionRtdProvider_spec.js +141 -0
  129. package/test/spec/modules/invibesBidAdapter_spec.js +29 -4
  130. package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
  131. package/test/spec/modules/ixBidAdapter_spec.js +285 -2
  132. package/test/spec/modules/konduitWrapper_spec.js +0 -1
  133. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +10 -7
  134. package/test/spec/modules/lotamePanoramaIdSystem_spec.js +227 -0
  135. package/test/spec/modules/luponmediaBidAdapter_spec.js +412 -0
  136. package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -4
  137. package/test/spec/modules/merkleIdSystem_spec.js +18 -0
  138. package/test/spec/modules/missenaBidAdapter_spec.js +134 -0
  139. package/test/spec/modules/nativoBidAdapter_spec.js +35 -18
  140. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +18 -0
  141. package/test/spec/modules/oguryBidAdapter_spec.js +13 -11
  142. package/test/spec/modules/openxBidAdapter_spec.js +5 -0
  143. package/test/spec/modules/prebidServerBidAdapter_spec.js +62 -2
  144. package/test/spec/modules/pubmaticBidAdapter_spec.js +1 -1
  145. package/test/spec/modules/realTimeDataModule_spec.js +135 -49
  146. package/test/spec/modules/relaidoBidAdapter_spec.js +71 -63
  147. package/test/spec/modules/richaudienceBidAdapter_spec.js +2 -2
  148. package/test/spec/modules/rubiconBidAdapter_spec.js +17 -0
  149. package/test/spec/modules/seedtagBidAdapter_spec.js +3 -0
  150. package/test/spec/modules/sharedIdSystem_spec.js +52 -6
  151. package/test/spec/modules/smaatoBidAdapter_spec.js +61 -0
  152. package/test/spec/modules/smartxBidAdapter_spec.js +9 -0
  153. package/test/spec/modules/sspBCBidAdapter_spec.js +33 -3
  154. package/test/spec/modules/tappxBidAdapter_spec.js +4 -0
  155. package/test/spec/modules/targetVideoBidAdapter_spec.js +96 -0
  156. package/test/spec/modules/trustxBidAdapter_spec.js +42 -0
  157. package/test/spec/modules/userId_spec.js +51 -0
  158. package/test/spec/modules/vidoomyBidAdapter_spec.js +32 -13
  159. package/test/spec/modules/visxBidAdapter_spec.js +121 -5
  160. package/test/spec/modules/weboramaRtdProvider_spec.js +408 -214
  161. package/test/spec/modules/yahoosspBidAdapter_spec.js +28 -1
  162. package/test/spec/modules/yieldlabBidAdapter_spec.js +81 -0
  163. package/test/spec/modules/yieldoneBidAdapter_spec.js +299 -53
  164. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +33 -1
  165. package/test/spec/unit/core/adapterManager_spec.js +24 -6
  166. package/test/spec/unit/core/targeting_spec.js +116 -0
  167. package/test/spec/utils_spec.js +38 -0
  168. package/wdio.conf.js +1 -1
@@ -3343,6 +3343,23 @@ describe('the rubicon adapter', function () {
3343
3343
  type: 'iframe', url: `${emilyUrl}?gdpr_consent=foo&us_privacy=1NYN`
3344
3344
  });
3345
3345
  });
3346
+
3347
+ it('should pass gdprApplies', function () {
3348
+ expect(spec.getUserSyncs({iframeEnabled: true}, {}, {
3349
+ gdprApplies: true
3350
+ }, '1NYN')).to.deep.equal({
3351
+ type: 'iframe', url: `${emilyUrl}?gdpr=1&us_privacy=1NYN`
3352
+ });
3353
+ });
3354
+
3355
+ it('should pass all correctly', function () {
3356
+ expect(spec.getUserSyncs({iframeEnabled: true}, {}, {
3357
+ gdprApplies: true,
3358
+ consentString: 'foo'
3359
+ }, '1NYN')).to.deep.equal({
3360
+ type: 'iframe', url: `${emilyUrl}?gdpr=1&gdpr_consent=foo&us_privacy=1NYN`
3361
+ });
3362
+ });
3346
3363
  });
3347
3364
 
3348
3365
  describe('get price granularity', function () {
@@ -274,6 +274,9 @@ describe('Seedtag Adapter', function() {
274
274
  expect(data.ga).to.equal(true)
275
275
  expect(data.cd).to.equal('consentString')
276
276
  })
277
+ it('should expose gvlid', function() {
278
+ expect(spec.gvlid).to.equal(157)
279
+ })
277
280
  })
278
281
  })
279
282
 
@@ -50,10 +50,10 @@ describe('SharedId System', function () {
50
50
  expect(callbackSpy.calledOnce).to.be.true;
51
51
  expect(callbackSpy.lastCall.lastArg).to.equal(UUID);
52
52
  });
53
- it('should log message if coppa is set', function () {
53
+ it('should abort if coppa is set', function () {
54
54
  coppaDataHandlerDataStub.returns('true');
55
- sharedIdSystemSubmodule.getId({});
56
- expect(utils.logInfo.args[0][0]).to.exist.and.to.equal('PubCommonId: IDs not provided for coppa requests, exiting PubCommonId');
55
+ const result = sharedIdSystemSubmodule.getId({});
56
+ expect(result).to.be.undefined;
57
57
  });
58
58
  });
59
59
  describe('SharedId System extendId()', function () {
@@ -85,10 +85,56 @@ describe('SharedId System', function () {
85
85
  let pubcommId = sharedIdSystemSubmodule.extendId(config, undefined, 'TestId').id;
86
86
  expect(pubcommId).to.equal('TestId');
87
87
  });
88
- it('should log message if coppa is set', function () {
88
+ it('should abort if coppa is set', function () {
89
89
  coppaDataHandlerDataStub.returns('true');
90
- sharedIdSystemSubmodule.extendId({}, undefined, 'TestId');
91
- expect(utils.logInfo.args[0][0]).to.exist.and.to.equal('PubCommonId: IDs not provided for coppa requests, exiting PubCommonId');
90
+ const result = sharedIdSystemSubmodule.extendId({params: {extend: true}}, undefined, 'TestId');
91
+ expect(result).to.be.undefined;
92
+ });
93
+ });
94
+
95
+ describe('SharedID System domainOverride', () => {
96
+ let sandbox, domain, cookies, rejectCookiesFor;
97
+
98
+ beforeEach(() => {
99
+ sandbox = sinon.createSandbox();
100
+ sandbox.stub(document, 'domain').get(() => domain);
101
+ cookies = {};
102
+ sandbox.stub(storage, 'getCookie').callsFake((key) => cookies[key]);
103
+ rejectCookiesFor = null;
104
+ sandbox.stub(storage, 'setCookie').callsFake((key, value, expires, sameSite, domain) => {
105
+ if (domain !== rejectCookiesFor) {
106
+ if (expires != null) {
107
+ expires = new Date(expires);
108
+ }
109
+ if (expires == null || expires > Date.now()) {
110
+ cookies[key] = value;
111
+ } else {
112
+ delete cookies[key];
113
+ }
114
+ }
115
+ });
116
+ });
117
+
118
+ afterEach(() => {
119
+ sandbox.restore();
120
+ });
121
+
122
+ it('should return TLD if cookies can be set there', () => {
123
+ domain = 'sub.domain.com';
124
+ rejectCookiesFor = 'com';
125
+ expect(sharedIdSystemSubmodule.domainOverride()).to.equal('domain.com');
126
+ });
127
+
128
+ it('should return undefined when cookies cannot be set', () => {
129
+ domain = 'sub.domain.com';
130
+ rejectCookiesFor = 'sub.domain.com';
131
+ expect(sharedIdSystemSubmodule.domainOverride()).to.be.undefined;
132
+ });
133
+
134
+ it('should return half-way domain if parent domain rejects cookies', () => {
135
+ domain = 'inner.outer.domain.com';
136
+ rejectCookiesFor = 'domain.com';
137
+ expect(sharedIdSystemSubmodule.domainOverride()).to.equal('outer.domain.com');
92
138
  });
93
139
  });
94
140
  });
@@ -287,6 +287,23 @@ describe('smaatoBidAdapterTest', () => {
287
287
  expect(req.regs.ext.us_privacy).to.equal('uspConsentString');
288
288
  });
289
289
 
290
+ it('sends no schain if no schain exists', () => {
291
+ const reqs = spec.buildRequests([singleBannerBidRequest], defaultBidderRequest);
292
+
293
+ const req = extractPayloadOfFirstAndOnlyRequest(reqs);
294
+ expect(req.source.ext.schain).to.not.exist;
295
+ });
296
+
297
+ it('sends instl if instl exists', () => {
298
+ const instl = { instl: 1 };
299
+ const bidRequestWithInstl = Object.assign({}, singleBannerBidRequest, {ortb2Imp: instl});
300
+
301
+ const reqs = spec.buildRequests([bidRequestWithInstl], defaultBidderRequest);
302
+
303
+ const req = extractPayloadOfFirstAndOnlyRequest(reqs);
304
+ expect(req.imp[0].instl).to.equal(1);
305
+ });
306
+
290
307
  it('sends tmax', () => {
291
308
  const reqs = spec.buildRequests([singleBannerBidRequest], defaultBidderRequest);
292
309
 
@@ -435,6 +452,16 @@ describe('smaatoBidAdapterTest', () => {
435
452
  expect(req.imp[0].bidfloor).to.be.equal(0.456);
436
453
  });
437
454
 
455
+ it('sends instl if instl exists', () => {
456
+ const instl = { instl: 1 };
457
+ const bidRequestWithInstl = Object.assign({}, singleVideoBidRequest, {ortb2Imp: instl});
458
+
459
+ const reqs = spec.buildRequests([bidRequestWithInstl], defaultBidderRequest);
460
+
461
+ const req = extractPayloadOfFirstAndOnlyRequest(reqs);
462
+ expect(req.imp[0].instl).to.equal(1);
463
+ });
464
+
438
465
  it('splits multi format bid requests', () => {
439
466
  const combinedBannerAndVideoBidRequest = {
440
467
  bidder: 'smaato',
@@ -516,6 +543,17 @@ describe('smaatoBidAdapterTest', () => {
516
543
  expect(req.imp[1].video.sequence).to.be.equal(2);
517
544
  });
518
545
 
546
+ it('sends instl if instl exists', () => {
547
+ const instl = { instl: 1 };
548
+ const bidRequestWithInstl = Object.assign({}, longFormVideoBidRequest, {ortb2Imp: instl});
549
+
550
+ const reqs = spec.buildRequests([bidRequestWithInstl], defaultBidderRequest);
551
+
552
+ const req = extractPayloadOfFirstAndOnlyRequest(reqs);
553
+ expect(req.imp[0].instl).to.equal(1);
554
+ expect(req.imp[1].instl).to.equal(1);
555
+ });
556
+
519
557
  it('sends bidfloor when configured', () => {
520
558
  const longFormVideoBidRequestWithFloor = Object.assign({}, longFormVideoBidRequest);
521
559
  longFormVideoBidRequestWithFloor.getFloor = function(arg) {
@@ -854,6 +892,29 @@ describe('smaatoBidAdapterTest', () => {
854
892
  expect(req.user.ext.eids).to.have.length(2);
855
893
  });
856
894
  });
895
+
896
+ describe('schain in request', () => {
897
+ it('schain is added to source.ext.schain', () => {
898
+ const schain = {
899
+ ver: '1.0',
900
+ complete: 1,
901
+ nodes: [
902
+ {
903
+ 'asi': 'asi',
904
+ 'sid': 'sid',
905
+ 'rid': 'rid',
906
+ 'hp': 1
907
+ }
908
+ ]
909
+ };
910
+ const bidRequestWithSchain = Object.assign({}, singleBannerBidRequest, {schain: schain});
911
+
912
+ const reqs = spec.buildRequests([bidRequestWithSchain], defaultBidderRequest);
913
+
914
+ const req = extractPayloadOfFirstAndOnlyRequest(reqs);
915
+ expect(req.source.ext.schain).to.deep.equal(schain);
916
+ });
917
+ });
857
918
  });
858
919
 
859
920
  describe('interpretResponse', () => {
@@ -189,6 +189,14 @@ describe('The smartx adapter', function () {
189
189
  domain: '',
190
190
  publisher: {
191
191
  id: '__name__'
192
+ },
193
+ content: {
194
+ ext: {
195
+ prebid: {
196
+ name: 'pbjs',
197
+ version: '$prebid.version$'
198
+ }
199
+ }
192
200
  }
193
201
  });
194
202
  });
@@ -525,6 +533,7 @@ describe('The smartx adapter', function () {
525
533
  bidderRequestObj.bidRequest.bids[0].params.outstream_options.title = 'abc';
526
534
  bidderRequestObj.bidRequest.bids[0].params.outstream_options.skipOffset = 2;
527
535
  bidderRequestObj.bidRequest.bids[0].params.outstream_options.desiredBitrate = 123;
536
+ bidderRequestObj.bidRequest.bids[0].params.outstream_options.visibilityThreshold = 30;
528
537
 
529
538
  responses[0].renderer.render(responses[0]);
530
539
 
@@ -518,6 +518,33 @@ describe('SSPBC adapter', function () {
518
518
  expect(payload.user).to.be.an('object').and.to.have.property('[ortb_extensions.consent]', bidRequest.gdprConsent.consentString);
519
519
  });
520
520
 
521
+ it('should send net info and pvid', function () {
522
+ expect(payload.user).to.be.an('object').and.to.have.property('data').that.is.an('array');
523
+
524
+ const userData = payload.user.data;
525
+ expect(userData.length).to.equal(2);
526
+
527
+ const netInfo = userData[0];
528
+ expect(netInfo.id).to.equal('12');
529
+ expect(netInfo.name).to.equal('NetInfo');
530
+ expect(netInfo).to.have.property('segment').that.is.an('array');
531
+
532
+ const pvid = userData[1];
533
+ expect(pvid.id).to.equal('7');
534
+ expect(pvid.name).to.equal('pvid');
535
+ expect(pvid).to.have.property('segment').that.is.an('array');
536
+ expect(pvid.segment[0]).to.have.property('value');
537
+ });
538
+
539
+ it('pvid should be constant on a single page view', function () {
540
+ const userData1 = payload.user.data;
541
+ const userData2 = payloadNative.user.data;
542
+ const pvid1 = userData1[1];
543
+ const pvid2 = userData2[1];
544
+
545
+ expect(pvid1.segment[0].value).to.equal(pvid2.segment[0].value);
546
+ });
547
+
521
548
  it('should build correct native payload', function () {
522
549
  const nativeAssets = payloadNative.imp && payloadNative.imp[0].native.request;
523
550
 
@@ -543,13 +570,16 @@ describe('SSPBC adapter', function () {
543
570
  expect(videoAssets).to.have.property('api').that.is.an('array');
544
571
  });
545
572
 
546
- it('should create auxilary placement identifier (size_numUsed)', function () {
573
+ it('should create auxilary placement identifier (size_numUsed), that is constant for a given adUnit', function () {
547
574
  const extAssets1 = payload.imp && payload.imp[0].ext.data;
548
575
  const extAssets2 = payloadSingle.imp && payloadSingle.imp[0].ext.data;
549
576
 
550
- // note that payload comes from first, and payloadSingle from second auction in the test run
577
+ /*
578
+ note that payload comes from first, and payloadSingle from second auction in the test run
579
+ also, since both have same adUnitName, value of pbsize property should be the same
580
+ */
551
581
  expect(extAssets1).to.have.property('pbsize').that.equals('750x200_1')
552
- expect(extAssets2).to.have.property('pbsize').that.equals('750x200_2')
582
+ expect(extAssets2).to.have.property('pbsize').that.equals('750x200_1')
553
583
  });
554
584
  });
555
585
 
@@ -183,6 +183,10 @@ describe('Tappx bid adapter', function () {
183
183
  badBidRequest_v.bids.mediaTypes.video.playerSize = [320, 250];
184
184
  assert.isFalse(spec.isBidRequestValid(badBidRequest_v.bids));
185
185
  });
186
+
187
+ it('should export the TCF vendor ID', function () {
188
+ expect(spec.gvlid).to.equal(628);
189
+ })
186
190
  });
187
191
 
188
192
  /**
@@ -0,0 +1,96 @@
1
+ import { spec } from '../../../modules/targetVideoBidAdapter.js'
2
+
3
+ describe('TargetVideo Bid Adapter', function() {
4
+ const bannerRequest = [{
5
+ bidder: 'targetVideo',
6
+ mediaTypes: {
7
+ banner: {
8
+ sizes: [[300, 250]],
9
+ }
10
+ },
11
+ params: {
12
+ placementId: 12345,
13
+ }
14
+ }];
15
+
16
+ it('Test the bid validation function', function() {
17
+ const validBid = spec.isBidRequestValid(bannerRequest[0]);
18
+ const invalidBid = spec.isBidRequestValid(null);
19
+
20
+ expect(validBid).to.be.true;
21
+ expect(invalidBid).to.be.false;
22
+ });
23
+
24
+ it('Test the request processing function', function () {
25
+ const request = spec.buildRequests(bannerRequest, bannerRequest[0]);
26
+ expect(request).to.not.be.empty;
27
+
28
+ const payload = JSON.parse(request.data);
29
+ expect(payload).to.not.be.empty;
30
+ expect(payload.sdk).to.deep.equal({
31
+ source: 'pbjs',
32
+ version: '$prebid.version$'
33
+ });
34
+ expect(payload.tags[0].id).to.equal(12345);
35
+ expect(payload.tags[0].gpid).to.equal('targetVideo');
36
+ expect(payload.tags[0].ad_types[0]).to.equal('video');
37
+ });
38
+
39
+ it('Handle nobid responses', function () {
40
+ const responseBody = {
41
+ 'version': '0.0.1',
42
+ 'tags': [{
43
+ 'uuid': '84ab500420319d',
44
+ 'tag_id': 5976557,
45
+ 'auction_id': '297492697822162468',
46
+ 'nobid': true
47
+ }]
48
+ };
49
+ const bidderRequest = null;
50
+
51
+ const bidResponse = spec.interpretResponse({ body: responseBody }, {bidderRequest});
52
+ expect(bidResponse.length).to.equal(0);
53
+ });
54
+
55
+ it('Test the response parsing function', function () {
56
+ const responseBody = {
57
+ 'tags': [{
58
+ 'uuid': '84ab500420319d',
59
+ 'ads': [{
60
+ 'ad_type': 'video',
61
+ 'cpm': 0.500000,
62
+ 'notify_url': 'https://www.target-video.com/',
63
+ 'rtb': {
64
+ 'video': {
65
+ 'player_width': 640,
66
+ 'player_height': 360,
67
+ 'asset_url': 'https://www.target-video.com/'
68
+ }
69
+ }
70
+ }]
71
+ }]
72
+ };
73
+ const bidderRequest = {
74
+ bids: [{
75
+ bidId: '84ab500420319d',
76
+ adUnitCode: 'code',
77
+ mediaTypes: {
78
+ banner: {
79
+ sizes: [[300, 250]]
80
+ }
81
+ }
82
+ }]
83
+ };
84
+
85
+ const bidResponse = spec.interpretResponse({ body: responseBody }, {bidderRequest});
86
+ expect(bidResponse).to.not.be.empty;
87
+
88
+ const bid = bidResponse[0];
89
+ expect(bid).to.not.be.empty;
90
+ expect(bid.cpm).to.equal(0.675);
91
+ expect(bid.width).to.equal(300);
92
+ expect(bid.height).to.equal(250);
93
+ expect(bid.ad).to.include('<script src="https://player.target-video.com/custom/targetvideo-banner.js"></script>')
94
+ expect(bid.ad).to.include('initPlayer')
95
+ });
96
+ });
@@ -519,6 +519,48 @@ describe('TrustXAdapter', function () {
519
519
  expect(payload.tmax).to.equal(3000);
520
520
  getConfigStub.restore();
521
521
  });
522
+ it('should contain imp[].ext.data.adserver if available', function() {
523
+ const ortb2Imp = [{
524
+ ext: {
525
+ data: {
526
+ adserver: {
527
+ name: 'ad_server_name',
528
+ adslot: '/111111/slot'
529
+ },
530
+ pbadslot: '/111111/slot'
531
+ }
532
+ }
533
+ }, {
534
+ ext: {
535
+ data: {
536
+ adserver: {
537
+ name: 'ad_server_name',
538
+ adslot: '/222222/slot'
539
+ },
540
+ pbadslot: '/222222/slot'
541
+ }
542
+ }
543
+ }];
544
+ const bidRequestsWithOrtb2Imp = bidRequests.slice(0, 3).map((bid, ind) => {
545
+ return Object.assign(ortb2Imp[ind] ? { ortb2Imp: ortb2Imp[ind] } : {}, bid);
546
+ });
547
+ const request = spec.buildRequests(bidRequestsWithOrtb2Imp, bidderRequest);
548
+ expect(request.data).to.be.an('string');
549
+ const payload = parseRequest(request.data);
550
+ expect(payload.imp[0].ext).to.deep.equal({
551
+ divid: bidRequests[0].adUnitCode,
552
+ data: ortb2Imp[0].ext.data,
553
+ gpid: ortb2Imp[0].ext.data.adserver.adslot
554
+ });
555
+ expect(payload.imp[1].ext).to.deep.equal({
556
+ divid: bidRequests[1].adUnitCode,
557
+ data: ortb2Imp[1].ext.data,
558
+ gpid: ortb2Imp[1].ext.data.adserver.adslot
559
+ });
560
+ expect(payload.imp[2].ext).to.deep.equal({
561
+ divid: bidRequests[2].adUnitCode
562
+ });
563
+ });
522
564
  it('all id like request fields must be a string', function () {
523
565
  const bidderRequestWithNumId = Object.assign({}, bidderRequest, { bidderRequestId: 123123, auctionId: 345345543 });
524
566
 
@@ -49,6 +49,7 @@ import {flocIdSubmodule} from 'modules/flocIdSystem.js'
49
49
  import {amxIdSubmodule} from '../../../modules/amxIdSystem.js';
50
50
  import {akamaiDAPIdSubmodule} from 'modules/akamaiDAPIdSystem.js'
51
51
  import {kinessoIdSubmodule} from 'modules/kinessoIdSystem.js'
52
+ import * as mockGpt from '../integration/faker/googletag.js';
52
53
 
53
54
  let assert = require('chai').assert;
54
55
  let expect = require('chai').expect;
@@ -114,15 +115,21 @@ describe('User ID', function () {
114
115
 
115
116
  describe('Decorate Ad Units', function () {
116
117
  beforeEach(function () {
118
+ // reset mockGpt so nothing else interferes
119
+ mockGpt.disable();
120
+ mockGpt.enable();
117
121
  coreStorage.setCookie('pubcid', '', EXPIRED_COOKIE_DATE);
118
122
  coreStorage.setCookie('pubcid_alt', 'altpubcid200000', (new Date(Date.now() + 5000).toUTCString()));
119
123
  sinon.spy(coreStorage, 'setCookie');
124
+ sinon.stub(utils, 'logWarn');
120
125
  });
121
126
 
122
127
  afterEach(function () {
128
+ mockGpt.enable();
123
129
  $$PREBID_GLOBAL$$.requestBids.removeAll();
124
130
  config.resetConfig();
125
131
  coreStorage.setCookie.restore();
132
+ utils.logWarn.restore();
126
133
  });
127
134
 
128
135
  after(function () {
@@ -321,6 +328,50 @@ describe('User ID', function () {
321
328
  expect((getGlobal()).getUserIdsAsEids()).to.deep.equal(createEidsArray((getGlobal()).getUserIds()));
322
329
  });
323
330
 
331
+ it('should set googletag ppid correctly', function () {
332
+ let adUnits = [getAdUnitMock()];
333
+ setSubmoduleRegistry([amxIdSubmodule, sharedIdSystemSubmodule, identityLinkSubmodule]);
334
+ init(config);
335
+
336
+ config.setConfig({
337
+ userSync: {
338
+ ppid: 'pubcid.org',
339
+ userIds: [
340
+ { name: 'amxId', value: {'amxId': 'amx-id-value-amx-id-value-amx-id-value'} },
341
+ { name: 'pubCommonId', value: {'pubcid': 'pubCommon-id-value-pubCommon-id-value'} },
342
+ { name: 'identityLink', value: {'idl_env': 'identityLink-id-value-identityLink-id-value'} },
343
+ ]
344
+ }
345
+ });
346
+ // before ppid should not be set
347
+ expect(window.googletag._ppid).to.equal(undefined);
348
+ requestBidsHook(() => {}, {adUnits});
349
+ // ppid should have been set without dashes and stuff
350
+ expect(window.googletag._ppid).to.equal('pubCommonidvaluepubCommonidvalue');
351
+ });
352
+
353
+ it('should log a warning if PPID too big or small', function () {
354
+ let adUnits = [getAdUnitMock()];
355
+ setSubmoduleRegistry([sharedIdSystemSubmodule]);
356
+ init(config);
357
+
358
+ config.setConfig({
359
+ userSync: {
360
+ ppid: 'pubcid.org',
361
+ userIds: [
362
+ { name: 'pubCommonId', value: {'pubcid': 'pubcommonIdValue'} },
363
+ ]
364
+ }
365
+ });
366
+ // before ppid should not be set
367
+ expect(window.googletag._ppid).to.equal(undefined);
368
+ requestBidsHook(() => {}, {adUnits});
369
+ // ppid should NOT have been set
370
+ expect(window.googletag._ppid).to.equal(undefined);
371
+ // a warning should have been emmited
372
+ expect(utils.logWarn.args[0][0]).to.exist.and.to.contain('User ID - Googletag Publisher Provided ID for pubcid.org is not between 32 and 150 characters - pubcommonIdValue');
373
+ });
374
+
324
375
  it('pbjs.refreshUserIds refreshes', function() {
325
376
  let sandbox = sinon.createSandbox();
326
377
 
@@ -4,6 +4,7 @@ import { newBidder } from 'src/adapters/bidderFactory.js';
4
4
  import { INSTREAM } from '../../../src/video';
5
5
 
6
6
  const ENDPOINT = `https://d.vidoomy.com/api/rtbserver/prebid/`;
7
+ const PIXELS = ['/test.png', '/test2.png?gdpr={{GDPR}}&gdpr_consent={{GDPR_CONSENT}}']
7
8
 
8
9
  describe('vidoomyBidAdapter', function() {
9
10
  const adapter = newBidder(spec);
@@ -101,24 +102,24 @@ describe('vidoomyBidAdapter', function() {
101
102
  });
102
103
 
103
104
  it('attaches source and version to endpoint URL as query params', function () {
104
- expect(request[0].url).to.include(ENDPOINT);
105
- expect(request[1].url).to.include(ENDPOINT);
105
+ expect(request[0].url).to.equal(ENDPOINT);
106
+ expect(request[1].url).to.equal(ENDPOINT);
106
107
  });
107
108
 
108
109
  it('only accepts first width and height sizes', function () {
109
- expect(request[0].url).to.include('w=300');
110
- expect(request[0].url).to.include('h=250');
111
- expect(request[0].url).to.not.include('w=200');
112
- expect(request[0].url).to.not.include('h=100');
113
- expect(request[1].url).to.include('w=400');
114
- expect(request[1].url).to.include('h=225');
110
+ expect('' + request[0].data.w).to.equal('300');
111
+ expect('' + request[0].data.h).to.equal('250');
112
+ expect('' + request[0].data.w).to.not.equal('200');
113
+ expect('' + request[0].data.h).to.not.equal('100');
114
+ expect('' + request[1].data.w).to.equal('400');
115
+ expect('' + request[1].data.h).to.equal('225');
115
116
  });
116
117
 
117
118
  it('should send id and pid parameters', function () {
118
- expect(request[0].url).to.include('id=123123');
119
- expect(request[0].url).to.include('pid=123123');
120
- expect(request[1].url).to.include('id=456456');
121
- expect(request[1].url).to.include('pid=456456');
119
+ expect('' + request[0].data.id).to.equal('123123');
120
+ expect('' + request[0].data.pid).to.equal('123123');
121
+ expect('' + request[1].data.id).to.equal('456456');
122
+ expect('' + request[1].data.pid).to.equal('456456');
122
123
  });
123
124
  });
124
125
 
@@ -182,7 +183,8 @@ describe('vidoomyBidAdapter', function() {
182
183
  'networkName': null,
183
184
  'primaryCatId': 'IAB3-1',
184
185
  'secondaryCatIds': null
185
- }
186
+ },
187
+ 'pixels': PIXELS
186
188
  }
187
189
  }
188
190
 
@@ -206,5 +208,22 @@ describe('vidoomyBidAdapter', function() {
206
208
 
207
209
  expect(result[0].requestId).to.equal(serverResponseBanner.body.requestId);
208
210
  });
211
+
212
+ it('should sync user cookies', function () {
213
+ const GDPR_CONSENT = 'GDPR_TEST'
214
+ const result = spec.getUserSyncs({
215
+ pixelEnabled: true
216
+ }, [serverResponseBanner], { consentString: GDPR_CONSENT, gdprApplies: 1 }, null)
217
+ expect(result).to.eql([
218
+ {
219
+ type: 'image',
220
+ url: PIXELS[0]
221
+ },
222
+ {
223
+ type: 'image',
224
+ url: `/test2.png?gdpr=1&gdpr_consent=${GDPR_CONSENT}`
225
+ }
226
+ ])
227
+ });
209
228
  });
210
229
  });