prebid.js 8.5.0 → 8.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/dist/33acrossBidAdapter.js +1 -1
- package/dist/33acrossIdSystem.js +1 -1
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adqueryBidAdapter.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adsinteractiveBidAdapter.js +1 -1
- package/dist/adtrgtmeBidAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/adyoulikeBidAdapter.js +1 -1
- package/dist/ajaBidAdapter.js +1 -1
- package/dist/alkimiBidAdapter.js +1 -1
- package/dist/amxBidAdapter.js +1 -1
- package/dist/amxIdSystem.js +1 -1
- package/dist/appierAnalyticsAdapter.js +1 -1
- package/dist/appnexusBidAdapter.js +1 -1
- package/dist/asoBidAdapter.js +1 -1
- package/dist/automatadAnalyticsAdapter.js +1 -0
- package/dist/axonixBidAdapter.js +1 -1
- package/dist/bidglassBidAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.js +1 -1
- package/dist/bridBidAdapter.js +1 -1
- package/dist/bridgewellBidAdapter.js +1 -1
- package/dist/brightMountainMediaBidAdapter.js +1 -1
- package/dist/carodaBidAdapter.js +1 -1
- package/dist/chtnwBidAdapter.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connatixBidAdapter.js +1 -0
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consumableBidAdapter.js +1 -1
- package/dist/conversantAnalyticsAdapter.js +1 -1
- package/dist/conversantBidAdapter.js +1 -1
- package/dist/craftBidAdapter.js +1 -1
- package/dist/criteoBidAdapter.js +1 -1
- package/dist/cwireBidAdapter.js +1 -1
- package/dist/dependencies.json +6 -0
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/euidIdSystem.js +1 -1
- package/dist/feedadBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/freepassBidAdapter.js +1 -1
- package/dist/freewheel-sspBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/greenbidsAnalyticsAdapter.js +1 -1
- package/dist/greenbidsRtdProvider.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/growthCodeAnalyticsAdapter.js +1 -1
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/hypelabBidAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/imdsBidAdapter.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/ixBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/kargoBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.js +1 -1
- package/dist/kueezRtbBidAdapter.js +1 -1
- package/dist/kulturemediaBidAdapter.js +1 -1
- package/dist/lassoBidAdapter.js +1 -1
- package/dist/lifestreetBidAdapter.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.js +1 -1
- package/dist/magniteAnalyticsAdapter.js +1 -1
- package/dist/malltvAnalyticsAdapter.js +1 -1
- package/dist/marsmediaBidAdapter.js +1 -1
- package/dist/mediafuseBidAdapter.js +1 -1
- package/dist/medianetBidAdapter.js +1 -1
- package/dist/mediasquareBidAdapter.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/minutemediaplusBidAdapter.js +1 -1
- package/dist/mspa.js +1 -1
- package/dist/newspassidBidAdapter.js +1 -1
- package/dist/nexx360BidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +140 -136
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/optidigitalBidAdapter.js +1 -1
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/parrableIdSystem.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebid-core.js +1 -1
- package/dist/pubCircleBidAdapter.js +1 -0
- package/dist/publinkIdSystem.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pxyzBidAdapter.js +1 -1
- package/dist/quantcastBidAdapter.js +1 -1
- package/dist/readpeakBidAdapter.js +1 -1
- package/dist/relaidoBidAdapter.js +1 -1
- package/dist/relevadRtdProvider.js +1 -1
- package/dist/retailspotBidAdapter.js +1 -1
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- package/dist/seedingAllianceBidAdapter.js +1 -1
- package/dist/seedtagBidAdapter.js +1 -1
- package/dist/sharethroughAnalyticsAdapter.js +1 -1
- package/dist/sharethroughBidAdapter.js +1 -1
- package/dist/shinezBidAdapter.js +1 -1
- package/dist/smaatoBidAdapter.js +1 -1
- package/dist/smartadserverBidAdapter.js +1 -1
- package/dist/smartxBidAdapter.js +1 -1
- package/dist/smilewantedBidAdapter.js +1 -1
- package/dist/sonobiBidAdapter.js +1 -1
- package/dist/sovrnAnalyticsAdapter.js +1 -1
- package/dist/sovrnBidAdapter.js +1 -1
- package/dist/ssmasBidAdapter.js +1 -1
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/stvBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/tappxBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.js +1 -1
- package/dist/topicsFpdModule.js +1 -1
- package/dist/trionBidAdapter.js +1 -1
- package/dist/tripleliftBidAdapter.js +1 -1
- package/dist/ttdBidAdapter.js +1 -1
- package/dist/ucfunnelAnalyticsAdapter.js +1 -1
- package/dist/uid2IdSystem.js +1 -1
- package/dist/underdogmediaBidAdapter.js +1 -1
- package/dist/undertoneBidAdapter.js +1 -1
- package/dist/viantOrtbBidAdapter.js +1 -0
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/videojsVideoProvider.js +1 -1
- package/dist/visxBidAdapter.js +1 -1
- package/dist/vuukleBidAdapter.js +1 -1
- package/dist/widespaceBidAdapter.js +1 -1
- package/dist/winrBidAdapter.js +1 -1
- package/dist/yahoosspBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/integrationExamples/videoModule/jwplayer/bidMarkedAsUsed.html +1 -1
- package/integrationExamples/videoModule/jwplayer/bidRequestScheduling.html +1 -1
- package/integrationExamples/videoModule/jwplayer/bidsBackHandlerOverride.html +137 -0
- package/integrationExamples/videoModule/jwplayer/eventListeners.html +1 -1
- package/integrationExamples/videoModule/jwplayer/eventsUI.html +1 -1
- package/integrationExamples/videoModule/jwplayer/gamAdServerMediation.html +1 -1
- package/integrationExamples/videoModule/jwplayer/mediaMetadata.html +1 -1
- package/integrationExamples/videoModule/jwplayer/playlist.html +1 -1
- package/integrationExamples/videoModule/videojs/bidsBackHandlerOverride.html +164 -0
- package/libraries/mspa/activityControls.js +51 -32
- package/modules/adagioBidAdapter.js +15 -1
- package/modules/adgenerationBidAdapter.js +5 -4
- package/modules/adsinteractiveBidAdapter.js +4 -2
- package/modules/alkimiBidAdapter.js +19 -7
- package/modules/appnexusBidAdapter.js +1 -1
- package/modules/automatadAnalyticsAdapter.js +325 -0
- package/modules/automatadAnalyticsAdapter.md +23 -0
- package/modules/connatixBidAdapter.js +185 -0
- package/modules/connatixBidAdapter.md +37 -0
- package/modules/criteoBidAdapter.js +18 -0
- package/modules/cwireBidAdapter.js +19 -0
- package/modules/freepassBidAdapter.js +20 -1
- package/modules/freepassBidAdapter.md +4 -1
- package/modules/gridBidAdapter.js +1 -8
- package/modules/growthCodeAnalyticsAdapter.js +7 -2
- package/modules/medianetBidAdapter.js +7 -4
- package/modules/mediasquareBidAdapter.js +3 -0
- package/modules/newspassid.md +76 -0
- package/modules/newspassidBidAdapter.js +44 -18
- package/modules/optidigitalBidAdapter.js +25 -16
- package/modules/pubCircleBidAdapter.js +231 -0
- package/modules/pubCircleBidAdapter.md +79 -0
- package/modules/relevadRtdProvider.js +6 -7
- package/modules/ssmasBidAdapter.js +2 -2
- package/modules/tappxBidAdapter.js +27 -15
- package/modules/tappxBidAdapter.md +17 -0
- package/modules/topicsFpdModule.js +21 -48
- package/modules/undertoneBidAdapter.md +1 -1
- package/modules/userId/eids.md +7 -0
- package/modules/viantOrtbBidAdapter.js +113 -0
- package/modules/viantOrtbBidAdapter.md +54 -0
- package/modules/vidazooBidAdapter.js +9 -2
- package/modules/videojsVideoProvider.js +9 -2
- package/package.json +1 -1
- package/test/spec/libraries/mspa/activityControls_spec.js +145 -212
- package/test/spec/modules/adagioBidAdapter_spec.js +89 -0
- package/test/spec/modules/adgenerationBidAdapter_spec.js +6 -6
- package/test/spec/modules/alkimiBidAdapter_spec.js +3 -9
- package/test/spec/modules/appnexusBidAdapter_spec.js +12 -1
- package/test/spec/modules/automatadAnalyticsAdapter_spec.js +533 -0
- package/test/spec/modules/connatixBidAdapter_spec.js +366 -0
- package/test/spec/modules/criteoBidAdapter_spec.js +52 -3
- package/test/spec/modules/cwireBidAdapter_spec.js +47 -0
- package/test/spec/modules/freepassBidAdapter_spec.js +44 -0
- package/test/spec/modules/gridBidAdapter_spec.js +68 -0
- package/test/spec/modules/medianetBidAdapter_spec.js +18 -18
- package/test/spec/modules/mediasquareBidAdapter_spec.js +5 -0
- package/test/spec/modules/newspassidBidAdapter_spec.js +6 -0
- package/test/spec/modules/optidigitalBidAdapter_spec.js +9 -2
- package/test/spec/modules/pubCircleBidAdapter_spec.js +399 -0
- package/test/spec/modules/tappxBidAdapter_spec.js +19 -0
- package/test/spec/modules/topicsFpdModule_spec.js +343 -365
- package/test/spec/modules/viantOrtbBidAdapter_spec.js +432 -0
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { spec, converter } from 'modules/viantOrtbBidAdapter.js';
|
|
2
|
+
import {assert, expect} from 'chai';
|
|
3
|
+
import { deepClone } from '../../../src/utils';
|
|
4
|
+
import {buildWindowTree} from '../../helpers/refererDetectionHelper';
|
|
5
|
+
import {detectReferer} from '../../../src/refererDetection';
|
|
6
|
+
describe('viantOrtbBidAdapter', function () {
|
|
7
|
+
function testBuildRequests(bidRequests, bidderRequestBase) {
|
|
8
|
+
let clonedBidderRequest = deepClone(bidderRequestBase);
|
|
9
|
+
clonedBidderRequest.bids = bidRequests;
|
|
10
|
+
let requests = spec.buildRequests(bidRequests, clonedBidderRequest);
|
|
11
|
+
return requests
|
|
12
|
+
}
|
|
13
|
+
describe('isBidRequestValid', function() {
|
|
14
|
+
function makeBid() {
|
|
15
|
+
return {
|
|
16
|
+
'bidder': 'viant',
|
|
17
|
+
'params': {
|
|
18
|
+
'publisherId': '464',
|
|
19
|
+
'placementId': 'some-PlacementId_1'
|
|
20
|
+
},
|
|
21
|
+
'mediaTypes': {
|
|
22
|
+
'banner': {
|
|
23
|
+
'sizes': [
|
|
24
|
+
[728, 90]
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
'adUnitCode': 'adunit-code',
|
|
29
|
+
'bidId': '30b31c1838de1e',
|
|
30
|
+
'bidderRequestId': '22edbae2733bf6',
|
|
31
|
+
'auctionId': '1d1a030790a475',
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
describe('core', function () {
|
|
36
|
+
it('should return true when required params found', function () {
|
|
37
|
+
expect(spec.isBidRequestValid(makeBid())).to.equal(true);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should return false when publisherId not passed', function () {
|
|
41
|
+
let bid = makeBid();
|
|
42
|
+
delete bid.params.publisherId;
|
|
43
|
+
expect(spec.isBidRequestValid(bid)).to.equal(false);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('should return true if placementId is not passed ', function () {
|
|
47
|
+
let bid = makeBid();
|
|
48
|
+
delete bid.params.placementId;
|
|
49
|
+
bid.ortb2Imp = {
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
expect(spec.isBidRequestValid(bid)).to.equal(true);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should return false if mediaTypes.banner is Not passed', function () {
|
|
56
|
+
let bid = makeBid();
|
|
57
|
+
delete bid.mediaTypes
|
|
58
|
+
expect(spec.isBidRequestValid(bid)).to.equal(false);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe('banner', function () {
|
|
63
|
+
it('should return true if banner.pos is passed correctly', function () {
|
|
64
|
+
let bid = makeBid();
|
|
65
|
+
bid.mediaTypes.banner.pos = 1;
|
|
66
|
+
expect(spec.isBidRequestValid(bid)).to.equal(true);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('video', function () {
|
|
71
|
+
describe('and request config uses mediaTypes', () => {
|
|
72
|
+
function makeBid() {
|
|
73
|
+
return {
|
|
74
|
+
'bidder': 'viant',
|
|
75
|
+
'params': {
|
|
76
|
+
'unit': '12345678',
|
|
77
|
+
'delDomain': 'test-del-domain',
|
|
78
|
+
'publisherId': '464',
|
|
79
|
+
'placementId': 'some-PlacementId_2'
|
|
80
|
+
},
|
|
81
|
+
'mediaTypes': {
|
|
82
|
+
'video': {
|
|
83
|
+
'context': 'instream',
|
|
84
|
+
'playerSize': [[640, 480]],
|
|
85
|
+
'mimes': ['video/mp4'],
|
|
86
|
+
'protocols': [1, 2, 3, 4, 5, 6, 7, 8],
|
|
87
|
+
'api': [1, 3],
|
|
88
|
+
'skip': 1,
|
|
89
|
+
'skipafter': 5,
|
|
90
|
+
'minduration': 10,
|
|
91
|
+
'maxduration': 30
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
'adUnitCode': 'adunit-code',
|
|
95
|
+
'bidId': '30b31c1838de1e',
|
|
96
|
+
'bidderRequestId': '22edbae2733bf6',
|
|
97
|
+
'auctionId': '1d1a030790a475',
|
|
98
|
+
'transactionId': '4008d88a-8137-410b-aa35-fbfdabcb478e'
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
it('should return true when required params found', function () {
|
|
102
|
+
expect(spec.isBidRequestValid(makeBid())).to.equal(true);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('should return false when required params are not passed', function () {
|
|
106
|
+
let videoBidWithMediaTypes = Object.assign({}, makeBid());
|
|
107
|
+
videoBidWithMediaTypes.params = {};
|
|
108
|
+
expect(spec.isBidRequestValid(videoBidWithMediaTypes)).to.equal(false);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
describe('buildRequests-banner', function () {
|
|
115
|
+
const baseBannerBidRequests = [{
|
|
116
|
+
'bidder': 'viant',
|
|
117
|
+
'params': {
|
|
118
|
+
'publisherId': '464',
|
|
119
|
+
'placementId': '1'
|
|
120
|
+
},
|
|
121
|
+
'mediaTypes': {
|
|
122
|
+
'banner': {
|
|
123
|
+
'sizes': [[728, 90]]
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
'gdprConsent': {
|
|
127
|
+
'consentString': 'consentString',
|
|
128
|
+
'gdprApplies': true,
|
|
129
|
+
},
|
|
130
|
+
'uspConsent': '1YYY',
|
|
131
|
+
'sizes': [[728, 90]],
|
|
132
|
+
'transactionId': '1111474f-58b1-4368-b812-84f8c937a099',
|
|
133
|
+
'adUnitCode': 'div-gpt-ad-1460505748561-0',
|
|
134
|
+
'bidId': '243310435309b5',
|
|
135
|
+
'bidderRequestId': '18084284054531',
|
|
136
|
+
'auctionId': 'e7b34fa3-8654-424e-8c49-03e509e53d8c',
|
|
137
|
+
'src': 'client',
|
|
138
|
+
'bidRequestsCount': 1
|
|
139
|
+
}];
|
|
140
|
+
|
|
141
|
+
const testWindow = buildWindowTree(['https://www.example.com/test', 'https://www.example.com/other/page', 'https://www.example.com/third/page'], 'https://othersite.com/', 'https://example.com/canonical/page');
|
|
142
|
+
const baseBidderRequestReferer = detectReferer(testWindow)();
|
|
143
|
+
const baseBidderRequest = {
|
|
144
|
+
'bidderCode': 'viant',
|
|
145
|
+
'auctionId': 'e7b34fa3-8654-424e-8c49-03e509e53d8c',
|
|
146
|
+
'bidderRequestId': '18084284054531',
|
|
147
|
+
'auctionStart': 1540945362095,
|
|
148
|
+
'timeout': 3000,
|
|
149
|
+
'refererInfo': baseBidderRequestReferer,
|
|
150
|
+
'start': 1540945362099,
|
|
151
|
+
'doneCbCallCount': 0
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
it('test regs', function () {
|
|
155
|
+
const gdprBaseBidderRequest = Object.assign({}, baseBidderRequest, {
|
|
156
|
+
gdprConsent: {
|
|
157
|
+
consentString: 'consentString',
|
|
158
|
+
gdprApplies: true,
|
|
159
|
+
},
|
|
160
|
+
uspConsent: '1YYN'
|
|
161
|
+
});
|
|
162
|
+
const request = testBuildRequests(baseBannerBidRequests, gdprBaseBidderRequest)[0];
|
|
163
|
+
expect(request.data.regs.ext).to.have.property('gdpr', 1);
|
|
164
|
+
expect(request.data.regs.ext).to.have.property('us_privacy', '1YYN');
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it('sends bid request to our endpoint that makes sense', function () {
|
|
168
|
+
const request = testBuildRequests(baseBannerBidRequests, baseBidderRequest)[0];
|
|
169
|
+
expect(request.method).to.equal('POST');
|
|
170
|
+
expect(request.url).to.be.not.empty;
|
|
171
|
+
expect(request.data).to.be.not.null;
|
|
172
|
+
});
|
|
173
|
+
it('sends bid requests to the correct endpoint', function () {
|
|
174
|
+
const url = testBuildRequests(baseBannerBidRequests, baseBidderRequest)[0].url;
|
|
175
|
+
expect(url).to.equal('https://bidders-us-east-1.adelphic.net/d/rtb/v25/prebid/bidder_test');
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it('sends site', function () {
|
|
179
|
+
const requestBody = testBuildRequests(baseBannerBidRequests, baseBidderRequest)[0].data;
|
|
180
|
+
expect(requestBody.site).to.be.not.null;
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('includes the ad size in the bid request', function () {
|
|
184
|
+
const requestBody = testBuildRequests(baseBannerBidRequests, baseBidderRequest)[0].data;
|
|
185
|
+
expect(requestBody.imp[0].banner.format[0].w).to.equal(728);
|
|
186
|
+
expect(requestBody.imp[0].banner.format[0].h).to.equal(90);
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it('sets the banner pos correctly if sent', function () {
|
|
190
|
+
let clonedBannerRequests = deepClone(baseBannerBidRequests);
|
|
191
|
+
clonedBannerRequests[0].mediaTypes.banner.pos = 1;
|
|
192
|
+
|
|
193
|
+
const requestBody = testBuildRequests(clonedBannerRequests, baseBidderRequest)[0].data;
|
|
194
|
+
expect(requestBody.imp[0].banner.pos).to.equal(1);
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
if (FEATURES.VIDEO) {
|
|
199
|
+
describe('buildRequests-video', function () {
|
|
200
|
+
function makeBid() {
|
|
201
|
+
return {
|
|
202
|
+
'bidder': 'viant',
|
|
203
|
+
'params': {
|
|
204
|
+
'unit': '12345678',
|
|
205
|
+
'delDomain': 'test-del-domain',
|
|
206
|
+
'publisherId': '464',
|
|
207
|
+
'placementId': 'some-PlacementId_2'
|
|
208
|
+
},
|
|
209
|
+
'mediaTypes': {
|
|
210
|
+
'video': {
|
|
211
|
+
'context': 'instream',
|
|
212
|
+
'playerSize': [[640, 480]],
|
|
213
|
+
'mimes': ['video/mp4'],
|
|
214
|
+
'protocols': [1, 2, 3, 4, 5, 6, 7, 8],
|
|
215
|
+
'api': [1, 3],
|
|
216
|
+
'skip': 1,
|
|
217
|
+
'skipafter': 5,
|
|
218
|
+
'minduration': 10,
|
|
219
|
+
'maxduration': 31
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
'adUnitCode': 'adunit-code',
|
|
223
|
+
'bidId': '30b31c1838de1e',
|
|
224
|
+
'bidderRequestId': '22edbae2733bf6',
|
|
225
|
+
'auctionId': '1d1a030790a475',
|
|
226
|
+
'transactionId': '4008d88a-8137-410b-aa35-fbfdabcb478e'
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
it('assert video and its fields is present in imp ', function () {
|
|
231
|
+
let requests = spec.buildRequests([makeBid()], {referrerInfo: {}});
|
|
232
|
+
let clonedRequests = deepClone(requests)
|
|
233
|
+
assert.equal(clonedRequests[0].data.imp[0].video.mimes[0], 'video/mp4')
|
|
234
|
+
assert.equal(clonedRequests[0].data.imp[0].video.maxduration, 31)
|
|
235
|
+
assert.equal(clonedRequests[0].data.imp[0].video.placement, 1)
|
|
236
|
+
assert.equal(clonedRequests[0].method, 'POST')
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
describe('interpretResponse', function () {
|
|
242
|
+
const baseBannerBidRequests = [{
|
|
243
|
+
'bidder': 'viant',
|
|
244
|
+
'params': {
|
|
245
|
+
'publisherId': '464',
|
|
246
|
+
'placementId': '1'
|
|
247
|
+
},
|
|
248
|
+
'mediaTypes': {
|
|
249
|
+
'banner': {
|
|
250
|
+
'sizes': [[728, 90]]
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
'sizes': [[728, 90]],
|
|
254
|
+
'transactionId': '1111474f-58b1-4368-b812-84f8c937a099',
|
|
255
|
+
'adUnitCode': 'div-gpt-ad-1460505748561-0',
|
|
256
|
+
'bidId': '243310435309b5',
|
|
257
|
+
'bidderRequestId': '18084284054531',
|
|
258
|
+
'auctionId': 'e7b34fa3-8654-424e-8c49-03e509e53d8c',
|
|
259
|
+
'src': 'client',
|
|
260
|
+
'bidRequestsCount': 1
|
|
261
|
+
}];
|
|
262
|
+
|
|
263
|
+
const testWindow = buildWindowTree(['https://www.example.com/test', 'https://www.example.com/other/page', 'https://www.example.com/third/page'], 'https://othersite.com/', 'https://example.com/canonical/page');
|
|
264
|
+
const baseBidderRequestReferer = detectReferer(testWindow)();
|
|
265
|
+
const baseBidderRequest = {
|
|
266
|
+
'bidderCode': 'viant',
|
|
267
|
+
'auctionId': 'e7b34fa3-8654-424e-8c49-03e509e53d8c',
|
|
268
|
+
'bidderRequestId': '18084284054531',
|
|
269
|
+
'auctionStart': 1540945362095,
|
|
270
|
+
'timeout': 3000,
|
|
271
|
+
'refererInfo': baseBidderRequestReferer,
|
|
272
|
+
'start': 1540945362099,
|
|
273
|
+
'doneCbCallCount': 0
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
it('empty bid response test', function () {
|
|
277
|
+
const request = testBuildRequests(baseBannerBidRequests, baseBidderRequest)[0];
|
|
278
|
+
let bidResponse = {nbr: 0}; // Unknown error
|
|
279
|
+
let bids = spec.interpretResponse({body: bidResponse}, request);
|
|
280
|
+
expect(bids.length).to.equal(0);
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
it('bid response is a banner', function () {
|
|
284
|
+
const request = testBuildRequests(baseBannerBidRequests, baseBidderRequest)[0];
|
|
285
|
+
let bidResponse = {
|
|
286
|
+
seatbid: [{
|
|
287
|
+
bid: [{
|
|
288
|
+
impid: '243310435309b5',
|
|
289
|
+
price: 2,
|
|
290
|
+
w: 728,
|
|
291
|
+
h: 90,
|
|
292
|
+
crid: 'test-creative-id',
|
|
293
|
+
dealid: 'test-deal-id',
|
|
294
|
+
adm: 'test-ad-markup',
|
|
295
|
+
}]
|
|
296
|
+
}],
|
|
297
|
+
cur: 'USD'
|
|
298
|
+
};
|
|
299
|
+
let bids = spec.interpretResponse({body: bidResponse}, request);
|
|
300
|
+
expect(bids.length).to.equal(1);
|
|
301
|
+
let bid = bids[0];
|
|
302
|
+
it('should return the proper mediaType', function () {
|
|
303
|
+
it('should return a creativeId', function () {
|
|
304
|
+
expect(bid.mediaType).to.equal('banner');
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
it('should return a price', function () {
|
|
308
|
+
expect(bid.cpm).to.equal(bidResponse.seatbid[0].bid[0].price);
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
it('should return a request id', function () {
|
|
312
|
+
expect(bid.requestId).to.equal(bidResponse.seatbid[0].bid[0].impid);
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
it('should return width and height for the creative', function () {
|
|
316
|
+
expect(bid.width).to.equal(bidResponse.seatbid[0].bid[0].w);
|
|
317
|
+
expect(bid.height).to.equal(bidResponse.seatbid[0].bid[0].h);
|
|
318
|
+
});
|
|
319
|
+
it('should return a creativeId', function () {
|
|
320
|
+
expect(bid.creativeId).to.equal(bidResponse.seatbid[0].bid[0].crid);
|
|
321
|
+
});
|
|
322
|
+
it('should return an ad', function () {
|
|
323
|
+
expect(bid.ad).to.equal(bidResponse.seatbid[0].bid[0].adm);
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
it('should return a deal id if it exists', function () {
|
|
327
|
+
expect(bid.dealId).to.equal(bidResponse.seatbid[0].bid[0].dealid);
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
it('should have a time-to-live of 5 minutes', function () {
|
|
331
|
+
expect(bid.ttl).to.equal(300);
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
it('should always return net revenue', function () {
|
|
335
|
+
expect(bid.netRevenue).to.equal(true);
|
|
336
|
+
});
|
|
337
|
+
it('should return a currency', function () {
|
|
338
|
+
expect(bid.currency).to.equal(bidResponse.cur);
|
|
339
|
+
});
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
describe('interpretResponse-Video', function () {
|
|
343
|
+
const baseVideoBidRequests = [{
|
|
344
|
+
'bidder': 'viant',
|
|
345
|
+
'params': {
|
|
346
|
+
'publisherId': '464',
|
|
347
|
+
'placementId': '1'
|
|
348
|
+
},
|
|
349
|
+
'mediaTypes': {
|
|
350
|
+
'video': {
|
|
351
|
+
'context': 'instream',
|
|
352
|
+
'playerSize': [[640, 480]],
|
|
353
|
+
'mimes': ['video/mp4'],
|
|
354
|
+
'protocols': [1, 2, 3, 4, 5, 6, 7, 8],
|
|
355
|
+
'api': [1, 3],
|
|
356
|
+
'skip': 1,
|
|
357
|
+
'skipafter': 5,
|
|
358
|
+
'minduration': 10,
|
|
359
|
+
'maxduration': 31
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
'sizes': [[640, 480]],
|
|
363
|
+
'transactionId': '1111474f-58b1-4368-b812-84f8c937a099',
|
|
364
|
+
'adUnitCode': 'div-gpt-ad-1460505748561-0',
|
|
365
|
+
'bidId': '243310435309b5',
|
|
366
|
+
'bidderRequestId': '18084284054531',
|
|
367
|
+
'auctionId': 'e7b34fa3-8654-424e-8c49-03e509e53d8c',
|
|
368
|
+
'src': 'client',
|
|
369
|
+
'bidRequestsCount': 1
|
|
370
|
+
}];
|
|
371
|
+
|
|
372
|
+
const testWindow = buildWindowTree(['https://www.example.com/test', 'https://www.example.com/other/page', 'https://www.example.com/third/page'], 'https://othersite.com/', 'https://example.com/canonical/page');
|
|
373
|
+
const baseBidderRequestReferer = detectReferer(testWindow)();
|
|
374
|
+
const baseBidderRequest = {
|
|
375
|
+
'bidderCode': 'viant',
|
|
376
|
+
'auctionId': 'e7b34fa3-8654-424e-8c49-03e509e53d8c',
|
|
377
|
+
'bidderRequestId': '18084284054531',
|
|
378
|
+
'auctionStart': 1540945362095,
|
|
379
|
+
'timeout': 3000,
|
|
380
|
+
'refererInfo': baseBidderRequestReferer,
|
|
381
|
+
'start': 1540945362099,
|
|
382
|
+
'doneCbCallCount': 0
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
it('bid response is a video', function () {
|
|
386
|
+
const request = testBuildRequests(baseVideoBidRequests, baseBidderRequest)[0];
|
|
387
|
+
const VIDEO_BID_RESPONSE = {
|
|
388
|
+
'id': 'bidderRequestId',
|
|
389
|
+
'bidid': 'e7b34fa3-8654-424e-8c49-03e509e53d8c',
|
|
390
|
+
'seatbid': [
|
|
391
|
+
{
|
|
392
|
+
'bid': [
|
|
393
|
+
{
|
|
394
|
+
'id': '1',
|
|
395
|
+
'impid': '243310435309b5',
|
|
396
|
+
'price': 1.09,
|
|
397
|
+
'adid': '144762342',
|
|
398
|
+
'nurl': 'http://0.0.0.0:8181/nurl',
|
|
399
|
+
'adm': '<VAST version="4.2"></VAST>',
|
|
400
|
+
'adomain': [
|
|
401
|
+
'https://dummydomain.com'
|
|
402
|
+
],
|
|
403
|
+
'cid': 'cid',
|
|
404
|
+
'crid': 'crid',
|
|
405
|
+
'iurl': 'iurl',
|
|
406
|
+
'cat': [],
|
|
407
|
+
'h': 480,
|
|
408
|
+
'w': 640
|
|
409
|
+
}
|
|
410
|
+
]
|
|
411
|
+
}
|
|
412
|
+
],
|
|
413
|
+
'cur': 'USD'
|
|
414
|
+
};
|
|
415
|
+
let bids = spec.interpretResponse({body: VIDEO_BID_RESPONSE}, request);
|
|
416
|
+
expect(bids.length).to.equal(1);
|
|
417
|
+
let bid = bids[0];
|
|
418
|
+
it('should return the proper mediaType', function () {
|
|
419
|
+
expect(bid.mediaType).to.equal('video');
|
|
420
|
+
});
|
|
421
|
+
it('should return correct Ad Markup', function () {
|
|
422
|
+
expect(bid.vastXml).to.equal('<VAST version="4.2"></VAST>');
|
|
423
|
+
});
|
|
424
|
+
it('should return correct Notification', function () {
|
|
425
|
+
expect(bid.vastUrl).to.equal('http://0.0.0.0:8181/nurl');
|
|
426
|
+
});
|
|
427
|
+
it('should return correct Cpm', function () {
|
|
428
|
+
expect(bid.cpm).to.equal(1.09);
|
|
429
|
+
});
|
|
430
|
+
});
|
|
431
|
+
});
|
|
432
|
+
});
|