prebid.js 6.5.0 → 6.9.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/.eslintrc.js +8 -1
- package/integrationExamples/gpt/amp/creative.html +11 -33
- package/integrationExamples/gpt/weboramaRtdProvider_example.html +154 -115
- package/integrationExamples/gpt/x-domain/creative.html +63 -29
- package/modules/.submodules.json +2 -1
- package/modules/adagioBidAdapter.js +0 -8
- package/modules/adagioBidAdapter.md +1 -1
- package/modules/adbookpspBidAdapter.js +27 -10
- package/modules/adhashBidAdapter.js +3 -3
- package/modules/adkernelBidAdapter.js +2 -1
- package/modules/admanBidAdapter.js +10 -4
- package/modules/adomikAnalyticsAdapter.js +23 -11
- package/modules/adqueryIdSystem.js +103 -0
- package/modules/adqueryIdSystem.md +35 -0
- package/modules/appnexusBidAdapter.js +14 -2
- package/modules/asealBidAdapter.js +58 -0
- package/modules/asealBidAdapter.md +52 -0
- package/modules/bliinkBidAdapter.js +2 -1
- package/modules/brandmetricsRtdProvider.js +168 -0
- package/modules/brandmetricsRtdProvider.md +40 -0
- package/modules/colossussspBidAdapter.js +12 -8
- package/modules/colossussspBidAdapter.md +15 -1
- package/modules/compassBidAdapter.js +10 -3
- package/modules/consumableBidAdapter.md +1 -1
- package/modules/conversantBidAdapter.js +7 -0
- package/modules/criteoBidAdapter.js +10 -1
- package/modules/criteoIdSystem.js +29 -7
- package/modules/currency.js +26 -1
- package/modules/displayioBidAdapter.js +157 -0
- package/modules/displayioBidAdapter.md +148 -0
- package/modules/e_volutionBidAdapter.js +158 -0
- package/modules/glimpseBidAdapter.js +66 -44
- package/modules/gnetBidAdapter.js +3 -3
- package/modules/gnetBidAdapter.md +4 -4
- package/modules/gumgumBidAdapter.js +56 -42
- package/modules/idImportLibrary.js +45 -8
- package/modules/idImportLibrary.md +4 -0
- package/modules/improvedigitalBidAdapter.js +29 -2
- package/modules/interactiveOffersBidAdapter.js +9 -6
- package/modules/jwplayerRtdProvider.js +71 -6
- package/modules/jwplayerRtdProvider.md +27 -11
- package/modules/kargoBidAdapter.js +2 -2
- package/modules/lunamediahbBidAdapter.js +32 -4
- package/modules/nextMillenniumBidAdapter.js +3 -1
- package/modules/oguryBidAdapter.js +14 -14
- package/modules/onetagBidAdapter.js +4 -2
- package/modules/pilotxBidAdapter.js +147 -0
- package/modules/pilotxBidAdapter.md +50 -0
- package/modules/priceFloors.js +2 -1
- package/modules/proxistoreBidAdapter.js +0 -2
- package/modules/pubmaticAnalyticsAdapter.js +16 -0
- package/modules/richaudienceBidAdapter.js +10 -4
- package/modules/riseBidAdapter.js +18 -7
- package/modules/rtbhouseBidAdapter.js +14 -4
- package/modules/rtdModule/index.js +14 -15
- package/modules/rubiconAnalyticsAdapter.js +8 -2
- package/modules/seedingAllianceBidAdapter.js +3 -3
- package/modules/sharethroughBidAdapter.js +12 -17
- package/modules/showheroes-bsBidAdapter.js +13 -2
- package/modules/sortableAnalyticsAdapter.js +5 -4
- package/modules/sovrnBidAdapter.js +93 -18
- package/modules/sovrnBidAdapter.md +80 -2
- package/modules/synacormediaBidAdapter.js +31 -10
- package/modules/tappxBidAdapter.js +8 -5
- package/modules/teadsBidAdapter.js +1 -2
- package/modules/undertoneBidAdapter.js +17 -1
- package/modules/userId/eids.js +7 -1
- package/modules/userId/userId.md +8 -0
- package/modules/viewability.js +177 -0
- package/modules/viewability.md +87 -0
- package/modules/weboramaRtdProvider.js +264 -34
- package/modules/weboramaRtdProvider.md +110 -40
- package/modules/welectBidAdapter.js +106 -0
- package/modules/yahoosspBidAdapter.js +2 -0
- package/package.json +2 -1
- package/src/adRendering.js +38 -0
- package/src/adloader.js +2 -1
- package/src/auction.js +103 -73
- package/src/bidderSettings.js +69 -0
- package/src/hook.js +5 -1
- package/src/prebid.js +19 -21
- package/src/secureCreatives.js +131 -47
- package/src/targeting.js +3 -2
- package/src/utils.js +13 -10
- package/test/helpers/syncPromise.js +71 -0
- package/test/spec/auctionmanager_spec.js +179 -15
- package/test/spec/modules/adagioBidAdapter_spec.js +0 -10
- package/test/spec/modules/adbookpspBidAdapter_spec.js +17 -3
- package/test/spec/modules/adhashBidAdapter_spec.js +2 -2
- package/test/spec/modules/admanBidAdapter_spec.js +2 -2
- package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
- package/test/spec/modules/adqueryIdSystem_spec.js +74 -0
- package/test/spec/modules/appnexusBidAdapter_spec.js +27 -0
- package/test/spec/modules/asealBidAdapter_spec.js +144 -0
- package/test/spec/modules/bliinkBidAdapter_spec.js +2 -0
- package/test/spec/modules/brandmetricsRtdProvider_spec.js +191 -0
- package/test/spec/modules/colossussspBidAdapter_spec.js +5 -2
- package/test/spec/modules/compassBidAdapter_spec.js +1 -0
- package/test/spec/modules/conversantBidAdapter_spec.js +54 -2
- package/test/spec/modules/criteoBidAdapter_spec.js +21 -0
- package/test/spec/modules/criteoIdSystem_spec.js +6 -3
- package/test/spec/modules/currency_spec.js +21 -6
- package/test/spec/modules/displayioBidAdapter_spec.js +239 -0
- package/test/spec/modules/e_volutionBidAdapter_spec.js +242 -0
- package/test/spec/modules/eids_spec.js +15 -0
- package/test/spec/modules/glimpseBidAdapter_spec.js +0 -18
- package/test/spec/modules/gnetBidAdapter_spec.js +6 -6
- package/test/spec/modules/gumgumBidAdapter_spec.js +46 -0
- package/test/spec/modules/idImportLibrary_spec.js +197 -10
- package/test/spec/modules/improvedigitalBidAdapter_spec.js +61 -0
- package/test/spec/modules/jwplayerRtdProvider_spec.js +195 -2
- package/test/spec/modules/kargoBidAdapter_spec.js +1 -1
- package/test/spec/modules/loglyliftBidAdapter_spec.js +1 -1
- package/test/spec/modules/lunamediahbBidAdapter_spec.js +27 -1
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +1 -1
- package/test/spec/modules/oguryBidAdapter_spec.js +69 -3
- package/test/spec/modules/pilotxBidAdapter_spec.js +244 -0
- package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +13 -1
- package/test/spec/modules/realTimeDataModule_spec.js +67 -5
- package/test/spec/modules/richaudienceBidAdapter_spec.js +40 -0
- package/test/spec/modules/riseBidAdapter_spec.js +31 -5
- package/test/spec/modules/rtbhouseBidAdapter_spec.js +20 -0
- package/test/spec/modules/rubiconAnalyticsAdapter_spec.js +61 -1
- package/test/spec/modules/sharethroughBidAdapter_spec.js +91 -6
- package/test/spec/modules/showheroes-bsBidAdapter_spec.js +2 -0
- package/test/spec/modules/sortableAnalyticsAdapter_spec.js +2 -3
- package/test/spec/modules/sovrnBidAdapter_spec.js +413 -333
- package/test/spec/modules/synacormediaBidAdapter_spec.js +70 -0
- package/test/spec/modules/tappxBidAdapter_spec.js +0 -19
- package/test/spec/modules/teadsBidAdapter_spec.js +14 -59
- package/test/spec/modules/undertoneBidAdapter_spec.js +55 -2
- package/test/spec/modules/userId_spec.js +68 -19
- package/test/spec/modules/viewability_spec.js +280 -0
- package/test/spec/modules/weboramaRtdProvider_spec.js +536 -20
- package/test/spec/modules/welectBidAdapter_spec.js +211 -0
- package/test/spec/modules/yahoosspBidAdapter_spec.js +10 -0
- package/test/spec/unit/core/bidderSettings_spec.js +123 -0
- package/test/spec/unit/pbjs_api_spec.js +21 -8
- package/test/spec/unit/secureCreatives_spec.js +143 -24
|
@@ -28,16 +28,23 @@ function isBidResponseValid(bid) {
|
|
|
28
28
|
function getPlacementReqData(bid) {
|
|
29
29
|
const { params, bidId, mediaTypes } = bid;
|
|
30
30
|
const schain = bid.schain || {};
|
|
31
|
-
const { placementId } = params;
|
|
31
|
+
const { placementId, endpointId } = params;
|
|
32
32
|
const bidfloor = getBidFloor(bid);
|
|
33
33
|
|
|
34
34
|
const placement = {
|
|
35
|
-
placementId,
|
|
36
35
|
bidId,
|
|
37
36
|
schain,
|
|
38
37
|
bidfloor
|
|
39
38
|
};
|
|
40
39
|
|
|
40
|
+
if (placementId) {
|
|
41
|
+
placement.placementId = placementId;
|
|
42
|
+
placement.type = 'publisher';
|
|
43
|
+
} else if (endpointId) {
|
|
44
|
+
placement.endpointId = endpointId;
|
|
45
|
+
placement.type = 'network';
|
|
46
|
+
}
|
|
47
|
+
|
|
41
48
|
if (mediaTypes && mediaTypes[BANNER]) {
|
|
42
49
|
placement.adFormat = BANNER;
|
|
43
50
|
placement.sizes = mediaTypes[BANNER].sizes;
|
|
@@ -90,7 +97,7 @@ export const spec = {
|
|
|
90
97
|
|
|
91
98
|
isBidRequestValid: (bid = {}) => {
|
|
92
99
|
const { params, bidId, mediaTypes } = bid;
|
|
93
|
-
let valid = Boolean(bidId && params && params.placementId);
|
|
100
|
+
let valid = Boolean(bidId && params && (params.placementId || params.endpointId));
|
|
94
101
|
|
|
95
102
|
if (mediaTypes && mediaTypes[BANNER]) {
|
|
96
103
|
valid = valid && Boolean(mediaTypes[BANNER] && mediaTypes[BANNER].sizes);
|
|
@@ -2,6 +2,7 @@ import { logWarn, isStr, deepAccess, isArray, getBidIdParameter, deepSetValue, i
|
|
|
2
2
|
import {registerBidder} from '../src/adapters/bidderFactory.js';
|
|
3
3
|
import {BANNER, VIDEO} from '../src/mediaTypes.js';
|
|
4
4
|
import {getStorageManager} from '../src/storageManager.js';
|
|
5
|
+
import { config } from '../src/config.js';
|
|
5
6
|
|
|
6
7
|
const GVLID = 24;
|
|
7
8
|
export const storage = getStorageManager(GVLID);
|
|
@@ -76,6 +77,9 @@ export const spec = {
|
|
|
76
77
|
displaymanager: 'Prebid.js',
|
|
77
78
|
displaymanagerver: '$prebid.version$'
|
|
78
79
|
};
|
|
80
|
+
if (bid.ortb2Imp) {
|
|
81
|
+
mergeDeep(imp, bid.ortb2Imp);
|
|
82
|
+
}
|
|
79
83
|
|
|
80
84
|
copyOptProperty(bid.params.tag_id, imp, 'tagid');
|
|
81
85
|
|
|
@@ -167,6 +171,9 @@ export const spec = {
|
|
|
167
171
|
payload.user = {ext: userExt};
|
|
168
172
|
}
|
|
169
173
|
|
|
174
|
+
const firstPartyData = config.getConfig('ortb2') || {};
|
|
175
|
+
mergeDeep(payload, firstPartyData);
|
|
176
|
+
|
|
170
177
|
return {
|
|
171
178
|
method: 'POST',
|
|
172
179
|
url: bidurl,
|
|
@@ -24,7 +24,7 @@ const LOG_PREFIX = 'Criteo: ';
|
|
|
24
24
|
Unminified source code can be found in the privately shared repo: https://github.com/Prebid-org/prebid-js-external-js-criteo/blob/master/dist/prod.js
|
|
25
25
|
*/
|
|
26
26
|
const FAST_BID_VERSION_PLACEHOLDER = '%FAST_BID_VERSION%';
|
|
27
|
-
export const FAST_BID_VERSION_CURRENT =
|
|
27
|
+
export const FAST_BID_VERSION_CURRENT = 117;
|
|
28
28
|
const FAST_BID_VERSION_LATEST = 'latest';
|
|
29
29
|
const FAST_BID_VERSION_NONE = 'none';
|
|
30
30
|
const PUBLISHER_TAG_URL_TEMPLATE = 'https://static.criteo.net/js/ld/publishertag.prebid' + FAST_BID_VERSION_PLACEHOLDER + '.js';
|
|
@@ -281,6 +281,7 @@ function checkNativeSendId(bidRequest) {
|
|
|
281
281
|
*/
|
|
282
282
|
function buildCdbRequest(context, bidRequests, bidderRequest) {
|
|
283
283
|
let networkId;
|
|
284
|
+
let schain;
|
|
284
285
|
const request = {
|
|
285
286
|
publisher: {
|
|
286
287
|
url: context.url,
|
|
@@ -288,6 +289,7 @@ function buildCdbRequest(context, bidRequests, bidderRequest) {
|
|
|
288
289
|
},
|
|
289
290
|
slots: bidRequests.map(bidRequest => {
|
|
290
291
|
networkId = bidRequest.params.networkId || networkId;
|
|
292
|
+
schain = bidRequest.schain || schain;
|
|
291
293
|
const slot = {
|
|
292
294
|
impid: bidRequest.adUnitCode,
|
|
293
295
|
transactionid: bidRequest.transactionId,
|
|
@@ -344,6 +346,13 @@ function buildCdbRequest(context, bidRequests, bidderRequest) {
|
|
|
344
346
|
if (networkId) {
|
|
345
347
|
request.publisher.networkid = networkId;
|
|
346
348
|
}
|
|
349
|
+
if (schain) {
|
|
350
|
+
request.source = {
|
|
351
|
+
ext: {
|
|
352
|
+
schain: schain
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
};
|
|
347
356
|
request.user = {
|
|
348
357
|
ext: bidderRequest.userExt
|
|
349
358
|
};
|
|
@@ -33,15 +33,37 @@ function getFromAllStorages(key) {
|
|
|
33
33
|
return storage.getCookie(key) || storage.getDataFromLocalStorage(key);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
function saveOnAllStorages(key, value) {
|
|
36
|
+
function saveOnAllStorages(key, value, hostname) {
|
|
37
37
|
if (key && value) {
|
|
38
|
-
storage.setCookie(key, value, expirationString);
|
|
39
38
|
storage.setDataInLocalStorage(key, value);
|
|
39
|
+
setCookieOnAllDomains(key, value, expirationString, hostname, true);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
function
|
|
44
|
-
|
|
43
|
+
function setCookieOnAllDomains(key, value, expiration, hostname, stopOnSuccess) {
|
|
44
|
+
const subDomains = hostname.split('.');
|
|
45
|
+
for (let i = 0; i < subDomains.length; ++i) {
|
|
46
|
+
// Try to write the cookie on this subdomain (we want it to be stored only on the TLD+1)
|
|
47
|
+
const domain = subDomains.slice(subDomains.length - i - 1, subDomains.length).join('.');
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
storage.setCookie(key, value, expiration, null, '.' + domain);
|
|
51
|
+
|
|
52
|
+
if (stopOnSuccess) {
|
|
53
|
+
// Try to read the cookie to check if we wrote it
|
|
54
|
+
const ck = storage.getCookie(key);
|
|
55
|
+
if (ck && ck === value) {
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
} catch (error) {
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function deleteFromAllStorages(key, hostname) {
|
|
66
|
+
setCookieOnAllDomains(key, '', pastDateString, hostname, true);
|
|
45
67
|
storage.removeDataFromLocalStorage(key);
|
|
46
68
|
}
|
|
47
69
|
|
|
@@ -89,15 +111,15 @@ function callCriteoUserSync(parsedCriteoData, gdprString, callback) {
|
|
|
89
111
|
const urlsToCall = typeof jsonResponse.acwsUrl === 'string' ? [jsonResponse.acwsUrl] : jsonResponse.acwsUrl;
|
|
90
112
|
urlsToCall.forEach(url => triggerPixel(url));
|
|
91
113
|
} else if (jsonResponse.bundle) {
|
|
92
|
-
saveOnAllStorages(bundleStorageKey, jsonResponse.bundle);
|
|
114
|
+
saveOnAllStorages(bundleStorageKey, jsonResponse.bundle, domain);
|
|
93
115
|
}
|
|
94
116
|
|
|
95
117
|
if (jsonResponse.bidId) {
|
|
96
|
-
saveOnAllStorages(bididStorageKey, jsonResponse.bidId);
|
|
118
|
+
saveOnAllStorages(bididStorageKey, jsonResponse.bidId, domain);
|
|
97
119
|
const criteoId = { criteoId: jsonResponse.bidId };
|
|
98
120
|
callback(criteoId);
|
|
99
121
|
} else {
|
|
100
|
-
deleteFromAllStorages(bididStorageKey);
|
|
122
|
+
deleteFromAllStorages(bididStorageKey, domain);
|
|
101
123
|
callback();
|
|
102
124
|
}
|
|
103
125
|
},
|
package/modules/currency.js
CHANGED
|
@@ -20,6 +20,25 @@ export var currencyRates = {};
|
|
|
20
20
|
var bidderCurrencyDefault = {};
|
|
21
21
|
var defaultRates;
|
|
22
22
|
|
|
23
|
+
export const ready = (() => {
|
|
24
|
+
let isDone, resolver, promise;
|
|
25
|
+
function reset() {
|
|
26
|
+
isDone = false;
|
|
27
|
+
resolver = null;
|
|
28
|
+
promise = new Promise((resolve) => {
|
|
29
|
+
resolver = resolve;
|
|
30
|
+
if (isDone) resolve();
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
function done() {
|
|
34
|
+
isDone = true;
|
|
35
|
+
if (resolver != null) { resolver() }
|
|
36
|
+
}
|
|
37
|
+
reset();
|
|
38
|
+
|
|
39
|
+
return {done, reset, promise: () => promise}
|
|
40
|
+
})();
|
|
41
|
+
|
|
23
42
|
/**
|
|
24
43
|
* Configuration function for currency
|
|
25
44
|
* @param {string} [config.adServerCurrency = 'USD']
|
|
@@ -138,11 +157,15 @@ function initCurrency(url) {
|
|
|
138
157
|
logInfo('currencyRates set to ' + JSON.stringify(currencyRates));
|
|
139
158
|
currencyRatesLoaded = true;
|
|
140
159
|
processBidResponseQueue();
|
|
160
|
+
ready.done();
|
|
141
161
|
} catch (e) {
|
|
142
162
|
errorSettingsRates('Failed to parse currencyRates response: ' + response);
|
|
143
163
|
}
|
|
144
164
|
},
|
|
145
|
-
error:
|
|
165
|
+
error: function (...args) {
|
|
166
|
+
errorSettingsRates(...args);
|
|
167
|
+
ready.done();
|
|
168
|
+
}
|
|
146
169
|
}
|
|
147
170
|
);
|
|
148
171
|
}
|
|
@@ -197,6 +220,8 @@ export function addBidResponseHook(fn, adUnitCode, bid) {
|
|
|
197
220
|
bidResponseQueue.push(wrapFunction(fn, this, [adUnitCode, bid]));
|
|
198
221
|
if (!currencySupportEnabled || currencyRatesLoaded) {
|
|
199
222
|
processBidResponseQueue();
|
|
223
|
+
} else {
|
|
224
|
+
fn.bail(ready.promise());
|
|
200
225
|
}
|
|
201
226
|
}
|
|
202
227
|
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import {registerBidder} from '../src/adapters/bidderFactory.js';
|
|
2
|
+
import {BANNER, VIDEO} from '../src/mediaTypes.js';
|
|
3
|
+
|
|
4
|
+
const BIDDER_VERSION = '1.0.0';
|
|
5
|
+
const BIDDER_CODE = 'displayio';
|
|
6
|
+
const GVLID = 999;
|
|
7
|
+
const BID_TTL = 300;
|
|
8
|
+
const SUPPORTED_AD_TYPES = [BANNER, VIDEO];
|
|
9
|
+
const DEFAULT_CURRENCY = 'USD';
|
|
10
|
+
|
|
11
|
+
export const spec = {
|
|
12
|
+
code: BIDDER_CODE,
|
|
13
|
+
gvlid: GVLID,
|
|
14
|
+
supportedMediaTypes: SUPPORTED_AD_TYPES,
|
|
15
|
+
isBidRequestValid: function(bid) {
|
|
16
|
+
return !!(bid.params && bid.params.placementId && bid.params.siteId &&
|
|
17
|
+
bid.params.adsSrvDomain && bid.params.cdnDomain);
|
|
18
|
+
},
|
|
19
|
+
buildRequests: function (bidRequests, bidderRequest) {
|
|
20
|
+
return bidRequests.map(bid => {
|
|
21
|
+
let url = '//' + bid.params.adsSrvDomain + '/srv?method=getPlacement&app=' +
|
|
22
|
+
bid.params.siteId + '&placement=' + bid.params.placementId;
|
|
23
|
+
const data = this._getPayload(bid, bidderRequest);
|
|
24
|
+
return {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
headers: {'Content-Type': 'application/json;charset=utf-8'},
|
|
27
|
+
url,
|
|
28
|
+
data
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
interpretResponse: function (serverResponse, serverRequest) {
|
|
33
|
+
const ads = serverResponse.body.data.ads;
|
|
34
|
+
const bidResponses = [];
|
|
35
|
+
const { data } = serverRequest.data;
|
|
36
|
+
if (ads.length) {
|
|
37
|
+
const adData = ads[0].ad.data;
|
|
38
|
+
const bidResponse = {
|
|
39
|
+
requestId: data.id,
|
|
40
|
+
cpm: adData.ecpm,
|
|
41
|
+
width: adData.w,
|
|
42
|
+
height: adData.h,
|
|
43
|
+
netRevenue: true,
|
|
44
|
+
ttl: BID_TTL,
|
|
45
|
+
creativeId: adData.adId || 0,
|
|
46
|
+
currency: DEFAULT_CURRENCY,
|
|
47
|
+
referrer: data.data.ref,
|
|
48
|
+
mediaType: ads[0].ad.subtype,
|
|
49
|
+
ad: adData.markup,
|
|
50
|
+
placement: data.placement,
|
|
51
|
+
adData: adData
|
|
52
|
+
};
|
|
53
|
+
if (bidResponse.vastUrl === 'videoVast') {
|
|
54
|
+
bidResponse.vastUrl = adData.videos[0].url
|
|
55
|
+
}
|
|
56
|
+
bidResponses.push(bidResponse);
|
|
57
|
+
}
|
|
58
|
+
return bidResponses;
|
|
59
|
+
},
|
|
60
|
+
_getPayload: function (bid, bidderRequest) {
|
|
61
|
+
const connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
|
|
62
|
+
const userSession = 'us_web_xxxxxxxxxxxx'.replace(/[x]/g, c => {
|
|
63
|
+
let r = Math.random() * 16 | 0;
|
|
64
|
+
let v = c === 'x' ? r : (r & 0x3 | 0x8);
|
|
65
|
+
return v.toString(16);
|
|
66
|
+
});
|
|
67
|
+
const { params } = bid;
|
|
68
|
+
const { siteId, placementId } = params;
|
|
69
|
+
const { refererInfo, uspConsent, gdprConsent } = bidderRequest;
|
|
70
|
+
const mediation = {consent: '-1', gdpr: '-1'};
|
|
71
|
+
if (gdprConsent) {
|
|
72
|
+
if (gdprConsent.consentString !== undefined) {
|
|
73
|
+
mediation.consent = gdprConsent.consentString;
|
|
74
|
+
}
|
|
75
|
+
if (gdprConsent.gdprApplies !== undefined) {
|
|
76
|
+
mediation.gdpr = gdprConsent.gdprApplies ? '1' : '0';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const payload = {
|
|
80
|
+
userSession,
|
|
81
|
+
data: {
|
|
82
|
+
id: bid.bidId,
|
|
83
|
+
action: 'getPlacement',
|
|
84
|
+
app: siteId,
|
|
85
|
+
placement: placementId,
|
|
86
|
+
data: {
|
|
87
|
+
pagecat: params.pageCategory ? params.pageCategory.split(',').map(k => k.trim()) : [],
|
|
88
|
+
keywords: params.keywords ? params.keywords.split(',').map(k => k.trim()) : [],
|
|
89
|
+
lang_content: document.documentElement.lang,
|
|
90
|
+
lang: window.navigator.language,
|
|
91
|
+
domain: window.location.hostname,
|
|
92
|
+
page: window.location.href,
|
|
93
|
+
ref: refererInfo.referer,
|
|
94
|
+
userids: _getUserIDs(),
|
|
95
|
+
geo: '',
|
|
96
|
+
},
|
|
97
|
+
complianceData: {
|
|
98
|
+
child: '-1',
|
|
99
|
+
us_privacy: uspConsent,
|
|
100
|
+
dnt: window.navigator.doNotTrack,
|
|
101
|
+
iabConsent: {},
|
|
102
|
+
mediation: {
|
|
103
|
+
consent: mediation.consent,
|
|
104
|
+
gdpr: mediation.gdpr,
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
integration: 'JS',
|
|
108
|
+
omidpn: 'Displayio',
|
|
109
|
+
mediationPlatform: 0,
|
|
110
|
+
prebidVersion: BIDDER_VERSION,
|
|
111
|
+
device: {
|
|
112
|
+
w: window.screen.width,
|
|
113
|
+
h: window.screen.height,
|
|
114
|
+
connection_type: connection ? connection.effectiveType : '',
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (navigator.permissions) {
|
|
119
|
+
navigator.permissions.query({ name: 'geolocation' })
|
|
120
|
+
.then((result) => {
|
|
121
|
+
if (result.state === 'granted') {
|
|
122
|
+
payload.data.data.geo = _getGeoData();
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return payload
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
function _getUserIDs () {
|
|
131
|
+
let ids = {};
|
|
132
|
+
try {
|
|
133
|
+
ids = window.owpbjs.getUserIdsAsEids();
|
|
134
|
+
} catch (e) {}
|
|
135
|
+
return ids;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async function _getGeoData () {
|
|
139
|
+
let geoData = null;
|
|
140
|
+
const getCurrentPosition = () => {
|
|
141
|
+
return new Promise((resolve, reject) =>
|
|
142
|
+
navigator.geolocation.getCurrentPosition(resolve, reject)
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
const position = await getCurrentPosition();
|
|
147
|
+
let {latitude, longitude, accuracy} = position.coords;
|
|
148
|
+
geoData = {
|
|
149
|
+
'lat': latitude,
|
|
150
|
+
'lng': longitude,
|
|
151
|
+
'precision': accuracy
|
|
152
|
+
};
|
|
153
|
+
} catch (e) {}
|
|
154
|
+
return geoData
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
registerBidder(spec);
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
Module Name: DisplayIO Bidder Adapter
|
|
5
|
+
Module Type: Bidder Adapter
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
# Description
|
|
9
|
+
|
|
10
|
+
Module that connects to display.io's demand sources.
|
|
11
|
+
Web mobile (not relevant for web desktop).
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
#Features
|
|
15
|
+
| Feature | | Feature | |
|
|
16
|
+
|---------------|---------------------------------------------------------|-----------------------|-----|
|
|
17
|
+
| Bidder Code | displayio | Prebid member | no |
|
|
18
|
+
| Media Types | Banner, video. <br/>Sizes (display 320x480 / vertical video) | GVL ID | no |
|
|
19
|
+
| GDPR Support | yes | Prebid.js Adapter | yes |
|
|
20
|
+
| USP Support | yes | Prebid Server Adapter | no |
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#Global configuration
|
|
24
|
+
```javascript
|
|
25
|
+
<head>
|
|
26
|
+
<script src="https://cdn.display.io/webis/webis.min.js"></script>
|
|
27
|
+
</head>
|
|
28
|
+
<script>
|
|
29
|
+
......................................
|
|
30
|
+
var CMP_TIMEOUT = 8000;
|
|
31
|
+
var consentManagement = {
|
|
32
|
+
gdpr: {
|
|
33
|
+
cmpApi: 'iab',
|
|
34
|
+
timeout: CMP_TIMEOUT,
|
|
35
|
+
defaultGdprScope: true
|
|
36
|
+
},
|
|
37
|
+
usp: {
|
|
38
|
+
cmpApi: 'iab',
|
|
39
|
+
timeout: CMP_TIMEOUT
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (typeof __tcfapi !== 'function') {
|
|
44
|
+
delete consentManagement.gdpr;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
pbjs.que.push(function() {
|
|
48
|
+
pbjs.setConfig({consentManagement})
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
......................................
|
|
53
|
+
|
|
54
|
+
function initAdserver(bidResponses) {
|
|
55
|
+
if (pbjs.initAdserverSet) return;
|
|
56
|
+
pbjs.initAdserverSet = true;
|
|
57
|
+
|
|
58
|
+
...........................
|
|
59
|
+
|
|
60
|
+
const displayioBids = getDisplayioBid(bidResponses)
|
|
61
|
+
displayioBids.forEach(b => {
|
|
62
|
+
const {adData, placement} = b[1].bids[0];
|
|
63
|
+
webis.init(adData, b[0], {placement})
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function getDisplayioBid(bidResponses) {
|
|
69
|
+
const codes = adUnits.map(u => u.code);
|
|
70
|
+
const bids = Object.entries(bidResponses);
|
|
71
|
+
bids.filter(([key, value]) => codes.includes(key) && value.bids[0].bidderCode === 'displayio');
|
|
72
|
+
return bids;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
......................................
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
# Bid Parameters
|
|
81
|
+
|
|
82
|
+
| Name | Scope | Type | Description | Example |
|
|
83
|
+
|----------------| ----- | ---- |----------------------------------------|-------------------------------|
|
|
84
|
+
| `siteId` | required | Number | SiteId and PlacementID are your inventory IDs on the display.io platform (please ask your Account Manager for your site and placement IDs). | 7753 |
|
|
85
|
+
| `placementId` | required | Number | SiteId and PlacementID are your inventory IDs on the display.io platform (please ask your Account Manager for your site and placement IDs). | 5375 |
|
|
86
|
+
| `adsSrvDomain` | required | String | | "appsrv.display.io" |
|
|
87
|
+
| `cdnDomain` | required | String | | "cdn.display.io" |
|
|
88
|
+
| `pageCategory` | optional | String | Comma-separated list of IAB content categories that describe the current page or view of the site, list of available values. | "pageCategory1, pageCategory2" |
|
|
89
|
+
| `keywords` | optional | String | Comma-separated list of keywords describing the content. | "keyword1, keyword2, keyword3" |
|
|
90
|
+
| `custom` | optional | Object | User-defined targeting key-value pairs. custom applies to a specific unit. | `{headerTextColor: "red", fixedHeaderSelector: '.site-header'}` |
|
|
91
|
+
| `custom.headerText`| optional | String | Ad container header text. By default, text is "Scroll to continue with content". Limited to 50 characters. | "Our awesome advertisement"|
|
|
92
|
+
| `custom.headerTextColor`| optional | String | Ad container header text color, "white" by default | "#2196f3"|
|
|
93
|
+
| `custom.headerBackgroundColor`| optional | String | Ad container header background color, "black" by default | "#fff" |
|
|
94
|
+
| `custom.adContainerBackgroundColor`| optional | String | Ad container body background color, "transparent" by default | "#000"|
|
|
95
|
+
| `custom.fixedHeaderSelector`| optional | String | In case your webpage has a fixed header – the header Id attribute or header class attribute should be defined as a value for parameter fixedHeaderSelector. | ".site-header"|
|
|
96
|
+
|
|
97
|
+
# adUnit configuration example
|
|
98
|
+
```javascript
|
|
99
|
+
var adUnits = [
|
|
100
|
+
{
|
|
101
|
+
code: 'ad-tag-1',
|
|
102
|
+
mediaTypes: {
|
|
103
|
+
banner: {
|
|
104
|
+
sizes: [[320, 480]]
|
|
105
|
+
},
|
|
106
|
+
video: {
|
|
107
|
+
sizes: [[360, 640]]
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
bids: [
|
|
111
|
+
{
|
|
112
|
+
bidder: 'displayio',
|
|
113
|
+
params: {
|
|
114
|
+
siteId: 1,
|
|
115
|
+
placementId: 1,
|
|
116
|
+
adsSrvDomain: 'appsrv.display.io',
|
|
117
|
+
cdnDomain: 'cdn.display.io',
|
|
118
|
+
pageCategory: 'pageCategory1, pageCategory2', //comma separated
|
|
119
|
+
keywords: 'keyword1, keyword2, keyword3', //comma separated
|
|
120
|
+
custom: {
|
|
121
|
+
headerText: 'Our awesome advertisement',
|
|
122
|
+
headerTextColor: '#2196f3',
|
|
123
|
+
headerBackgroundColor: 'black',
|
|
124
|
+
adContainerBackgroundColor: 'transparent',
|
|
125
|
+
fixedHeaderSelector: '.site-header',
|
|
126
|
+
},
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
// minimal required options
|
|
132
|
+
{
|
|
133
|
+
code: 'ad-tag-2',
|
|
134
|
+
bids: [{
|
|
135
|
+
bidder: 'displayio',
|
|
136
|
+
params: {
|
|
137
|
+
siteId: 1,
|
|
138
|
+
placementId: 1,
|
|
139
|
+
adsSrvDomain: 'appsrv.display.io',
|
|
140
|
+
cdnDomain: 'cdn.display.io',
|
|
141
|
+
}
|
|
142
|
+
}]
|
|
143
|
+
}
|
|
144
|
+
];
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
# Additional Details
|
|
148
|
+
[Mobile web prebid.js integration](https://www.display.io/documentation/mobile-web-prebid-js-integration/)
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { registerBidder } from '../src/adapters/bidderFactory.js';
|
|
2
|
+
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
|
|
3
|
+
import { isFn, deepAccess, logMessage } from '../src/utils.js';
|
|
4
|
+
|
|
5
|
+
const BIDDER_CODE = 'e_volution';
|
|
6
|
+
const AD_URL = 'https://service.e-volution.ai/?c=o&m=multi';
|
|
7
|
+
const URL_SYNC = 'https://service.e-volution.ai/?c=o&m=sync';
|
|
8
|
+
const NO_SYNC = true;
|
|
9
|
+
|
|
10
|
+
function isBidResponseValid(bid) {
|
|
11
|
+
if (!bid.requestId || !bid.cpm || !bid.creativeId ||
|
|
12
|
+
!bid.ttl || !bid.currency) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
switch (bid.mediaType) {
|
|
16
|
+
case BANNER:
|
|
17
|
+
return Boolean(bid.width && bid.height && bid.ad);
|
|
18
|
+
case VIDEO:
|
|
19
|
+
return Boolean(bid.vastUrl);
|
|
20
|
+
case NATIVE:
|
|
21
|
+
return Boolean(bid.native && bid.native.title && bid.native.image && bid.native.impressionTrackers);
|
|
22
|
+
default:
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getBidFloor(bid) {
|
|
28
|
+
if (!isFn(bid.getFloor)) {
|
|
29
|
+
return deepAccess(bid, 'params.bidfloor', 0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
const bidFloor = bid.getFloor({
|
|
34
|
+
currency: 'USD',
|
|
35
|
+
mediaType: '*',
|
|
36
|
+
size: '*',
|
|
37
|
+
});
|
|
38
|
+
return bidFloor.floor;
|
|
39
|
+
} catch (_) {
|
|
40
|
+
return 0
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const spec = {
|
|
45
|
+
code: BIDDER_CODE,
|
|
46
|
+
supportedMediaTypes: [BANNER, VIDEO, NATIVE],
|
|
47
|
+
noSync: NO_SYNC,
|
|
48
|
+
|
|
49
|
+
isBidRequestValid: (bid) => {
|
|
50
|
+
return Boolean(bid.bidId && bid.params && !isNaN(parseInt(bid.params.placementId)));
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
buildRequests: (validBidRequests = [], bidderRequest) => {
|
|
54
|
+
let winTop = window;
|
|
55
|
+
let location;
|
|
56
|
+
try {
|
|
57
|
+
location = new URL(bidderRequest.refererInfo.referer)
|
|
58
|
+
winTop = window.top;
|
|
59
|
+
} catch (e) {
|
|
60
|
+
location = winTop.location;
|
|
61
|
+
logMessage(e);
|
|
62
|
+
};
|
|
63
|
+
let placements = [];
|
|
64
|
+
let request = {
|
|
65
|
+
'deviceWidth': winTop.screen.width,
|
|
66
|
+
'deviceHeight': winTop.screen.height,
|
|
67
|
+
'language': (navigator && navigator.language) ? navigator.language.split('-')[0] : '',
|
|
68
|
+
'secure': 1,
|
|
69
|
+
'host': location.host,
|
|
70
|
+
'page': location.pathname,
|
|
71
|
+
'placements': placements
|
|
72
|
+
};
|
|
73
|
+
if (bidderRequest) {
|
|
74
|
+
if (bidderRequest.uspConsent) {
|
|
75
|
+
request.ccpa = bidderRequest.uspConsent;
|
|
76
|
+
}
|
|
77
|
+
if (bidderRequest.gdprConsent) {
|
|
78
|
+
request.gdpr = bidderRequest.gdprConsent
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const len = validBidRequests.length;
|
|
82
|
+
|
|
83
|
+
for (let i = 0; i < len; i++) {
|
|
84
|
+
let bid = validBidRequests[i];
|
|
85
|
+
|
|
86
|
+
const placement = {
|
|
87
|
+
placementId: bid.params.placementId,
|
|
88
|
+
bidId: bid.bidId,
|
|
89
|
+
bidfloor: getBidFloor(bid)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (bid.mediaTypes && bid.mediaTypes[BANNER] && bid.mediaTypes[BANNER].sizes) {
|
|
93
|
+
placement.traffic = BANNER;
|
|
94
|
+
placement.sizes = bid.mediaTypes[BANNER].sizes;
|
|
95
|
+
} else if (bid.mediaTypes && bid.mediaTypes[VIDEO] && bid.mediaTypes[VIDEO].playerSize) {
|
|
96
|
+
placement.traffic = VIDEO;
|
|
97
|
+
placement.wPlayer = bid.mediaTypes[VIDEO].playerSize[0];
|
|
98
|
+
placement.hPlayer = bid.mediaTypes[VIDEO].playerSize[1];
|
|
99
|
+
placement.minduration = bid.mediaTypes[VIDEO].minduration;
|
|
100
|
+
placement.maxduration = bid.mediaTypes[VIDEO].maxduration;
|
|
101
|
+
placement.mimes = bid.mediaTypes[VIDEO].mimes;
|
|
102
|
+
placement.protocols = bid.mediaTypes[VIDEO].protocols;
|
|
103
|
+
placement.startdelay = bid.mediaTypes[VIDEO].startdelay;
|
|
104
|
+
placement.placement = bid.mediaTypes[VIDEO].placement;
|
|
105
|
+
placement.skip = bid.mediaTypes[VIDEO].skip;
|
|
106
|
+
placement.skipafter = bid.mediaTypes[VIDEO].skipafter;
|
|
107
|
+
placement.minbitrate = bid.mediaTypes[VIDEO].minbitrate;
|
|
108
|
+
placement.maxbitrate = bid.mediaTypes[VIDEO].maxbitrate;
|
|
109
|
+
placement.delivery = bid.mediaTypes[VIDEO].delivery;
|
|
110
|
+
placement.playbackmethod = bid.mediaTypes[VIDEO].playbackmethod;
|
|
111
|
+
placement.api = bid.mediaTypes[VIDEO].api;
|
|
112
|
+
placement.linearity = bid.mediaTypes[VIDEO].linearity;
|
|
113
|
+
} else if (bid.mediaTypes && bid.mediaTypes[NATIVE]) {
|
|
114
|
+
placement.traffic = NATIVE;
|
|
115
|
+
placement.native = bid.mediaTypes[NATIVE];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (bid.schain) {
|
|
119
|
+
placements.schain = bid.schain;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
placements.push(placement);
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
method: 'POST',
|
|
126
|
+
url: AD_URL,
|
|
127
|
+
data: request
|
|
128
|
+
};
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
interpretResponse: (serverResponse) => {
|
|
132
|
+
let response = [];
|
|
133
|
+
for (let i = 0; i < serverResponse.body.length; i++) {
|
|
134
|
+
let resItem = serverResponse.body[i];
|
|
135
|
+
if (isBidResponseValid(resItem)) {
|
|
136
|
+
const advertiserDomains = resItem.adomain && resItem.adomain.length ? resItem.adomain : [];
|
|
137
|
+
resItem.meta = { ...resItem.meta, advertiserDomains };
|
|
138
|
+
|
|
139
|
+
response.push(resItem);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return response;
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
getUserSyncs: (syncOptions, serverResponses) => {
|
|
146
|
+
if (NO_SYNC) {
|
|
147
|
+
return false
|
|
148
|
+
} else {
|
|
149
|
+
return [{
|
|
150
|
+
type: 'image',
|
|
151
|
+
url: URL_SYNC
|
|
152
|
+
}];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
registerBidder(spec);
|