prebid.js 6.1.0 → 6.2.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 (69) hide show
  1. package/README.md +1 -1
  2. package/browsers.json +13 -29
  3. package/karma.conf.maker.js +1 -1
  4. package/modules/admixerBidAdapter.js +2 -1
  5. package/modules/adnuntiusBidAdapter.js +2 -1
  6. package/modules/adplusBidAdapter.js +203 -0
  7. package/modules/adplusBidAdapter.md +39 -0
  8. package/modules/adyoulikeBidAdapter.js +7 -2
  9. package/modules/appnexusBidAdapter.js +19 -2
  10. package/modules/beachfrontBidAdapter.js +14 -17
  11. package/modules/craftBidAdapter.js +5 -3
  12. package/modules/dchain.js +149 -0
  13. package/modules/dchain.md +45 -0
  14. package/modules/emx_digitalBidAdapter.js +9 -1
  15. package/modules/freewheel-sspBidAdapter.js +6 -0
  16. package/modules/goldbachBidAdapter.js +1176 -0
  17. package/modules/goldbachBidAdapter.md +151 -0
  18. package/modules/gumgumBidAdapter.js +5 -1
  19. package/modules/intersectionRtdProvider.js +114 -0
  20. package/modules/invibesBidAdapter.js +15 -9
  21. package/modules/ipromBidAdapter.js +79 -0
  22. package/modules/limelightDigitalBidAdapter.js +2 -1
  23. package/modules/luponmediaBidAdapter.js +570 -0
  24. package/modules/missenaBidAdapter.js +89 -0
  25. package/modules/pubmaticBidAdapter.js +3 -3
  26. package/modules/relaidoBidAdapter.js +86 -65
  27. package/modules/richaudienceBidAdapter.js +1 -1
  28. package/modules/smaatoBidAdapter.js +4 -1
  29. package/modules/smartxBidAdapter.js +17 -1
  30. package/modules/tappxBidAdapter.js +3 -1
  31. package/modules/undertoneBidAdapter.js +8 -1
  32. package/modules/userId/index.js +27 -2
  33. package/modules/ventes.md +71 -0
  34. package/modules/ventesBidAdapter.js +104 -64
  35. package/modules/ventesBidAdapter.md +0 -1
  36. package/modules/visxBidAdapter.js +19 -2
  37. package/modules/visxBidAdapter.md +4 -6
  38. package/modules/yahoosspBidAdapter.md +1 -1
  39. package/modules/yieldoneBidAdapter.js +115 -11
  40. package/package.json +1 -1
  41. package/src/auction.js +3 -2
  42. package/src/targeting.js +2 -2
  43. package/src/utils.js +7 -0
  44. package/test/spec/integration/faker/googletag.js +6 -0
  45. package/test/spec/modules/adnuntiusBidAdapter_spec.js +18 -0
  46. package/test/spec/modules/adplusBidAdapter_spec.js +213 -0
  47. package/test/spec/modules/adyoulikeBidAdapter_spec.js +26 -0
  48. package/test/spec/modules/appnexusBidAdapter_spec.js +49 -1
  49. package/test/spec/modules/beachfrontBidAdapter_spec.js +65 -1
  50. package/test/spec/modules/dchain_spec.js +329 -0
  51. package/test/spec/modules/emx_digitalBidAdapter_spec.js +10 -0
  52. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +19 -0
  53. package/test/spec/modules/goldbachBidAdapter_spec.js +1359 -0
  54. package/test/spec/modules/gumgumBidAdapter_spec.js +6 -0
  55. package/test/spec/modules/intersectionRtdProvider_spec.js +141 -0
  56. package/test/spec/modules/invibesBidAdapter_spec.js +29 -4
  57. package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
  58. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +10 -7
  59. package/test/spec/modules/luponmediaBidAdapter_spec.js +412 -0
  60. package/test/spec/modules/missenaBidAdapter_spec.js +134 -0
  61. package/test/spec/modules/pubmaticBidAdapter_spec.js +1 -1
  62. package/test/spec/modules/relaidoBidAdapter_spec.js +71 -63
  63. package/test/spec/modules/smaatoBidAdapter_spec.js +31 -0
  64. package/test/spec/modules/smartxBidAdapter_spec.js +9 -0
  65. package/test/spec/modules/tappxBidAdapter_spec.js +4 -0
  66. package/test/spec/modules/userId_spec.js +51 -0
  67. package/test/spec/modules/visxBidAdapter_spec.js +120 -4
  68. package/test/spec/modules/yieldoneBidAdapter_spec.js +299 -53
  69. package/test/spec/unit/core/targeting_spec.js +44 -0
@@ -152,6 +152,12 @@ describe('gumgumAdapter', function () {
152
152
  const zoneParam = { 'zone': '123a' };
153
153
  const pubIdParam = { 'pubId': 123 };
154
154
 
155
+ it('should set aun if the adUnitCode is available', function () {
156
+ const request = { ...bidRequests[0] };
157
+ const bidRequest = spec.buildRequests([request])[0];
158
+ expect(bidRequest.data.aun).to.equal(bidRequests[0].adUnitCode);
159
+ });
160
+
155
161
  it('should set pubId param if found', function () {
156
162
  const request = { ...bidRequests[0], params: pubIdParam };
157
163
  const bidRequest = spec.buildRequests([request])[0];
@@ -0,0 +1,141 @@
1
+ import {config as _config, config} from 'src/config.js';
2
+ import { expect } from 'chai';
3
+ import events from 'src/events.js';
4
+ import * as prebidGlobal from 'src/prebidGlobal.js';
5
+ import { intersectionSubmodule } from 'modules/intersectionRtdProvider.js';
6
+ import * as utils from 'src/utils.js';
7
+ import {getGlobal} from 'src/prebidGlobal.js';
8
+ import 'src/prebid.js';
9
+
10
+ describe('Intersection RTD Provider', function () {
11
+ let sandbox;
12
+ let placeholder;
13
+ const pbjs = getGlobal();
14
+ const adUnit = {
15
+ code: 'ad-slot-1',
16
+ mediaTypes: {
17
+ banner: {
18
+ sizes: [ [300, 250] ]
19
+ }
20
+ },
21
+ bids: [
22
+ {
23
+ bidder: 'fake'
24
+ }
25
+ ]
26
+ };
27
+ const providerConfig = {name: 'intersection', waitForIt: true};
28
+ const rtdConfig = {realTimeData: {auctionDelay: 200, dataProviders: [providerConfig]}}
29
+ describe('IntersectionObserver not supported', function() {
30
+ beforeEach(function() {
31
+ sandbox = sinon.sandbox.create();
32
+ });
33
+ afterEach(function() {
34
+ sandbox.restore();
35
+ sandbox = undefined;
36
+ });
37
+ it('init should return false', function () {
38
+ sandbox.stub(window, 'IntersectionObserver').value(undefined);
39
+ expect(intersectionSubmodule.init({})).is.false;
40
+ });
41
+ });
42
+ describe('IntersectionObserver supported', function() {
43
+ beforeEach(function() {
44
+ sandbox = sinon.sandbox.create();
45
+ placeholder = createDiv();
46
+ append();
47
+ const __config = {};
48
+ sandbox.stub(_config, 'getConfig').callsFake(function (path) {
49
+ return utils.deepAccess(__config, path);
50
+ });
51
+ sandbox.stub(_config, 'setConfig').callsFake(function (obj) {
52
+ utils.mergeDeep(__config, obj);
53
+ });
54
+ });
55
+ afterEach(function() {
56
+ sandbox.restore();
57
+ remove();
58
+ sandbox = undefined;
59
+ placeholder = undefined;
60
+ pbjs.removeAdUnit();
61
+ });
62
+ it('init should return true', function () {
63
+ expect(intersectionSubmodule.init({})).is.true;
64
+ });
65
+ it('should set intersection. (request with "adUnitCodes")', function(done) {
66
+ pbjs.addAdUnits([utils.deepClone(adUnit)]);
67
+ config.setConfig(rtdConfig);
68
+ const onDone = sandbox.stub();
69
+ const requestBidObject = {adUnitCodes: [adUnit.code]};
70
+ intersectionSubmodule.init({});
71
+ intersectionSubmodule.getBidRequestData(
72
+ requestBidObject,
73
+ onDone,
74
+ providerConfig
75
+ );
76
+ setTimeout(function() {
77
+ expect(pbjs.adUnits[0].bids[0]).to.have.property('intersection');
78
+ done();
79
+ }, 200);
80
+ });
81
+ it('should set intersection. (request with "adUnits")', function(done) {
82
+ config.setConfig(rtdConfig);
83
+ const onDone = sandbox.stub();
84
+ const requestBidObject = {adUnits: [utils.deepClone(adUnit)]};
85
+ intersectionSubmodule.init();
86
+ intersectionSubmodule.getBidRequestData(
87
+ requestBidObject,
88
+ onDone,
89
+ providerConfig
90
+ );
91
+ setTimeout(function() {
92
+ expect(requestBidObject.adUnits[0].bids[0]).to.have.property('intersection');
93
+ done();
94
+ }, 200);
95
+ });
96
+ it('should set intersection. (request all)', function(done) {
97
+ pbjs.addAdUnits([utils.deepClone(adUnit)]);
98
+ config.setConfig(rtdConfig);
99
+ const onDone = sandbox.stub();
100
+ const requestBidObject = {};
101
+ intersectionSubmodule.init({});
102
+ intersectionSubmodule.getBidRequestData(
103
+ requestBidObject,
104
+ onDone,
105
+ providerConfig
106
+ );
107
+ setTimeout(function() {
108
+ expect(pbjs.adUnits[0].bids[0]).to.have.property('intersection');
109
+ done();
110
+ }, 200);
111
+ });
112
+ it('should call done due timeout', function(done) {
113
+ config.setConfig(rtdConfig);
114
+ remove();
115
+ const onDone = sandbox.stub();
116
+ const requestBidObject = {adUnits: [utils.deepClone(adUnit)]};
117
+ intersectionSubmodule.init({});
118
+ intersectionSubmodule.getBidRequestData(
119
+ requestBidObject,
120
+ onDone,
121
+ {...providerConfig, test: 1}
122
+ );
123
+ setTimeout(function() {
124
+ sinon.assert.calledOnce(onDone);
125
+ expect(requestBidObject.adUnits[0].bids[0]).to.not.have.property('intersection');
126
+ done();
127
+ }, 300);
128
+ });
129
+ });
130
+ function createDiv() {
131
+ const div = document.createElement('div');
132
+ div.id = adUnit.code;
133
+ return div;
134
+ }
135
+ function append() {
136
+ placeholder && document.body.appendChild(placeholder);
137
+ }
138
+ function remove() {
139
+ placeholder && placeholder.parentElement && placeholder.parentElement.removeChild(placeholder);
140
+ }
141
+ });
@@ -15,7 +15,7 @@ describe('invibesBidAdapter:', function () {
15
15
  params: {
16
16
  placementId: PLACEMENT_ID
17
17
  },
18
- adUnitCode: 'test-div',
18
+ adUnitCode: 'test-div1',
19
19
  auctionId: 'a1',
20
20
  sizes: [
21
21
  [300, 250],
@@ -30,7 +30,7 @@ describe('invibesBidAdapter:', function () {
30
30
  params: {
31
31
  placementId: 'abcde'
32
32
  },
33
- adUnitCode: 'test-div',
33
+ adUnitCode: 'test-div2',
34
34
  auctionId: 'a2',
35
35
  sizes: [
36
36
  [300, 250],
@@ -48,7 +48,7 @@ describe('invibesBidAdapter:', function () {
48
48
  params: {
49
49
  placementId: PLACEMENT_ID
50
50
  },
51
- adUnitCode: 'test-div',
51
+ adUnitCode: 'test-div1',
52
52
  auctionId: 'a1',
53
53
  sizes: [
54
54
  [300, 250],
@@ -67,7 +67,7 @@ describe('invibesBidAdapter:', function () {
67
67
  params: {
68
68
  placementId: 'abcde'
69
69
  },
70
- adUnitCode: 'test-div',
70
+ adUnitCode: 'test-div2',
71
71
  auctionId: 'a2',
72
72
  sizes: [
73
73
  [300, 250],
@@ -223,6 +223,12 @@ describe('invibesBidAdapter:', function () {
223
223
  expect(JSON.parse(request.data.bidParamsJson).placementIds).to.contain(bidRequests[1].params.placementId);
224
224
  });
225
225
 
226
+ it('sends all adUnitCodes', function () {
227
+ const request = spec.buildRequests(bidRequests);
228
+ expect(JSON.parse(request.data.bidParamsJson).adUnitCodes).to.contain(bidRequests[0].adUnitCode);
229
+ expect(JSON.parse(request.data.bidParamsJson).adUnitCodes).to.contain(bidRequests[1].adUnitCode);
230
+ });
231
+
226
232
  it('sends all Placement Ids and userId', function () {
227
233
  const request = spec.buildRequests(bidRequestsWithUserId);
228
234
  expect(JSON.parse(request.data.bidParamsJson).userId).to.exist;
@@ -823,6 +829,20 @@ describe('invibesBidAdapter:', function () {
823
829
  }
824
830
  };
825
831
 
832
+ let responseWithAdUnit = {
833
+ Ads: [{
834
+ BidPrice: 0.5,
835
+ VideoExposedId: 123
836
+ }],
837
+ BidModel: {
838
+ BidVersion: 1,
839
+ PlacementId: '12345_test-div1',
840
+ AuctionStartTime: Date.now(),
841
+ CreativeHtml: '<!-- Creative -->'
842
+ },
843
+ UseAdUnitCode: true
844
+ };
845
+
826
846
  var buildResponse = function(placementId, cid, blcids, creativeId) {
827
847
  return {
828
848
  MultipositionEnabled: true,
@@ -911,6 +931,11 @@ describe('invibesBidAdapter:', function () {
911
931
  let secondResult = spec.interpretResponse({body: response}, {bidRequests});
912
932
  expect(secondResult).to.be.empty;
913
933
  });
934
+
935
+ it('bids using the adUnitCode', function () {
936
+ let result = spec.interpretResponse({body: responseWithAdUnit}, {bidRequests});
937
+ expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0]));
938
+ });
914
939
  });
915
940
 
916
941
  context('when the response has meta', function () {
@@ -0,0 +1,195 @@
1
+ import {expect} from 'chai';
2
+ import {spec} from 'modules/ipromBidAdapter.js';
3
+
4
+ describe('iPROM Adapter', function () {
5
+ let bidRequests;
6
+ let bidderRequest;
7
+
8
+ beforeEach(function () {
9
+ bidRequests = [
10
+ {
11
+ bidder: 'iprom',
12
+ params: {
13
+ id: '1234',
14
+ dimension: '300x250',
15
+ },
16
+ adUnitCode: '/19966331/header-bid-tag-1',
17
+ mediaTypes: {
18
+ banner: {
19
+ sizes: [[300, 250], [300, 600]],
20
+ }
21
+ },
22
+ bidId: '29a72b151f7bd3',
23
+ auctionId: 'e36abb27-g3b1-1ad6-8a4c-701c8919d3hh',
24
+ bidderRequestId: '2z76da40m1b3cb8',
25
+ transactionId: 'j51lhf58-1ad6-g3b1-3j6s-912c9493g0gu'
26
+ }
27
+ ];
28
+
29
+ bidderRequest = {
30
+ timeout: 3000,
31
+ refererInfo: {
32
+ referer: 'https://adserver.si/index.html',
33
+ reachedTop: true,
34
+ numIframes: 1,
35
+ stack: [
36
+ 'https://adserver.si/index.html',
37
+ 'https://adserver.si/iframe1.html',
38
+ ]
39
+ }
40
+ }
41
+ });
42
+
43
+ describe('validating bids', function () {
44
+ it('should accept valid bid', function () {
45
+ let validBid = {
46
+ bidder: 'iprom',
47
+ params: {
48
+ id: '1234',
49
+ dimension: '300x250',
50
+ },
51
+ };
52
+
53
+ const isValid = spec.isBidRequestValid(validBid);
54
+
55
+ expect(isValid).to.equal(true);
56
+ });
57
+
58
+ it('should reject bid if missing dimension and id', function () {
59
+ let invalidBid = {
60
+ bidder: 'iprom',
61
+ params: {}
62
+ };
63
+
64
+ const isValid = spec.isBidRequestValid(invalidBid);
65
+
66
+ expect(isValid).to.equal(false);
67
+ });
68
+
69
+ it('should reject bid if missing dimension', function () {
70
+ let invalidBid = {
71
+ bidder: 'iprom',
72
+ params: {
73
+ id: '1234',
74
+ }
75
+ };
76
+
77
+ const isValid = spec.isBidRequestValid(invalidBid);
78
+
79
+ expect(isValid).to.equal(false);
80
+ });
81
+
82
+ it('should reject bid if dimension is not a string', function () {
83
+ let invalidBid = {
84
+ bidder: 'iprom',
85
+ params: {
86
+ id: '1234',
87
+ dimension: 404,
88
+ }
89
+ };
90
+
91
+ const isValid = spec.isBidRequestValid(invalidBid);
92
+
93
+ expect(isValid).to.equal(false);
94
+ });
95
+
96
+ it('should reject bid if missing id', function () {
97
+ let invalidBid = {
98
+ bidder: 'iprom',
99
+ params: {
100
+ dimension: '300x250',
101
+ }
102
+ };
103
+
104
+ const isValid = spec.isBidRequestValid(invalidBid);
105
+
106
+ expect(isValid).to.equal(false);
107
+ });
108
+
109
+ it('should reject bid if id is not a string', function () {
110
+ let invalidBid = {
111
+ bidder: 'iprom',
112
+ params: {
113
+ id: 1234,
114
+ dimension: '300x250',
115
+ }
116
+ };
117
+
118
+ const isValid = spec.isBidRequestValid(invalidBid);
119
+
120
+ expect(isValid).to.equal(false);
121
+ });
122
+ });
123
+
124
+ describe('building requests', function () {
125
+ it('should go to correct endpoint', function () {
126
+ const request = spec.buildRequests(bidRequests, bidderRequest);
127
+
128
+ expect(request.method).to.exist;
129
+ expect(request.method).to.equal('POST');
130
+ expect(request.url).to.exist;
131
+ expect(request.url).to.equal('https://core.iprom.net/programmatic');
132
+ });
133
+
134
+ it('should add referer info', function () {
135
+ const request = spec.buildRequests(bidRequests, bidderRequest);
136
+ const requestparse = JSON.parse(request.data);
137
+
138
+ expect(requestparse.referer).to.exist;
139
+ expect(requestparse.referer.referer).to.equal('https://adserver.si/index.html');
140
+ });
141
+
142
+ it('should add adapter version', function () {
143
+ const request = spec.buildRequests(bidRequests, bidderRequest);
144
+ const requestparse = JSON.parse(request.data);
145
+
146
+ expect(requestparse.version).to.exist;
147
+ });
148
+
149
+ it('should contain id and dimension', function () {
150
+ const request = spec.buildRequests(bidRequests, bidderRequest);
151
+ const requestparse = JSON.parse(request.data);
152
+
153
+ expect(requestparse.bids[0].params.id).to.equal('1234');
154
+ expect(requestparse.bids[0].params.dimension).to.equal('300x250');
155
+ });
156
+ });
157
+
158
+ describe('handling responses', function () {
159
+ it('should return complete bid response', function () {
160
+ const serverResponse = {
161
+ body: [{
162
+ requestId: '29a72b151f7bd3',
163
+ cpm: 0.5,
164
+ width: '300',
165
+ height: '250',
166
+ creativeId: 1234,
167
+ ad: '<html><head><title>Iprom Header bidding example</title></head><body><img src="https://iprom.si/files/2015/08/iprom-logo.svg"></body></html>',
168
+ aDomains: ['https://example.com'],
169
+ }
170
+ ]};
171
+
172
+ const request = spec.buildRequests(bidRequests, bidderRequest);
173
+ const bids = spec.interpretResponse(serverResponse, request);
174
+
175
+ expect(bids).to.be.lengthOf(1);
176
+ expect(bids[0].requestId).to.equal('29a72b151f7bd3');
177
+ expect(bids[0].cpm).to.equal(0.5);
178
+ expect(bids[0].width).to.equal('300');
179
+ expect(bids[0].height).to.equal('250');
180
+ expect(bids[0].ad).to.have.length.above(1);
181
+ expect(bids[0].meta.advertiserDomains).to.deep.equal(['https://example.com']);
182
+ });
183
+
184
+ it('should return empty bid response', function () {
185
+ const emptyServerResponse = {
186
+ body: []
187
+ };
188
+
189
+ const request = spec.buildRequests(bidRequests, bidderRequest);
190
+ const bids = spec.interpretResponse(emptyServerResponse, request);
191
+
192
+ expect(bids).to.be.lengthOf(0);
193
+ });
194
+ });
195
+ });
@@ -9,7 +9,8 @@ describe('limelightDigitalAdapter', function () {
9
9
  params: {
10
10
  host: 'exchange.ortb.net',
11
11
  adUnitId: 123,
12
- adUnitType: 'banner'
12
+ adUnitType: 'banner',
13
+ publisherId: 'perfectPublisher'
13
14
  },
14
15
  placementCode: 'placement_0',
15
16
  auctionId: '74f78609-a92d-4cf1-869f-1b244bbfb5d2',
@@ -41,7 +42,8 @@ describe('limelightDigitalAdapter', function () {
41
42
  params: {
42
43
  host: 'exchange.ortb.net',
43
44
  adUnitId: 789,
44
- adUnitType: 'video'
45
+ adUnitType: 'video',
46
+ publisherId: 'secondPerfectPublisher'
45
47
  },
46
48
  placementCode: 'placement_2',
47
49
  auctionId: 'e4771143-6aa7-41ec-8824-ced4342c96c8',
@@ -89,7 +91,7 @@ describe('limelightDigitalAdapter', function () {
89
91
  expect(data.deviceHeight).to.be.a('number')
90
92
  expect(data.secure).to.be.a('boolean')
91
93
  data.adUnits.forEach(adUnit => {
92
- expect(adUnit).to.have.all.keys('id', 'bidId', 'type', 'sizes', 'transactionId')
94
+ expect(adUnit).to.have.all.keys('id', 'bidId', 'type', 'sizes', 'transactionId', 'publisherId')
93
95
  expect(adUnit.id).to.be.a('number')
94
96
  expect(adUnit.bidId).to.be.a('string')
95
97
  expect(adUnit.type).to.be.a('string')
@@ -456,10 +458,10 @@ describe('limelightDigitalAdapter', function () {
456
458
  });
457
459
 
458
460
  function validateAdUnit(adUnit, bid) {
459
- expect(adUnit.id).to.equal(bid.params.adUnitId)
460
- expect(adUnit.bidId).to.equal(bid.bidId)
461
- expect(adUnit.type).to.equal(bid.params.adUnitType.toUpperCase())
462
- expect(adUnit.transactionId).to.equal(bid.transactionId)
461
+ expect(adUnit.id).to.equal(bid.params.adUnitId);
462
+ expect(adUnit.bidId).to.equal(bid.bidId);
463
+ expect(adUnit.type).to.equal(bid.params.adUnitType.toUpperCase());
464
+ expect(adUnit.transactionId).to.equal(bid.transactionId);
463
465
  let bidSizes = [];
464
466
  if (bid.mediaTypes) {
465
467
  if (bid.mediaTypes.video && bid.mediaTypes.video.playerSize) {
@@ -478,4 +480,5 @@ function validateAdUnit(adUnit, bid) {
478
480
  height: size[1]
479
481
  }
480
482
  }));
483
+ expect(adUnit.publisherId).to.equal(bid.params.publisherId);
481
484
  }