prebid.js 8.40.0 → 8.41.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/33acrossAnalyticsAdapter.js +1 -1
- package/dist/33acrossBidAdapter.js +1 -1
- package/dist/33acrossIdSystem.js +1 -1
- package/dist/BTBidAdapter.js +1 -1
- package/dist/adagioAnalyticsAdapter.js +1 -1
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adkernelBidAdapter.js +1 -1
- package/dist/adqueryBidAdapter.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adstirBidAdapter.js +1 -1
- package/dist/adtrgtmeBidAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/adyoulikeBidAdapter.js +1 -1
- package/dist/agmaAnalyticsAdapter.js +1 -1
- package/dist/ajaBidAdapter.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 -1
- 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/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/discoveryBidAdapter.js +1 -1
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/dxkultureBidAdapter.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/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/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/hypelabBidAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/illuminBidAdapter.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/jixieBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/kargoBidAdapter.js +1 -1
- package/dist/kimberliteBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.js +1 -1
- package/dist/kueezRtbBidAdapter.js +1 -1
- package/dist/lassoBidAdapter.js +1 -1
- package/dist/lifestreetBidAdapter.js +1 -1
- package/dist/liveIntentIdSystem.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.js +1 -1
- package/dist/luceadBidAdapter.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/mediasquareBidAdapter.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/minutemediaplusBidAdapter.js +1 -1
- package/dist/missenaBidAdapter.js +1 -1
- package/dist/nextMillenniumBidAdapter.js +1 -1
- package/dist/nexx360BidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +155 -153
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/openxBidAdapter.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/pstudioBidAdapter.js +1 -0
- package/dist/publinkIdSystem.js +1 -1
- package/dist/publirBidAdapter.js +1 -0
- package/dist/pubmaticAnalyticsAdapter.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/rasBidAdapter.js +1 -1
- package/dist/readpeakBidAdapter.js +1 -1
- package/dist/relaidoBidAdapter.js +1 -1
- package/dist/retailspotBidAdapter.js +1 -1
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rtbhouseBidAdapter.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/shinezRtbBidAdapter.js +1 -1
- package/dist/smaatoBidAdapter.js +1 -1
- package/dist/smartadserverBidAdapter.js +1 -1
- package/dist/smartxBidAdapter.js +1 -1
- package/dist/smartyadsBidAdapter.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/sspBCBidAdapter.js +1 -1
- package/dist/stnBidAdapter.js +1 -1
- package/dist/stvBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/taboolaBidAdapter.js +1 -1
- package/dist/tagorasBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.js +1 -1
- package/dist/themoneytizerBidAdapter.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/unrulyBidAdapter.js +1 -1
- package/dist/userId.js +1 -1
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/visxBidAdapter.js +1 -1
- package/dist/vuukleBidAdapter.js +1 -1
- package/dist/weboramaRtdProvider.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/dist/zeta_global_sspBidAdapter.js +1 -1
- package/integrationExamples/gpt/publir_hello_world.html +84 -0
- package/modules/adkernelBidAdapter.js +2 -1
- package/modules/automatadAnalyticsAdapter.js +31 -22
- package/modules/discoveryBidAdapter.js +5 -4
- package/modules/hypelabBidAdapter.js +31 -5
- package/modules/kargoBidAdapter.js +25 -13
- package/modules/kueezRtbBidAdapter.js +1 -1
- package/modules/nextMillenniumBidAdapter.js +52 -33
- package/modules/nexx360BidAdapter.js +2 -3
- package/modules/onetagBidAdapter.js +2 -1
- package/modules/pstudioBidAdapter.js +435 -0
- package/modules/pstudioBidAdapter.md +148 -0
- package/modules/publirBidAdapter.js +391 -0
- package/modules/publirBidAdapter.md +47 -0
- package/modules/pubmaticAnalyticsAdapter.js +7 -2
- package/modules/rasBidAdapter.js +178 -22
- package/modules/rasBidAdapter.md +2 -2
- package/modules/rtbhouseBidAdapter.js +2 -1
- package/modules/sharethroughBidAdapter.js +4 -0
- package/modules/smartyadsBidAdapter.js +10 -2
- package/modules/sovrnBidAdapter.js +15 -8
- package/modules/sspBCBidAdapter.js +22 -17
- package/modules/taboolaBidAdapter.js +1 -1
- package/modules/userId/index.js +1 -1
- package/modules/weboramaRtdProvider.js +99 -36
- package/modules/weboramaRtdProvider.md +13 -4
- package/modules/zeta_global_sspBidAdapter.js +26 -1
- package/package.json +1 -1
- package/test/spec/modules/automatadAnalyticsAdapter_spec.js +102 -15
- package/test/spec/modules/discoveryBidAdapter_spec.js +1 -1
- package/test/spec/modules/hypelabBidAdapter_spec.js +5 -1
- package/test/spec/modules/kargoBidAdapter_spec.js +29 -11
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +34 -3
- package/test/spec/modules/nexx360BidAdapter_spec.js +5 -5
- package/test/spec/modules/onetagBidAdapter_spec.js +4 -1
- package/test/spec/modules/pstudioBidAdapter_spec.js +514 -0
- package/test/spec/modules/publirBidAdapter_spec.js +488 -0
- package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +12 -1
- package/test/spec/modules/rasBidAdapter_spec.js +364 -2
- package/test/spec/modules/sharethroughBidAdapter_spec.js +35 -0
- package/test/spec/modules/sovrnBidAdapter_spec.js +39 -0
- package/test/spec/modules/sspBCBidAdapter_spec.js +1 -1
- package/test/spec/modules/taboolaBidAdapter_spec.js +1 -1
- package/test/spec/modules/weboramaRtdProvider_spec.js +114 -0
- package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +4 -4
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import { spec } from 'modules/publirBidAdapter.js';
|
|
3
|
+
import { newBidder } from 'src/adapters/bidderFactory.js';
|
|
4
|
+
import { config } from 'src/config.js';
|
|
5
|
+
import { BANNER } from '../../../src/mediaTypes.js';
|
|
6
|
+
import * as utils from 'src/utils.js';
|
|
7
|
+
|
|
8
|
+
const ENDPOINT = 'https://prebid.publir.com/publirPrebidEndPoint';
|
|
9
|
+
const RTB_DOMAIN_TEST = 'prebid.publir.com';
|
|
10
|
+
const TTL = 360;
|
|
11
|
+
|
|
12
|
+
describe('publirAdapter', function () {
|
|
13
|
+
const adapter = newBidder(spec);
|
|
14
|
+
|
|
15
|
+
describe('inherited functions', function () {
|
|
16
|
+
it('exists and is a function', function () {
|
|
17
|
+
expect(adapter.callBids).to.exist.and.to.be.a('function');
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('bid adapter', function () {
|
|
22
|
+
it('should have aliases', function () {
|
|
23
|
+
expect(spec.aliases).to.be.an('array').that.is.not.empty;
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe('isBidRequestValid', function () {
|
|
28
|
+
const bid = {
|
|
29
|
+
'bidder': spec.code,
|
|
30
|
+
'adUnitCode': 'adunit-code',
|
|
31
|
+
'sizes': [['640', '480']],
|
|
32
|
+
'params': {
|
|
33
|
+
'pubId': 'jdye8weeyirk00000001'
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
it('should return true when required params are passed', function () {
|
|
38
|
+
expect(spec.isBidRequestValid(bid)).to.equal(true);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should return false when pubId is missing', function () {
|
|
42
|
+
const bid = {
|
|
43
|
+
'bidder': spec.code,
|
|
44
|
+
'adUnitCode': 'adunit-code',
|
|
45
|
+
'sizes': [['640', '480']],
|
|
46
|
+
'params': {}
|
|
47
|
+
};
|
|
48
|
+
expect(spec.isBidRequestValid(bid)).to.equal(false);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('should return false when required params are not found', function () {
|
|
52
|
+
const newBid = Object.assign({}, bid);
|
|
53
|
+
delete newBid.params;
|
|
54
|
+
newBid.params = {
|
|
55
|
+
'pubId': null
|
|
56
|
+
};
|
|
57
|
+
expect(spec.isBidRequestValid(newBid)).to.equal(false);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
describe('buildRequests', function () {
|
|
62
|
+
const bidRequests = [
|
|
63
|
+
{
|
|
64
|
+
'bidder': spec.code,
|
|
65
|
+
'adUnitCode': 'adunit-code',
|
|
66
|
+
'sizes': [[300, 250]],
|
|
67
|
+
'params': {
|
|
68
|
+
'pubId': 'jdye8weeyirk00000001'
|
|
69
|
+
},
|
|
70
|
+
'bidId': '299ffc8cca0b87',
|
|
71
|
+
'loop': 1,
|
|
72
|
+
'bidderRequestId': '1144f487e563f9',
|
|
73
|
+
'auctionId': 'bfc420c3-8577-4568-9766-a8a935fb620d',
|
|
74
|
+
'mediaTypes': {
|
|
75
|
+
'banner': {
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
'ad': '"<img src=\"https://...\"/>"'
|
|
79
|
+
}
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
const bidderRequest = {
|
|
83
|
+
bidderCode: 'publir',
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
it('sends bid request to ENDPOINT via POST', function () {
|
|
87
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
88
|
+
expect(request.url).to.equal(ENDPOINT);
|
|
89
|
+
expect(request.method).to.equal('POST');
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('sends bid request to rtbDomain ENDPOINT via POST', function () {
|
|
93
|
+
bidRequests[0].params.rtbDomain = RTB_DOMAIN_TEST;
|
|
94
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
95
|
+
expect(request.url).to.equal(ENDPOINT);
|
|
96
|
+
expect(request.method).to.equal('POST');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('should send the correct bid Id', function () {
|
|
100
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
101
|
+
expect(request.data.bids[0].bidId).to.equal('299ffc8cca0b87');
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('should respect syncEnabled option', function() {
|
|
105
|
+
config.setConfig({
|
|
106
|
+
userSync: {
|
|
107
|
+
syncEnabled: false,
|
|
108
|
+
filterSettings: {
|
|
109
|
+
all: {
|
|
110
|
+
bidders: '*',
|
|
111
|
+
filter: 'include'
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
117
|
+
expect(request.data.params).to.be.an('object');
|
|
118
|
+
expect(request.data.params).to.not.have.property('cs_method');
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('should respect "iframe" filter settings', function () {
|
|
122
|
+
config.setConfig({
|
|
123
|
+
userSync: {
|
|
124
|
+
syncEnabled: true,
|
|
125
|
+
filterSettings: {
|
|
126
|
+
iframe: {
|
|
127
|
+
bidders: [spec.code],
|
|
128
|
+
filter: 'include'
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
134
|
+
expect(request.data.params).to.be.an('object');
|
|
135
|
+
expect(request.data.params).to.have.property('cs_method', 'iframe');
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('should respect "all" filter settings', function () {
|
|
139
|
+
config.setConfig({
|
|
140
|
+
userSync: {
|
|
141
|
+
syncEnabled: true,
|
|
142
|
+
filterSettings: {
|
|
143
|
+
all: {
|
|
144
|
+
bidders: [spec.code],
|
|
145
|
+
filter: 'include'
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
151
|
+
expect(request.data.params).to.be.an('object');
|
|
152
|
+
expect(request.data.params).to.have.property('cs_method', 'iframe');
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('should send the pixel user sync param if userSync is enabled and no "iframe" or "all" configs are present', function () {
|
|
156
|
+
config.resetConfig();
|
|
157
|
+
config.setConfig({
|
|
158
|
+
userSync: {
|
|
159
|
+
syncEnabled: true,
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
163
|
+
expect(request.data.params).to.be.an('object');
|
|
164
|
+
expect(request.data.params).to.have.property('cs_method', 'pixel');
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it('should respect total exclusion', function() {
|
|
168
|
+
config.setConfig({
|
|
169
|
+
userSync: {
|
|
170
|
+
syncEnabled: true,
|
|
171
|
+
filterSettings: {
|
|
172
|
+
image: {
|
|
173
|
+
bidders: [spec.code],
|
|
174
|
+
filter: 'exclude'
|
|
175
|
+
},
|
|
176
|
+
iframe: {
|
|
177
|
+
bidders: [spec.code],
|
|
178
|
+
filter: 'exclude'
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
184
|
+
expect(request.data.params).to.be.an('object');
|
|
185
|
+
expect(request.data.params).to.not.have.property('cs_method');
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it('should have us_privacy param if usPrivacy is available in the bidRequest', function () {
|
|
189
|
+
const bidderRequestWithUSP = Object.assign({uspConsent: '1YNN'}, bidderRequest);
|
|
190
|
+
const request = spec.buildRequests(bidRequests, bidderRequestWithUSP);
|
|
191
|
+
expect(request.data.params).to.be.an('object');
|
|
192
|
+
expect(request.data.params).to.have.property('us_privacy', '1YNN');
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
it('should have an empty us_privacy param if usPrivacy is missing in the bidRequest', function () {
|
|
196
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
197
|
+
expect(request.data.params).to.be.an('object');
|
|
198
|
+
expect(request.data.params).to.not.have.property('us_privacy');
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it('should not send the gdpr param if gdprApplies is false in the bidRequest', function () {
|
|
202
|
+
const bidderRequestWithGDPR = Object.assign({gdprConsent: {gdprApplies: false}}, bidderRequest);
|
|
203
|
+
const request = spec.buildRequests(bidRequests, bidderRequestWithGDPR);
|
|
204
|
+
expect(request.data.params).to.be.an('object');
|
|
205
|
+
expect(request.data.params).to.not.have.property('gdpr');
|
|
206
|
+
expect(request.data.params).to.not.have.property('gdpr_consent');
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
it('should send the gdpr param if gdprApplies is true in the bidRequest', function () {
|
|
210
|
+
const bidderRequestWithGDPR = Object.assign({gdprConsent: {gdprApplies: true, consentString: 'test-consent-string'}}, bidderRequest);
|
|
211
|
+
const request = spec.buildRequests(bidRequests, bidderRequestWithGDPR);
|
|
212
|
+
expect(request.data.params).to.be.an('object');
|
|
213
|
+
expect(request.data.params).to.have.property('gdpr', true);
|
|
214
|
+
expect(request.data.params).to.have.property('gdpr_consent', 'test-consent-string');
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it('should have schain param if it is available in the bidRequest', () => {
|
|
218
|
+
const schain = {
|
|
219
|
+
ver: '1.0',
|
|
220
|
+
complete: 1,
|
|
221
|
+
nodes: [{ asi: 'indirectseller.com', sid: '00001', hp: 1 }],
|
|
222
|
+
};
|
|
223
|
+
bidRequests[0].schain = schain;
|
|
224
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
225
|
+
expect(request.data.params).to.be.an('object');
|
|
226
|
+
expect(request.data.params).to.have.property('schain', '1.0,1!indirectseller.com,00001,1,,,');
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it('should set flooPrice to getFloor.floor value if it is greater than params.floorPrice', function() {
|
|
230
|
+
const bid = utils.deepClone(bidRequests[0]);
|
|
231
|
+
bid.getFloor = () => {
|
|
232
|
+
return {
|
|
233
|
+
currency: 'USD',
|
|
234
|
+
floor: 3.32
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
bid.params.floorPrice = 0.64;
|
|
238
|
+
const request = spec.buildRequests([bid], bidderRequest);
|
|
239
|
+
expect(request.data.bids[0]).to.be.an('object');
|
|
240
|
+
expect(request.data.bids[0]).to.have.property('floorPrice', 3.32);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it('should set floorPrice to params.floorPrice value if it is greater than getFloor.floor', function() {
|
|
244
|
+
const bid = utils.deepClone(bidRequests[0]);
|
|
245
|
+
bid.getFloor = () => {
|
|
246
|
+
return {
|
|
247
|
+
currency: 'USD',
|
|
248
|
+
floor: 0.8
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
bid.params.floorPrice = 1.5;
|
|
252
|
+
const request = spec.buildRequests([bid], bidderRequest);
|
|
253
|
+
expect(request.data.bids[0]).to.be.an('object');
|
|
254
|
+
expect(request.data.bids[0]).to.have.property('floorPrice', 1.5);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it('should check sua param in bid request', function() {
|
|
258
|
+
const sua = {
|
|
259
|
+
'platform': {
|
|
260
|
+
'brand': 'macOS',
|
|
261
|
+
'version': ['12', '4', '0']
|
|
262
|
+
},
|
|
263
|
+
'browsers': [
|
|
264
|
+
{
|
|
265
|
+
'brand': 'Chromium',
|
|
266
|
+
'version': [ '106', '0', '5249', '119' ]
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
'brand': 'Google Chrome',
|
|
270
|
+
'version': [ '106', '0', '5249', '119' ]
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
'brand': 'Not;A=Brand',
|
|
274
|
+
'version': [ '99', '0', '0', '0' ]
|
|
275
|
+
}
|
|
276
|
+
],
|
|
277
|
+
'mobile': 0,
|
|
278
|
+
'model': '',
|
|
279
|
+
'bitness': '64',
|
|
280
|
+
'architecture': 'x86'
|
|
281
|
+
}
|
|
282
|
+
const bid = utils.deepClone(bidRequests[0]);
|
|
283
|
+
bid.ortb2 = {
|
|
284
|
+
'device': {
|
|
285
|
+
'sua': {
|
|
286
|
+
'platform': {
|
|
287
|
+
'brand': 'macOS',
|
|
288
|
+
'version': [ '12', '4', '0' ]
|
|
289
|
+
},
|
|
290
|
+
'browsers': [
|
|
291
|
+
{
|
|
292
|
+
'brand': 'Chromium',
|
|
293
|
+
'version': [ '106', '0', '5249', '119' ]
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
'brand': 'Google Chrome',
|
|
297
|
+
'version': [ '106', '0', '5249', '119' ]
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
'brand': 'Not;A=Brand',
|
|
301
|
+
'version': [ '99', '0', '0', '0' ]
|
|
302
|
+
}
|
|
303
|
+
],
|
|
304
|
+
'mobile': 0,
|
|
305
|
+
'model': '',
|
|
306
|
+
'bitness': '64',
|
|
307
|
+
'architecture': 'x86'
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
const requestWithSua = spec.buildRequests([bid], bidderRequest);
|
|
312
|
+
const data = requestWithSua.data;
|
|
313
|
+
expect(data.bids[0].sua).to.exist;
|
|
314
|
+
expect(data.bids[0].sua).to.deep.equal(sua);
|
|
315
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
316
|
+
expect(request.data.bids[0].sua).to.not.exist;
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
describe('COPPA Param', function() {
|
|
320
|
+
it('should set coppa equal 0 in bid request if coppa is set to false', function() {
|
|
321
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
322
|
+
expect(request.data.bids[0].coppa).to.be.equal(0);
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
it('should set coppa equal 1 in bid request if coppa is set to true', function() {
|
|
326
|
+
const bid = utils.deepClone(bidRequests[0]);
|
|
327
|
+
bid.ortb2 = {
|
|
328
|
+
'regs': {
|
|
329
|
+
'coppa': true,
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
const request = spec.buildRequests([bid], bidderRequest);
|
|
333
|
+
expect(request.data.bids[0].coppa).to.be.equal(1);
|
|
334
|
+
});
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
describe('interpretResponse', function () {
|
|
339
|
+
const response = {
|
|
340
|
+
params: {
|
|
341
|
+
currency: 'USD',
|
|
342
|
+
netRevenue: true,
|
|
343
|
+
},
|
|
344
|
+
bids: [
|
|
345
|
+
{
|
|
346
|
+
cpm: 12.5,
|
|
347
|
+
ad: '"<img src=\"https://...\"/>"',
|
|
348
|
+
width: 300,
|
|
349
|
+
height: 250,
|
|
350
|
+
requestId: '21e12606d47ba7',
|
|
351
|
+
adomain: ['abc.com'],
|
|
352
|
+
mediaType: BANNER,
|
|
353
|
+
campId: '65902db45721d690ee0bc8c3'
|
|
354
|
+
}]
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
const expectedBannerResponse = {
|
|
358
|
+
requestId: '21e12606d47ba7',
|
|
359
|
+
cpm: 12.5,
|
|
360
|
+
currency: 'USD',
|
|
361
|
+
width: 300,
|
|
362
|
+
height: 250,
|
|
363
|
+
ttl: TTL,
|
|
364
|
+
creativeId: '639153ddd0s443',
|
|
365
|
+
netRevenue: true,
|
|
366
|
+
nurl: 'http://example.com/win/1234',
|
|
367
|
+
mediaType: BANNER,
|
|
368
|
+
meta: {
|
|
369
|
+
mediaType: BANNER,
|
|
370
|
+
ad_key: '9b5e00f2-8831-4efa-a933-c4f68710ffc0'
|
|
371
|
+
},
|
|
372
|
+
ad: '"<img src=\"https://...\"/>"',
|
|
373
|
+
campId: '65902db45721d690ee0bc8c3',
|
|
374
|
+
bidder: 'publir'
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
it('should get correct bid response', function () {
|
|
378
|
+
const result = spec.interpretResponse({ body: response });
|
|
379
|
+
expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedBannerResponse));
|
|
380
|
+
});
|
|
381
|
+
})
|
|
382
|
+
|
|
383
|
+
describe('getUserSyncs', function() {
|
|
384
|
+
const imageSyncResponse = {
|
|
385
|
+
body: {
|
|
386
|
+
params: {
|
|
387
|
+
userSyncPixels: [
|
|
388
|
+
'https://image-sync-url.test/1',
|
|
389
|
+
'https://image-sync-url.test/2',
|
|
390
|
+
'https://image-sync-url.test/3'
|
|
391
|
+
]
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
const iframeSyncResponse = {
|
|
397
|
+
body: {
|
|
398
|
+
params: {
|
|
399
|
+
userSyncURL: 'https://iframe-sync-url.test'
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
it('should register all img urls from the response', function() {
|
|
405
|
+
const syncs = spec.getUserSyncs({ pixelEnabled: true }, [imageSyncResponse]);
|
|
406
|
+
expect(syncs).to.deep.equal([
|
|
407
|
+
{
|
|
408
|
+
type: 'image',
|
|
409
|
+
url: 'https://image-sync-url.test/1'
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
type: 'image',
|
|
413
|
+
url: 'https://image-sync-url.test/2'
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
type: 'image',
|
|
417
|
+
url: 'https://image-sync-url.test/3'
|
|
418
|
+
}
|
|
419
|
+
]);
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
it('should register the iframe url from the response', function() {
|
|
423
|
+
const syncs = spec.getUserSyncs({ iframeEnabled: true }, [iframeSyncResponse]);
|
|
424
|
+
expect(syncs).to.deep.equal([
|
|
425
|
+
{
|
|
426
|
+
type: 'iframe',
|
|
427
|
+
url: 'https://iframe-sync-url.test'
|
|
428
|
+
}
|
|
429
|
+
]);
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
it('should register both image and iframe urls from the responses', function() {
|
|
433
|
+
const syncs = spec.getUserSyncs({ pixelEnabled: true, iframeEnabled: true }, [iframeSyncResponse, imageSyncResponse]);
|
|
434
|
+
expect(syncs).to.deep.equal([
|
|
435
|
+
{
|
|
436
|
+
type: 'iframe',
|
|
437
|
+
url: 'https://iframe-sync-url.test'
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
type: 'image',
|
|
441
|
+
url: 'https://image-sync-url.test/1'
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
type: 'image',
|
|
445
|
+
url: 'https://image-sync-url.test/2'
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
type: 'image',
|
|
449
|
+
url: 'https://image-sync-url.test/3'
|
|
450
|
+
}
|
|
451
|
+
]);
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
it('should handle an empty response', function() {
|
|
455
|
+
const syncs = spec.getUserSyncs({ iframeEnabled: true }, []);
|
|
456
|
+
expect(syncs).to.deep.equal([]);
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
it('should handle when user syncs are disabled', function() {
|
|
460
|
+
const syncs = spec.getUserSyncs({ pixelEnabled: false }, [imageSyncResponse]);
|
|
461
|
+
expect(syncs).to.deep.equal([]);
|
|
462
|
+
});
|
|
463
|
+
})
|
|
464
|
+
|
|
465
|
+
describe('onBidWon', function() {
|
|
466
|
+
beforeEach(function() {
|
|
467
|
+
sinon.stub(utils, 'triggerPixel');
|
|
468
|
+
});
|
|
469
|
+
afterEach(function() {
|
|
470
|
+
utils.triggerPixel.restore();
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
it('Should trigger pixel if bid nurl', function() {
|
|
474
|
+
const bid = {
|
|
475
|
+
'bidder': spec.code,
|
|
476
|
+
'adUnitCode': 'adunit-code',
|
|
477
|
+
'sizes': [['640', '480']],
|
|
478
|
+
'nurl': 'http://example.com/win/1234',
|
|
479
|
+
'params': {
|
|
480
|
+
'pubId': 'jdye8weeyirk00000001'
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
spec.onBidWon(bid);
|
|
485
|
+
expect(utils.triggerPixel.callCount).to.equal(1)
|
|
486
|
+
})
|
|
487
|
+
})
|
|
488
|
+
});
|
|
@@ -100,7 +100,7 @@ const BID2 = Object.assign({}, BID, {
|
|
|
100
100
|
adserverTargeting: {
|
|
101
101
|
'hb_bidder': 'pubmatic',
|
|
102
102
|
'hb_adid': '3bd4ebb1c900e2',
|
|
103
|
-
'hb_pb':
|
|
103
|
+
'hb_pb': 1.50,
|
|
104
104
|
'hb_size': '728x90',
|
|
105
105
|
'hb_source': 'server'
|
|
106
106
|
},
|
|
@@ -606,6 +606,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
606
606
|
expect(data.s[0].ps[0].ocpm).to.equal(1.23);
|
|
607
607
|
expect(data.s[0].ps[0].ocry).to.equal('USD');
|
|
608
608
|
expect(data.s[0].ps[0].frv).to.equal(1.1);
|
|
609
|
+
expect(data.s[0].ps[0].pb).to.equal(1.2);
|
|
609
610
|
// slot 2
|
|
610
611
|
expect(data.s[1].sn).to.equal('/19968336/header-bid-tag-1');
|
|
611
612
|
expect(data.s[1].fskp).to.equal(0);
|
|
@@ -640,6 +641,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
640
641
|
expect(data.s[1].ps[0].ocpm).to.equal(1.52);
|
|
641
642
|
expect(data.s[1].ps[0].ocry).to.equal('USD');
|
|
642
643
|
expect(data.s[1].ps[0].frv).to.equal(1.1);
|
|
644
|
+
expect(data.s[1].ps[0].pb).to.equal(1.50);
|
|
643
645
|
|
|
644
646
|
// tracker slot1
|
|
645
647
|
let firstTracker = requests[0].url;
|
|
@@ -812,6 +814,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
812
814
|
expect(data.s[0].ps[0].ocpm).to.equal(1.23);
|
|
813
815
|
expect(data.s[0].ps[0].ocry).to.equal('USD');
|
|
814
816
|
expect(data.s[1].ps[0].frv).to.equal(1.1);
|
|
817
|
+
expect(data.s[1].ps[0].pb).to.equal(1.50);
|
|
815
818
|
// tracker slot1
|
|
816
819
|
let firstTracker = requests[0].url;
|
|
817
820
|
expect(firstTracker.split('?')[0]).to.equal('https://t.pubmatic.com/wt');
|
|
@@ -1035,6 +1038,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
1035
1038
|
expect(data.s[1].ps[0].ocpm).to.equal(1.52);
|
|
1036
1039
|
expect(data.s[1].ps[0].ocry).to.equal('USD');
|
|
1037
1040
|
expect(data.s[1].ps[0].frv).to.equal(1.1);
|
|
1041
|
+
expect(data.s[1].ps[0].pb).to.equal(1.50);
|
|
1038
1042
|
});
|
|
1039
1043
|
|
|
1040
1044
|
it('Logger: currency conversion check', function() {
|
|
@@ -1149,6 +1153,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
1149
1153
|
expect(data.s[1].ps[0].ocpm).to.equal(1.52);
|
|
1150
1154
|
expect(data.s[1].ps[0].ocry).to.equal('USD');
|
|
1151
1155
|
expect(data.s[1].ps[0].frv).to.equal(1.1);
|
|
1156
|
+
expect(data.s[1].ps[0].pb).to.equal(1.50);
|
|
1152
1157
|
expect(data.dvc).to.deep.equal({'plt': 2});
|
|
1153
1158
|
// respective tracker slot
|
|
1154
1159
|
let firstTracker = requests[1].url;
|
|
@@ -1209,6 +1214,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
1209
1214
|
expect(data.s[1].ps[0].ocry).to.equal('USD');
|
|
1210
1215
|
expect(data.dvc).to.deep.equal({'plt': 1});
|
|
1211
1216
|
expect(data.s[1].ps[0].frv).to.equal(1.1);
|
|
1217
|
+
expect(data.s[1].ps[0].pb).to.equal(1.50);
|
|
1212
1218
|
// respective tracker slot
|
|
1213
1219
|
let firstTracker = requests[1].url;
|
|
1214
1220
|
expect(firstTracker.split('?')[0]).to.equal('https://t.pubmatic.com/wt');
|
|
@@ -1267,6 +1273,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
1267
1273
|
expect(data.s[1].ps[0].ocpm).to.equal(1.52);
|
|
1268
1274
|
expect(data.s[1].ps[0].ocry).to.equal('USD');
|
|
1269
1275
|
expect(data.s[1].ps[0].frv).to.equal(1.1);
|
|
1276
|
+
expect(data.s[1].ps[0].pb).to.equal(1.50);
|
|
1270
1277
|
// respective tracker slot
|
|
1271
1278
|
let firstTracker = requests[1].url;
|
|
1272
1279
|
expect(firstTracker.split('?')[0]).to.equal('https://t.pubmatic.com/wt');
|
|
@@ -1388,6 +1395,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
1388
1395
|
expect(data.s[1].ps[0].ocpm).to.equal(1.52);
|
|
1389
1396
|
expect(data.s[1].ps[0].ocry).to.equal('USD');
|
|
1390
1397
|
expect(data.s[1].ps[0].frv).to.equal(1.1);
|
|
1398
|
+
expect(data.s[1].ps[0].pb).to.equal(1.50);
|
|
1391
1399
|
});
|
|
1392
1400
|
|
|
1393
1401
|
it('Logger: best case + win tracker in case of Bidder Aliases', function() {
|
|
@@ -1466,6 +1474,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
1466
1474
|
expect(data.s[0].ps[0].ocpm).to.equal(1.23);
|
|
1467
1475
|
expect(data.s[0].ps[0].ocry).to.equal('USD');
|
|
1468
1476
|
expect(data.s[0].ps[0].frv).to.equal(1.1);
|
|
1477
|
+
expect(data.s[0].ps[0].pb).to.equal(1.2);
|
|
1469
1478
|
|
|
1470
1479
|
// slot 2
|
|
1471
1480
|
expect(data.s[1].sn).to.equal('/19968336/header-bid-tag-1');
|
|
@@ -1501,6 +1510,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
1501
1510
|
expect(data.s[1].ps[0].ocpm).to.equal(1.52);
|
|
1502
1511
|
expect(data.s[1].ps[0].ocry).to.equal('USD');
|
|
1503
1512
|
expect(data.s[1].ps[0].frv).to.equal(1.1);
|
|
1513
|
+
expect(data.s[1].ps[0].pb).to.equal(1.50);
|
|
1504
1514
|
|
|
1505
1515
|
// tracker slot1
|
|
1506
1516
|
let firstTracker = requests[0].url;
|
|
@@ -1596,6 +1606,7 @@ describe('pubmatic analytics adapter', function () {
|
|
|
1596
1606
|
expect(data.s[0].ps[0].ocpm).to.equal(1.23);
|
|
1597
1607
|
expect(data.s[0].ps[0].ocry).to.equal('USD');
|
|
1598
1608
|
expect(data.s[0].ps[0].frv).to.equal(1.1);
|
|
1609
|
+
expect(data.s[0].ps[0].pb).to.equal(1.2);
|
|
1599
1610
|
|
|
1600
1611
|
// slot 2
|
|
1601
1612
|
expect(data.s[1].sn).to.equal('/19968336/header-bid-tag-1');
|