prebid.js 6.2.0 → 6.6.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 -82
- package/integrationExamples/gpt/weboramaRtdProvider_example.html +23 -14
- package/karma.conf.maker.js +1 -1
- package/modules/.submodules.json +2 -1
- package/modules/33acrossBidAdapter.js +189 -102
- package/modules/adagioBidAdapter.js +1 -1
- package/modules/addefendBidAdapter.js +1 -0
- package/modules/adkernelBidAdapter.js +148 -62
- package/modules/adlooxAdServerVideo.js +2 -2
- package/modules/adlooxAnalyticsAdapter.js +4 -4
- package/modules/admanBidAdapter.js +11 -4
- package/modules/admixerBidAdapter.js +1 -1
- package/modules/adnuntiusBidAdapter.js +3 -1
- package/modules/adomikAnalyticsAdapter.js +27 -9
- package/modules/adqueryIdSystem.js +103 -0
- package/modules/adqueryIdSystem.md +35 -0
- package/modules/adxcgBidAdapter.js +311 -359
- package/modules/adxcgBidAdapter.md +22 -21
- package/modules/adyoulikeBidAdapter.js +13 -9
- package/modules/aniviewBidAdapter.js +1 -1
- package/modules/appnexusBidAdapter.js +0 -1
- package/modules/beopBidAdapter.js +6 -4
- package/modules/bidViewability.js +3 -3
- package/modules/bidViewabilityIO.js +3 -3
- package/modules/bliinkBidAdapter.js +3 -2
- package/modules/colossussspBidAdapter.js +7 -0
- package/modules/compassBidAdapter.js +208 -0
- package/modules/compassBidAdapter.md +79 -0
- package/modules/consentManagement.js +7 -1
- package/modules/criteoBidAdapter.js +1 -1
- package/modules/criteoIdSystem.js +29 -7
- package/modules/currency.js +2 -2
- package/modules/cwireBidAdapter.js +3 -0
- 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/dspxBidAdapter.js +1 -1
- package/modules/engageyaBidAdapter.js +1 -1
- package/modules/feedadBidAdapter.js +2 -2
- package/modules/feedadBidAdapter.md +4 -2
- package/modules/futureads.md +48 -0
- package/modules/glimpseBidAdapter.js +82 -47
- package/modules/gptPreAuction.js +55 -7
- package/modules/gridBidAdapter.js +4 -3
- package/modules/gumgumBidAdapter.js +2 -2
- 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/kinessoIdSystem.js +1 -1
- 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/lotamePanoramaIdSystem.js +80 -8
- package/modules/mediasquareBidAdapter.js +1 -9
- package/modules/nextMillenniumBidAdapter.js +39 -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/prebidServerBidAdapter/index.js +16 -12
- 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 +4 -4
- package/modules/riseBidAdapter.js +1 -1
- package/modules/rtbhouseBidAdapter.js +14 -4
- package/modules/rtdModule/index.js +49 -18
- package/modules/rubiconBidAdapter.js +31 -19
- package/modules/sharedIdSystem.js +27 -1
- package/modules/showheroes-bsBidAdapter.js +13 -2
- package/modules/tappxBidAdapter.js +8 -5
- package/modules/targetVideoBidAdapter.js +187 -0
- package/modules/targetVideoBidAdapter.md +34 -0
- 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/vidoomyBidAdapter.js +16 -10
- package/modules/weboramaRtdProvider.js +288 -73
- package/modules/weboramaRtdProvider.md +27 -10
- package/modules/welectBidAdapter.js +106 -0
- package/modules/yahoosspBidAdapter.js +5 -1
- package/modules/yieldmoBidAdapter.js +23 -5
- package/modules/zetaSspBidAdapter.md +33 -1
- package/modules/zeta_global_sspAnalyticsAdapter.js +97 -0
- package/modules/zeta_global_sspAnalyticsAdapter.md +24 -0
- package/modules/zeta_global_sspBidAdapter.js +22 -1
- package/package.json +1 -1
- package/plugins/pbjsGlobals.js +28 -1
- package/src/auction.js +2 -2
- package/src/config.js +27 -3
- package/src/hook.js +5 -1
- package/src/prebid.js +21 -6
- package/src/targeting.js +22 -1
- package/src/utils.js +46 -8
- package/test/helpers/prebidGlobal.js +1 -0
- package/test/spec/config_spec.js +279 -0
- package/test/spec/modules/33acrossBidAdapter_spec.js +300 -78
- package/test/spec/modules/adlooxAnalyticsAdapter_spec.js +6 -6
- package/test/spec/modules/admanBidAdapter_spec.js +2 -2
- package/test/spec/modules/adnuntiusBidAdapter_spec.js +17 -0
- package/test/spec/modules/adomikAnalyticsAdapter_spec.js +9 -1
- package/test/spec/modules/adqueryIdSystem_spec.js +74 -0
- package/test/spec/modules/adxcgBidAdapter_spec.js +820 -571
- 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 +9 -0
- 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/cwireBidAdapter_spec.js +10 -8
- 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/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/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/lotamePanoramaIdSystem_spec.js +227 -0
- package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -4
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +26 -1
- package/test/spec/modules/oguryBidAdapter_spec.js +10 -2
- package/test/spec/modules/optimeraRtdProvider_spec.js +14 -1
- package/test/spec/modules/ozoneBidAdapter_spec.js +43 -31
- package/test/spec/modules/prebidServerBidAdapter_spec.js +43 -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 +147 -48
- package/test/spec/modules/richaudienceBidAdapter_spec.js +42 -2
- package/test/spec/modules/riseBidAdapter_spec.js +1 -1
- package/test/spec/modules/rtbhouseBidAdapter_spec.js +20 -0
- package/test/spec/modules/rubiconBidAdapter_spec.js +65 -9
- package/test/spec/modules/sharedIdSystem_spec.js +52 -6
- package/test/spec/modules/showheroes-bsBidAdapter_spec.js +2 -0
- package/test/spec/modules/tappxBidAdapter_spec.js +0 -19
- package/test/spec/modules/targetVideoBidAdapter_spec.js +96 -0
- package/test/spec/modules/teadsBidAdapter_spec.js +14 -59
- package/test/spec/modules/userId_spec.js +68 -19
- package/test/spec/modules/weboramaRtdProvider_spec.js +408 -214
- package/test/spec/modules/welectBidAdapter_spec.js +211 -0
- package/test/spec/modules/yahoosspBidAdapter_spec.js +28 -1
- package/test/spec/modules/zeta_global_sspAnalyticsAdapter_spec.js +427 -0
- package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +33 -1
- package/test/spec/unit/core/targeting_spec.js +72 -0
- package/test/spec/unit/pbjs_api_spec.js +3 -1
- package/test/spec/utils_spec.js +38 -0
- package/test/test_deps.js +3 -0
- package/test/test_index.js +1 -3
|
@@ -95,6 +95,40 @@ describe('Adyoulike Adapter', function () {
|
|
|
95
95
|
}
|
|
96
96
|
];
|
|
97
97
|
|
|
98
|
+
const bidRequestWithMultipleMediatype = [
|
|
99
|
+
{
|
|
100
|
+
'bidId': 'bid_id_0',
|
|
101
|
+
'bidder': 'adyoulike',
|
|
102
|
+
'placementCode': 'adunit/hb-0',
|
|
103
|
+
'params': {
|
|
104
|
+
'placement': 'placement_0'
|
|
105
|
+
},
|
|
106
|
+
'sizes': '300x250',
|
|
107
|
+
'mediaTypes': {
|
|
108
|
+
'banner': {
|
|
109
|
+
'sizes': ['640x480']
|
|
110
|
+
},
|
|
111
|
+
'video': {
|
|
112
|
+
'playerSize': [640, 480],
|
|
113
|
+
'context': 'outstream'
|
|
114
|
+
},
|
|
115
|
+
'native': {
|
|
116
|
+
'image': {
|
|
117
|
+
'required': true,
|
|
118
|
+
},
|
|
119
|
+
'title': {
|
|
120
|
+
'required': true,
|
|
121
|
+
'len': 80
|
|
122
|
+
},
|
|
123
|
+
'cta': {
|
|
124
|
+
'required': false
|
|
125
|
+
},
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
'transactionId': 'bid_id_0_transaction_id'
|
|
129
|
+
}
|
|
130
|
+
];
|
|
131
|
+
|
|
98
132
|
const bidRequestWithNativeImageType = [
|
|
99
133
|
{
|
|
100
134
|
'bidId': 'bid_id_0',
|
|
@@ -647,6 +681,21 @@ describe('Adyoulike Adapter', function () {
|
|
|
647
681
|
expect(payload.Bids['bid_id_0'].TransactionID).to.be.equal('bid_id_0_transaction_id');
|
|
648
682
|
});
|
|
649
683
|
|
|
684
|
+
it('sends bid request to endpoint with single placement multiple mediatype', function () {
|
|
685
|
+
canonicalQuery.restore();
|
|
686
|
+
const request = spec.buildRequests(bidRequestWithMultipleMediatype, bidderRequest);
|
|
687
|
+
const payload = JSON.parse(request.data);
|
|
688
|
+
|
|
689
|
+
expect(request.url).to.contain(getEndpoint());
|
|
690
|
+
expect(request.method).to.equal('POST');
|
|
691
|
+
|
|
692
|
+
expect(request.url).to.not.contains('CanonicalUrl=' + encodeURIComponent(canonicalUrl));
|
|
693
|
+
expect(payload.Version).to.equal('1.0');
|
|
694
|
+
expect(payload.Bids['bid_id_0'].PlacementID).to.be.equal('placement_0');
|
|
695
|
+
expect(payload.PageRefreshed).to.equal(false);
|
|
696
|
+
expect(payload.Bids['bid_id_0'].TransactionID).to.be.equal('bid_id_0_transaction_id');
|
|
697
|
+
});
|
|
698
|
+
|
|
650
699
|
it('sends bid request to endpoint with multiple placements', function () {
|
|
651
700
|
const request = spec.buildRequests(bidRequestMultiPlacements, bidderRequest);
|
|
652
701
|
const payload = JSON.parse(request.data);
|
|
@@ -124,7 +124,7 @@ describe('BeOp Bid Adapter tests', () => {
|
|
|
124
124
|
expect(payload.tc_string).to.exist;
|
|
125
125
|
expect(payload.tc_string).to.equal('BOJ8RZsOJ8RZsABAB8AAAAAZ+A==');
|
|
126
126
|
expect(payload.url).to.exist;
|
|
127
|
-
expect(payload.url).to.equal('http://
|
|
127
|
+
expect(payload.url).to.equal('http://localhost:9876/context.html');
|
|
128
128
|
});
|
|
129
129
|
});
|
|
130
130
|
|
|
@@ -3,7 +3,7 @@ import * as events from 'src/events.js';
|
|
|
3
3
|
import * as utils from 'src/utils.js';
|
|
4
4
|
import * as sinon from 'sinon';
|
|
5
5
|
import { expect } from 'chai';
|
|
6
|
-
import
|
|
6
|
+
import CONSTANTS from 'src/constants.json';
|
|
7
7
|
|
|
8
8
|
describe('#bidViewabilityIO', function() {
|
|
9
9
|
const makeElement = (id) => {
|
|
@@ -97,7 +97,7 @@ describe('#bidViewabilityIO', function() {
|
|
|
97
97
|
expect(mockObserver.unobserve.calledOnce).to.be.true;
|
|
98
98
|
expect(emitSpy.calledOnce).to.be.true;
|
|
99
99
|
// expect(emitSpy.firstCall.args).to.be.false;
|
|
100
|
-
expect(emitSpy.firstCall.args[0]).to.eq(EVENTS.BID_VIEWABLE);
|
|
100
|
+
expect(emitSpy.firstCall.args[0]).to.eq(CONSTANTS.EVENTS.BID_VIEWABLE);
|
|
101
101
|
});
|
|
102
102
|
})
|
|
103
103
|
|
|
@@ -5,7 +5,7 @@ import * as utils from 'src/utils.js';
|
|
|
5
5
|
import * as sinon from 'sinon';
|
|
6
6
|
import {expect, spy} from 'chai';
|
|
7
7
|
import * as prebidGlobal from 'src/prebidGlobal.js';
|
|
8
|
-
import
|
|
8
|
+
import CONSTANTS from 'src/constants.json';
|
|
9
9
|
import adapterManager, { gdprDataHandler, uspDataHandler } from 'src/adapterManager.js';
|
|
10
10
|
import parse from 'url-parse';
|
|
11
11
|
|
|
@@ -279,9 +279,9 @@ describe('#bidViewability', function() {
|
|
|
279
279
|
let call = callBidViewableBidderSpy.getCall(0);
|
|
280
280
|
expect(call.args[0]).to.equal(PBJS_WINNING_BID.bidder);
|
|
281
281
|
expect(call.args[1]).to.deep.equal(PBJS_WINNING_BID);
|
|
282
|
-
// EVENTS.BID_VIEWABLE is triggered
|
|
282
|
+
// CONSTANTS.EVENTS.BID_VIEWABLE is triggered
|
|
283
283
|
call = eventsEmitSpy.getCall(0);
|
|
284
|
-
expect(call.args[0]).to.equal(EVENTS.BID_VIEWABLE);
|
|
284
|
+
expect(call.args[0]).to.equal(CONSTANTS.EVENTS.BID_VIEWABLE);
|
|
285
285
|
expect(call.args[1]).to.deep.equal(PBJS_WINNING_BID);
|
|
286
286
|
});
|
|
287
287
|
|
|
@@ -290,7 +290,7 @@ describe('#bidViewability', function() {
|
|
|
290
290
|
expect(triggerPixelSpy.callCount).to.equal(0);
|
|
291
291
|
// adapterManager.callBidViewableBidder is NOT called
|
|
292
292
|
expect(callBidViewableBidderSpy.callCount).to.equal(0);
|
|
293
|
-
// EVENTS.BID_VIEWABLE is NOT triggered
|
|
293
|
+
// CONSTANTS.EVENTS.BID_VIEWABLE is NOT triggered
|
|
294
294
|
expect(eventsEmitSpy.callCount).to.equal(0);
|
|
295
295
|
});
|
|
296
296
|
});
|
|
@@ -186,6 +186,15 @@ describe('ColossussspAdapter', function () {
|
|
|
186
186
|
});
|
|
187
187
|
});
|
|
188
188
|
|
|
189
|
+
describe('onBidWon', function () {
|
|
190
|
+
it('should make an ajax call', function () {
|
|
191
|
+
const bid = {
|
|
192
|
+
nurl: 'http://example.com/win',
|
|
193
|
+
};
|
|
194
|
+
expect(spec.onBidWon(bid)).to.equals(undefined);
|
|
195
|
+
});
|
|
196
|
+
})
|
|
197
|
+
|
|
189
198
|
describe('getUserSyncs', function () {
|
|
190
199
|
let userSync = spec.getUserSyncs();
|
|
191
200
|
it('Returns valid URL and type', function () {
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import { spec } from '../../../modules/compassBidAdapter.js';
|
|
3
|
+
import { BANNER, VIDEO, NATIVE } from '../../../src/mediaTypes.js';
|
|
4
|
+
import { getUniqueIdentifierStr } from '../../../src/utils.js';
|
|
5
|
+
|
|
6
|
+
const bidder = 'compass'
|
|
7
|
+
|
|
8
|
+
describe('CompassBidAdapter', function () {
|
|
9
|
+
const bids = [
|
|
10
|
+
{
|
|
11
|
+
bidId: getUniqueIdentifierStr(),
|
|
12
|
+
bidder: bidder,
|
|
13
|
+
mediaTypes: {
|
|
14
|
+
[BANNER]: {
|
|
15
|
+
sizes: [[300, 250]]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
params: {
|
|
19
|
+
placementId: 'testBanner',
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
bidId: getUniqueIdentifierStr(),
|
|
24
|
+
bidder: bidder,
|
|
25
|
+
mediaTypes: {
|
|
26
|
+
[VIDEO]: {
|
|
27
|
+
playerSize: [[300, 300]],
|
|
28
|
+
minduration: 5,
|
|
29
|
+
maxduration: 60
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
params: {
|
|
33
|
+
placementId: 'testVideo',
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
bidId: getUniqueIdentifierStr(),
|
|
38
|
+
bidder: bidder,
|
|
39
|
+
mediaTypes: {
|
|
40
|
+
[NATIVE]: {
|
|
41
|
+
native: {
|
|
42
|
+
title: {
|
|
43
|
+
required: true
|
|
44
|
+
},
|
|
45
|
+
body: {
|
|
46
|
+
required: true
|
|
47
|
+
},
|
|
48
|
+
icon: {
|
|
49
|
+
required: true,
|
|
50
|
+
size: [64, 64]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
params: {
|
|
56
|
+
placementId: 'testNative',
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
const invalidBid = {
|
|
62
|
+
bidId: getUniqueIdentifierStr(),
|
|
63
|
+
bidder: bidder,
|
|
64
|
+
mediaTypes: {
|
|
65
|
+
[BANNER]: {
|
|
66
|
+
sizes: [[300, 250]]
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
params: {
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const bidderRequest = {
|
|
75
|
+
uspConsent: '1---',
|
|
76
|
+
gdprConsent: 'COvFyGBOvFyGBAbAAAENAPCAAOAAAAAAAAAAAEEUACCKAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw',
|
|
77
|
+
refererInfo: {
|
|
78
|
+
referer: 'https://test.com'
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
describe('isBidRequestValid', function () {
|
|
83
|
+
it('Should return true if there are bidId, params and key parameters present', function () {
|
|
84
|
+
expect(spec.isBidRequestValid(bids[0])).to.be.true;
|
|
85
|
+
});
|
|
86
|
+
it('Should return false if at least one of parameters is not present', function () {
|
|
87
|
+
expect(spec.isBidRequestValid(invalidBid)).to.be.false;
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
describe('buildRequests', function () {
|
|
92
|
+
let serverRequest = spec.buildRequests(bids, bidderRequest);
|
|
93
|
+
|
|
94
|
+
it('Creates a ServerRequest object with method, URL and data', function () {
|
|
95
|
+
expect(serverRequest).to.exist;
|
|
96
|
+
expect(serverRequest.method).to.exist;
|
|
97
|
+
expect(serverRequest.url).to.exist;
|
|
98
|
+
expect(serverRequest.data).to.exist;
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('Returns POST method', function () {
|
|
102
|
+
expect(serverRequest.method).to.equal('POST');
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('Returns valid URL', function () {
|
|
106
|
+
expect(serverRequest.url).to.equal('https://sa-lb.deliverimp.com/pbjs');
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('Returns general data valid', function () {
|
|
110
|
+
let data = serverRequest.data;
|
|
111
|
+
expect(data).to.be.an('object');
|
|
112
|
+
expect(data).to.have.all.keys('deviceWidth',
|
|
113
|
+
'deviceHeight',
|
|
114
|
+
'language',
|
|
115
|
+
'secure',
|
|
116
|
+
'host',
|
|
117
|
+
'page',
|
|
118
|
+
'placements',
|
|
119
|
+
'coppa',
|
|
120
|
+
'ccpa',
|
|
121
|
+
'gdpr',
|
|
122
|
+
'tmax'
|
|
123
|
+
);
|
|
124
|
+
expect(data.deviceWidth).to.be.a('number');
|
|
125
|
+
expect(data.deviceHeight).to.be.a('number');
|
|
126
|
+
expect(data.language).to.be.a('string');
|
|
127
|
+
expect(data.secure).to.be.within(0, 1);
|
|
128
|
+
expect(data.host).to.be.a('string');
|
|
129
|
+
expect(data.page).to.be.a('string');
|
|
130
|
+
expect(data.coppa).to.be.a('number');
|
|
131
|
+
expect(data.gdpr).to.be.a('string');
|
|
132
|
+
expect(data.ccpa).to.be.a('string');
|
|
133
|
+
expect(data.tmax).to.be.a('number');
|
|
134
|
+
expect(data.placements).to.have.lengthOf(3);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('Returns valid placements', function () {
|
|
138
|
+
const { placements } = serverRequest.data;
|
|
139
|
+
for (let i = 0, len = placements.length; i < len; i++) {
|
|
140
|
+
const placement = placements[i];
|
|
141
|
+
expect(placement.placementId).to.be.oneOf(['testBanner', 'testVideo', 'testNative']);
|
|
142
|
+
expect(placement.adFormat).to.be.oneOf([BANNER, VIDEO, NATIVE]);
|
|
143
|
+
expect(placement.bidId).to.be.a('string');
|
|
144
|
+
expect(placement.schain).to.be.an('object');
|
|
145
|
+
expect(placement.bidfloor).to.exist.and.to.equal(0);
|
|
146
|
+
expect(placement.type).to.exist.and.to.equal('publisher');
|
|
147
|
+
|
|
148
|
+
if (placement.adFormat === BANNER) {
|
|
149
|
+
expect(placement.sizes).to.be.an('array');
|
|
150
|
+
}
|
|
151
|
+
switch (placement.adFormat) {
|
|
152
|
+
case BANNER:
|
|
153
|
+
expect(placement.sizes).to.be.an('array');
|
|
154
|
+
break;
|
|
155
|
+
case VIDEO:
|
|
156
|
+
expect(placement.playerSize).to.be.an('array');
|
|
157
|
+
expect(placement.minduration).to.be.an('number');
|
|
158
|
+
expect(placement.maxduration).to.be.an('number');
|
|
159
|
+
break;
|
|
160
|
+
case NATIVE:
|
|
161
|
+
expect(placement.native).to.be.an('object');
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it('Returns data with gdprConsent and without uspConsent', function () {
|
|
168
|
+
delete bidderRequest.uspConsent;
|
|
169
|
+
serverRequest = spec.buildRequests(bids, bidderRequest);
|
|
170
|
+
let data = serverRequest.data;
|
|
171
|
+
expect(data.gdpr).to.exist;
|
|
172
|
+
expect(data.gdpr).to.be.a('string');
|
|
173
|
+
expect(data.gdpr).to.equal(bidderRequest.gdprConsent);
|
|
174
|
+
expect(data.ccpa).to.not.exist;
|
|
175
|
+
delete bidderRequest.gdprConsent;
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it('Returns data with uspConsent and without gdprConsent', function () {
|
|
179
|
+
bidderRequest.uspConsent = '1---';
|
|
180
|
+
delete bidderRequest.gdprConsent;
|
|
181
|
+
serverRequest = spec.buildRequests(bids, bidderRequest);
|
|
182
|
+
let data = serverRequest.data;
|
|
183
|
+
expect(data.ccpa).to.exist;
|
|
184
|
+
expect(data.ccpa).to.be.a('string');
|
|
185
|
+
expect(data.ccpa).to.equal(bidderRequest.uspConsent);
|
|
186
|
+
expect(data.gdpr).to.not.exist;
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it('Returns empty data if no valid requests are passed', function () {
|
|
190
|
+
serverRequest = spec.buildRequests([], bidderRequest);
|
|
191
|
+
let data = serverRequest.data;
|
|
192
|
+
expect(data.placements).to.be.an('array').that.is.empty;
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
describe('interpretResponse', function () {
|
|
197
|
+
it('Should interpret banner response', function () {
|
|
198
|
+
const banner = {
|
|
199
|
+
body: [{
|
|
200
|
+
mediaType: 'banner',
|
|
201
|
+
width: 300,
|
|
202
|
+
height: 250,
|
|
203
|
+
cpm: 0.4,
|
|
204
|
+
ad: 'Test',
|
|
205
|
+
requestId: '23fhj33i987f',
|
|
206
|
+
ttl: 120,
|
|
207
|
+
creativeId: '2',
|
|
208
|
+
netRevenue: true,
|
|
209
|
+
currency: 'USD',
|
|
210
|
+
dealId: '1',
|
|
211
|
+
meta: {
|
|
212
|
+
advertiserDomains: ['google.com'],
|
|
213
|
+
advertiserId: 1234
|
|
214
|
+
}
|
|
215
|
+
}]
|
|
216
|
+
};
|
|
217
|
+
let bannerResponses = spec.interpretResponse(banner);
|
|
218
|
+
expect(bannerResponses).to.be.an('array').that.is.not.empty;
|
|
219
|
+
let dataItem = bannerResponses[0];
|
|
220
|
+
expect(dataItem).to.have.all.keys('requestId', 'cpm', 'width', 'height', 'ad', 'ttl', 'creativeId',
|
|
221
|
+
'netRevenue', 'currency', 'dealId', 'mediaType', 'meta');
|
|
222
|
+
expect(dataItem.requestId).to.equal(banner.body[0].requestId);
|
|
223
|
+
expect(dataItem.cpm).to.equal(banner.body[0].cpm);
|
|
224
|
+
expect(dataItem.width).to.equal(banner.body[0].width);
|
|
225
|
+
expect(dataItem.height).to.equal(banner.body[0].height);
|
|
226
|
+
expect(dataItem.ad).to.equal(banner.body[0].ad);
|
|
227
|
+
expect(dataItem.ttl).to.equal(banner.body[0].ttl);
|
|
228
|
+
expect(dataItem.creativeId).to.equal(banner.body[0].creativeId);
|
|
229
|
+
expect(dataItem.netRevenue).to.be.true;
|
|
230
|
+
expect(dataItem.currency).to.equal(banner.body[0].currency);
|
|
231
|
+
expect(dataItem.meta).to.be.an('object').that.has.any.key('advertiserDomains');
|
|
232
|
+
});
|
|
233
|
+
it('Should interpret video response', function () {
|
|
234
|
+
const video = {
|
|
235
|
+
body: [{
|
|
236
|
+
vastUrl: 'test.com',
|
|
237
|
+
mediaType: 'video',
|
|
238
|
+
cpm: 0.5,
|
|
239
|
+
requestId: '23fhj33i987f',
|
|
240
|
+
ttl: 120,
|
|
241
|
+
creativeId: '2',
|
|
242
|
+
netRevenue: true,
|
|
243
|
+
currency: 'USD',
|
|
244
|
+
dealId: '1',
|
|
245
|
+
meta: {
|
|
246
|
+
advertiserDomains: ['google.com'],
|
|
247
|
+
advertiserId: 1234
|
|
248
|
+
}
|
|
249
|
+
}]
|
|
250
|
+
};
|
|
251
|
+
let videoResponses = spec.interpretResponse(video);
|
|
252
|
+
expect(videoResponses).to.be.an('array').that.is.not.empty;
|
|
253
|
+
|
|
254
|
+
let dataItem = videoResponses[0];
|
|
255
|
+
expect(dataItem).to.have.all.keys('requestId', 'cpm', 'vastUrl', 'ttl', 'creativeId',
|
|
256
|
+
'netRevenue', 'currency', 'dealId', 'mediaType', 'meta');
|
|
257
|
+
expect(dataItem.requestId).to.equal('23fhj33i987f');
|
|
258
|
+
expect(dataItem.cpm).to.equal(0.5);
|
|
259
|
+
expect(dataItem.vastUrl).to.equal('test.com');
|
|
260
|
+
expect(dataItem.ttl).to.equal(120);
|
|
261
|
+
expect(dataItem.creativeId).to.equal('2');
|
|
262
|
+
expect(dataItem.netRevenue).to.be.true;
|
|
263
|
+
expect(dataItem.currency).to.equal('USD');
|
|
264
|
+
expect(dataItem.meta).to.be.an('object').that.has.any.key('advertiserDomains');
|
|
265
|
+
});
|
|
266
|
+
it('Should interpret native response', function () {
|
|
267
|
+
const native = {
|
|
268
|
+
body: [{
|
|
269
|
+
mediaType: 'native',
|
|
270
|
+
native: {
|
|
271
|
+
clickUrl: 'test.com',
|
|
272
|
+
title: 'Test',
|
|
273
|
+
image: 'test.com',
|
|
274
|
+
impressionTrackers: ['test.com'],
|
|
275
|
+
},
|
|
276
|
+
ttl: 120,
|
|
277
|
+
cpm: 0.4,
|
|
278
|
+
requestId: '23fhj33i987f',
|
|
279
|
+
creativeId: '2',
|
|
280
|
+
netRevenue: true,
|
|
281
|
+
currency: 'USD',
|
|
282
|
+
meta: {
|
|
283
|
+
advertiserDomains: ['google.com'],
|
|
284
|
+
advertiserId: 1234
|
|
285
|
+
}
|
|
286
|
+
}]
|
|
287
|
+
};
|
|
288
|
+
let nativeResponses = spec.interpretResponse(native);
|
|
289
|
+
expect(nativeResponses).to.be.an('array').that.is.not.empty;
|
|
290
|
+
|
|
291
|
+
let dataItem = nativeResponses[0];
|
|
292
|
+
expect(dataItem).to.have.keys('requestId', 'cpm', 'ttl', 'creativeId', 'netRevenue', 'currency', 'mediaType', 'native', 'meta');
|
|
293
|
+
expect(dataItem.native).to.have.keys('clickUrl', 'impressionTrackers', 'title', 'image')
|
|
294
|
+
expect(dataItem.requestId).to.equal('23fhj33i987f');
|
|
295
|
+
expect(dataItem.cpm).to.equal(0.4);
|
|
296
|
+
expect(dataItem.native.clickUrl).to.equal('test.com');
|
|
297
|
+
expect(dataItem.native.title).to.equal('Test');
|
|
298
|
+
expect(dataItem.native.image).to.equal('test.com');
|
|
299
|
+
expect(dataItem.native.impressionTrackers).to.be.an('array').that.is.not.empty;
|
|
300
|
+
expect(dataItem.native.impressionTrackers[0]).to.equal('test.com');
|
|
301
|
+
expect(dataItem.ttl).to.equal(120);
|
|
302
|
+
expect(dataItem.creativeId).to.equal('2');
|
|
303
|
+
expect(dataItem.netRevenue).to.be.true;
|
|
304
|
+
expect(dataItem.currency).to.equal('USD');
|
|
305
|
+
expect(dataItem.meta).to.be.an('object').that.has.any.key('advertiserDomains');
|
|
306
|
+
});
|
|
307
|
+
it('Should return an empty array if invalid banner response is passed', function () {
|
|
308
|
+
const invBanner = {
|
|
309
|
+
body: [{
|
|
310
|
+
width: 300,
|
|
311
|
+
cpm: 0.4,
|
|
312
|
+
ad: 'Test',
|
|
313
|
+
requestId: '23fhj33i987f',
|
|
314
|
+
ttl: 120,
|
|
315
|
+
creativeId: '2',
|
|
316
|
+
netRevenue: true,
|
|
317
|
+
currency: 'USD',
|
|
318
|
+
dealId: '1'
|
|
319
|
+
}]
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
let serverResponses = spec.interpretResponse(invBanner);
|
|
323
|
+
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
324
|
+
});
|
|
325
|
+
it('Should return an empty array if invalid video response is passed', function () {
|
|
326
|
+
const invVideo = {
|
|
327
|
+
body: [{
|
|
328
|
+
mediaType: 'video',
|
|
329
|
+
cpm: 0.5,
|
|
330
|
+
requestId: '23fhj33i987f',
|
|
331
|
+
ttl: 120,
|
|
332
|
+
creativeId: '2',
|
|
333
|
+
netRevenue: true,
|
|
334
|
+
currency: 'USD',
|
|
335
|
+
dealId: '1'
|
|
336
|
+
}]
|
|
337
|
+
};
|
|
338
|
+
let serverResponses = spec.interpretResponse(invVideo);
|
|
339
|
+
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
340
|
+
});
|
|
341
|
+
it('Should return an empty array if invalid native response is passed', function () {
|
|
342
|
+
const invNative = {
|
|
343
|
+
body: [{
|
|
344
|
+
mediaType: 'native',
|
|
345
|
+
clickUrl: 'test.com',
|
|
346
|
+
title: 'Test',
|
|
347
|
+
impressionTrackers: ['test.com'],
|
|
348
|
+
ttl: 120,
|
|
349
|
+
requestId: '23fhj33i987f',
|
|
350
|
+
creativeId: '2',
|
|
351
|
+
netRevenue: true,
|
|
352
|
+
currency: 'USD',
|
|
353
|
+
}]
|
|
354
|
+
};
|
|
355
|
+
let serverResponses = spec.interpretResponse(invNative);
|
|
356
|
+
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
357
|
+
});
|
|
358
|
+
it('Should return an empty array if invalid response is passed', function () {
|
|
359
|
+
const invalid = {
|
|
360
|
+
body: [{
|
|
361
|
+
ttl: 120,
|
|
362
|
+
creativeId: '2',
|
|
363
|
+
netRevenue: true,
|
|
364
|
+
currency: 'USD',
|
|
365
|
+
dealId: '1'
|
|
366
|
+
}]
|
|
367
|
+
};
|
|
368
|
+
let serverResponses = spec.interpretResponse(invalid);
|
|
369
|
+
expect(serverResponses).to.be.an('array').that.is.empty;
|
|
370
|
+
});
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
describe('getUserSyncs', function() {
|
|
374
|
+
it('Should return array of objects with proper sync config , include GDPR', function() {
|
|
375
|
+
const syncData = spec.getUserSyncs({}, {}, {
|
|
376
|
+
consentString: 'ALL',
|
|
377
|
+
gdprApplies: true,
|
|
378
|
+
}, {});
|
|
379
|
+
expect(syncData).to.be.an('array').which.is.not.empty;
|
|
380
|
+
expect(syncData[0]).to.be.an('object')
|
|
381
|
+
expect(syncData[0].type).to.be.a('string')
|
|
382
|
+
expect(syncData[0].type).to.equal('image')
|
|
383
|
+
expect(syncData[0].url).to.be.a('string')
|
|
384
|
+
expect(syncData[0].url).to.equal('https://sa-cs.deliverimp.com/image?pbjs=1&gdpr=1&gdpr_consent=ALL&coppa=0')
|
|
385
|
+
});
|
|
386
|
+
it('Should return array of objects with proper sync config , include CCPA', function() {
|
|
387
|
+
const syncData = spec.getUserSyncs({}, {}, {}, {
|
|
388
|
+
consentString: '1---'
|
|
389
|
+
});
|
|
390
|
+
expect(syncData).to.be.an('array').which.is.not.empty;
|
|
391
|
+
expect(syncData[0]).to.be.an('object')
|
|
392
|
+
expect(syncData[0].type).to.be.a('string')
|
|
393
|
+
expect(syncData[0].type).to.equal('image')
|
|
394
|
+
expect(syncData[0].url).to.be.a('string')
|
|
395
|
+
expect(syncData[0].url).to.equal('https://sa-cs.deliverimp.com/image?pbjs=1&ccpa_consent=1---&coppa=0')
|
|
396
|
+
});
|
|
397
|
+
});
|
|
398
|
+
});
|
|
@@ -715,6 +715,26 @@ describe('consentManagement', function () {
|
|
|
715
715
|
expect(consent).to.be.null;
|
|
716
716
|
});
|
|
717
717
|
|
|
718
|
+
it('allows the auction when CMP is unresponsive', (done) => {
|
|
719
|
+
setConsentConfig({
|
|
720
|
+
cmpApi: 'iab',
|
|
721
|
+
timeout: 10,
|
|
722
|
+
defaultGdprScope: true
|
|
723
|
+
});
|
|
724
|
+
|
|
725
|
+
requestBidsHook(() => {
|
|
726
|
+
didHookReturn = true;
|
|
727
|
+
}, {});
|
|
728
|
+
|
|
729
|
+
setTimeout(() => {
|
|
730
|
+
expect(didHookReturn).to.be.true;
|
|
731
|
+
const consent = gdprDataHandler.getConsentData();
|
|
732
|
+
expect(consent.gdprApplies).to.be.true;
|
|
733
|
+
expect(consent.consentString).to.be.undefined;
|
|
734
|
+
done();
|
|
735
|
+
}, 20);
|
|
736
|
+
});
|
|
737
|
+
|
|
718
738
|
it('It still considers it a valid cmp response if gdprApplies is not a boolean', function () {
|
|
719
739
|
// gdprApplies is undefined, should just still store consent response but use whatever defaultGdprScope was
|
|
720
740
|
let testConsentData = {
|
|
@@ -116,16 +116,19 @@ describe('CriteoId module', function () {
|
|
|
116
116
|
expect(setCookieStub.calledWith('cto_bundle')).to.be.false;
|
|
117
117
|
expect(setLocalStorageStub.calledWith('cto_bundle')).to.be.false;
|
|
118
118
|
} else if (response.bundle) {
|
|
119
|
-
expect(setCookieStub.calledWith('cto_bundle', response.bundle, expirationTs)).to.be.true;
|
|
119
|
+
expect(setCookieStub.calledWith('cto_bundle', response.bundle, expirationTs, null, '.com')).to.be.true;
|
|
120
|
+
expect(setCookieStub.calledWith('cto_bundle', response.bundle, expirationTs, null, '.testdev.com')).to.be.true;
|
|
120
121
|
expect(setLocalStorageStub.calledWith('cto_bundle', response.bundle)).to.be.true;
|
|
121
122
|
expect(triggerPixelStub.called).to.be.false;
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
if (response.bidId) {
|
|
125
|
-
expect(setCookieStub.calledWith('cto_bidid', response.bidId, expirationTs)).to.be.true;
|
|
126
|
+
expect(setCookieStub.calledWith('cto_bidid', response.bidId, expirationTs, null, '.com')).to.be.true;
|
|
127
|
+
expect(setCookieStub.calledWith('cto_bidid', response.bidId, expirationTs, null, '.testdev.com')).to.be.true;
|
|
126
128
|
expect(setLocalStorageStub.calledWith('cto_bidid', response.bidId)).to.be.true;
|
|
127
129
|
} else {
|
|
128
|
-
expect(setCookieStub.calledWith('cto_bidid', '', pastDateString)).to.be.true;
|
|
130
|
+
expect(setCookieStub.calledWith('cto_bidid', '', pastDateString, null, '.com')).to.be.true;
|
|
131
|
+
expect(setCookieStub.calledWith('cto_bidid', '', pastDateString, null, '.testdev.com')).to.be.true;
|
|
129
132
|
expect(removeFromLocalStorageStub.calledWith('cto_bidid')).to.be.true;
|
|
130
133
|
}
|
|
131
134
|
});
|
|
@@ -36,11 +36,6 @@ const BidderRequestBuilder = function BidderRequestBuilder(options) {
|
|
|
36
36
|
bidderRequestId: BID_DEFAULTS.request.bidderRequestId,
|
|
37
37
|
transactionId: BID_DEFAULTS.request.transactionId,
|
|
38
38
|
timeout: 3000,
|
|
39
|
-
refererInfo: {
|
|
40
|
-
numIframes: 0,
|
|
41
|
-
reachedTop: true,
|
|
42
|
-
referer: 'http://test.io/index.html?pbjs_debug=true'
|
|
43
|
-
}
|
|
44
39
|
};
|
|
45
40
|
|
|
46
41
|
const request = {
|
|
@@ -82,16 +77,13 @@ const BidRequestBuilder = function BidRequestBuilder(options, deleteKeys) {
|
|
|
82
77
|
};
|
|
83
78
|
|
|
84
79
|
describe('C-WIRE bid adapter', () => {
|
|
85
|
-
let utilsMock;
|
|
86
80
|
let sandbox;
|
|
87
81
|
|
|
88
82
|
beforeEach(() => {
|
|
89
|
-
utilsMock = sinon.mock(utils);
|
|
90
83
|
sandbox = sinon.createSandbox();
|
|
91
84
|
});
|
|
92
85
|
|
|
93
86
|
afterEach(() => {
|
|
94
|
-
utilsMock.restore();
|
|
95
87
|
sandbox.restore();
|
|
96
88
|
});
|
|
97
89
|
|
|
@@ -146,6 +138,12 @@ describe('C-WIRE bid adapter', () => {
|
|
|
146
138
|
|
|
147
139
|
describe('C-WIRE - buildRequests()', function () {
|
|
148
140
|
it('creates a valid request', function () {
|
|
141
|
+
// for whatever reason stub for getWindowLocation does not work
|
|
142
|
+
// so this was the closest way to test for get params
|
|
143
|
+
const params = sandbox.stub(utils, 'getParameterByName');
|
|
144
|
+
params.withArgs('cwgroups').returns('group_1');
|
|
145
|
+
params.withArgs('cwcreative').returns('54321');
|
|
146
|
+
|
|
149
147
|
const bid01 = new BidRequestBuilder({
|
|
150
148
|
mediaTypes: {
|
|
151
149
|
banner: {
|
|
@@ -153,12 +151,16 @@ describe('C-WIRE bid adapter', () => {
|
|
|
153
151
|
}
|
|
154
152
|
}
|
|
155
153
|
}).withParams().build();
|
|
154
|
+
|
|
156
155
|
const bidderRequest01 = new BidderRequestBuilder().build();
|
|
157
156
|
|
|
158
157
|
const requests = spec.buildRequests([bid01], bidderRequest01);
|
|
158
|
+
|
|
159
159
|
expect(requests.data.slots.length).to.equal(1);
|
|
160
160
|
expect(requests.data.cwid).to.be.null;
|
|
161
161
|
expect(requests.data.slots[0].sizes[0]).to.equal('1x1');
|
|
162
|
+
expect(requests.data.cwcreative).to.equal('54321');
|
|
163
|
+
expect(requests.data.refgroups[0]).to.equal('group_1');
|
|
162
164
|
});
|
|
163
165
|
});
|
|
164
166
|
|