prebid.js 6.3.0 → 6.7.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/.circleci/config.yml +1 -1
- package/gulpfile.js +87 -74
- package/integrationExamples/gpt/amp/creative.html +11 -33
- package/karma.conf.maker.js +1 -1
- package/modules/.submodules.json +2 -1
- package/modules/adbookpspBidAdapter.js +27 -10
- package/modules/adhashBidAdapter.js +3 -3
- package/modules/adkernelBidAdapter.js +148 -62
- package/modules/adlooxAdServerVideo.js +2 -2
- package/modules/adlooxAnalyticsAdapter.js +4 -4
- package/modules/admanBidAdapter.js +10 -4
- package/modules/adomikAnalyticsAdapter.js +27 -9
- package/modules/adqueryIdSystem.js +103 -0
- package/modules/adqueryIdSystem.md +35 -0
- package/modules/adyoulikeBidAdapter.js +13 -9
- package/modules/aniviewBidAdapter.js +1 -1
- package/modules/beopBidAdapter.js +1 -1
- package/modules/bidViewability.js +3 -3
- package/modules/bidViewabilityIO.js +3 -3
- package/modules/bliinkBidAdapter.js +3 -2
- package/modules/colossussspBidAdapter.js +12 -8
- package/modules/colossussspBidAdapter.md +15 -1
- package/modules/compassBidAdapter.js +208 -0
- package/modules/compassBidAdapter.md +79 -0
- package/modules/consentManagement.js +7 -1
- package/modules/consumableBidAdapter.md +1 -1
- package/modules/criteoBidAdapter.js +1 -1
- package/modules/criteoIdSystem.js +29 -7
- package/modules/currency.js +2 -2
- package/modules/dailyhuntBidAdapter.js +435 -0
- package/modules/dailyhuntBidAdapter.md +4 -0
- package/modules/docereeBidAdapter.js +10 -1
- package/modules/docereeBidAdapter.md +2 -0
- package/modules/engageyaBidAdapter.js +1 -1
- package/modules/feedadBidAdapter.js +2 -2
- package/modules/feedadBidAdapter.md +4 -2
- 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/gridBidAdapter.js +4 -3
- package/modules/gumgumBidAdapter.js +4 -4
- package/modules/idImportLibrary.js +45 -8
- package/modules/idImportLibrary.md +4 -0
- package/modules/improvedigitalBidAdapter.js +42 -4
- package/modules/instreamTracking.js +4 -4
- package/modules/invibesBidAdapter.js +49 -5
- package/modules/invibesBidAdapter.md +2 -1
- package/modules/ixBidAdapter.js +53 -18
- 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/livewrappedBidAdapter.js +8 -2
- package/modules/loglyliftBidAdapter.js +79 -0
- package/modules/loglyliftBidAdapter.md +55 -0
- package/modules/nextMillenniumBidAdapter.js +11 -7
- 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/pubgeniusBidAdapter.js +1 -1
- package/modules/pubmaticAnalyticsAdapter.js +16 -0
- package/modules/pubxaiAnalyticsAdapter.js +17 -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/rubiconBidAdapter.js +21 -11
- package/modules/seedingAllianceBidAdapter.js +3 -3
- package/modules/sharethroughBidAdapter.js +12 -17
- package/modules/showheroes-bsBidAdapter.js +13 -2
- package/modules/synacormediaBidAdapter.js +31 -10
- package/modules/tappxBidAdapter.js +8 -5
- package/modules/teadsBidAdapter.js +1 -2
- package/modules/telariaBidAdapter.js +2 -2
- package/modules/trustxBidAdapter.js +8 -16
- 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/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/auction.js +2 -2
- package/src/config.js +27 -3
- package/src/hook.js +5 -1
- package/src/prebid.js +20 -4
- package/src/secureCreatives.js +3 -2
- package/src/utils.js +12 -1
- package/test/helpers/prebidGlobal.js +1 -0
- package/test/spec/config_spec.js +279 -0
- package/test/spec/modules/adbookpspBidAdapter_spec.js +17 -3
- package/test/spec/modules/adhashBidAdapter_spec.js +2 -2
- package/test/spec/modules/adlooxAnalyticsAdapter_spec.js +6 -6
- package/test/spec/modules/admanBidAdapter_spec.js +2 -2
- package/test/spec/modules/adomikAnalyticsAdapter_spec.js +9 -1
- package/test/spec/modules/adqueryIdSystem_spec.js +74 -0
- package/test/spec/modules/adyoulikeBidAdapter_spec.js +49 -0
- package/test/spec/modules/beopBidAdapter_spec.js +1 -1
- package/test/spec/modules/bidViewabilityIO_spec.js +2 -2
- package/test/spec/modules/bidViewability_spec.js +4 -4
- package/test/spec/modules/bliinkBidAdapter_spec.js +2 -0
- package/test/spec/modules/colossussspBidAdapter_spec.js +5 -2
- package/test/spec/modules/compassBidAdapter_spec.js +398 -0
- package/test/spec/modules/consentManagement_spec.js +20 -0
- package/test/spec/modules/criteoIdSystem_spec.js +6 -3
- package/test/spec/modules/dailyhuntBidAdapter_spec.js +404 -0
- package/test/spec/modules/docereeBidAdapter_spec.js +9 -1
- package/test/spec/modules/eids_spec.js +15 -0
- package/test/spec/modules/feedadBidAdapter_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/idImportLibrary_spec.js +197 -10
- package/test/spec/modules/improvedigitalBidAdapter_spec.js +45 -1
- package/test/spec/modules/invibesBidAdapter_spec.js +119 -0
- package/test/spec/modules/ixBidAdapter_spec.js +112 -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/livewrappedBidAdapter_spec.js +31 -0
- package/test/spec/modules/loglyliftBidAdapter_spec.js +172 -0
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +9 -2
- 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/pubgeniusBidAdapter_spec.js +3 -3
- package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +13 -1
- package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +11 -0
- 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/rubiconBidAdapter_spec.js +48 -9
- package/test/spec/modules/sharethroughBidAdapter_spec.js +91 -6
- package/test/spec/modules/showheroes-bsBidAdapter_spec.js +2 -0
- 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/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/zeta_global_sspAnalyticsAdapter_spec.js +427 -0
- package/test/spec/unit/pbjs_api_spec.js +3 -1
- package/test/test_deps.js +3 -0
- package/test/test_index.js +1 -3
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
// import or require modules necessary for the test, e.g.:
|
|
2
|
+
import { expect } from 'chai'; // may prefer 'assert' in place of 'expect'
|
|
3
|
+
import { spec } from '../../../modules/pilotxBidAdapter.js';
|
|
4
|
+
|
|
5
|
+
describe('pilotxAdapter', function () {
|
|
6
|
+
describe('isBidRequestValid', function () {
|
|
7
|
+
let banner;
|
|
8
|
+
beforeEach(function () {
|
|
9
|
+
banner = {
|
|
10
|
+
bidder: 'pilotx',
|
|
11
|
+
adUnitCode: 'adunit-test',
|
|
12
|
+
mediaTypes: { banner: {} },
|
|
13
|
+
sizes: [[300, 250], [468, 60]],
|
|
14
|
+
bidId: '2de8c82e30665a',
|
|
15
|
+
params: {
|
|
16
|
+
placementId: '1'
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should return false if sizes is empty', function () {
|
|
22
|
+
banner.sizes = []
|
|
23
|
+
expect(spec.isBidRequestValid(banner)).to.equal(false);
|
|
24
|
+
});
|
|
25
|
+
it('should return true if all is valid/ is not empty', function () {
|
|
26
|
+
expect(spec.isBidRequestValid(banner)).to.equal(true);
|
|
27
|
+
});
|
|
28
|
+
it('should return false if there is no placement id found', function () {
|
|
29
|
+
banner.params = {}
|
|
30
|
+
expect(spec.isBidRequestValid(banner)).to.equal(false);
|
|
31
|
+
});
|
|
32
|
+
it('should return false if sizes is empty', function () {
|
|
33
|
+
banner.sizes = []
|
|
34
|
+
expect(spec.isBidRequestValid(banner)).to.equal(false);
|
|
35
|
+
});
|
|
36
|
+
it('should return false for no size and empty params', function() {
|
|
37
|
+
const emptySizes = {
|
|
38
|
+
bidder: 'pilotx',
|
|
39
|
+
adUnitCode: 'adunit-test',
|
|
40
|
+
mediaTypes: { banner: {} },
|
|
41
|
+
bidId: '2de8c82e30665a',
|
|
42
|
+
params: {
|
|
43
|
+
placementId: '1',
|
|
44
|
+
sizes: []
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
expect(spec.isBidRequestValid(emptySizes)).to.equal(false);
|
|
48
|
+
})
|
|
49
|
+
it('should return true for no size and valid size params', function() {
|
|
50
|
+
const emptySizes = {
|
|
51
|
+
bidder: 'pilotx',
|
|
52
|
+
adUnitCode: 'adunit-test',
|
|
53
|
+
mediaTypes: { banner: {} },
|
|
54
|
+
bidId: '2de8c82e30665a',
|
|
55
|
+
params: {
|
|
56
|
+
placementId: '1',
|
|
57
|
+
sizes: [[300, 250], [468, 60]]
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
expect(spec.isBidRequestValid(emptySizes)).to.equal(true);
|
|
61
|
+
})
|
|
62
|
+
it('should return false for no size items', function() {
|
|
63
|
+
const emptySizes = {
|
|
64
|
+
bidder: 'pilotx',
|
|
65
|
+
adUnitCode: 'adunit-test',
|
|
66
|
+
mediaTypes: { banner: {} },
|
|
67
|
+
bidId: '2de8c82e30665a',
|
|
68
|
+
params: {
|
|
69
|
+
placementId: '1'
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
expect(spec.isBidRequestValid(emptySizes)).to.equal(false);
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
describe('buildRequests', function () {
|
|
77
|
+
const mockRequest = { refererInfo: {} };
|
|
78
|
+
const mockRequestGDPR = {
|
|
79
|
+
refererInfo: {},
|
|
80
|
+
gdprConsent: {
|
|
81
|
+
consentString: 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==',
|
|
82
|
+
gdprApplies: true
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
const mockVideo1 = [{
|
|
87
|
+
adUnitCode: 'video1',
|
|
88
|
+
auctionId: '01618029-7ae9-4e98-a73a-1ed0c817f414',
|
|
89
|
+
bidId: '2a59588c0114fa',
|
|
90
|
+
bidRequestsCount: 1,
|
|
91
|
+
bidder: 'pilotx',
|
|
92
|
+
bidderRequestId: '1f6b4ba2039726',
|
|
93
|
+
bidderRequestsCount: 1,
|
|
94
|
+
bidderWinsCount: 0,
|
|
95
|
+
crumbs: { pubcid: 'de5240ef-ff80-4b55-8837-26a11cfbf64c' },
|
|
96
|
+
mediaTypes: {
|
|
97
|
+
video: {
|
|
98
|
+
context: 'instream',
|
|
99
|
+
mimes: ['video/mp4'],
|
|
100
|
+
playbackmethod: [2],
|
|
101
|
+
playerSize: [[640, 480]],
|
|
102
|
+
protocols: [1, 2, 3, 4, 5, 6, 7, 8],
|
|
103
|
+
skip: 1
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
ortb2Imp: {
|
|
107
|
+
ext: {
|
|
108
|
+
data: {
|
|
109
|
+
pbadslot: 'video1'
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
params: { placementId: '379' },
|
|
114
|
+
sizes: [[640, 480]],
|
|
115
|
+
src: 'client',
|
|
116
|
+
transactionId: 'fec9f2ff-da13-4921-8437-8d679c2be7fe',
|
|
117
|
+
}];
|
|
118
|
+
const mockVideo2 = [{
|
|
119
|
+
adUnitCode: 'video1',
|
|
120
|
+
auctionId: '01618029-7ae9-4e98-a73a-1ed0c817f414',
|
|
121
|
+
bidId: '2a59588c0114fa',
|
|
122
|
+
bidRequestsCount: 1,
|
|
123
|
+
bidder: 'pilotx',
|
|
124
|
+
bidderRequestId: '1f6b4ba2039726',
|
|
125
|
+
bidderRequestsCount: 1,
|
|
126
|
+
bidderWinsCount: 0,
|
|
127
|
+
crumbs: { pubcid: 'de5240ef-ff80-4b55-8837-26a11cfbf64c' },
|
|
128
|
+
mediaTypes: {
|
|
129
|
+
video: {
|
|
130
|
+
context: 'instream',
|
|
131
|
+
mimes: ['video/mp4'],
|
|
132
|
+
playbackmethod: [2],
|
|
133
|
+
playerSize: [[640, 480]],
|
|
134
|
+
protocols: [1, 2, 3, 4, 5, 6, 7, 8],
|
|
135
|
+
skip: 1
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
ortb2Imp: {
|
|
139
|
+
ext: {
|
|
140
|
+
data: {
|
|
141
|
+
pbadslot: 'video1'
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
params: { placementId: '379' },
|
|
146
|
+
sizes: [640, 480],
|
|
147
|
+
src: 'client',
|
|
148
|
+
transactionId: 'fec9f2ff-da13-4921-8437-8d679c2be7fe',
|
|
149
|
+
}];
|
|
150
|
+
it('should return correct response', function () {
|
|
151
|
+
const builtRequest = spec.buildRequests(mockVideo1, mockRequest)
|
|
152
|
+
let builtRequestData = builtRequest.data
|
|
153
|
+
let data = JSON.parse(builtRequestData)
|
|
154
|
+
expect(data['379'].bidId).to.equal(mockVideo1[0].bidId)
|
|
155
|
+
});
|
|
156
|
+
it('should return correct response for only array of size', function () {
|
|
157
|
+
const builtRequest = spec.buildRequests(mockVideo2, mockRequest)
|
|
158
|
+
let builtRequestData = builtRequest.data
|
|
159
|
+
let data = JSON.parse(builtRequestData)
|
|
160
|
+
expect(data['379'].sizes[0][0]).to.equal(mockVideo2[0].sizes[0])
|
|
161
|
+
expect(data['379'].sizes[0][1]).to.equal(mockVideo2[0].sizes[1])
|
|
162
|
+
});
|
|
163
|
+
it('should be valid and pass gdpr items correctly', function () {
|
|
164
|
+
const builtRequest = spec.buildRequests(mockVideo2, mockRequestGDPR)
|
|
165
|
+
let builtRequestData = builtRequest.data
|
|
166
|
+
let data = JSON.parse(builtRequestData)
|
|
167
|
+
expect(data['379'].gdprConsentString).to.equal(mockRequestGDPR.gdprConsent.consentString)
|
|
168
|
+
expect(data['379'].gdprConsentRequired).to.equal(mockRequestGDPR.gdprConsent.gdprApplies)
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
describe('interpretResponse', function () {
|
|
172
|
+
const bidRequest = {}
|
|
173
|
+
const serverResponse = {
|
|
174
|
+
cpm: 2.5,
|
|
175
|
+
creativeId: 'V9060',
|
|
176
|
+
currency: 'US',
|
|
177
|
+
height: 480,
|
|
178
|
+
mediaType: 'video',
|
|
179
|
+
netRevenue: false,
|
|
180
|
+
requestId: '273b39c74069cb',
|
|
181
|
+
ttl: 3000,
|
|
182
|
+
vastUrl: 'http://testadserver.com/ads?&k=60cd901ad8ab70c9cedf373cb17b93b8&pid=379&tid=91342717',
|
|
183
|
+
width: 640
|
|
184
|
+
}
|
|
185
|
+
const serverResponseVideo = {
|
|
186
|
+
body: serverResponse
|
|
187
|
+
}
|
|
188
|
+
const serverResponse2 = {
|
|
189
|
+
cpm: 2.5,
|
|
190
|
+
creativeId: 'V9060',
|
|
191
|
+
currency: 'US',
|
|
192
|
+
height: 480,
|
|
193
|
+
mediaType: 'banner',
|
|
194
|
+
netRevenue: false,
|
|
195
|
+
requestId: '273b39c74069cb',
|
|
196
|
+
ttl: 3000,
|
|
197
|
+
vastUrl: 'http://testadserver.com/ads?&k=60cd901ad8ab70c9cedf373cb17b93b8&pid=379&tid=91342717',
|
|
198
|
+
width: 640
|
|
199
|
+
}
|
|
200
|
+
const serverResponseBanner = {
|
|
201
|
+
body: serverResponse2
|
|
202
|
+
}
|
|
203
|
+
it('should be valid from bidRequest for video', function () {
|
|
204
|
+
const bidResponses = spec.interpretResponse(serverResponseVideo, bidRequest)
|
|
205
|
+
expect(bidResponses[0].requestId).to.equal(serverResponse.requestId)
|
|
206
|
+
expect(bidResponses[0].cpm).to.equal(serverResponse.cpm)
|
|
207
|
+
expect(bidResponses[0].width).to.equal(serverResponse.width)
|
|
208
|
+
expect(bidResponses[0].height).to.equal(serverResponse.height)
|
|
209
|
+
expect(bidResponses[0].creativeId).to.equal(serverResponse.creativeId)
|
|
210
|
+
expect(bidResponses[0].currency).to.equal(serverResponse.currency)
|
|
211
|
+
expect(bidResponses[0].netRevenue).to.equal(serverResponse.netRevenue)
|
|
212
|
+
expect(bidResponses[0].ttl).to.equal(serverResponse.ttl)
|
|
213
|
+
expect(bidResponses[0].vastUrl).to.equal(serverResponse.vastUrl)
|
|
214
|
+
expect(bidResponses[0].mediaType).to.equal(serverResponse.mediaType)
|
|
215
|
+
expect(bidResponses[0].meta.mediaType).to.equal(serverResponse.mediaType)
|
|
216
|
+
});
|
|
217
|
+
it('should be valid from bidRequest for banner', function () {
|
|
218
|
+
const bidResponses = spec.interpretResponse(serverResponseBanner, bidRequest)
|
|
219
|
+
expect(bidResponses[0].requestId).to.equal(serverResponse2.requestId)
|
|
220
|
+
expect(bidResponses[0].cpm).to.equal(serverResponse2.cpm)
|
|
221
|
+
expect(bidResponses[0].width).to.equal(serverResponse2.width)
|
|
222
|
+
expect(bidResponses[0].height).to.equal(serverResponse2.height)
|
|
223
|
+
expect(bidResponses[0].creativeId).to.equal(serverResponse2.creativeId)
|
|
224
|
+
expect(bidResponses[0].currency).to.equal(serverResponse2.currency)
|
|
225
|
+
expect(bidResponses[0].netRevenue).to.equal(serverResponse2.netRevenue)
|
|
226
|
+
expect(bidResponses[0].ttl).to.equal(serverResponse2.ttl)
|
|
227
|
+
expect(bidResponses[0].ad).to.equal(serverResponse2.ad)
|
|
228
|
+
expect(bidResponses[0].mediaType).to.equal(serverResponse2.mediaType)
|
|
229
|
+
expect(bidResponses[0].meta.mediaType).to.equal(serverResponse2.mediaType)
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
describe('setPlacementID', function () {
|
|
233
|
+
const multiplePlacementIds = ['380', '381']
|
|
234
|
+
it('should be valid with an array of placement ids passed', function () {
|
|
235
|
+
const placementID = spec.setPlacementID(multiplePlacementIds)
|
|
236
|
+
expect(placementID).to.equal('380#381')
|
|
237
|
+
});
|
|
238
|
+
it('should be valid with single placement ID passed', function () {
|
|
239
|
+
const placementID = spec.setPlacementID('381')
|
|
240
|
+
expect(placementID).to.equal('381')
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
// Add other `describe` or `it` blocks as necessary
|
|
244
|
+
});
|
|
@@ -173,7 +173,7 @@ describe('pubGENIUS adapter', () => {
|
|
|
173
173
|
|
|
174
174
|
expectedRequest = {
|
|
175
175
|
method: 'POST',
|
|
176
|
-
url: 'https://
|
|
176
|
+
url: 'https://auction.adpearl.io/prebid/auction',
|
|
177
177
|
data: {
|
|
178
178
|
id: 'fake-auction-id',
|
|
179
179
|
imp: [
|
|
@@ -493,7 +493,7 @@ describe('pubGENIUS adapter', () => {
|
|
|
493
493
|
};
|
|
494
494
|
expectedSync = {
|
|
495
495
|
type: 'iframe',
|
|
496
|
-
url: 'https://
|
|
496
|
+
url: 'https://auction.adpearl.io/usersync/pixels.html?',
|
|
497
497
|
};
|
|
498
498
|
});
|
|
499
499
|
|
|
@@ -551,7 +551,7 @@ describe('pubGENIUS adapter', () => {
|
|
|
551
551
|
onTimeout(timeoutData);
|
|
552
552
|
|
|
553
553
|
expect(server.requests[0].method).to.equal('POST');
|
|
554
|
-
expect(server.requests[0].url).to.equal('https://
|
|
554
|
+
expect(server.requests[0].url).to.equal('https://auction.adpearl.io/prebid/events?type=timeout');
|
|
555
555
|
expect(JSON.parse(server.requests[0].requestBody)).to.deep.equal(timeoutData);
|
|
556
556
|
});
|
|
557
557
|
});
|
|
@@ -95,6 +95,9 @@ const BID2 = Object.assign({}, BID, {
|
|
|
95
95
|
'hb_pb': '1.500',
|
|
96
96
|
'hb_size': '728x90',
|
|
97
97
|
'hb_source': 'server'
|
|
98
|
+
},
|
|
99
|
+
meta: {
|
|
100
|
+
advertiserDomains: ['example.com']
|
|
98
101
|
}
|
|
99
102
|
});
|
|
100
103
|
|
|
@@ -382,6 +385,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
382
385
|
expect(data.s[1].ps[0].di).to.equal('the-deal-id');
|
|
383
386
|
expect(data.s[1].ps[0].dc).to.equal('PMP');
|
|
384
387
|
expect(data.s[1].ps[0].mi).to.equal('matched-impression');
|
|
388
|
+
expect(data.s[1].ps[0].adv).to.equal('example.com');
|
|
385
389
|
expect(data.s[1].ps[0].l1).to.equal(3214);
|
|
386
390
|
expect(data.s[1].ps[0].l2).to.equal(0);
|
|
387
391
|
expect(data.s[1].ps[0].ss).to.equal(1);
|
|
@@ -651,6 +655,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
651
655
|
expect(data.s[1].ps[0].di).to.equal('the-deal-id');
|
|
652
656
|
expect(data.s[1].ps[0].dc).to.equal('PMP');
|
|
653
657
|
expect(data.s[1].ps[0].mi).to.equal('matched-impression');
|
|
658
|
+
expect(data.s[1].ps[0].adv).to.equal('example.com');
|
|
654
659
|
expect(data.s[1].ps[0].l1).to.equal(3214);
|
|
655
660
|
expect(data.s[1].ps[0].l2).to.equal(0);
|
|
656
661
|
expect(data.s[1].ps[0].ss).to.equal(1);
|
|
@@ -708,6 +713,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
708
713
|
expect(data.s[1].ps[0].di).to.equal('the-deal-id');
|
|
709
714
|
expect(data.s[1].ps[0].dc).to.equal('PMP');
|
|
710
715
|
expect(data.s[1].ps[0].mi).to.equal('matched-impression');
|
|
716
|
+
expect(data.s[1].ps[0].adv).to.equal('example.com');
|
|
711
717
|
expect(data.s[1].ps[0].l1).to.equal(3214);
|
|
712
718
|
expect(data.s[1].ps[0].l2).to.equal(0);
|
|
713
719
|
expect(data.s[1].ps[0].ss).to.equal(1);
|
|
@@ -754,6 +760,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
754
760
|
expect(data.s[1].ps[0].di).to.equal('the-deal-id');
|
|
755
761
|
expect(data.s[1].ps[0].dc).to.equal('PMP');
|
|
756
762
|
expect(data.s[1].ps[0].mi).to.equal('matched-impression');
|
|
763
|
+
expect(data.s[1].ps[0].adv).to.equal('example.com');
|
|
757
764
|
expect(data.s[1].ps[0].l1).to.equal(3214);
|
|
758
765
|
expect(data.s[1].ps[0].l2).to.equal(0);
|
|
759
766
|
expect(data.s[1].ps[0].ss).to.equal(1);
|
|
@@ -771,9 +778,10 @@ describe('pubmatic analytics adapter', function () {
|
|
|
771
778
|
expect(data.kgpv).to.equal('*');
|
|
772
779
|
});
|
|
773
780
|
|
|
774
|
-
it('Logger: regexPattern in bid.bidResponse', function() {
|
|
781
|
+
it('Logger: regexPattern in bid.bidResponse and url in adomain', function() {
|
|
775
782
|
const BID2_COPY = utils.deepClone(BID2);
|
|
776
783
|
BID2_COPY.regexPattern = '*';
|
|
784
|
+
BID2_COPY.meta.advertiserDomains = ['https://www.example.com/abc/223']
|
|
777
785
|
events.emit(AUCTION_INIT, MOCK.AUCTION_INIT);
|
|
778
786
|
events.emit(AUCTION_INIT, MOCK.AUCTION_INIT);
|
|
779
787
|
events.emit(BID_REQUESTED, MOCK.BID_REQUESTED);
|
|
@@ -808,6 +816,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
808
816
|
expect(data.s[1].ps[0].di).to.equal('the-deal-id');
|
|
809
817
|
expect(data.s[1].ps[0].dc).to.equal('PMP');
|
|
810
818
|
expect(data.s[1].ps[0].mi).to.equal('matched-impression');
|
|
819
|
+
expect(data.s[1].ps[0].adv).to.equal('example.com');
|
|
811
820
|
expect(data.s[1].ps[0].l1).to.equal(3214);
|
|
812
821
|
expect(data.s[1].ps[0].l2).to.equal(0);
|
|
813
822
|
expect(data.s[1].ps[0].ss).to.equal(1);
|
|
@@ -859,6 +868,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
859
868
|
expect(data.s[1].ps[0].di).to.equal('the-deal-id');
|
|
860
869
|
expect(data.s[1].ps[0].dc).to.equal('PMP');
|
|
861
870
|
expect(data.s[1].ps[0].mi).to.equal('matched-impression');
|
|
871
|
+
expect(data.s[1].ps[0].adv).to.equal('example.com');
|
|
862
872
|
expect(data.s[1].ps[0].l1).to.equal(3214);
|
|
863
873
|
expect(data.s[1].ps[0].l2).to.equal(0);
|
|
864
874
|
expect(data.s[1].ps[0].ss).to.equal(1);
|
|
@@ -912,6 +922,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
912
922
|
expect(data.s[1].ps[0].di).to.equal('the-deal-id');
|
|
913
923
|
expect(data.s[1].ps[0].dc).to.equal('PMP');
|
|
914
924
|
expect(data.s[1].ps[0].mi).to.equal('matched-impression');
|
|
925
|
+
expect(data.s[1].ps[0].adv).to.equal('example.com');
|
|
915
926
|
expect(data.s[1].ps[0].l1).to.equal(3214);
|
|
916
927
|
expect(data.s[1].ps[0].l2).to.equal(0);
|
|
917
928
|
expect(data.s[1].ps[0].ss).to.equal(1);
|
|
@@ -1011,6 +1022,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
1011
1022
|
expect(data.s[1].ps[0].di).to.equal('the-deal-id');
|
|
1012
1023
|
expect(data.s[1].ps[0].dc).to.equal('PMP');
|
|
1013
1024
|
expect(data.s[1].ps[0].mi).to.equal('matched-impression');
|
|
1025
|
+
expect(data.s[1].ps[0].adv).to.equal('example.com');
|
|
1014
1026
|
expect(data.s[1].ps[0].l1).to.equal(3214);
|
|
1015
1027
|
expect(data.s[1].ps[0].l2).to.equal(0);
|
|
1016
1028
|
expect(data.s[1].ps[0].ss).to.equal(1);
|
|
@@ -28,6 +28,7 @@ describe('pubxai analytics adapter', function() {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
let location = utils.getWindowLocation();
|
|
31
|
+
let storage = window.top['sessionStorage'];
|
|
31
32
|
|
|
32
33
|
let prebidEvent = {
|
|
33
34
|
'auctionInit': {
|
|
@@ -514,6 +515,11 @@ describe('pubxai analytics adapter', function() {
|
|
|
514
515
|
'path': location.pathname,
|
|
515
516
|
'search': location.search
|
|
516
517
|
},
|
|
518
|
+
'pmcDetail': {
|
|
519
|
+
'bidDensity': storage.getItem('pbx:dpbid'),
|
|
520
|
+
'maxBid': storage.getItem('pbx:mxbid'),
|
|
521
|
+
'auctionId': storage.getItem('pbx:aucid')
|
|
522
|
+
}
|
|
517
523
|
};
|
|
518
524
|
|
|
519
525
|
let expectedAfterBid = {
|
|
@@ -577,6 +583,11 @@ describe('pubxai analytics adapter', function() {
|
|
|
577
583
|
'deviceOS': getOS(),
|
|
578
584
|
'browser': getBrowser()
|
|
579
585
|
},
|
|
586
|
+
'pmcDetail': {
|
|
587
|
+
'bidDensity': storage.getItem('pbx:dpbid'),
|
|
588
|
+
'maxBid': storage.getItem('pbx:mxbid'),
|
|
589
|
+
'auctionId': storage.getItem('pbx:aucid')
|
|
590
|
+
},
|
|
580
591
|
'initOptions': initOptions
|
|
581
592
|
};
|
|
582
593
|
|
|
@@ -3,6 +3,7 @@ import {config} from 'src/config.js';
|
|
|
3
3
|
import * as sinon from 'sinon';
|
|
4
4
|
import {default as CONSTANTS} from '../../../src/constants.json';
|
|
5
5
|
import {default as events} from '../../../src/events.js';
|
|
6
|
+
import 'src/prebid.js';
|
|
6
7
|
|
|
7
8
|
const getBidRequestDataSpy = sinon.spy();
|
|
8
9
|
|
|
@@ -140,7 +141,56 @@ describe('Real time module', function () {
|
|
|
140
141
|
const adUnits = rtdModule.getAdUnitTargeting(auction);
|
|
141
142
|
assert.deepEqual(expectedAdUnits, adUnits)
|
|
142
143
|
done();
|
|
143
|
-
})
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
describe('setBidRequestData', () => {
|
|
147
|
+
let withWait, withoutWait;
|
|
148
|
+
|
|
149
|
+
function runSetBidRequestData() {
|
|
150
|
+
return new Promise((resolve) => {
|
|
151
|
+
rtdModule.setBidRequestsData(resolve, {bidRequest: {}});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
beforeEach(() => {
|
|
156
|
+
withWait = {
|
|
157
|
+
submod: validSMWait,
|
|
158
|
+
cbTime: 0,
|
|
159
|
+
cbRan: false
|
|
160
|
+
};
|
|
161
|
+
withoutWait = {
|
|
162
|
+
submod: validSM,
|
|
163
|
+
cbTime: 0,
|
|
164
|
+
cbRan: false
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
[withWait, withoutWait].forEach((c) => {
|
|
168
|
+
c.submod.getBidRequestData = sinon.stub().callsFake((_, cb) => {
|
|
169
|
+
setTimeout(() => {
|
|
170
|
+
c.cbRan = true;
|
|
171
|
+
cb();
|
|
172
|
+
}, c.cbTime);
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it('should allow non-priority submodules to run synchronously', () => {
|
|
178
|
+
withWait.cbTime = withoutWait.cbTime = 0;
|
|
179
|
+
return runSetBidRequestData().then(() => {
|
|
180
|
+
expect(withWait.cbRan).to.be.true;
|
|
181
|
+
expect(withoutWait.cbRan).to.be.true;
|
|
182
|
+
})
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it('should not wait for non-priority submodules if priority ones complete first', () => {
|
|
186
|
+
withWait.cbTime = 10;
|
|
187
|
+
withoutWait.cbTime = 100;
|
|
188
|
+
return runSetBidRequestData().then(() => {
|
|
189
|
+
expect(withWait.cbRan).to.be.true;
|
|
190
|
+
expect(withoutWait.cbRan).to.be.false;
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
});
|
|
144
194
|
});
|
|
145
195
|
|
|
146
196
|
it('deep merge object', function () {
|
|
@@ -195,7 +245,7 @@ describe('Real time module', function () {
|
|
|
195
245
|
'name': 'tp1',
|
|
196
246
|
},
|
|
197
247
|
{
|
|
198
|
-
'name': 'tp2'
|
|
248
|
+
'name': 'tp2',
|
|
199
249
|
}
|
|
200
250
|
]
|
|
201
251
|
}
|
|
@@ -206,7 +256,7 @@ describe('Real time module', function () {
|
|
|
206
256
|
function eventHandlingProvider(name) {
|
|
207
257
|
const provider = {
|
|
208
258
|
name: name,
|
|
209
|
-
init: () => true
|
|
259
|
+
init: () => true,
|
|
210
260
|
}
|
|
211
261
|
Object.values(EVENTS).forEach((ev) => provider[ev] = sinon.spy());
|
|
212
262
|
return provider;
|
|
@@ -222,7 +272,19 @@ describe('Real time module', function () {
|
|
|
222
272
|
afterEach(() => {
|
|
223
273
|
_detachers.forEach((d) => d())
|
|
224
274
|
config.resetConfig();
|
|
225
|
-
})
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
it('should set targeting for auctionEnd', () => {
|
|
278
|
+
providers.forEach(p => p.getTargetingData = sinon.spy());
|
|
279
|
+
const auction = {
|
|
280
|
+
adUnitCodes: ['a1'],
|
|
281
|
+
adUnits: [{code: 'a1'}]
|
|
282
|
+
};
|
|
283
|
+
mockEmitEvent(CONSTANTS.EVENTS.AUCTION_END, auction);
|
|
284
|
+
providers.forEach(p => {
|
|
285
|
+
expect(p.getTargetingData.calledWith(auction.adUnitCodes)).to.be.true;
|
|
286
|
+
});
|
|
287
|
+
});
|
|
226
288
|
|
|
227
289
|
Object.entries(EVENTS).forEach(([event, hook]) => {
|
|
228
290
|
it(`'${event}' should be propagated to providers through '${hook}'`, () => {
|
|
@@ -242,5 +304,5 @@ describe('Real time module', function () {
|
|
|
242
304
|
expect(providers[1][hook].called).to.be.true;
|
|
243
305
|
});
|
|
244
306
|
});
|
|
245
|
-
})
|
|
307
|
+
});
|
|
246
308
|
});
|
|
@@ -791,6 +791,46 @@ describe('Richaudience adapter tests', function () {
|
|
|
791
791
|
})).to.equal(true);
|
|
792
792
|
});
|
|
793
793
|
|
|
794
|
+
it('should pass schain', function() {
|
|
795
|
+
let schain = {
|
|
796
|
+
'ver': '1.0',
|
|
797
|
+
'complete': 1,
|
|
798
|
+
'nodes': [{
|
|
799
|
+
'asi': 'richaudience.com',
|
|
800
|
+
'sid': '00001',
|
|
801
|
+
'hp': 1
|
|
802
|
+
}, {
|
|
803
|
+
'asi': 'richaudience-2.com',
|
|
804
|
+
'sid': '00002',
|
|
805
|
+
'hp': 1
|
|
806
|
+
}]
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
DEFAULT_PARAMS_NEW_SIZES[0].schain = {
|
|
810
|
+
'ver': '1.0',
|
|
811
|
+
'complete': 1,
|
|
812
|
+
'nodes': [{
|
|
813
|
+
'asi': 'richaudience.com',
|
|
814
|
+
'sid': '00001',
|
|
815
|
+
'hp': 1
|
|
816
|
+
}, {
|
|
817
|
+
'asi': 'richaudience-2.com',
|
|
818
|
+
'sid': '00002',
|
|
819
|
+
'hp': 1
|
|
820
|
+
}]
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
const request = spec.buildRequests(DEFAULT_PARAMS_NEW_SIZES, {
|
|
824
|
+
gdprConsent: {
|
|
825
|
+
consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
|
|
826
|
+
gdprApplies: true
|
|
827
|
+
},
|
|
828
|
+
refererInfo: {}
|
|
829
|
+
})
|
|
830
|
+
const requestContent = JSON.parse(request[0].data);
|
|
831
|
+
expect(requestContent).to.have.property('schain').to.deep.equal(schain);
|
|
832
|
+
})
|
|
833
|
+
|
|
794
834
|
describe('userSync', function () {
|
|
795
835
|
it('Verifies user syncs iframe include', function () {
|
|
796
836
|
config.setConfig({
|
|
@@ -257,7 +257,7 @@ describe('riseAdapter', function () {
|
|
|
257
257
|
const requests = spec.buildRequests(bidRequests, bidderRequest);
|
|
258
258
|
for (const request of requests) {
|
|
259
259
|
expect(request.data).to.be.an('object');
|
|
260
|
-
expect(request.data).to.have.property('schain', '1.0,1!indirectseller.com,00001
|
|
260
|
+
expect(request.data).to.have.property('schain', '1.0,1!indirectseller.com,00001,1,,,');
|
|
261
261
|
}
|
|
262
262
|
});
|
|
263
263
|
|
|
@@ -68,6 +68,7 @@ describe('RTBHouseAdapter', () => {
|
|
|
68
68
|
'params': {
|
|
69
69
|
'publisherId': 'PREBID_TEST',
|
|
70
70
|
'region': 'prebid-eu',
|
|
71
|
+
'channel': 'Partner_Site - news',
|
|
71
72
|
'test': 1
|
|
72
73
|
},
|
|
73
74
|
'adUnitCode': 'adunit-code',
|
|
@@ -101,6 +102,25 @@ describe('RTBHouseAdapter', () => {
|
|
|
101
102
|
expect(JSON.parse(builtTestRequest).test).to.equal(1);
|
|
102
103
|
});
|
|
103
104
|
|
|
105
|
+
it('should build channel param into request.site', () => {
|
|
106
|
+
let builtTestRequest = spec.buildRequests(bidRequests, bidderRequest).data;
|
|
107
|
+
expect(JSON.parse(builtTestRequest).site.channel).to.equal('Partner_Site - news');
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
it('should not build channel param into request.site if no value is passed', () => {
|
|
111
|
+
let bidRequest = Object.assign([], bidRequests);
|
|
112
|
+
bidRequest[0].params.channel = undefined;
|
|
113
|
+
let builtTestRequest = spec.buildRequests(bidRequest, bidderRequest).data;
|
|
114
|
+
expect(JSON.parse(builtTestRequest).site.channel).to.be.undefined
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
it('should cap the request.site.channel length to 50', () => {
|
|
118
|
+
let bidRequest = Object.assign([], bidRequests);
|
|
119
|
+
bidRequest[0].params.channel = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent scelerisque ipsum eu purus lobortis iaculis.';
|
|
120
|
+
let builtTestRequest = spec.buildRequests(bidRequest, bidderRequest).data;
|
|
121
|
+
expect(JSON.parse(builtTestRequest).site.channel.length).to.equal(50)
|
|
122
|
+
})
|
|
123
|
+
|
|
104
124
|
it('should build valid OpenRTB banner object', () => {
|
|
105
125
|
const request = JSON.parse(spec.buildRequests(bidRequests, bidderRequest).data);
|
|
106
126
|
const imp = request.imp[0];
|
|
@@ -987,6 +987,36 @@ describe('rubicon analytics adapter', function () {
|
|
|
987
987
|
expect(message.auctions[0].adUnits[1].bids[0].bidResponse.adomains).to.be.undefined;
|
|
988
988
|
});
|
|
989
989
|
|
|
990
|
+
it('should NOT pass along adomians with other edge cases', function () {
|
|
991
|
+
events.emit(AUCTION_INIT, MOCK.AUCTION_INIT);
|
|
992
|
+
events.emit(BID_REQUESTED, MOCK.BID_REQUESTED);
|
|
993
|
+
|
|
994
|
+
// should filter out non string values and pass valid ones
|
|
995
|
+
let bidResponse1 = utils.deepClone(MOCK.BID_RESPONSE[0]);
|
|
996
|
+
bidResponse1.meta = {
|
|
997
|
+
advertiserDomains: [123, 'prebid.org', false, true, [], 'magnite.com', {}]
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
// array of arrays (as seen when passed by kargo bid adapter)
|
|
1001
|
+
let bidResponse2 = utils.deepClone(MOCK.BID_RESPONSE[1]);
|
|
1002
|
+
bidResponse2.meta = {
|
|
1003
|
+
advertiserDomains: [['prebid.org']]
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
events.emit(BID_RESPONSE, bidResponse1);
|
|
1007
|
+
events.emit(BID_RESPONSE, bidResponse2);
|
|
1008
|
+
events.emit(BIDDER_DONE, MOCK.BIDDER_DONE);
|
|
1009
|
+
events.emit(AUCTION_END, MOCK.AUCTION_END);
|
|
1010
|
+
events.emit(SET_TARGETING, MOCK.SET_TARGETING);
|
|
1011
|
+
events.emit(BID_WON, MOCK.BID_WON[0]);
|
|
1012
|
+
events.emit(BID_WON, MOCK.BID_WON[1]);
|
|
1013
|
+
|
|
1014
|
+
let message = JSON.parse(server.requests[0].requestBody);
|
|
1015
|
+
validate(message);
|
|
1016
|
+
expect(message.auctions[0].adUnits[0].bids[0].bidResponse.adomains).to.deep.equal(['prebid.org', 'magnite.com']);
|
|
1017
|
+
expect(message.auctions[0].adUnits[1].bids[0].bidResponse.adomains).to.be.undefined;
|
|
1018
|
+
});
|
|
1019
|
+
|
|
990
1020
|
it('should not pass empty adServerTargeting values', function () {
|
|
991
1021
|
events.emit(AUCTION_INIT, MOCK.AUCTION_INIT);
|
|
992
1022
|
events.emit(BID_REQUESTED, MOCK.BID_REQUESTED);
|