prebid.js 5.18.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc.js +1 -10
- package/README.md +3 -1
- package/browsers.json +1 -8
- package/gulpfile.js +1 -0
- package/integrationExamples/gpt/akamaidap_segments_example.html +132 -0
- package/modules/.submodules.json +1 -0
- package/modules/adfBidAdapter.js +21 -16
- package/modules/adheseBidAdapter.js +7 -2
- package/modules/adkernelBidAdapter.js +1 -0
- package/modules/adlivetechBidAdapter.md +61 -0
- package/modules/adomikAnalyticsAdapter.js +10 -4
- package/modules/adtelligentBidAdapter.js +2 -1
- package/modules/airgridRtdProvider.js +1 -1
- package/modules/akamaiDapRtdProvider.js +474 -0
- package/modules/akamaiDapRtdProvider.md +47 -0
- package/modules/appnexusBidAdapter.js +9 -3
- package/modules/atsAnalyticsAdapter.js +67 -46
- package/modules/atsAnalyticsAdapter.md +1 -0
- package/modules/betweenBidAdapter.js +20 -3
- package/modules/browsiRtdProvider.js +106 -18
- package/modules/cleanioRtdProvider.js +192 -0
- package/modules/cleanioRtdProvider.md +59 -0
- package/modules/codefuelBidAdapter.js +181 -0
- package/modules/codefuelBidAdapter.md +111 -0
- package/modules/connectIdSystem.js +104 -0
- package/modules/connectIdSystem.md +33 -0
- package/modules/datablocksBidAdapter.js +3 -3
- package/modules/deepintentBidAdapter.js +107 -10
- package/modules/deepintentBidAdapter.md +36 -1
- package/modules/deltaprojectsBidAdapter.js +252 -0
- package/modules/deltaprojectsBidAdapter.md +32 -0
- package/modules/engageyaBidAdapter.js +171 -0
- package/modules/glimpseBidAdapter.js +31 -16
- package/modules/gptPreAuction.js +11 -5
- package/modules/gridBidAdapter.js +1 -0
- package/modules/gumgumBidAdapter.js +8 -0
- package/modules/id5IdSystem.md +6 -6
- package/modules/imRtdProvider.js +31 -0
- package/modules/inskinBidAdapter.js +7 -3
- package/modules/ixBidAdapter.js +174 -22
- package/modules/jixieBidAdapter.js +8 -2
- package/modules/justpremiumBidAdapter.js +6 -1
- package/modules/limelightDigitalBidAdapter.js +22 -2
- package/modules/livewrappedAnalyticsAdapter.js +49 -1
- package/modules/merkleIdSystem.js +5 -0
- package/modules/multibid/index.js +3 -3
- package/modules/nativoBidAdapter.js +32 -2
- package/modules/nextMillenniumBidAdapter.js +12 -3
- package/modules/oguryBidAdapter.js +16 -2
- package/modules/openxBidAdapter.js +40 -23
- package/modules/operaadsBidAdapter.js +21 -1
- package/modules/otmBidAdapter.js +146 -0
- package/modules/otmBidAdapter.md +27 -26
- package/modules/outbrainBidAdapter.js +5 -0
- package/modules/playwireBidAdapter.md +61 -0
- package/modules/prebidServerBidAdapter/index.js +3 -3
- package/modules/publinkIdSystem.js +11 -6
- package/modules/pubmaticBidAdapter.js +2 -0
- package/modules/rtdModule/index.js +2 -2
- package/modules/saambaaBidAdapter.js +420 -0
- package/modules/saambaaBidAdapter.md +65 -68
- package/modules/seedtagBidAdapter.js +6 -0
- package/modules/smaatoBidAdapter.js +6 -1
- package/modules/sonobiBidAdapter.js +7 -0
- package/modules/sortableBidAdapter.js +1 -0
- package/modules/sspBCBidAdapter.js +34 -3
- package/modules/teadsBidAdapter.js +3 -0
- package/modules/tripleliftBidAdapter.js +22 -5
- package/modules/trustxBidAdapter.js +18 -7
- package/modules/undertoneBidAdapter.js +9 -5
- package/modules/undertoneBidAdapter.md +5 -1
- package/modules/userId/eids.js +18 -0
- package/modules/userId/eids.md +7 -0
- package/modules/userId/userId.md +12 -0
- package/modules/ventesBidAdapter.js +370 -0
- package/modules/ventesBidAdapter.md +94 -0
- package/modules/videobyteBidAdapter.js +13 -6
- package/modules/videobyteBidAdapter.md +49 -0
- package/modules/vidoomyBidAdapter.js +51 -100
- package/modules/visxBidAdapter.js +1 -1
- package/modules/yahoosspBidAdapter.js +6 -6
- package/modules/yieldlabBidAdapter.js +41 -10
- package/modules/yieldlabBidAdapter.md +91 -48
- package/modules/yieldmoSyntheticInventoryModule.js +46 -0
- package/modules/yieldmoSyntheticInventoryModule.md +68 -0
- package/package.json +6 -1
- package/src/adapterManager.js +19 -8
- package/src/adapters/bidderFactory.js +4 -3
- package/src/auction.js +11 -11
- package/src/constants.json +1 -0
- package/src/secureCreatives.js +6 -7
- package/src/targeting.js +11 -9
- package/test/spec/modules/adfBidAdapter_spec.js +83 -29
- package/test/spec/modules/adheseBidAdapter_spec.js +27 -1
- package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
- package/test/spec/modules/adtelligentBidAdapter_spec.js +1 -0
- package/test/spec/modules/akamaiDapRtdProvider_spec.js +246 -0
- package/test/spec/modules/appnexusBidAdapter_spec.js +16 -1
- package/test/spec/modules/atsAnalyticsAdapter_spec.js +42 -9
- package/test/spec/modules/betweenBidAdapter_spec.js +41 -0
- package/test/spec/modules/browsiRtdProvider_spec.js +62 -7
- package/test/spec/modules/cleanioRtdProvider_spec.js +188 -0
- package/test/spec/modules/codefuelBidAdapter_spec.js +316 -0
- package/test/spec/modules/connectIdSystem_spec.js +189 -0
- package/test/spec/modules/datablocksBidAdapter_spec.js +3 -3
- package/test/spec/modules/deepintentBidAdapter_spec.js +153 -3
- package/test/spec/modules/deltaprojectsBidAdapter_spec.js +399 -0
- package/test/spec/modules/engageyaBidAdapter_spec.js +422 -0
- package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
- package/test/spec/modules/glimpseBidAdapter_spec.js +33 -0
- package/test/spec/modules/gptPreAuction_spec.js +58 -4
- package/test/spec/modules/gumgumBidAdapter_spec.js +5 -1
- package/test/spec/modules/imRtdProvider_spec.js +25 -0
- package/test/spec/modules/ixBidAdapter_spec.js +298 -5
- package/test/spec/modules/jixieBidAdapter_spec.js +13 -11
- package/test/spec/modules/justpremiumBidAdapter_spec.js +9 -2
- package/test/spec/modules/konduitWrapper_spec.js +0 -1
- package/test/spec/modules/limelightDigitalBidAdapter_spec.js +155 -1
- package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +52 -7
- package/test/spec/modules/merkleIdSystem_spec.js +18 -0
- package/test/spec/modules/multibid_spec.js +31 -31
- package/test/spec/modules/nativoBidAdapter_spec.js +35 -18
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +13 -1
- package/test/spec/modules/oguryBidAdapter_spec.js +66 -23
- package/test/spec/modules/openxBidAdapter_spec.js +90 -13
- package/test/spec/modules/operaadsBidAdapter_spec.js +38 -6
- package/test/spec/modules/otmBidAdapter_spec.js +67 -0
- package/test/spec/modules/outbrainBidAdapter_spec.js +18 -0
- package/test/spec/modules/prebidServerBidAdapter_spec.js +19 -2
- package/test/spec/modules/publinkIdSystem_spec.js +6 -6
- package/test/spec/modules/seedtagBidAdapter_spec.js +3 -0
- package/test/spec/modules/smaatoBidAdapter_spec.js +30 -0
- package/test/spec/modules/sonobiBidAdapter_spec.js +34 -1
- package/test/spec/modules/sortableBidAdapter_spec.js +11 -0
- package/test/spec/modules/sspBCBidAdapter_spec.js +33 -3
- package/test/spec/modules/teadsBidAdapter_spec.js +132 -0
- package/test/spec/modules/tripleliftBidAdapter_spec.js +128 -0
- package/test/spec/modules/trustxBidAdapter_spec.js +45 -3
- package/test/spec/modules/undertoneBidAdapter_spec.js +52 -0
- package/test/spec/modules/ventesBidAdapter_spec.js +845 -0
- package/test/spec/modules/videobyteBidAdapter_spec.js +2 -2
- package/test/spec/modules/vidoomyBidAdapter_spec.js +32 -13
- package/test/spec/modules/visxBidAdapter_spec.js +1 -1
- package/test/spec/modules/yieldlabBidAdapter_spec.js +81 -0
- package/test/spec/modules/yieldmoSyntheticInventoryModule_spec.js +89 -0
- package/test/spec/unit/core/adapterManager_spec.js +56 -6
- package/test/spec/unit/core/bidderFactory_spec.js +61 -1
- package/test/spec/unit/pbjs_api_spec.js +37 -2
- package/test/spec/unit/secureCreatives_spec.js +54 -25
- package/wdio.conf.js +1 -1
|
@@ -8,7 +8,7 @@ Maintainer: prebid@deepintent.com
|
|
|
8
8
|
|
|
9
9
|
# Description
|
|
10
10
|
|
|
11
|
-
Deepintent currently supports the BANNER type ads through prebid js
|
|
11
|
+
Deepintent currently supports the BANNER and VIDEO type ads through prebid js
|
|
12
12
|
|
|
13
13
|
Module that connects to Deepintent's demand sources.
|
|
14
14
|
|
|
@@ -40,6 +40,41 @@ Module that connects to Deepintent's demand sources.
|
|
|
40
40
|
];
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
# Sample Video Ad Unit
|
|
44
|
+
```
|
|
45
|
+
var adVideoAdUnits = [
|
|
46
|
+
{
|
|
47
|
+
code: 'test-div-video',
|
|
48
|
+
mediaTypes: {
|
|
49
|
+
video: {
|
|
50
|
+
playerSize: [640, 480], // required
|
|
51
|
+
context: 'instream' //required
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
bids: [{
|
|
55
|
+
bidder: 'deepintent',
|
|
56
|
+
params: {
|
|
57
|
+
tagId: '1300', // Required parameter // required
|
|
58
|
+
video: {
|
|
59
|
+
mimes: ['video/mp4','video/x-flv'], // required
|
|
60
|
+
skippable: true, // optional
|
|
61
|
+
minduration: 5, // optional
|
|
62
|
+
maxduration: 30, // optional
|
|
63
|
+
startdelay: 5, // optional
|
|
64
|
+
playbackmethod: [1,3], // optional
|
|
65
|
+
api: [ 1, 2 ], // optional
|
|
66
|
+
protocols: [ 2, 3 ], // optional
|
|
67
|
+
battr: [ 13, 14 ], // optional
|
|
68
|
+
linearity: 1, // optional
|
|
69
|
+
placement: 2, // optional
|
|
70
|
+
minbitrate: 10, // optional
|
|
71
|
+
maxbitrate: 10 // optional
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}]
|
|
75
|
+
}]
|
|
76
|
+
```
|
|
77
|
+
|
|
43
78
|
###Recommended User Sync Configuration
|
|
44
79
|
|
|
45
80
|
```javascript
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { registerBidder } from '../src/adapters/bidderFactory.js';
|
|
2
|
+
import { BANNER } from '../src/mediaTypes.js';
|
|
3
|
+
import {
|
|
4
|
+
_each, _map, isFn, isNumber, createTrackPixelHtml, deepAccess, parseUrl, logWarn, logError
|
|
5
|
+
} from '../src/utils.js';
|
|
6
|
+
import {config} from '../src/config.js';
|
|
7
|
+
|
|
8
|
+
export const BIDDER_CODE = 'deltaprojects';
|
|
9
|
+
export const BIDDER_ENDPOINT_URL = 'https://d5p.de17a.com/dogfight/prebid';
|
|
10
|
+
export const USERSYNC_URL = 'https://userservice.de17a.com/getuid/prebid';
|
|
11
|
+
|
|
12
|
+
/** -- isBidRequestValid --**/
|
|
13
|
+
function isBidRequestValid(bid) {
|
|
14
|
+
if (!bid) return false;
|
|
15
|
+
|
|
16
|
+
if (bid.bidder !== BIDDER_CODE) return false;
|
|
17
|
+
|
|
18
|
+
// publisher id is required
|
|
19
|
+
const publisherId = deepAccess(bid, 'params.publisherId')
|
|
20
|
+
if (!publisherId) {
|
|
21
|
+
logError('Invalid bid request, missing publisher id in params');
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** -- Build requests --**/
|
|
29
|
+
function buildRequests(validBidRequests, bidderRequest) {
|
|
30
|
+
/** == shared ==**/
|
|
31
|
+
// -- build id
|
|
32
|
+
const id = bidderRequest.auctionId;
|
|
33
|
+
|
|
34
|
+
// -- build site
|
|
35
|
+
const loc = parseUrl(bidderRequest.refererInfo.referer);
|
|
36
|
+
const publisherId = setOnAny(validBidRequests, 'params.publisherId');
|
|
37
|
+
const siteId = setOnAny(validBidRequests, 'params.siteId');
|
|
38
|
+
const site = {
|
|
39
|
+
id: siteId,
|
|
40
|
+
domain: loc.hostname,
|
|
41
|
+
page: loc.href,
|
|
42
|
+
ref: loc.href,
|
|
43
|
+
publisher: { id: publisherId },
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// -- build device
|
|
47
|
+
const ua = navigator.userAgent;
|
|
48
|
+
const device = {
|
|
49
|
+
ua,
|
|
50
|
+
w: screen.width,
|
|
51
|
+
h: screen.height
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// -- build user, reg
|
|
55
|
+
let user = { ext: {} };
|
|
56
|
+
const regs = { ext: {} };
|
|
57
|
+
const gdprConsent = bidderRequest && bidderRequest.gdprConsent;
|
|
58
|
+
if (gdprConsent) {
|
|
59
|
+
user.ext = { consent: gdprConsent.consentString };
|
|
60
|
+
if (typeof gdprConsent.gdprApplies == 'boolean') {
|
|
61
|
+
regs.ext.gdpr = gdprConsent.gdprApplies ? 1 : 0
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// -- build tmax
|
|
66
|
+
let tmax = (bidderRequest && bidderRequest.timeout > 0) ? bidderRequest.timeout : undefined;
|
|
67
|
+
|
|
68
|
+
// build bid specific
|
|
69
|
+
return validBidRequests.map(validBidRequest => {
|
|
70
|
+
const openRTBRequest = buildOpenRTBRequest(validBidRequest, id, site, device, user, tmax, regs);
|
|
71
|
+
return {
|
|
72
|
+
method: 'POST',
|
|
73
|
+
url: BIDDER_ENDPOINT_URL,
|
|
74
|
+
data: openRTBRequest,
|
|
75
|
+
options: { contentType: 'application/json' },
|
|
76
|
+
bids: [validBidRequest],
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function buildOpenRTBRequest(validBidRequest, id, site, device, user, tmax, regs) {
|
|
82
|
+
// build cur
|
|
83
|
+
const currency = config.getConfig('currency.adServerCurrency') || deepAccess(validBidRequest, 'params.currency');
|
|
84
|
+
const cur = currency && [currency];
|
|
85
|
+
|
|
86
|
+
// build impression
|
|
87
|
+
const impression = buildImpression(validBidRequest, currency);
|
|
88
|
+
|
|
89
|
+
// build test
|
|
90
|
+
const test = deepAccess(validBidRequest, 'params.test') ? 1 : 0
|
|
91
|
+
|
|
92
|
+
const at = 1
|
|
93
|
+
|
|
94
|
+
// build source
|
|
95
|
+
const source = {
|
|
96
|
+
tid: validBidRequest.transactionId,
|
|
97
|
+
fd: 1,
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
id,
|
|
102
|
+
at,
|
|
103
|
+
imp: [impression],
|
|
104
|
+
site,
|
|
105
|
+
device,
|
|
106
|
+
user,
|
|
107
|
+
test,
|
|
108
|
+
tmax,
|
|
109
|
+
cur,
|
|
110
|
+
source,
|
|
111
|
+
regs,
|
|
112
|
+
ext: {},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function buildImpression(bid, currency) {
|
|
117
|
+
const impression = {
|
|
118
|
+
id: bid.bidId,
|
|
119
|
+
tagid: bid.params.tagId,
|
|
120
|
+
ext: {},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const bannerMediaType = deepAccess(bid, `mediaTypes.${BANNER}`);
|
|
124
|
+
impression.banner = buildImpressionBanner(bid, bannerMediaType);
|
|
125
|
+
|
|
126
|
+
// bid floor
|
|
127
|
+
const bidFloor = getBidFloor(bid, BANNER, '*', currency);
|
|
128
|
+
if (bidFloor) {
|
|
129
|
+
impression.bidfloor = bidFloor.floor;
|
|
130
|
+
impression.bidfloorcur = bidFloor.currency;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return impression;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function buildImpressionBanner(bid, bannerMediaType) {
|
|
137
|
+
const bannerSizes = (bannerMediaType && bannerMediaType.sizes) || bid.sizes;
|
|
138
|
+
return {
|
|
139
|
+
format: _map(bannerSizes, ([width, height]) => ({ w: width, h: height })),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** -- Interpret response --**/
|
|
144
|
+
function interpretResponse(serverResponse) {
|
|
145
|
+
if (!serverResponse.body) {
|
|
146
|
+
logWarn('Response body is invalid, return !!');
|
|
147
|
+
return [];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const { body: { id, seatbid, cur } } = serverResponse;
|
|
151
|
+
if (!id || !seatbid) {
|
|
152
|
+
logWarn('Id / seatbid of response is invalid, return !!');
|
|
153
|
+
return [];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const bidResponses = [];
|
|
157
|
+
|
|
158
|
+
_each(seatbid, seatbid => {
|
|
159
|
+
_each(seatbid.bid, bid => {
|
|
160
|
+
const bidObj = {
|
|
161
|
+
requestId: bid.impid,
|
|
162
|
+
cpm: parseFloat(bid.price),
|
|
163
|
+
width: parseInt(bid.w),
|
|
164
|
+
height: parseInt(bid.h),
|
|
165
|
+
creativeId: bid.crid || bid.id,
|
|
166
|
+
dealId: bid.dealid || null,
|
|
167
|
+
currency: cur,
|
|
168
|
+
netRevenue: true,
|
|
169
|
+
ttl: 60,
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
bidObj.mediaType = BANNER;
|
|
173
|
+
bidObj.ad = bid.adm;
|
|
174
|
+
if (bid.nurl) {
|
|
175
|
+
bidObj.ad += createTrackPixelHtml(decodeURIComponent(bid.nurl));
|
|
176
|
+
}
|
|
177
|
+
if (bid.ext) {
|
|
178
|
+
bidObj[BIDDER_CODE] = bid.ext;
|
|
179
|
+
}
|
|
180
|
+
bidResponses.push(bidObj);
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
return bidResponses;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** -- On Bid Won -- **/
|
|
187
|
+
function onBidWon(bid) {
|
|
188
|
+
let cpm = bid.cpm;
|
|
189
|
+
if (bid.currency && bid.currency !== bid.originalCurrency && typeof bid.getCpmInNewCurrency === 'function') {
|
|
190
|
+
cpm = bid.getCpmInNewCurrency(bid.originalCurrency);
|
|
191
|
+
}
|
|
192
|
+
const wonPrice = Math.round(cpm * 1000000);
|
|
193
|
+
const wonPriceMacroPatten = /\$\{AUCTION_PRICE:B64\}/g;
|
|
194
|
+
bid.ad = bid.ad.replace(wonPriceMacroPatten, wonPrice);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** -- Get user syncs --**/
|
|
198
|
+
function getUserSyncs(syncOptions, serverResponses, gdprConsent) {
|
|
199
|
+
const syncs = []
|
|
200
|
+
|
|
201
|
+
if (syncOptions.pixelEnabled) {
|
|
202
|
+
let gdprParams;
|
|
203
|
+
if (gdprConsent) {
|
|
204
|
+
if (typeof gdprConsent.gdprApplies === 'boolean') {
|
|
205
|
+
gdprParams = `?gdpr=${Number(gdprConsent.gdprApplies)}&gdpr_consent=${gdprConsent.consentString}`;
|
|
206
|
+
} else {
|
|
207
|
+
gdprParams = `?gdpr_consent=${gdprConsent.consentString}`;
|
|
208
|
+
}
|
|
209
|
+
} else {
|
|
210
|
+
gdprParams = '';
|
|
211
|
+
}
|
|
212
|
+
syncs.push({
|
|
213
|
+
type: 'image',
|
|
214
|
+
url: USERSYNC_URL + gdprParams
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
return syncs;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** -- Get bid floor --**/
|
|
221
|
+
export function getBidFloor(bid, mediaType, size, currency) {
|
|
222
|
+
if (isFn(bid.getFloor)) {
|
|
223
|
+
const bidFloorCurrency = currency || 'USD';
|
|
224
|
+
const bidFloor = bid.getFloor({currency: bidFloorCurrency, mediaType: mediaType, size: size});
|
|
225
|
+
if (isNumber(bidFloor.floor)) {
|
|
226
|
+
return bidFloor;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** -- Helper methods --**/
|
|
232
|
+
function setOnAny(collection, key) {
|
|
233
|
+
for (let i = 0, result; i < collection.length; i++) {
|
|
234
|
+
result = deepAccess(collection[i], key);
|
|
235
|
+
if (result) {
|
|
236
|
+
return result;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** -- Register -- */
|
|
242
|
+
export const spec = {
|
|
243
|
+
code: BIDDER_CODE,
|
|
244
|
+
supportedMediaTypes: [BANNER],
|
|
245
|
+
isBidRequestValid,
|
|
246
|
+
buildRequests,
|
|
247
|
+
interpretResponse,
|
|
248
|
+
onBidWon,
|
|
249
|
+
getUserSyncs,
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
registerBidder(spec);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
Module Name: Delta Projects Bid Adapter
|
|
5
|
+
Module Type: Bidder Adapter
|
|
6
|
+
Maintainer: dev@deltaprojects.com
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
# Description
|
|
10
|
+
|
|
11
|
+
Connects to Delta Projects DSP for bids.
|
|
12
|
+
|
|
13
|
+
# Test Parameters
|
|
14
|
+
```
|
|
15
|
+
// define banner unit
|
|
16
|
+
var bannerUnit = {
|
|
17
|
+
code: 'div-gpt-ad-1460505748561-0',
|
|
18
|
+
mediaTypes: {
|
|
19
|
+
banner: {
|
|
20
|
+
sizes: [[300, 250], [300,600]],
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
// Replace this object to test a new Adapter!
|
|
24
|
+
bids: [{
|
|
25
|
+
bidder: 'deltaprojects',
|
|
26
|
+
params: {
|
|
27
|
+
publisherId: '4' //required
|
|
28
|
+
}
|
|
29
|
+
}]
|
|
30
|
+
};
|
|
31
|
+
```
|
|
32
|
+
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { BANNER, NATIVE } from '../src/mediaTypes.js';
|
|
2
|
+
import { createTrackPixelHtml } from '../src/utils.js';
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
registerBidder
|
|
6
|
+
} = require('../src/adapters/bidderFactory.js');
|
|
7
|
+
const BIDDER_CODE = 'engageya';
|
|
8
|
+
const ENDPOINT_URL = 'https://recs.engageya.com/rec-api/getrecs.json';
|
|
9
|
+
const ENDPOINT_METHOD = 'GET';
|
|
10
|
+
const SUPPORTED_SIZES = [
|
|
11
|
+
[100, 75], [236, 202], [100, 100], [130, 130], [200, 200], [250, 250], [300, 272], [300, 250], [300, 230], [300, 214], [300, 187], [300, 166], [300, 150], [300, 133], [300, 120], [400, 200], [300, 200], [250, 377], [620, 410], [207, 311], [310, 166], [310, 333], [190, 106], [228, 132], [300, 174], [80, 60], [600, 500], [600, 600], [1080, 610], [1080, 610], [624, 350], [650, 1168], [1080, 1920], [300, 374]
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
function getPageUrl(bidRequest, bidderRequest) {
|
|
15
|
+
if (bidRequest.params.pageUrl && bidRequest.params.pageUrl != '[PAGE_URL]') {
|
|
16
|
+
return bidRequest.params.pageUrl;
|
|
17
|
+
}
|
|
18
|
+
if (bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer) {
|
|
19
|
+
return bidderRequest.refererInfo.referer;
|
|
20
|
+
}
|
|
21
|
+
const pageUrl = (isInIframe() && document.referrer)
|
|
22
|
+
? document.referrer
|
|
23
|
+
: window.location.href;
|
|
24
|
+
return encodeURIComponent(pageUrl);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function isInIframe() {
|
|
28
|
+
try {
|
|
29
|
+
var isInIframe = (window.self !== window.top);
|
|
30
|
+
} catch (e) {
|
|
31
|
+
isInIframe = true;
|
|
32
|
+
}
|
|
33
|
+
return isInIframe;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getImageSrc(rec) {
|
|
37
|
+
return rec.thumbnail_path.indexOf('http') === -1 ? 'https:' + rec.thumbnail_path : rec.thumbnail_path;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function getImpressionTrackers(rec, response) {
|
|
41
|
+
const responseTrackers = [response.viewPxl];
|
|
42
|
+
if (!rec.trackers) {
|
|
43
|
+
return responseTrackers;
|
|
44
|
+
}
|
|
45
|
+
const impressionTrackers = rec.trackers.impressionPixels || [];
|
|
46
|
+
const viewTrackers = rec.trackers.viewPixels || [];
|
|
47
|
+
return [...impressionTrackers, ...viewTrackers, ...responseTrackers];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function parseNativeResponse(rec, response) {
|
|
51
|
+
return {
|
|
52
|
+
title: rec.title,
|
|
53
|
+
body: '',
|
|
54
|
+
image: {
|
|
55
|
+
url: getImageSrc(rec),
|
|
56
|
+
width: response.imageWidth,
|
|
57
|
+
height: response.imageHeight
|
|
58
|
+
},
|
|
59
|
+
privacyLink: '',
|
|
60
|
+
clickUrl: rec.clickUrl,
|
|
61
|
+
displayUrl: rec.url,
|
|
62
|
+
cta: '',
|
|
63
|
+
sponsoredBy: rec.displayName,
|
|
64
|
+
impressionTrackers: getImpressionTrackers(rec, response),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function parseBannerResponse(rec, response) {
|
|
69
|
+
if (rec.tag) {
|
|
70
|
+
return rec.tag;
|
|
71
|
+
}
|
|
72
|
+
let style;
|
|
73
|
+
try {
|
|
74
|
+
let additionalData = JSON.parse(response.widget.additionalData);
|
|
75
|
+
const css = additionalData.css || '';
|
|
76
|
+
style = css ? `<style>${css}</style>` : '';
|
|
77
|
+
} catch (e) {
|
|
78
|
+
style = '';
|
|
79
|
+
}
|
|
80
|
+
const title = rec.title && rec.title.trim() ? `<div class="eng_tag_ttl" style="display: none">${rec.title}</div>` : '';
|
|
81
|
+
const displayName = rec.displayName && title ? `<div class="eng_tag_brnd" style="display: none">${rec.displayName}</div>` : '';
|
|
82
|
+
const trackers = getImpressionTrackers(rec, response)
|
|
83
|
+
.map(createTrackPixelHtml)
|
|
84
|
+
.join('');
|
|
85
|
+
return `<html><body>${style}<div id="ENG_TAG"><a href="${rec.clickUrl}" target=_blank><img class="eng_tag_img" src="${getImageSrc(rec)}" style="width:${response.imageWidth}px;height:${response.imageHeight}px;" alt="${rec.title}"/>${displayName}${title}</a>${trackers}</div></body></html>`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function getImageSize(bidRequest) {
|
|
89
|
+
if (bidRequest.sizes && bidRequest.sizes.length > 0) {
|
|
90
|
+
return bidRequest.sizes[0];
|
|
91
|
+
} else if (bidRequest.nativeParams && bidRequest.nativeParams.image && bidRequest.nativeParams.image.sizes) {
|
|
92
|
+
return bidRequest.nativeParams.image.sizes;
|
|
93
|
+
}
|
|
94
|
+
return [-1, -1];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function isValidSize([width, height]) {
|
|
98
|
+
if (!width || !height) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
return SUPPORTED_SIZES.some(([supportedWidth, supportedHeight]) => supportedWidth === width && supportedHeight === height);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export const spec = {
|
|
105
|
+
code: BIDDER_CODE,
|
|
106
|
+
supportedMediaTypes: [BANNER, NATIVE],
|
|
107
|
+
|
|
108
|
+
isBidRequestValid: function (bidRequest) {
|
|
109
|
+
return bidRequest &&
|
|
110
|
+
bidRequest.params &&
|
|
111
|
+
bidRequest.params.hasOwnProperty('widgetId') &&
|
|
112
|
+
bidRequest.params.hasOwnProperty('websiteId') &&
|
|
113
|
+
!isNaN(bidRequest.params.widgetId) &&
|
|
114
|
+
!isNaN(bidRequest.params.websiteId) &&
|
|
115
|
+
isValidSize(getImageSize(bidRequest));
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
buildRequests: function (validBidRequests, bidderRequest) {
|
|
119
|
+
if (!validBidRequests) {
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
return validBidRequests.map(bidRequest => {
|
|
123
|
+
if (bidRequest.params) {
|
|
124
|
+
const mediaType = bidRequest.hasOwnProperty('nativeParams') ? 1 : 2;
|
|
125
|
+
const [imageWidth, imageHeight] = getImageSize(bidRequest);
|
|
126
|
+
const widgetId = bidRequest.params.widgetId;
|
|
127
|
+
const websiteId = bidRequest.params.websiteId;
|
|
128
|
+
const pageUrl = getPageUrl(bidRequest, bidderRequest);
|
|
129
|
+
const bidId = bidRequest.bidId;
|
|
130
|
+
let finalUrl = ENDPOINT_URL + '?pubid=0&webid=' + websiteId + '&wid=' + widgetId + '&url=' + pageUrl + '&ireqid=' + bidId + '&pbtpid=' + mediaType + '&imw=' + imageWidth + '&imh=' + imageHeight;
|
|
131
|
+
if (bidderRequest && bidderRequest.gdprConsent && bidderRequest.gdprApplies && bidderRequest.consentString) {
|
|
132
|
+
finalUrl += '&is_gdpr=1&gdpr_consent=' + bidderRequest.consentString;
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
url: finalUrl,
|
|
136
|
+
method: ENDPOINT_METHOD,
|
|
137
|
+
data: ''
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}).filter(Boolean);
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
interpretResponse: function (serverResponse, bidRequest) {
|
|
144
|
+
if (!serverResponse.body || !serverResponse.body.recs || !serverResponse.body.recs.length) {
|
|
145
|
+
return [];
|
|
146
|
+
}
|
|
147
|
+
var response = serverResponse.body;
|
|
148
|
+
var isNative = response.pbtypeId == 1;
|
|
149
|
+
return response.recs.map(rec => {
|
|
150
|
+
let bid = {
|
|
151
|
+
requestId: response.ireqId,
|
|
152
|
+
width: response.imageWidth,
|
|
153
|
+
height: response.imageHeight,
|
|
154
|
+
creativeId: rec.postId,
|
|
155
|
+
cpm: rec.pecpm || (rec.ecpm / 100),
|
|
156
|
+
currency: 'USD',
|
|
157
|
+
netRevenue: !!rec.pecpm,
|
|
158
|
+
ttl: 360,
|
|
159
|
+
meta: { advertiserDomains: rec.domain ? [rec.domain] : [] },
|
|
160
|
+
}
|
|
161
|
+
if (isNative) {
|
|
162
|
+
bid.native = parseNativeResponse(rec, response);
|
|
163
|
+
} else {
|
|
164
|
+
bid.ad = parseBannerResponse(rec, response);
|
|
165
|
+
}
|
|
166
|
+
return bid;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
registerBidder(spec);
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { BANNER } from '../src/mediaTypes.js'
|
|
2
|
+
import { config } from '../src/config.js'
|
|
2
3
|
import { getStorageManager } from '../src/storageManager.js'
|
|
3
4
|
import { isArray } from '../src/utils.js'
|
|
4
5
|
import { registerBidder } from '../src/adapters/bidderFactory.js'
|
|
5
6
|
|
|
6
7
|
const storageManager = getStorageManager()
|
|
7
8
|
|
|
9
|
+
const GVLID = 1012
|
|
8
10
|
const BIDDER_CODE = 'glimpse'
|
|
9
11
|
const ENDPOINT = 'https://api.glimpsevault.io/ads/serving/public/v1/prebid'
|
|
10
12
|
const LOCAL_STORAGE_KEY = {
|
|
11
|
-
|
|
13
|
+
vault: {
|
|
12
14
|
jwt: 'gp_vault_jwt',
|
|
13
15
|
},
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export const spec = {
|
|
19
|
+
gvlid: GVLID,
|
|
17
20
|
code: BIDDER_CODE,
|
|
18
21
|
supportedMediaTypes: [BANNER],
|
|
19
22
|
|
|
@@ -37,20 +40,28 @@ export const spec = {
|
|
|
37
40
|
* @returns {ServerRequest}
|
|
38
41
|
*/
|
|
39
42
|
buildRequests: (validBidRequests, bidderRequest) => {
|
|
40
|
-
const
|
|
41
|
-
const
|
|
43
|
+
const demo = config.getConfig('glimpse.demo') || false
|
|
44
|
+
const account = config.getConfig('glimpse.account') || -1
|
|
45
|
+
const demand = config.getConfig('glimpse.demand') || 'glimpse'
|
|
46
|
+
const keywords = config.getConfig('glimpse.keywords') || {}
|
|
47
|
+
|
|
48
|
+
const auth = getVaultJwt()
|
|
42
49
|
const referer = getReferer(bidderRequest)
|
|
43
50
|
const gdprConsent = getGdprConsentChoice(bidderRequest)
|
|
44
|
-
const
|
|
51
|
+
const bids = validBidRequests.map((bidRequest) => {
|
|
52
|
+
return processBidRequest(bidRequest, keywords)
|
|
53
|
+
})
|
|
45
54
|
|
|
46
55
|
const data = {
|
|
47
|
-
auth
|
|
56
|
+
auth,
|
|
48
57
|
data: {
|
|
49
58
|
bidderCode: spec.code,
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
demo,
|
|
60
|
+
account,
|
|
61
|
+
demand,
|
|
52
62
|
referer,
|
|
53
63
|
gdprConsent,
|
|
64
|
+
bids,
|
|
54
65
|
}
|
|
55
66
|
}
|
|
56
67
|
|
|
@@ -65,10 +76,9 @@ export const spec = {
|
|
|
65
76
|
/**
|
|
66
77
|
* Parse response from Glimpse server
|
|
67
78
|
* @param bidResponse {ServerResponse}
|
|
68
|
-
* @param bidRequest {BidRequest}
|
|
69
79
|
* @returns {Bid[]}
|
|
70
80
|
*/
|
|
71
|
-
interpretResponse: (bidResponse
|
|
81
|
+
interpretResponse: (bidResponse) => {
|
|
72
82
|
const isValidResponse = isValidBidResponse(bidResponse)
|
|
73
83
|
|
|
74
84
|
if (isValidResponse) {
|
|
@@ -81,16 +91,20 @@ export const spec = {
|
|
|
81
91
|
},
|
|
82
92
|
}
|
|
83
93
|
|
|
84
|
-
function processBidRequest(bidRequest) {
|
|
94
|
+
function processBidRequest(bidRequest, globalKeywords) {
|
|
85
95
|
const sizes = normalizeSizes(bidRequest.sizes)
|
|
86
|
-
const
|
|
96
|
+
const bidKeywords = bidRequest.params.keywords || {}
|
|
97
|
+
const keywords = {
|
|
98
|
+
...globalKeywords,
|
|
99
|
+
...bidKeywords,
|
|
100
|
+
}
|
|
87
101
|
|
|
88
102
|
return {
|
|
103
|
+
unitCode: bidRequest.adUnitCode,
|
|
89
104
|
bidId: bidRequest.bidId,
|
|
90
105
|
placementId: bidRequest.params.placementId,
|
|
91
|
-
unitCode: bidRequest.adUnitCode,
|
|
92
|
-
sizes,
|
|
93
106
|
keywords,
|
|
107
|
+
sizes,
|
|
94
108
|
}
|
|
95
109
|
}
|
|
96
110
|
|
|
@@ -124,7 +138,8 @@ function getReferer(bidderRequest) {
|
|
|
124
138
|
function getGdprConsentChoice(bidderRequest) {
|
|
125
139
|
const hasGdprConsent =
|
|
126
140
|
hasValue(bidderRequest) &&
|
|
127
|
-
hasValue(bidderRequest.gdprConsent)
|
|
141
|
+
hasValue(bidderRequest.gdprConsent) &&
|
|
142
|
+
hasStringValue(bidderRequest.gdprConsent.consentString)
|
|
128
143
|
|
|
129
144
|
if (hasGdprConsent) {
|
|
130
145
|
return bidderRequest.gdprConsent
|
|
@@ -138,11 +153,11 @@ function getGdprConsentChoice(bidderRequest) {
|
|
|
138
153
|
}
|
|
139
154
|
|
|
140
155
|
function setVaultJwt(auth) {
|
|
141
|
-
storageManager.setDataInLocalStorage(LOCAL_STORAGE_KEY.
|
|
156
|
+
storageManager.setDataInLocalStorage(LOCAL_STORAGE_KEY.vault.jwt, auth)
|
|
142
157
|
}
|
|
143
158
|
|
|
144
159
|
function getVaultJwt() {
|
|
145
|
-
return storageManager.getDataFromLocalStorage(LOCAL_STORAGE_KEY.
|
|
160
|
+
return storageManager.getDataFromLocalStorage(LOCAL_STORAGE_KEY.vault.jwt) || ''
|
|
146
161
|
}
|
|
147
162
|
|
|
148
163
|
function isValidBidResponse(bidResponse) {
|
package/modules/gptPreAuction.js
CHANGED
|
@@ -55,15 +55,16 @@ export const appendPbAdSlot = adUnit => {
|
|
|
55
55
|
const context = adUnit.ortb2Imp.ext.data;
|
|
56
56
|
const { customPbAdSlot } = _currentConfig;
|
|
57
57
|
|
|
58
|
-
if (
|
|
59
|
-
|
|
58
|
+
// use context.pbAdSlot if set (if someone set it already, it will take precedence over others)
|
|
59
|
+
if (context.pbadslot) {
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
if (customPbAdSlot) {
|
|
64
|
+
context.pbadslot = customPbAdSlot(adUnit.code, deepAccess(context, 'adserver.adslot'));
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
+
|
|
67
68
|
// use data attribute 'data-adslotid' if set
|
|
68
69
|
try {
|
|
69
70
|
const adUnitCodeDiv = document.getElementById(adUnit.code);
|
|
@@ -78,12 +79,17 @@ export const appendPbAdSlot = adUnit => {
|
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
81
|
context.pbadslot = adUnit.code;
|
|
82
|
+
return true;
|
|
81
83
|
};
|
|
82
84
|
|
|
83
85
|
export const makeBidRequestsHook = (fn, adUnits, ...args) => {
|
|
84
86
|
appendGptSlots(adUnits);
|
|
85
87
|
adUnits.forEach(adUnit => {
|
|
86
|
-
appendPbAdSlot(adUnit);
|
|
88
|
+
const usedAdUnitCode = appendPbAdSlot(adUnit);
|
|
89
|
+
// gpid should be set to itself if already set, or to what pbadslot was (as long as it was not adUnit code)
|
|
90
|
+
if (!adUnit.ortb2Imp.ext.gpid && !usedAdUnitCode) {
|
|
91
|
+
adUnit.ortb2Imp.ext.gpid = adUnit.ortb2Imp.ext.data.pbadslot;
|
|
92
|
+
}
|
|
87
93
|
});
|
|
88
94
|
return fn.call(this, adUnits, ...args);
|
|
89
95
|
};
|
|
@@ -294,6 +294,14 @@ function buildRequests(validBidRequests, bidderRequest) {
|
|
|
294
294
|
let data = {};
|
|
295
295
|
let gpid = '';
|
|
296
296
|
|
|
297
|
+
const date = new Date();
|
|
298
|
+
const lt = date && date.getTime();
|
|
299
|
+
const to = date && date.getTimezoneOffset();
|
|
300
|
+
if (to) {
|
|
301
|
+
lt && (data.lt = lt);
|
|
302
|
+
data.to = to;
|
|
303
|
+
}
|
|
304
|
+
|
|
297
305
|
// ADTS-134 Retrieve ID envelopes
|
|
298
306
|
for (const eid in eids) data[eid] = eids[eid];
|
|
299
307
|
|