prebid.js 6.0.0 → 6.1.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/.babelrc.js +1 -7
- package/gulpfile.js +1 -0
- package/modules/adheseBidAdapter.js +7 -2
- package/modules/adkernelBidAdapter.js +1 -0
- package/modules/adlivetechBidAdapter.md +61 -0
- package/modules/adomikAnalyticsAdapter.js +10 -4
- package/modules/appnexusBidAdapter.js +4 -0
- package/modules/codefuelBidAdapter.js +1 -3
- package/modules/codefuelBidAdapter.md +3 -3
- package/modules/datablocksBidAdapter.js +3 -3
- package/modules/deepintentBidAdapter.js +1 -1
- package/modules/engageyaBidAdapter.js +68 -54
- package/modules/glimpseBidAdapter.js +31 -16
- package/modules/gptPreAuction.js +11 -5
- package/modules/gridBidAdapter.js +1 -1
- package/modules/id5IdSystem.md +6 -6
- package/modules/imRtdProvider.js +31 -0
- package/modules/ixBidAdapter.js +166 -21
- package/modules/merkleIdSystem.js +5 -0
- package/modules/nativoBidAdapter.js +27 -1
- package/modules/oguryBidAdapter.js +2 -1
- package/modules/openxBidAdapter.js +6 -1
- package/modules/prebidServerBidAdapter/index.js +3 -3
- package/modules/pubmaticBidAdapter.js +2 -0
- package/modules/saambaaBidAdapter.js +420 -0
- package/modules/saambaaBidAdapter.md +65 -68
- package/modules/seedtagBidAdapter.js +6 -0
- package/modules/smaatoBidAdapter.js +6 -1
- package/modules/sspBCBidAdapter.js +34 -3
- package/modules/trustxBidAdapter.js +10 -1
- package/modules/vidoomyBidAdapter.js +51 -100
- package/modules/visxBidAdapter.js +1 -1
- package/modules/yieldlabBidAdapter.js +41 -10
- package/modules/yieldlabBidAdapter.md +91 -48
- package/package.json +6 -1
- package/src/adapterManager.js +14 -8
- package/test/spec/modules/adheseBidAdapter_spec.js +27 -1
- package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
- package/test/spec/modules/appnexusBidAdapter_spec.js +14 -0
- package/test/spec/modules/codefuelBidAdapter_spec.js +1 -1
- package/test/spec/modules/datablocksBidAdapter_spec.js +3 -3
- package/test/spec/modules/engageyaBidAdapter_spec.js +231 -95
- package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
- package/test/spec/modules/glimpseBidAdapter_spec.js +33 -0
- package/test/spec/modules/gptPreAuction_spec.js +58 -4
- package/test/spec/modules/imRtdProvider_spec.js +25 -0
- package/test/spec/modules/ixBidAdapter_spec.js +285 -2
- package/test/spec/modules/konduitWrapper_spec.js +0 -1
- package/test/spec/modules/merkleIdSystem_spec.js +18 -0
- package/test/spec/modules/nativoBidAdapter_spec.js +35 -18
- package/test/spec/modules/oguryBidAdapter_spec.js +13 -11
- package/test/spec/modules/openxBidAdapter_spec.js +5 -0
- package/test/spec/modules/prebidServerBidAdapter_spec.js +19 -2
- package/test/spec/modules/seedtagBidAdapter_spec.js +3 -0
- package/test/spec/modules/smaatoBidAdapter_spec.js +30 -0
- package/test/spec/modules/sspBCBidAdapter_spec.js +33 -3
- package/test/spec/modules/trustxBidAdapter_spec.js +42 -0
- package/test/spec/modules/vidoomyBidAdapter_spec.js +32 -13
- package/test/spec/modules/visxBidAdapter_spec.js +1 -1
- package/test/spec/modules/yieldlabBidAdapter_spec.js +81 -0
- package/test/spec/unit/core/adapterManager_spec.js +24 -6
|
@@ -1335,6 +1335,20 @@ describe('AppNexusAdapter', function () {
|
|
|
1335
1335
|
expect(Object.keys(result[0].meta)).to.include.members(['advertiserId']);
|
|
1336
1336
|
});
|
|
1337
1337
|
|
|
1338
|
+
it('should add brand id', function() {
|
|
1339
|
+
let responseBrandId = deepClone(response);
|
|
1340
|
+
responseBrandId.tags[0].ads[0].brand_id = 123;
|
|
1341
|
+
|
|
1342
|
+
let bidderRequest = {
|
|
1343
|
+
bids: [{
|
|
1344
|
+
bidId: '3db3773286ee59',
|
|
1345
|
+
adUnitCode: 'code'
|
|
1346
|
+
}]
|
|
1347
|
+
}
|
|
1348
|
+
let result = spec.interpretResponse({ body: responseBrandId }, {bidderRequest});
|
|
1349
|
+
expect(Object.keys(result[0].meta)).to.include.members(['brandId']);
|
|
1350
|
+
});
|
|
1351
|
+
|
|
1338
1352
|
it('should add advertiserDomains', function() {
|
|
1339
1353
|
let responseAdvertiserId = deepClone(response);
|
|
1340
1354
|
responseAdvertiserId.tags[0].ads[0].adomain = ['123'];
|
|
@@ -183,7 +183,7 @@ describe('Codefuel Adapter', function () {
|
|
|
183
183
|
tmax: 500
|
|
184
184
|
}
|
|
185
185
|
const res = spec.buildRequests([bidRequest], commonBidderRequest)
|
|
186
|
-
expect(res.url).to.equal('https://
|
|
186
|
+
expect(res.url).to.equal('https://ai-p-codefuel-ds-rtb-us-east-1-k8s.seccint.com/prebid')
|
|
187
187
|
expect(res.data).to.deep.equal(expectedData)
|
|
188
188
|
})
|
|
189
189
|
|
|
@@ -96,8 +96,8 @@ const bidderRequest = {
|
|
|
96
96
|
refererInfo: {
|
|
97
97
|
numIframes: 0,
|
|
98
98
|
reachedTop: true,
|
|
99
|
-
referer: 'https://v5demo.datablocks.net/test',
|
|
100
|
-
stack: ['https://v5demo.datablocks.net/test']
|
|
99
|
+
referer: 'https://7560.v5demo.datablocks.net/test',
|
|
100
|
+
stack: ['https://7560.v5demo.datablocks.net/test']
|
|
101
101
|
},
|
|
102
102
|
start: Date.now(),
|
|
103
103
|
timeout: 10000
|
|
@@ -452,7 +452,7 @@ describe('DatablocksAdapter', function() {
|
|
|
452
452
|
|
|
453
453
|
it('Returns valid URL', function() {
|
|
454
454
|
expect(request.url).to.exist;
|
|
455
|
-
expect(request.url).to.equal('https://
|
|
455
|
+
expect(request.url).to.equal('https://v5demo.datablocks.net/openrtb/?sid=7560');
|
|
456
456
|
});
|
|
457
457
|
|
|
458
458
|
it('Creates an array of request objects', function() {
|
|
@@ -4,18 +4,7 @@ import * as utils from 'src/utils.js';
|
|
|
4
4
|
|
|
5
5
|
const ENDPOINT_URL = 'https://recs.engageya.com/rec-api/getrecs.json';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
var hash;
|
|
9
|
-
var myJson = {};
|
|
10
|
-
var hashes = url.slice(url.indexOf('?') + 1).split('&');
|
|
11
|
-
for (var i = 0; i < hashes.length; i++) {
|
|
12
|
-
hash = hashes[i].split('=');
|
|
13
|
-
myJson[hash[0]] = hash[1];
|
|
14
|
-
}
|
|
15
|
-
return myJson;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
describe('engageya adapter', function () {
|
|
7
|
+
describe('Engageya adapter', function () {
|
|
19
8
|
let bidRequests;
|
|
20
9
|
let nativeBidRequests;
|
|
21
10
|
|
|
@@ -55,40 +44,57 @@ describe('engageya adapter', function () {
|
|
|
55
44
|
}
|
|
56
45
|
]
|
|
57
46
|
})
|
|
47
|
+
|
|
58
48
|
describe('isBidRequestValid', function () {
|
|
59
|
-
it('
|
|
49
|
+
it('Valid bid case', function () {
|
|
60
50
|
let validBid = {
|
|
61
51
|
bidder: 'engageya',
|
|
62
52
|
params: {
|
|
63
53
|
widgetId: 85610,
|
|
64
54
|
websiteId: 91140,
|
|
65
55
|
pageUrl: '[PAGE_URL]'
|
|
66
|
-
}
|
|
56
|
+
},
|
|
57
|
+
sizes: [[300, 250]]
|
|
67
58
|
}
|
|
68
59
|
let isValid = spec.isBidRequestValid(validBid);
|
|
69
|
-
expect(isValid).to.
|
|
60
|
+
expect(isValid).to.be.true;
|
|
70
61
|
});
|
|
71
62
|
|
|
72
|
-
it('
|
|
63
|
+
it('Invalid bid case: widgetId and websiteId is not passed', function () {
|
|
73
64
|
let validBid = {
|
|
74
65
|
bidder: 'engageya',
|
|
75
66
|
params: {}
|
|
76
67
|
}
|
|
77
68
|
let isValid = spec.isBidRequestValid(validBid);
|
|
78
|
-
expect(isValid).to.
|
|
69
|
+
expect(isValid).to.be.false;
|
|
79
70
|
})
|
|
80
71
|
|
|
81
|
-
it('
|
|
72
|
+
it('Invalid bid case: widget id must be number', function () {
|
|
82
73
|
let invalidBid = {
|
|
83
74
|
bidder: 'engageya',
|
|
84
75
|
params: {
|
|
85
76
|
widgetId: '157746a',
|
|
86
77
|
websiteId: 91140,
|
|
87
78
|
pageUrl: '[PAGE_URL]'
|
|
88
|
-
}
|
|
79
|
+
},
|
|
80
|
+
sizes: [[300, 250]]
|
|
81
|
+
}
|
|
82
|
+
let isValid = spec.isBidRequestValid(invalidBid);
|
|
83
|
+
expect(isValid).to.be.false;
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('Invalid bid case: unsupported sizes', function () {
|
|
87
|
+
let invalidBid = {
|
|
88
|
+
bidder: 'engageya',
|
|
89
|
+
params: {
|
|
90
|
+
widgetId: '157746a',
|
|
91
|
+
websiteId: 91140,
|
|
92
|
+
pageUrl: '[PAGE_URL]'
|
|
93
|
+
},
|
|
94
|
+
sizes: [[250, 250]]
|
|
89
95
|
}
|
|
90
96
|
let isValid = spec.isBidRequestValid(invalidBid);
|
|
91
|
-
expect(isValid).to.
|
|
97
|
+
expect(isValid).to.be.false;
|
|
92
98
|
})
|
|
93
99
|
})
|
|
94
100
|
|
|
@@ -113,36 +119,30 @@ describe('engageya adapter', function () {
|
|
|
113
119
|
|
|
114
120
|
it('Request params check', function () {
|
|
115
121
|
let request = spec.buildRequests(bidRequests)[0];
|
|
116
|
-
const
|
|
117
|
-
expect(parseInt(
|
|
118
|
-
expect(parseInt(
|
|
119
|
-
})
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
describe('interpretResponse', function () {
|
|
123
|
-
it('should return empty array if no response', function () {
|
|
124
|
-
const result = spec.interpretResponse({}, [])
|
|
125
|
-
expect(result).to.be.an('array').that.is.empty
|
|
122
|
+
const urlParams = new URL(request.url).searchParams;
|
|
123
|
+
expect(parseInt(urlParams.get('wid'))).to.exist.and.to.equal(bidRequests[0].params.widgetId);
|
|
124
|
+
expect(parseInt(urlParams.get('webid'))).to.exist.and.to.equal(bidRequests[0].params.websiteId);
|
|
126
125
|
});
|
|
127
126
|
|
|
128
|
-
it('
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
pbtypeId: 2
|
|
135
|
-
};
|
|
136
|
-
let request = spec.buildRequests(bidRequests)[0];
|
|
137
|
-
const result = spec.interpretResponse({ body: response }, request)
|
|
138
|
-
expect(result).to.be.an('array').that.is.empty
|
|
127
|
+
it('Request pageUrl - use param', function () {
|
|
128
|
+
const pageUrl = 'https://url.test';
|
|
129
|
+
bidRequests[0].params.pageUrl = pageUrl;
|
|
130
|
+
const request = spec.buildRequests(bidRequests)[0];
|
|
131
|
+
const urlParams = new URL(request.url).searchParams;
|
|
132
|
+
expect(urlParams.get('url')).to.exist.and.to.equal(pageUrl);
|
|
139
133
|
});
|
|
134
|
+
})
|
|
140
135
|
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
describe('interpretResponse', function () {
|
|
137
|
+
let nativeResponse;
|
|
138
|
+
let bannerResponse;
|
|
139
|
+
|
|
140
|
+
beforeEach(() => {
|
|
141
|
+
const recsResponse = {
|
|
143
142
|
recs: [
|
|
144
143
|
{
|
|
145
|
-
ecpm:
|
|
144
|
+
ecpm: 9.20,
|
|
145
|
+
pecpm: 0.0520,
|
|
146
146
|
postId: '<!-- CREATIVE ID -->',
|
|
147
147
|
thumbnail_path: 'https://engageya.live/wp-content/uploads/2019/05/images.png',
|
|
148
148
|
domain: 'domain.test',
|
|
@@ -159,8 +159,80 @@ describe('engageya adapter', function () {
|
|
|
159
159
|
imageWidth: 300,
|
|
160
160
|
imageHeight: 250,
|
|
161
161
|
ireqId: '1d236f7890b',
|
|
162
|
-
|
|
162
|
+
viewPxl: '//view.pixel',
|
|
163
163
|
};
|
|
164
|
+
|
|
165
|
+
nativeResponse = {
|
|
166
|
+
...recsResponse,
|
|
167
|
+
pbtypeId: 1,
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
bannerResponse = {
|
|
171
|
+
...recsResponse,
|
|
172
|
+
pbtypeId: 2,
|
|
173
|
+
widget: {
|
|
174
|
+
additionalData: '{"css":".eng_tag_ttl{display:block!important}"}'
|
|
175
|
+
},
|
|
176
|
+
}
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
it('should return empty array if no response', function () {
|
|
180
|
+
const result = spec.interpretResponse({}, [])
|
|
181
|
+
expect(result).to.be.an('array').that.is.empty
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it('should return empty array if no valid bids', function () {
|
|
185
|
+
let response = {
|
|
186
|
+
recs: [],
|
|
187
|
+
imageWidth: 300,
|
|
188
|
+
imageHeight: 250,
|
|
189
|
+
ireqId: '1d236f7890b',
|
|
190
|
+
pbtypeId: 2,
|
|
191
|
+
viewPxl: '//view.pixel',
|
|
192
|
+
};
|
|
193
|
+
let request = spec.buildRequests(bidRequests)[0];
|
|
194
|
+
const result = spec.interpretResponse({ body: response }, request)
|
|
195
|
+
expect(result).to.be.an('array').that.is.empty
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
it('should interpret native response', function () {
|
|
199
|
+
let expectedResult = [
|
|
200
|
+
{
|
|
201
|
+
requestId: '1d236f7890b',
|
|
202
|
+
cpm: 0.0520,
|
|
203
|
+
width: 300,
|
|
204
|
+
height: 250,
|
|
205
|
+
netRevenue: true,
|
|
206
|
+
currency: 'USD',
|
|
207
|
+
creativeId: '<!-- CREATIVE ID -->',
|
|
208
|
+
ttl: 360,
|
|
209
|
+
meta: {
|
|
210
|
+
advertiserDomains: ['domain.test']
|
|
211
|
+
},
|
|
212
|
+
native: {
|
|
213
|
+
title: 'Test title',
|
|
214
|
+
body: '',
|
|
215
|
+
image: {
|
|
216
|
+
url: 'https://engageya.live/wp-content/uploads/2019/05/images.png',
|
|
217
|
+
width: 300,
|
|
218
|
+
height: 250
|
|
219
|
+
},
|
|
220
|
+
privacyLink: '',
|
|
221
|
+
clickUrl: '//click.test',
|
|
222
|
+
displayUrl: '//url.test',
|
|
223
|
+
cta: '',
|
|
224
|
+
sponsoredBy: 'Test displayName',
|
|
225
|
+
impressionTrackers: ['//impression.test', '//view.test', '//view.pixel'],
|
|
226
|
+
},
|
|
227
|
+
}
|
|
228
|
+
];
|
|
229
|
+
let request = spec.buildRequests(bidRequests)[0];
|
|
230
|
+
let result = spec.interpretResponse({ body: nativeResponse }, request);
|
|
231
|
+
expect(result).to.deep.equal(expectedResult);
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it('should interpret native response - without pecpm', function () {
|
|
235
|
+
delete nativeResponse.recs[0].pecpm;
|
|
164
236
|
let expectedResult = [
|
|
165
237
|
{
|
|
166
238
|
requestId: '1d236f7890b',
|
|
@@ -187,81 +259,76 @@ describe('engageya adapter', function () {
|
|
|
187
259
|
displayUrl: '//url.test',
|
|
188
260
|
cta: '',
|
|
189
261
|
sponsoredBy: 'Test displayName',
|
|
190
|
-
impressionTrackers: ['//impression.test', '//view.test'],
|
|
262
|
+
impressionTrackers: ['//impression.test', '//view.test', '//view.pixel'],
|
|
191
263
|
},
|
|
192
264
|
}
|
|
193
265
|
];
|
|
194
266
|
let request = spec.buildRequests(bidRequests)[0];
|
|
195
|
-
let result = spec.interpretResponse({ body:
|
|
267
|
+
let result = spec.interpretResponse({ body: nativeResponse }, request);
|
|
196
268
|
expect(result).to.deep.equal(expectedResult);
|
|
197
269
|
});
|
|
198
270
|
|
|
199
|
-
it('should interpret
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
271
|
+
it('should interpret native response - without trackers', function () {
|
|
272
|
+
delete nativeResponse.recs[0].trackers;
|
|
273
|
+
let expectedResult = [
|
|
274
|
+
{
|
|
275
|
+
requestId: '1d236f7890b',
|
|
276
|
+
cpm: 0.0520,
|
|
277
|
+
width: 300,
|
|
278
|
+
height: 250,
|
|
279
|
+
netRevenue: true,
|
|
280
|
+
currency: 'USD',
|
|
281
|
+
creativeId: '<!-- CREATIVE ID -->',
|
|
282
|
+
ttl: 360,
|
|
283
|
+
meta: {
|
|
284
|
+
advertiserDomains: ['domain.test']
|
|
285
|
+
},
|
|
286
|
+
native: {
|
|
207
287
|
title: 'Test title',
|
|
288
|
+
body: '',
|
|
289
|
+
image: {
|
|
290
|
+
url: 'https://engageya.live/wp-content/uploads/2019/05/images.png',
|
|
291
|
+
width: 300,
|
|
292
|
+
height: 250
|
|
293
|
+
},
|
|
294
|
+
privacyLink: '',
|
|
208
295
|
clickUrl: '//click.test',
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
],
|
|
217
|
-
imageWidth: 300,
|
|
218
|
-
imageHeight: 250,
|
|
219
|
-
ireqId: '1d236f7890b',
|
|
220
|
-
pbtypeId: 2,
|
|
221
|
-
widget: {
|
|
222
|
-
additionalData: '{"css":".eng_tag_ttl{display:block!important}"}'
|
|
296
|
+
displayUrl: '//url.test',
|
|
297
|
+
cta: '',
|
|
298
|
+
sponsoredBy: 'Test displayName',
|
|
299
|
+
impressionTrackers: ['//view.pixel'],
|
|
300
|
+
},
|
|
223
301
|
}
|
|
224
|
-
|
|
302
|
+
];
|
|
303
|
+
let request = spec.buildRequests(bidRequests)[0];
|
|
304
|
+
let result = spec.interpretResponse({ body: nativeResponse }, request);
|
|
305
|
+
expect(result).to.deep.equal(expectedResult);
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
it('should interpret display response', function () {
|
|
225
309
|
let expectedResult = [
|
|
226
310
|
{
|
|
227
311
|
requestId: '1d236f7890b',
|
|
228
|
-
cpm: 0.
|
|
312
|
+
cpm: 0.0520,
|
|
229
313
|
width: 300,
|
|
230
314
|
height: 250,
|
|
231
|
-
netRevenue:
|
|
315
|
+
netRevenue: true,
|
|
232
316
|
currency: 'USD',
|
|
233
317
|
creativeId: '<!-- CREATIVE ID -->',
|
|
234
318
|
ttl: 360,
|
|
235
319
|
meta: {
|
|
236
320
|
advertiserDomains: ['domain.test']
|
|
237
321
|
},
|
|
238
|
-
ad: `<html><body><style>.eng_tag_ttl{display:block!important}</style><div id="ENG_TAG"><a href="//click.test" target=_blank><img class="eng_tag_img" src="https://engageya.live/wp-content/uploads/2019/05/images.png" style="width:300px;height:250px;" alt="Test title"/><div class="eng_tag_brnd" style="display: none">Test displayName</div><div class="eng_tag_ttl" style="display: none">Test title</div></a><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//impression.test"></div><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.test"></div></div></body></html>`,
|
|
322
|
+
ad: `<html><body><style>.eng_tag_ttl{display:block!important}</style><div id="ENG_TAG"><a href="//click.test" target=_blank><img class="eng_tag_img" src="https://engageya.live/wp-content/uploads/2019/05/images.png" style="width:300px;height:250px;" alt="Test title"/><div class="eng_tag_brnd" style="display: none">Test displayName</div><div class="eng_tag_ttl" style="display: none">Test title</div></a><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//impression.test"></div><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.test"></div><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.pixel"></div></div></body></html>`,
|
|
239
323
|
}
|
|
240
324
|
];
|
|
241
325
|
let request = spec.buildRequests(bidRequests)[0];
|
|
242
|
-
let result = spec.interpretResponse({ body:
|
|
326
|
+
let result = spec.interpretResponse({ body: bannerResponse }, request);
|
|
243
327
|
expect(result).to.deep.equal(expectedResult);
|
|
244
328
|
});
|
|
245
329
|
|
|
246
|
-
it('should interpret display response without
|
|
247
|
-
|
|
248
|
-
recs: [
|
|
249
|
-
{
|
|
250
|
-
ecpm: 0.0920,
|
|
251
|
-
postId: '<!-- CREATIVE ID -->',
|
|
252
|
-
thumbnail_path: 'https://engageya.live/wp-content/uploads/2019/05/images.png',
|
|
253
|
-
domain: 'domain.test',
|
|
254
|
-
title: ' ',
|
|
255
|
-
clickUrl: '//click.test',
|
|
256
|
-
url: '//url.test',
|
|
257
|
-
displayName: 'Test displayName',
|
|
258
|
-
}
|
|
259
|
-
],
|
|
260
|
-
imageWidth: 300,
|
|
261
|
-
imageHeight: 250,
|
|
262
|
-
ireqId: '1d236f7890b',
|
|
263
|
-
pbtypeId: 2,
|
|
264
|
-
};
|
|
330
|
+
it('should interpret display response - without pecpm', function () {
|
|
331
|
+
delete bannerResponse.recs[0].pecpm;
|
|
265
332
|
let expectedResult = [
|
|
266
333
|
{
|
|
267
334
|
requestId: '1d236f7890b',
|
|
@@ -275,11 +342,80 @@ describe('engageya adapter', function () {
|
|
|
275
342
|
meta: {
|
|
276
343
|
advertiserDomains: ['domain.test']
|
|
277
344
|
},
|
|
278
|
-
ad: `<html><body><div id="ENG_TAG"><a href="//click.test" target=_blank><img class="eng_tag_img" src="https://engageya.live/wp-content/uploads/2019/05/images.png" style="width:300px;height:250px;" alt=" "
|
|
345
|
+
ad: `<html><body><style>.eng_tag_ttl{display:block!important}</style><div id="ENG_TAG"><a href="//click.test" target=_blank><img class="eng_tag_img" src="https://engageya.live/wp-content/uploads/2019/05/images.png" style="width:300px;height:250px;" alt="Test title"/><div class="eng_tag_brnd" style="display: none">Test displayName</div><div class="eng_tag_ttl" style="display: none">Test title</div></a><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//impression.test"></div><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.test"></div><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.pixel"></div></div></body></html>`,
|
|
346
|
+
}
|
|
347
|
+
];
|
|
348
|
+
let request = spec.buildRequests(bidRequests)[0];
|
|
349
|
+
let result = spec.interpretResponse({ body: bannerResponse }, request);
|
|
350
|
+
expect(result).to.deep.equal(expectedResult);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
it('should interpret display response - without title', function () {
|
|
354
|
+
bannerResponse.recs[0].title = ' ';
|
|
355
|
+
let expectedResult = [
|
|
356
|
+
{
|
|
357
|
+
requestId: '1d236f7890b',
|
|
358
|
+
cpm: 0.0520,
|
|
359
|
+
width: 300,
|
|
360
|
+
height: 250,
|
|
361
|
+
netRevenue: true,
|
|
362
|
+
currency: 'USD',
|
|
363
|
+
creativeId: '<!-- CREATIVE ID -->',
|
|
364
|
+
ttl: 360,
|
|
365
|
+
meta: {
|
|
366
|
+
advertiserDomains: ['domain.test']
|
|
367
|
+
},
|
|
368
|
+
ad: `<html><body><style>.eng_tag_ttl{display:block!important}</style><div id="ENG_TAG"><a href="//click.test" target=_blank><img class="eng_tag_img" src="https://engageya.live/wp-content/uploads/2019/05/images.png" style="width:300px;height:250px;" alt=" "/></a><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//impression.test"></div><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.test"></div><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.pixel"></div></div></body></html>`,
|
|
369
|
+
}
|
|
370
|
+
];
|
|
371
|
+
let request = spec.buildRequests(bidRequests)[0];
|
|
372
|
+
let result = spec.interpretResponse({ body: bannerResponse }, request);
|
|
373
|
+
expect(result).to.deep.equal(expectedResult);
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
it('should interpret display response - without widget additional data', function () {
|
|
377
|
+
bannerResponse.widget.additionalData = null;
|
|
378
|
+
let expectedResult = [
|
|
379
|
+
{
|
|
380
|
+
requestId: '1d236f7890b',
|
|
381
|
+
cpm: 0.0520,
|
|
382
|
+
width: 300,
|
|
383
|
+
height: 250,
|
|
384
|
+
netRevenue: true,
|
|
385
|
+
currency: 'USD',
|
|
386
|
+
creativeId: '<!-- CREATIVE ID -->',
|
|
387
|
+
ttl: 360,
|
|
388
|
+
meta: {
|
|
389
|
+
advertiserDomains: ['domain.test']
|
|
390
|
+
},
|
|
391
|
+
ad: `<html><body><div id="ENG_TAG"><a href="//click.test" target=_blank><img class="eng_tag_img" src="https://engageya.live/wp-content/uploads/2019/05/images.png" style="width:300px;height:250px;" alt="Test title"/><div class="eng_tag_brnd" style="display: none">Test displayName</div><div class="eng_tag_ttl" style="display: none">Test title</div></a><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//impression.test"></div><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.test"></div><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.pixel"></div></div></body></html>`,
|
|
392
|
+
}
|
|
393
|
+
];
|
|
394
|
+
let request = spec.buildRequests(bidRequests)[0];
|
|
395
|
+
let result = spec.interpretResponse({ body: bannerResponse }, request);
|
|
396
|
+
expect(result).to.deep.equal(expectedResult);
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
it('should interpret display response - without trackers', function () {
|
|
400
|
+
bannerResponse.recs[0].trackers = null;
|
|
401
|
+
let expectedResult = [
|
|
402
|
+
{
|
|
403
|
+
requestId: '1d236f7890b',
|
|
404
|
+
cpm: 0.0520,
|
|
405
|
+
width: 300,
|
|
406
|
+
height: 250,
|
|
407
|
+
netRevenue: true,
|
|
408
|
+
currency: 'USD',
|
|
409
|
+
creativeId: '<!-- CREATIVE ID -->',
|
|
410
|
+
ttl: 360,
|
|
411
|
+
meta: {
|
|
412
|
+
advertiserDomains: ['domain.test']
|
|
413
|
+
},
|
|
414
|
+
ad: `<html><body><style>.eng_tag_ttl{display:block!important}</style><div id="ENG_TAG"><a href="//click.test" target=_blank><img class="eng_tag_img" src="https://engageya.live/wp-content/uploads/2019/05/images.png" style="width:300px;height:250px;" alt="Test title"/><div class="eng_tag_brnd" style="display: none">Test displayName</div><div class="eng_tag_ttl" style="display: none">Test title</div></a><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="//view.pixel"></div></div></body></html>`,
|
|
279
415
|
}
|
|
280
416
|
];
|
|
281
417
|
let request = spec.buildRequests(bidRequests)[0];
|
|
282
|
-
let result = spec.interpretResponse({ body:
|
|
418
|
+
let result = spec.interpretResponse({ body: bannerResponse }, request);
|
|
283
419
|
expect(result).to.deep.equal(expectedResult);
|
|
284
420
|
});
|
|
285
421
|
})
|
|
@@ -328,26 +328,25 @@ describe('E-Planning Adapter', function () {
|
|
|
328
328
|
describe('buildRequests', function () {
|
|
329
329
|
let bidRequests = [validBid];
|
|
330
330
|
let sandbox;
|
|
331
|
+
let getWindowSelfStub;
|
|
332
|
+
let innerWidth;
|
|
331
333
|
beforeEach(() => {
|
|
332
334
|
sandbox = sinon.sandbox.create();
|
|
335
|
+
getWindowSelfStub = sandbox.stub(utils, 'getWindowSelf');
|
|
336
|
+
getWindowSelfStub.returns(createWindow(800));
|
|
333
337
|
});
|
|
334
338
|
|
|
335
339
|
afterEach(() => {
|
|
336
340
|
sandbox.restore();
|
|
337
341
|
});
|
|
338
342
|
|
|
339
|
-
const createWindow = () => {
|
|
343
|
+
const createWindow = (innerWidth) => {
|
|
340
344
|
const win = {};
|
|
341
345
|
win.self = win;
|
|
342
|
-
win.innerWidth =
|
|
346
|
+
win.innerWidth = innerWidth;
|
|
343
347
|
return win;
|
|
344
348
|
};
|
|
345
349
|
|
|
346
|
-
function setupSingleWindow(sandBox) {
|
|
347
|
-
const win = createWindow();
|
|
348
|
-
sandBox.stub(utils, 'getWindowSelf').returns(win);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
350
|
it('should create the url correctly', function () {
|
|
352
351
|
const url = spec.buildRequests(bidRequests, bidderRequest).url;
|
|
353
352
|
expect(url).to.equal('https://pbjs.e-planning.net/pbjs/1/' + CI + '/1/localhost/ROS');
|
|
@@ -516,7 +515,8 @@ describe('E-Planning Adapter', function () {
|
|
|
516
515
|
|
|
517
516
|
it('should return the e parameter with a value according to the sizes in order corresponding to the desktop priority list of the ad units', function () {
|
|
518
517
|
let bidRequestsPrioritySizes = [validBidExistingSizesInPriorityListForDesktop];
|
|
519
|
-
|
|
518
|
+
// overwrite default innerWdith for tests with a larger one we consider "Desktop" or NOT Mobile
|
|
519
|
+
getWindowSelfStub.returns(createWindow(1025));
|
|
520
520
|
const e = spec.buildRequests(bidRequestsPrioritySizes, bidderRequest).data.e;
|
|
521
521
|
expect(e).to.equal('300x250_0:300x250,300x600,970x250');
|
|
522
522
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BANNER } from '../../../src/mediaTypes'
|
|
1
2
|
import { expect } from 'chai'
|
|
2
3
|
import { newBidder } from 'src/adapters/bidderFactory.js'
|
|
3
4
|
import { spec } from 'modules/glimpseBidAdapter.js'
|
|
@@ -79,6 +80,20 @@ function getDeepCopy(object) {
|
|
|
79
80
|
describe('GlimpseProtocolAdapter', () => {
|
|
80
81
|
const glimpseAdapter = newBidder(spec)
|
|
81
82
|
|
|
83
|
+
describe('spec', () => {
|
|
84
|
+
it('Has defined the glimpse gvlid', () => {
|
|
85
|
+
expect(spec.gvlid).to.equal(1012)
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
it('Has defined glimpse as the bidder', () => {
|
|
89
|
+
expect(spec.code).to.equal('glimpse')
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
it('Has defined valid mediaTypes', () => {
|
|
93
|
+
expect(spec.supportedMediaTypes).to.deep.equal([BANNER])
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
|
|
82
97
|
describe('Inherited functions', () => {
|
|
83
98
|
it('Functions exist and are valid types', () => {
|
|
84
99
|
expect(glimpseAdapter.callBids).to.exist.and.to.be.a('function')
|
|
@@ -163,6 +178,24 @@ describe('GlimpseProtocolAdapter', () => {
|
|
|
163
178
|
const bidRequests = [getBidRequest()]
|
|
164
179
|
const bidderRequest = getBidderRequest()
|
|
165
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
|
+
|
|
166
199
|
it('Adds GDPR consent', () => {
|
|
167
200
|
const request = spec.buildRequests(bidRequests, bidderRequest)
|
|
168
201
|
const payload = JSON.parse(request.data)
|
|
@@ -197,15 +197,69 @@ describe('GPT pre-auction module', () => {
|
|
|
197
197
|
code: 'slotCode3',
|
|
198
198
|
}];
|
|
199
199
|
|
|
200
|
+
// first two adUnits directly pass in pbadslot => gpid is same
|
|
200
201
|
const expectedAdUnits = [{
|
|
201
202
|
code: 'adUnit1',
|
|
202
|
-
ortb2Imp: {
|
|
203
|
-
|
|
203
|
+
ortb2Imp: {
|
|
204
|
+
ext: {
|
|
205
|
+
data: {
|
|
206
|
+
pbadslot: '12345'
|
|
207
|
+
},
|
|
208
|
+
gpid: '12345'
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
// second adunit
|
|
213
|
+
{
|
|
204
214
|
code: 'slotCode1',
|
|
205
|
-
ortb2Imp: {
|
|
215
|
+
ortb2Imp: {
|
|
216
|
+
ext: {
|
|
217
|
+
data: {
|
|
218
|
+
pbadslot: '67890',
|
|
219
|
+
adserver: {
|
|
220
|
+
name: 'gam',
|
|
221
|
+
adslot: 'slotCode1'
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
gpid: '67890'
|
|
225
|
+
}
|
|
226
|
+
}
|
|
206
227
|
}, {
|
|
207
228
|
code: 'slotCode3',
|
|
208
|
-
ortb2Imp: {
|
|
229
|
+
ortb2Imp: {
|
|
230
|
+
ext: {
|
|
231
|
+
data: {
|
|
232
|
+
pbadslot: 'slotCode3',
|
|
233
|
+
adserver: {
|
|
234
|
+
name: 'gam',
|
|
235
|
+
adslot: 'slotCode3'
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
gpid: 'slotCode3'
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}];
|
|
242
|
+
|
|
243
|
+
window.googletag.pubads().setSlots(testSlots);
|
|
244
|
+
runMakeBidRequests(testAdUnits);
|
|
245
|
+
expect(returnedAdUnits).to.deep.equal(expectedAdUnits);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
it('should not apply gpid if pbadslot was set by adUnitCode', () => {
|
|
249
|
+
const testAdUnits = [{
|
|
250
|
+
code: 'noMatchCode',
|
|
251
|
+
}];
|
|
252
|
+
|
|
253
|
+
// first two adUnits directly pass in pbadslot => gpid is same
|
|
254
|
+
const expectedAdUnits = [{
|
|
255
|
+
code: 'noMatchCode',
|
|
256
|
+
ortb2Imp: {
|
|
257
|
+
ext: {
|
|
258
|
+
data: {
|
|
259
|
+
pbadslot: 'noMatchCode'
|
|
260
|
+
},
|
|
261
|
+
}
|
|
262
|
+
}
|
|
209
263
|
}];
|
|
210
264
|
|
|
211
265
|
window.googletag.pubads().setSlots(testSlots);
|