prebid.js 6.4.0 → 6.8.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.
- package/integrationExamples/gpt/amp/creative.html +11 -33
- package/integrationExamples/gpt/x-domain/creative.html +53 -26
- package/modules/.submodules.json +2 -1
- package/modules/adagioBidAdapter.js +0 -8
- package/modules/adagioBidAdapter.md +1 -1
- package/modules/adbookpspBidAdapter.js +27 -10
- package/modules/adhashBidAdapter.js +3 -3
- package/modules/adkernelBidAdapter.js +2 -1
- package/modules/admanBidAdapter.js +10 -4
- package/modules/adomikAnalyticsAdapter.js +23 -11
- package/modules/adqueryIdSystem.js +103 -0
- package/modules/adqueryIdSystem.md +35 -0
- package/modules/adyoulikeBidAdapter.js +13 -9
- package/modules/appnexusBidAdapter.js +11 -0
- package/modules/bliinkBidAdapter.js +3 -2
- package/modules/brandmetricsRtdProvider.js +168 -0
- package/modules/brandmetricsRtdProvider.md +40 -0
- package/modules/colossussspBidAdapter.js +12 -8
- package/modules/colossussspBidAdapter.md +15 -1
- package/modules/compassBidAdapter.js +10 -3
- package/modules/consentManagement.js +7 -1
- package/modules/consumableBidAdapter.md +1 -1
- package/modules/criteoBidAdapter.js +10 -1
- package/modules/criteoIdSystem.js +29 -7
- package/modules/currency.js +26 -1
- package/modules/displayioBidAdapter.js +157 -0
- package/modules/displayioBidAdapter.md +148 -0
- package/modules/docereeBidAdapter.js +10 -1
- package/modules/docereeBidAdapter.md +2 -0
- package/modules/e_volutionBidAdapter.js +158 -0
- package/modules/glimpseBidAdapter.js +66 -44
- package/modules/gnetBidAdapter.js +3 -3
- package/modules/gnetBidAdapter.md +4 -4
- package/modules/gptPreAuction.js +55 -7
- package/modules/gumgumBidAdapter.js +56 -42
- package/modules/idImportLibrary.js +45 -8
- package/modules/idImportLibrary.md +4 -0
- package/modules/improvedigitalBidAdapter.js +24 -2
- package/modules/interactiveOffersBidAdapter.js +9 -6
- package/modules/ixBidAdapter.js +29 -12
- package/modules/jwplayerRtdProvider.js +71 -6
- package/modules/jwplayerRtdProvider.md +27 -11
- package/modules/kargoBidAdapter.js +2 -2
- package/modules/limelightDigitalBidAdapter.js +2 -1
- package/modules/livewrappedAnalyticsAdapter.js +3 -1
- package/modules/loglyliftBidAdapter.js +79 -0
- package/modules/loglyliftBidAdapter.md +55 -0
- package/modules/nextMillenniumBidAdapter.js +3 -1
- package/modules/oguryBidAdapter.js +9 -2
- package/modules/onetagBidAdapter.js +4 -2
- package/modules/optimeraRtdProvider.js +8 -1
- package/modules/ozoneBidAdapter.js +21 -64
- package/modules/pilotxBidAdapter.js +147 -0
- package/modules/pilotxBidAdapter.md +50 -0
- package/modules/proxistoreBidAdapter.js +0 -2
- package/modules/pubmaticAnalyticsAdapter.js +16 -0
- package/modules/richaudienceBidAdapter.js +3 -2
- package/modules/riseBidAdapter.js +1 -1
- package/modules/rtbhouseBidAdapter.js +14 -4
- package/modules/rtdModule/index.js +14 -15
- package/modules/rubiconAnalyticsAdapter.js +3 -2
- package/modules/seedingAllianceBidAdapter.js +3 -3
- package/modules/sharethroughBidAdapter.js +12 -17
- package/modules/showheroes-bsBidAdapter.js +13 -2
- package/modules/sovrnBidAdapter.js +93 -18
- package/modules/sovrnBidAdapter.md +80 -2
- package/modules/synacormediaBidAdapter.js +31 -10
- package/modules/tappxBidAdapter.js +8 -5
- package/modules/teadsBidAdapter.js +1 -2
- package/modules/undertoneBidAdapter.js +17 -1
- package/modules/userId/eids.js +7 -1
- package/modules/userId/userId.md +8 -0
- package/modules/viewability.js +177 -0
- package/modules/viewability.md +87 -0
- package/modules/welectBidAdapter.js +106 -0
- package/modules/yahoosspBidAdapter.js +2 -0
- package/modules/yieldmoBidAdapter.js +23 -5
- package/modules/zeta_global_sspAnalyticsAdapter.js +97 -0
- package/modules/zeta_global_sspAnalyticsAdapter.md +24 -0
- package/package.json +1 -1
- package/src/adRendering.js +38 -0
- package/src/auction.js +44 -9
- package/src/config.js +27 -3
- package/src/hook.js +5 -1
- package/src/prebid.js +21 -21
- package/src/secureCreatives.js +114 -44
- package/src/utils.js +25 -4
- package/test/helpers/syncPromise.js +71 -0
- package/test/spec/auctionmanager_spec.js +148 -16
- package/test/spec/config_spec.js +279 -0
- package/test/spec/modules/adagioBidAdapter_spec.js +0 -10
- package/test/spec/modules/adbookpspBidAdapter_spec.js +17 -3
- package/test/spec/modules/adhashBidAdapter_spec.js +2 -2
- package/test/spec/modules/admanBidAdapter_spec.js +2 -2
- package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
- package/test/spec/modules/adqueryIdSystem_spec.js +74 -0
- package/test/spec/modules/adyoulikeBidAdapter_spec.js +49 -0
- package/test/spec/modules/appnexusBidAdapter_spec.js +27 -0
- package/test/spec/modules/bliinkBidAdapter_spec.js +2 -0
- package/test/spec/modules/brandmetricsRtdProvider_spec.js +191 -0
- package/test/spec/modules/colossussspBidAdapter_spec.js +5 -2
- package/test/spec/modules/compassBidAdapter_spec.js +1 -0
- package/test/spec/modules/consentManagement_spec.js +20 -0
- package/test/spec/modules/criteoBidAdapter_spec.js +21 -0
- package/test/spec/modules/criteoIdSystem_spec.js +6 -3
- package/test/spec/modules/currency_spec.js +21 -6
- package/test/spec/modules/displayioBidAdapter_spec.js +239 -0
- package/test/spec/modules/docereeBidAdapter_spec.js +9 -1
- package/test/spec/modules/e_volutionBidAdapter_spec.js +242 -0
- package/test/spec/modules/eids_spec.js +15 -0
- package/test/spec/modules/glimpseBidAdapter_spec.js +0 -18
- package/test/spec/modules/gnetBidAdapter_spec.js +6 -6
- package/test/spec/modules/gptPreAuction_spec.js +177 -2
- package/test/spec/modules/gumgumBidAdapter_spec.js +46 -0
- package/test/spec/modules/idImportLibrary_spec.js +197 -10
- package/test/spec/modules/improvedigitalBidAdapter_spec.js +42 -0
- package/test/spec/modules/ixBidAdapter_spec.js +104 -62
- package/test/spec/modules/jwplayerRtdProvider_spec.js +195 -2
- package/test/spec/modules/kargoBidAdapter_spec.js +1 -1
- package/test/spec/modules/limelightDigitalBidAdapter_spec.js +75 -17
- package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +22 -0
- package/test/spec/modules/loglyliftBidAdapter_spec.js +172 -0
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +1 -1
- package/test/spec/modules/oguryBidAdapter_spec.js +10 -2
- package/test/spec/modules/optimeraRtdProvider_spec.js +14 -1
- package/test/spec/modules/ozoneBidAdapter_spec.js +43 -31
- package/test/spec/modules/pilotxBidAdapter_spec.js +244 -0
- package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +13 -1
- package/test/spec/modules/realTimeDataModule_spec.js +67 -5
- package/test/spec/modules/richaudienceBidAdapter_spec.js +40 -0
- package/test/spec/modules/riseBidAdapter_spec.js +1 -1
- package/test/spec/modules/rtbhouseBidAdapter_spec.js +20 -0
- package/test/spec/modules/rubiconAnalyticsAdapter_spec.js +30 -0
- package/test/spec/modules/sharethroughBidAdapter_spec.js +91 -6
- package/test/spec/modules/showheroes-bsBidAdapter_spec.js +2 -0
- package/test/spec/modules/sovrnBidAdapter_spec.js +413 -333
- package/test/spec/modules/synacormediaBidAdapter_spec.js +70 -0
- package/test/spec/modules/tappxBidAdapter_spec.js +0 -19
- package/test/spec/modules/teadsBidAdapter_spec.js +14 -59
- package/test/spec/modules/undertoneBidAdapter_spec.js +55 -2
- package/test/spec/modules/userId_spec.js +68 -19
- package/test/spec/modules/viewability_spec.js +280 -0
- package/test/spec/modules/welectBidAdapter_spec.js +211 -0
- package/test/spec/modules/yahoosspBidAdapter_spec.js +10 -0
- package/test/spec/modules/zeta_global_sspAnalyticsAdapter_spec.js +427 -0
- package/test/spec/unit/pbjs_api_spec.js +20 -2
- package/test/spec/unit/secureCreatives_spec.js +85 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import {expect} from 'chai';
|
|
2
|
+
import {spec} from '../../../modules/e_volutionBidAdapter.js';
|
|
3
|
+
|
|
4
|
+
describe('EvolutionTechBidAdapter', function () {
|
|
5
|
+
let bid = {
|
|
6
|
+
bidId: '23fhj33i987f',
|
|
7
|
+
bidder: 'e_volution',
|
|
8
|
+
params: {
|
|
9
|
+
placementId: 0
|
|
10
|
+
},
|
|
11
|
+
mediaTypes: {
|
|
12
|
+
banner: {
|
|
13
|
+
sizes: [[300, 250]],
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
describe('isBidRequestValid', function () {
|
|
19
|
+
it('Should return true if there are bidId, params and placementId parameters present', function () {
|
|
20
|
+
expect(spec.isBidRequestValid(bid)).to.be.true;
|
|
21
|
+
});
|
|
22
|
+
it('Should return false if at least one of parameters is not present', function () {
|
|
23
|
+
delete bid.params.placementId;
|
|
24
|
+
expect(spec.isBidRequestValid(bid)).to.be.false;
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('buildRequests', function () {
|
|
29
|
+
let serverRequest = spec.buildRequests([bid]);
|
|
30
|
+
it('Creates a ServerRequest object with method, URL and data', function () {
|
|
31
|
+
expect(serverRequest).to.exist;
|
|
32
|
+
expect(serverRequest.method).to.exist;
|
|
33
|
+
expect(serverRequest.url).to.exist;
|
|
34
|
+
expect(serverRequest.data).to.exist;
|
|
35
|
+
});
|
|
36
|
+
it('Returns POST method', function () {
|
|
37
|
+
expect(serverRequest.method).to.equal('POST');
|
|
38
|
+
});
|
|
39
|
+
it('Returns valid URL', function () {
|
|
40
|
+
expect(serverRequest.url).to.equal('https://service.e-volution.ai/?c=o&m=multi');
|
|
41
|
+
});
|
|
42
|
+
it('Returns valid data if array of bids is valid', function () {
|
|
43
|
+
let data = serverRequest.data;
|
|
44
|
+
expect(data).to.be.an('object');
|
|
45
|
+
expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'language', 'secure', 'host', 'page', 'placements');
|
|
46
|
+
expect(data.deviceWidth).to.be.a('number');
|
|
47
|
+
expect(data.deviceHeight).to.be.a('number');
|
|
48
|
+
expect(data.language).to.be.a('string');
|
|
49
|
+
expect(data.secure).to.be.within(0, 1);
|
|
50
|
+
expect(data.host).to.be.a('string');
|
|
51
|
+
expect(data.page).to.be.a('string');
|
|
52
|
+
let placement = data['placements'][0];
|
|
53
|
+
expect(placement).to.have.keys('placementId', 'bidId', 'traffic', 'sizes', 'bidfloor');
|
|
54
|
+
expect(placement.placementId).to.equal(0);
|
|
55
|
+
expect(placement.bidId).to.equal('23fhj33i987f');
|
|
56
|
+
expect(placement.traffic).to.equal('banner');
|
|
57
|
+
});
|
|
58
|
+
it('Returns empty data if no valid requests are passed', function () {
|
|
59
|
+
serverRequest = spec.buildRequests([]);
|
|
60
|
+
let data = serverRequest.data;
|
|
61
|
+
expect(data.placements).to.be.an('array').that.is.empty;
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
describe('interpretResponse', function () {
|
|
65
|
+
it('Should interpret banner response', function () {
|
|
66
|
+
const banner = {
|
|
67
|
+
body: [{
|
|
68
|
+
mediaType: 'banner',
|
|
69
|
+
width: 300,
|
|
70
|
+
height: 250,
|
|
71
|
+
cpm: 0.4,
|
|
72
|
+
ad: 'Test',
|
|
73
|
+
requestId: '23fhj33i987f',
|
|
74
|
+
ttl: 120,
|
|
75
|
+
creativeId: '2',
|
|
76
|
+
netRevenue: true,
|
|
77
|
+
currency: 'USD',
|
|
78
|
+
dealId: '1',
|
|
79
|
+
meta: {}
|
|
80
|
+
}]
|
|
81
|
+
};
|
|
82
|
+
let bannerResponses = spec.interpretResponse(banner);
|
|
83
|
+
expect(bannerResponses).to.be.an('array').that.is.not.empty;
|
|
84
|
+
let dataItem = bannerResponses[0];
|
|
85
|
+
expect(dataItem).to.have.all.keys('requestId', 'cpm', 'width', 'height', 'ad', 'ttl', 'creativeId',
|
|
86
|
+
'netRevenue', 'currency', 'dealId', 'mediaType', 'meta');
|
|
87
|
+
expect(dataItem.requestId).to.equal('23fhj33i987f');
|
|
88
|
+
expect(dataItem.cpm).to.equal(0.4);
|
|
89
|
+
expect(dataItem.width).to.equal(300);
|
|
90
|
+
expect(dataItem.height).to.equal(250);
|
|
91
|
+
expect(dataItem.ad).to.equal('Test');
|
|
92
|
+
expect(dataItem.ttl).to.equal(120);
|
|
93
|
+
expect(dataItem.creativeId).to.equal('2');
|
|
94
|
+
expect(dataItem.netRevenue).to.be.true;
|
|
95
|
+
expect(dataItem.currency).to.equal('USD');
|
|
96
|
+
});
|
|
97
|
+
it('Should interpret video response', function () {
|
|
98
|
+
const video = {
|
|
99
|
+
body: [{
|
|
100
|
+
vastUrl: 'test.com',
|
|
101
|
+
mediaType: 'video',
|
|
102
|
+
cpm: 0.5,
|
|
103
|
+
requestId: '23fhj33i987f',
|
|
104
|
+
ttl: 120,
|
|
105
|
+
creativeId: '2',
|
|
106
|
+
netRevenue: true,
|
|
107
|
+
currency: 'USD',
|
|
108
|
+
dealId: '1',
|
|
109
|
+
meta: {}
|
|
110
|
+
}]
|
|
111
|
+
};
|
|
112
|
+
let videoResponses = spec.interpretResponse(video);
|
|
113
|
+
expect(videoResponses).to.be.an('array').that.is.not.empty;
|
|
114
|
+
|
|
115
|
+
let dataItem = videoResponses[0];
|
|
116
|
+
expect(dataItem).to.have.all.keys('requestId', 'cpm', 'vastUrl', 'ttl', 'creativeId',
|
|
117
|
+
'netRevenue', 'currency', 'dealId', 'mediaType', 'meta');
|
|
118
|
+
expect(dataItem.requestId).to.equal('23fhj33i987f');
|
|
119
|
+
expect(dataItem.cpm).to.equal(0.5);
|
|
120
|
+
expect(dataItem.vastUrl).to.equal('test.com');
|
|
121
|
+
expect(dataItem.ttl).to.equal(120);
|
|
122
|
+
expect(dataItem.creativeId).to.equal('2');
|
|
123
|
+
expect(dataItem.netRevenue).to.be.true;
|
|
124
|
+
expect(dataItem.currency).to.equal('USD');
|
|
125
|
+
});
|
|
126
|
+
it('Should interpret native response', function () {
|
|
127
|
+
const native = {
|
|
128
|
+
body: [{
|
|
129
|
+
mediaType: 'native',
|
|
130
|
+
native: {
|
|
131
|
+
clickUrl: 'test.com',
|
|
132
|
+
title: 'Test',
|
|
133
|
+
image: 'test.com',
|
|
134
|
+
impressionTrackers: ['test.com'],
|
|
135
|
+
},
|
|
136
|
+
ttl: 120,
|
|
137
|
+
cpm: 0.4,
|
|
138
|
+
requestId: '23fhj33i987f',
|
|
139
|
+
creativeId: '2',
|
|
140
|
+
netRevenue: true,
|
|
141
|
+
currency: 'USD',
|
|
142
|
+
meta: {}
|
|
143
|
+
}]
|
|
144
|
+
};
|
|
145
|
+
let nativeResponses = spec.interpretResponse(native);
|
|
146
|
+
expect(nativeResponses).to.be.an('array').that.is.not.empty;
|
|
147
|
+
|
|
148
|
+
let dataItem = nativeResponses[0];
|
|
149
|
+
expect(dataItem).to.have.keys('requestId', 'cpm', 'ttl', 'creativeId', 'netRevenue', 'currency', 'mediaType', 'native', 'meta');
|
|
150
|
+
expect(dataItem.native).to.have.keys('clickUrl', 'impressionTrackers', 'title', 'image')
|
|
151
|
+
expect(dataItem.requestId).to.equal('23fhj33i987f');
|
|
152
|
+
expect(dataItem.cpm).to.equal(0.4);
|
|
153
|
+
expect(dataItem.native.clickUrl).to.equal('test.com');
|
|
154
|
+
expect(dataItem.native.title).to.equal('Test');
|
|
155
|
+
expect(dataItem.native.image).to.equal('test.com');
|
|
156
|
+
expect(dataItem.native.impressionTrackers).to.be.an('array').that.is.not.empty;
|
|
157
|
+
expect(dataItem.native.impressionTrackers[0]).to.equal('test.com');
|
|
158
|
+
expect(dataItem.ttl).to.equal(120);
|
|
159
|
+
expect(dataItem.creativeId).to.equal('2');
|
|
160
|
+
expect(dataItem.netRevenue).to.be.true;
|
|
161
|
+
expect(dataItem.currency).to.equal('USD');
|
|
162
|
+
});
|
|
163
|
+
it('Should return an empty array if invalid banner response is passed', function () {
|
|
164
|
+
const invBanner = {
|
|
165
|
+
body: [{
|
|
166
|
+
width: 300,
|
|
167
|
+
cpm: 0.4,
|
|
168
|
+
ad: 'Test',
|
|
169
|
+
requestId: '23fhj33i987f',
|
|
170
|
+
ttl: 120,
|
|
171
|
+
creativeId: '2',
|
|
172
|
+
netRevenue: true,
|
|
173
|
+
currency: 'USD',
|
|
174
|
+
dealId: '1'
|
|
175
|
+
}]
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
let serverResponses = spec.interpretResponse(invBanner);
|
|
179
|
+
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
180
|
+
});
|
|
181
|
+
it('Should return an empty array if invalid video response is passed', function () {
|
|
182
|
+
const invVideo = {
|
|
183
|
+
body: [{
|
|
184
|
+
mediaType: 'video',
|
|
185
|
+
cpm: 0.5,
|
|
186
|
+
requestId: '23fhj33i987f',
|
|
187
|
+
ttl: 120,
|
|
188
|
+
creativeId: '2',
|
|
189
|
+
netRevenue: true,
|
|
190
|
+
currency: 'USD',
|
|
191
|
+
dealId: '1'
|
|
192
|
+
}]
|
|
193
|
+
};
|
|
194
|
+
let serverResponses = spec.interpretResponse(invVideo);
|
|
195
|
+
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
196
|
+
});
|
|
197
|
+
it('Should return an empty array if invalid native response is passed', function () {
|
|
198
|
+
const invNative = {
|
|
199
|
+
body: [{
|
|
200
|
+
mediaType: 'native',
|
|
201
|
+
clickUrl: 'test.com',
|
|
202
|
+
title: 'Test',
|
|
203
|
+
impressionTrackers: ['test.com'],
|
|
204
|
+
ttl: 120,
|
|
205
|
+
requestId: '23fhj33i987f',
|
|
206
|
+
creativeId: '2',
|
|
207
|
+
netRevenue: true,
|
|
208
|
+
currency: 'USD',
|
|
209
|
+
}]
|
|
210
|
+
};
|
|
211
|
+
let serverResponses = spec.interpretResponse(invNative);
|
|
212
|
+
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
213
|
+
});
|
|
214
|
+
it('Should return an empty array if invalid response is passed', function () {
|
|
215
|
+
const invalid = {
|
|
216
|
+
body: [{
|
|
217
|
+
ttl: 120,
|
|
218
|
+
creativeId: '2',
|
|
219
|
+
netRevenue: true,
|
|
220
|
+
currency: 'USD',
|
|
221
|
+
dealId: '1'
|
|
222
|
+
}]
|
|
223
|
+
};
|
|
224
|
+
let serverResponses = spec.interpretResponse(invalid);
|
|
225
|
+
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
describe('getUserSyncs', function () {
|
|
229
|
+
let userSync = spec.getUserSyncs();
|
|
230
|
+
it('Returns valid URL and type', function () {
|
|
231
|
+
if (spec.noSync) {
|
|
232
|
+
expect(userSync).to.be.equal(false);
|
|
233
|
+
} else {
|
|
234
|
+
expect(userSync).to.be.an('array').with.lengthOf(1);
|
|
235
|
+
expect(userSync[0].type).to.exist;
|
|
236
|
+
expect(userSync[0].url).to.exist;
|
|
237
|
+
expect(userSync[0].type).to.be.equal('image');
|
|
238
|
+
expect(userSync[0].url).to.be.equal('https://service.e-volution.ai/?c=o&m=sync');
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
});
|
|
@@ -348,6 +348,21 @@ describe('eids array generation for known sub-modules', function() {
|
|
|
348
348
|
}]
|
|
349
349
|
});
|
|
350
350
|
});
|
|
351
|
+
|
|
352
|
+
it('qid', function() {
|
|
353
|
+
const userId = {
|
|
354
|
+
qid: 'some-random-id-value'
|
|
355
|
+
};
|
|
356
|
+
const newEids = createEidsArray(userId);
|
|
357
|
+
expect(newEids.length).to.equal(1);
|
|
358
|
+
expect(newEids[0]).to.deep.equal({
|
|
359
|
+
source: 'adquery.io',
|
|
360
|
+
uids: [{
|
|
361
|
+
id: 'some-random-id-value',
|
|
362
|
+
atype: 1
|
|
363
|
+
}]
|
|
364
|
+
});
|
|
365
|
+
});
|
|
351
366
|
});
|
|
352
367
|
describe('Negative case', function() {
|
|
353
368
|
it('eids array generation for UN-known sub-module', function() {
|
|
@@ -178,24 +178,6 @@ describe('GlimpseProtocolAdapter', () => {
|
|
|
178
178
|
const bidRequests = [getBidRequest()]
|
|
179
179
|
const bidderRequest = getBidderRequest()
|
|
180
180
|
|
|
181
|
-
it('Adds a demo flag', () => {
|
|
182
|
-
const request = spec.buildRequests(bidRequests, bidderRequest)
|
|
183
|
-
const payload = JSON.parse(request.data)
|
|
184
|
-
expect(payload.data.demo).to.be.false
|
|
185
|
-
})
|
|
186
|
-
|
|
187
|
-
it('Adds an account id', () => {
|
|
188
|
-
const request = spec.buildRequests(bidRequests, bidderRequest)
|
|
189
|
-
const payload = JSON.parse(request.data)
|
|
190
|
-
expect(payload.data.account).to.equal(-1)
|
|
191
|
-
})
|
|
192
|
-
|
|
193
|
-
it('Adds a demand provider', () => {
|
|
194
|
-
const request = spec.buildRequests(bidRequests, bidderRequest)
|
|
195
|
-
const payload = JSON.parse(request.data)
|
|
196
|
-
expect(payload.data.demand).to.equal('glimpse')
|
|
197
|
-
})
|
|
198
|
-
|
|
199
181
|
it('Adds GDPR consent', () => {
|
|
200
182
|
const request = spec.buildRequests(bidRequests, bidderRequest)
|
|
201
183
|
const payload = JSON.parse(request.data)
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
newBidder
|
|
9
9
|
} from 'src/adapters/bidderFactory.js';
|
|
10
10
|
|
|
11
|
-
const ENDPOINT = 'https://
|
|
11
|
+
const ENDPOINT = 'https://service.gnetrtb.com/api/adrequest';
|
|
12
12
|
|
|
13
13
|
describe('gnetAdapter', function () {
|
|
14
14
|
const adapter = newBidder(spec);
|
|
@@ -23,7 +23,7 @@ describe('gnetAdapter', function () {
|
|
|
23
23
|
let bid = {
|
|
24
24
|
bidder: 'gnet',
|
|
25
25
|
params: {
|
|
26
|
-
websiteId: '
|
|
26
|
+
websiteId: '1', adunitId: '1'
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
|
|
@@ -43,7 +43,7 @@ describe('gnetAdapter', function () {
|
|
|
43
43
|
const bidRequests = [{
|
|
44
44
|
bidder: 'gnet',
|
|
45
45
|
params: {
|
|
46
|
-
websiteId: '
|
|
46
|
+
websiteId: '1', adunitId: '1'
|
|
47
47
|
},
|
|
48
48
|
adUnitCode: '/150790500/4_ZONA_IAB_300x250_5',
|
|
49
49
|
sizes: [
|
|
@@ -57,7 +57,7 @@ describe('gnetAdapter', function () {
|
|
|
57
57
|
|
|
58
58
|
const bidderRequest = {
|
|
59
59
|
refererInfo: {
|
|
60
|
-
referer: 'https://
|
|
60
|
+
referer: 'https://gnetrtb.com'
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
|
|
@@ -66,13 +66,13 @@ describe('gnetAdapter', function () {
|
|
|
66
66
|
expect(requests[0].url).to.equal(ENDPOINT);
|
|
67
67
|
expect(requests[0].method).to.equal('POST');
|
|
68
68
|
expect(requests[0].data).to.equal(JSON.stringify({
|
|
69
|
-
'referer': 'https://
|
|
69
|
+
'referer': 'https://gnetrtb.com',
|
|
70
70
|
'adUnitCode': '/150790500/4_ZONA_IAB_300x250_5',
|
|
71
71
|
'bidId': '2a19afd5173318',
|
|
72
72
|
'transactionId': '894bdff6-61ec-4bec-a5a9-f36a5bfccef5',
|
|
73
73
|
'sizes': ['300x250'],
|
|
74
74
|
'params': {
|
|
75
|
-
'websiteId': '
|
|
75
|
+
'websiteId': '1', 'adunitId': '1'
|
|
76
76
|
}
|
|
77
77
|
}));
|
|
78
78
|
});
|
|
@@ -20,7 +20,9 @@ describe('GPT pre-auction module', () => {
|
|
|
20
20
|
const testSlots = [
|
|
21
21
|
makeSlot({ code: 'slotCode1', divId: 'div1' }),
|
|
22
22
|
makeSlot({ code: 'slotCode2', divId: 'div2' }),
|
|
23
|
-
makeSlot({ code: 'slotCode3', divId: 'div3' })
|
|
23
|
+
makeSlot({ code: 'slotCode3', divId: 'div3' }),
|
|
24
|
+
makeSlot({ code: 'slotCode4', divId: 'div4' }),
|
|
25
|
+
makeSlot({ code: 'slotCode4', divId: 'div5' })
|
|
24
26
|
];
|
|
25
27
|
|
|
26
28
|
describe('appendPbAdSlot', () => {
|
|
@@ -172,7 +174,9 @@ describe('GPT pre-auction module', () => {
|
|
|
172
174
|
expect(_currentConfig).to.deep.equal({
|
|
173
175
|
enabled: true,
|
|
174
176
|
customGptSlotMatching: false,
|
|
175
|
-
customPbAdSlot: false
|
|
177
|
+
customPbAdSlot: false,
|
|
178
|
+
customPreAuction: false,
|
|
179
|
+
useDefaultPreAuction: false
|
|
176
180
|
});
|
|
177
181
|
});
|
|
178
182
|
});
|
|
@@ -266,5 +270,176 @@ describe('GPT pre-auction module', () => {
|
|
|
266
270
|
runMakeBidRequests(testAdUnits);
|
|
267
271
|
expect(returnedAdUnits).to.deep.equal(expectedAdUnits);
|
|
268
272
|
});
|
|
273
|
+
|
|
274
|
+
it('should use the passed customPreAuction logic', () => {
|
|
275
|
+
let counter = 0;
|
|
276
|
+
config.setConfig({
|
|
277
|
+
gptPreAuction: {
|
|
278
|
+
enabled: true,
|
|
279
|
+
customPreAuction: (adUnit, slotName) => {
|
|
280
|
+
counter += 1;
|
|
281
|
+
return `${adUnit.code}-${slotName || counter}`;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
const testAdUnits = [
|
|
286
|
+
{
|
|
287
|
+
code: 'adUnit1',
|
|
288
|
+
ortb2Imp: { ext: { data: { pbadslot: '12345' } } }
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
code: 'adUnit2',
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
code: 'slotCode3',
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
code: 'div4',
|
|
298
|
+
}
|
|
299
|
+
];
|
|
300
|
+
|
|
301
|
+
// all slots should be passed in same time and have slot-${index}
|
|
302
|
+
const expectedAdUnits = [{
|
|
303
|
+
code: 'adUnit1',
|
|
304
|
+
ortb2Imp: {
|
|
305
|
+
ext: {
|
|
306
|
+
// no slotname match so uses adUnit.code-counter
|
|
307
|
+
data: {
|
|
308
|
+
pbadslot: 'adUnit1-1'
|
|
309
|
+
},
|
|
310
|
+
gpid: 'adUnit1-1'
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
// second adunit
|
|
315
|
+
{
|
|
316
|
+
code: 'adUnit2',
|
|
317
|
+
ortb2Imp: {
|
|
318
|
+
ext: {
|
|
319
|
+
// no slotname match so uses adUnit.code-counter
|
|
320
|
+
data: {
|
|
321
|
+
pbadslot: 'adUnit2-2'
|
|
322
|
+
},
|
|
323
|
+
gpid: 'adUnit2-2'
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}, {
|
|
327
|
+
code: 'slotCode3',
|
|
328
|
+
ortb2Imp: {
|
|
329
|
+
ext: {
|
|
330
|
+
// slotname found, so uses code + slotname (which is same)
|
|
331
|
+
data: {
|
|
332
|
+
pbadslot: 'slotCode3-slotCode3',
|
|
333
|
+
adserver: {
|
|
334
|
+
name: 'gam',
|
|
335
|
+
adslot: 'slotCode3'
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
gpid: 'slotCode3-slotCode3'
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}, {
|
|
342
|
+
code: 'div4',
|
|
343
|
+
ortb2Imp: {
|
|
344
|
+
ext: {
|
|
345
|
+
// slotname found, so uses code + slotname
|
|
346
|
+
data: {
|
|
347
|
+
pbadslot: 'div4-slotCode4',
|
|
348
|
+
adserver: {
|
|
349
|
+
name: 'gam',
|
|
350
|
+
adslot: 'slotCode4'
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
gpid: 'div4-slotCode4'
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}];
|
|
357
|
+
|
|
358
|
+
window.googletag.pubads().setSlots(testSlots);
|
|
359
|
+
runMakeBidRequests(testAdUnits);
|
|
360
|
+
expect(returnedAdUnits).to.deep.equal(expectedAdUnits);
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
it('should use useDefaultPreAuction logic', () => {
|
|
364
|
+
config.setConfig({
|
|
365
|
+
gptPreAuction: {
|
|
366
|
+
enabled: true,
|
|
367
|
+
useDefaultPreAuction: true
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
const testAdUnits = [
|
|
371
|
+
// First adUnit should use the preset pbadslot
|
|
372
|
+
{
|
|
373
|
+
code: 'adUnit1',
|
|
374
|
+
ortb2Imp: { ext: { data: { pbadslot: '12345' } } }
|
|
375
|
+
},
|
|
376
|
+
// Second adUnit should not match a gam slot, so no slot set
|
|
377
|
+
{
|
|
378
|
+
code: 'adUnit2',
|
|
379
|
+
},
|
|
380
|
+
// third adunit matches a single slot so uses it
|
|
381
|
+
{
|
|
382
|
+
code: 'slotCode3',
|
|
383
|
+
},
|
|
384
|
+
// fourth adunit matches multiple slots so combination
|
|
385
|
+
{
|
|
386
|
+
code: 'div4',
|
|
387
|
+
}
|
|
388
|
+
];
|
|
389
|
+
|
|
390
|
+
const expectedAdUnits = [{
|
|
391
|
+
code: 'adUnit1',
|
|
392
|
+
ortb2Imp: {
|
|
393
|
+
ext: {
|
|
394
|
+
data: {
|
|
395
|
+
pbadslot: '12345'
|
|
396
|
+
},
|
|
397
|
+
gpid: '12345'
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
// second adunit
|
|
402
|
+
{
|
|
403
|
+
code: 'adUnit2',
|
|
404
|
+
ortb2Imp: {
|
|
405
|
+
ext: {
|
|
406
|
+
data: {
|
|
407
|
+
},
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}, {
|
|
411
|
+
code: 'slotCode3',
|
|
412
|
+
ortb2Imp: {
|
|
413
|
+
ext: {
|
|
414
|
+
data: {
|
|
415
|
+
pbadslot: 'slotCode3',
|
|
416
|
+
adserver: {
|
|
417
|
+
name: 'gam',
|
|
418
|
+
adslot: 'slotCode3'
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
gpid: 'slotCode3'
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}, {
|
|
425
|
+
code: 'div4',
|
|
426
|
+
ortb2Imp: {
|
|
427
|
+
ext: {
|
|
428
|
+
data: {
|
|
429
|
+
pbadslot: 'slotCode4#div4',
|
|
430
|
+
adserver: {
|
|
431
|
+
name: 'gam',
|
|
432
|
+
adslot: 'slotCode4'
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
gpid: 'slotCode4#div4'
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}];
|
|
439
|
+
|
|
440
|
+
window.googletag.pubads().setSlots(testSlots);
|
|
441
|
+
runMakeBidRequests(testAdUnits);
|
|
442
|
+
expect(returnedAdUnits).to.deep.equal(expectedAdUnits);
|
|
443
|
+
});
|
|
269
444
|
});
|
|
270
445
|
});
|
|
@@ -544,6 +544,52 @@ describe('gumgumAdapter', function () {
|
|
|
544
544
|
const bidRequest = spec.buildRequests(bidRequests)[0];
|
|
545
545
|
expect(!!bidRequest.data.lt).to.be.true;
|
|
546
546
|
});
|
|
547
|
+
|
|
548
|
+
it('should handle no gg params', function () {
|
|
549
|
+
const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { referer: 'https://www.prebid.org/?param1=foo¶m2=bar¶m3=baz' } })[0];
|
|
550
|
+
|
|
551
|
+
// no params are in object
|
|
552
|
+
expect(bidRequest.data.hasOwnProperty('eAdBuyId')).to.be.false;
|
|
553
|
+
expect(bidRequest.data.hasOwnProperty('adBuyId')).to.be.false;
|
|
554
|
+
expect(bidRequest.data.hasOwnProperty('ggdeal')).to.be.false;
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
it('should handle encrypted ad buy id', function () {
|
|
558
|
+
const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { referer: 'https://www.prebid.org/?param1=foo&ggad=bar¶m3=baz' } })[0];
|
|
559
|
+
|
|
560
|
+
// correct params are in object
|
|
561
|
+
expect(bidRequest.data.hasOwnProperty('eAdBuyId')).to.be.true;
|
|
562
|
+
expect(bidRequest.data.hasOwnProperty('adBuyId')).to.be.false;
|
|
563
|
+
expect(bidRequest.data.hasOwnProperty('ggdeal')).to.be.false;
|
|
564
|
+
|
|
565
|
+
// params are stripped from pu property
|
|
566
|
+
expect(bidRequest.data.pu.includes('ggad')).to.be.false;
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
it('should handle unencrypted ad buy id', function () {
|
|
570
|
+
const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { referer: 'https://www.prebid.org/?param1=foo&ggad=123¶m3=baz' } })[0];
|
|
571
|
+
|
|
572
|
+
// correct params are in object
|
|
573
|
+
expect(bidRequest.data.hasOwnProperty('eAdBuyId')).to.be.false;
|
|
574
|
+
expect(bidRequest.data.hasOwnProperty('adBuyId')).to.be.true;
|
|
575
|
+
expect(bidRequest.data.hasOwnProperty('ggdeal')).to.be.false;
|
|
576
|
+
|
|
577
|
+
// params are stripped from pu property
|
|
578
|
+
expect(bidRequest.data.pu.includes('ggad')).to.be.false;
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
it('should handle multiple gg params', function () {
|
|
582
|
+
const bidRequest = spec.buildRequests(bidRequests, { refererInfo: { referer: 'https://www.prebid.org/?ggdeal=foo&ggad=bar¶m3=baz' } })[0];
|
|
583
|
+
|
|
584
|
+
// correct params are in object
|
|
585
|
+
expect(bidRequest.data.hasOwnProperty('eAdBuyId')).to.be.true;
|
|
586
|
+
expect(bidRequest.data.hasOwnProperty('adBuyId')).to.be.false;
|
|
587
|
+
expect(bidRequest.data.hasOwnProperty('ggdeal')).to.be.true;
|
|
588
|
+
|
|
589
|
+
// params are stripped from pu property
|
|
590
|
+
expect(bidRequest.data.pu.includes('ggad')).to.be.false;
|
|
591
|
+
expect(bidRequest.data.pu.includes('ggdeal')).to.be.false;
|
|
592
|
+
});
|
|
547
593
|
})
|
|
548
594
|
|
|
549
595
|
describe('interpretResponse', function () {
|