prebid.js 5.19.0 → 6.2.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 +4 -2
- package/browsers.json +13 -37
- package/gulpfile.js +1 -0
- package/karma.conf.maker.js +1 -1
- package/modules/adheseBidAdapter.js +7 -2
- package/modules/adkernelBidAdapter.js +1 -0
- package/modules/adlivetechBidAdapter.md +61 -0
- package/modules/admixerBidAdapter.js +2 -1
- package/modules/adnuntiusBidAdapter.js +2 -1
- package/modules/adomikAnalyticsAdapter.js +10 -4
- package/modules/adplusBidAdapter.js +203 -0
- package/modules/adplusBidAdapter.md +39 -0
- package/modules/adyoulikeBidAdapter.js +7 -2
- package/modules/airgridRtdProvider.js +1 -1
- package/modules/appnexusBidAdapter.js +28 -5
- package/modules/atsAnalyticsAdapter.js +67 -46
- package/modules/atsAnalyticsAdapter.md +1 -0
- package/modules/beachfrontBidAdapter.js +14 -17
- package/modules/betweenBidAdapter.js +2 -1
- package/modules/browsiRtdProvider.js +106 -18
- package/modules/cleanioRtdProvider.js +192 -0
- package/modules/cleanioRtdProvider.md +59 -0
- package/modules/codefuelBidAdapter.js +1 -3
- package/modules/codefuelBidAdapter.md +3 -3
- package/modules/craftBidAdapter.js +5 -3
- package/modules/datablocksBidAdapter.js +3 -3
- package/modules/dchain.js +149 -0
- package/modules/dchain.md +45 -0
- package/modules/deepintentBidAdapter.js +1 -1
- package/modules/deltaprojectsBidAdapter.js +252 -0
- package/modules/deltaprojectsBidAdapter.md +32 -0
- package/modules/emx_digitalBidAdapter.js +9 -1
- package/modules/engageyaBidAdapter.js +68 -54
- package/modules/freewheel-sspBidAdapter.js +6 -0
- package/modules/glimpseBidAdapter.js +31 -16
- package/modules/goldbachBidAdapter.js +1176 -0
- package/modules/goldbachBidAdapter.md +151 -0
- package/modules/gptPreAuction.js +11 -5
- package/modules/gridBidAdapter.js +1 -0
- package/modules/gumgumBidAdapter.js +5 -1
- package/modules/id5IdSystem.md +6 -6
- package/modules/imRtdProvider.js +31 -0
- package/modules/intersectionRtdProvider.js +114 -0
- package/modules/invibesBidAdapter.js +15 -9
- package/modules/ipromBidAdapter.js +79 -0
- package/modules/ixBidAdapter.js +173 -22
- package/modules/jixieBidAdapter.js +8 -2
- package/modules/justpremiumBidAdapter.js +6 -1
- package/modules/limelightDigitalBidAdapter.js +2 -1
- package/modules/livewrappedAnalyticsAdapter.js +5 -0
- package/modules/luponmediaBidAdapter.js +570 -0
- package/modules/merkleIdSystem.js +5 -0
- package/modules/missenaBidAdapter.js +89 -0
- package/modules/multibid/index.js +3 -3
- package/modules/nativoBidAdapter.js +32 -2
- package/modules/oguryBidAdapter.js +2 -1
- package/modules/openxBidAdapter.js +7 -2
- 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/pubmaticBidAdapter.js +5 -3
- package/modules/relaidoBidAdapter.js +86 -65
- package/modules/richaudienceBidAdapter.js +1 -1
- 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 +9 -1
- package/modules/smartxBidAdapter.js +17 -1
- package/modules/sonobiBidAdapter.js +7 -0
- package/modules/sortableBidAdapter.js +1 -0
- package/modules/sspBCBidAdapter.js +34 -3
- package/modules/tappxBidAdapter.js +3 -1
- package/modules/teadsBidAdapter.js +3 -0
- package/modules/trustxBidAdapter.js +18 -7
- package/modules/undertoneBidAdapter.js +8 -1
- package/modules/userId/index.js +27 -2
- package/modules/ventes.md +71 -0
- package/modules/ventesBidAdapter.js +410 -0
- package/modules/ventesBidAdapter.md +93 -0
- package/modules/vidoomyBidAdapter.js +51 -100
- package/modules/visxBidAdapter.js +20 -3
- package/modules/visxBidAdapter.md +4 -6
- package/modules/yahoosspBidAdapter.js +6 -6
- package/modules/yahoosspBidAdapter.md +1 -1
- package/modules/yieldlabBidAdapter.js +41 -10
- package/modules/yieldlabBidAdapter.md +91 -48
- package/modules/yieldoneBidAdapter.js +115 -11
- package/package.json +6 -1
- package/src/adapterManager.js +14 -8
- package/src/auction.js +14 -13
- package/src/targeting.js +2 -2
- package/src/utils.js +7 -0
- package/test/spec/integration/faker/googletag.js +6 -0
- package/test/spec/modules/adheseBidAdapter_spec.js +27 -1
- package/test/spec/modules/adnuntiusBidAdapter_spec.js +18 -0
- package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
- package/test/spec/modules/adplusBidAdapter_spec.js +213 -0
- package/test/spec/modules/adyoulikeBidAdapter_spec.js +26 -0
- package/test/spec/modules/appnexusBidAdapter_spec.js +65 -2
- package/test/spec/modules/atsAnalyticsAdapter_spec.js +42 -9
- package/test/spec/modules/beachfrontBidAdapter_spec.js +65 -1
- 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 +1 -1
- package/test/spec/modules/datablocksBidAdapter_spec.js +3 -3
- package/test/spec/modules/dchain_spec.js +329 -0
- package/test/spec/modules/deltaprojectsBidAdapter_spec.js +399 -0
- package/test/spec/modules/emx_digitalBidAdapter_spec.js +10 -0
- package/test/spec/modules/engageyaBidAdapter_spec.js +231 -95
- package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
- package/test/spec/modules/freewheel-sspBidAdapter_spec.js +19 -0
- package/test/spec/modules/glimpseBidAdapter_spec.js +33 -0
- package/test/spec/modules/goldbachBidAdapter_spec.js +1359 -0
- package/test/spec/modules/gptPreAuction_spec.js +58 -4
- package/test/spec/modules/gumgumBidAdapter_spec.js +6 -0
- package/test/spec/modules/imRtdProvider_spec.js +25 -0
- package/test/spec/modules/intersectionRtdProvider_spec.js +141 -0
- package/test/spec/modules/invibesBidAdapter_spec.js +29 -4
- package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
- package/test/spec/modules/ixBidAdapter_spec.js +288 -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 +10 -7
- package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +23 -4
- package/test/spec/modules/luponmediaBidAdapter_spec.js +412 -0
- package/test/spec/modules/merkleIdSystem_spec.js +18 -0
- package/test/spec/modules/missenaBidAdapter_spec.js +134 -0
- package/test/spec/modules/multibid_spec.js +31 -31
- package/test/spec/modules/nativoBidAdapter_spec.js +35 -18
- package/test/spec/modules/oguryBidAdapter_spec.js +13 -11
- package/test/spec/modules/openxBidAdapter_spec.js +5 -26
- 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/pubmaticBidAdapter_spec.js +1 -1
- package/test/spec/modules/relaidoBidAdapter_spec.js +71 -63
- package/test/spec/modules/seedtagBidAdapter_spec.js +3 -0
- package/test/spec/modules/smaatoBidAdapter_spec.js +61 -0
- package/test/spec/modules/smartxBidAdapter_spec.js +9 -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/tappxBidAdapter_spec.js +4 -0
- package/test/spec/modules/teadsBidAdapter_spec.js +132 -0
- package/test/spec/modules/trustxBidAdapter_spec.js +45 -3
- package/test/spec/modules/userId_spec.js +51 -0
- package/test/spec/modules/ventesBidAdapter_spec.js +845 -0
- package/test/spec/modules/vidoomyBidAdapter_spec.js +32 -13
- package/test/spec/modules/visxBidAdapter_spec.js +121 -5
- package/test/spec/modules/yieldlabBidAdapter_spec.js +81 -0
- package/test/spec/modules/yieldoneBidAdapter_spec.js +299 -53
- package/test/spec/unit/core/adapterManager_spec.js +26 -7
- package/test/spec/unit/core/targeting_spec.js +44 -0
- package/wdio.conf.js +1 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
Module Name: clean.io Rtd provider
|
|
5
|
+
Module Type: Rtd Provider
|
|
6
|
+
Maintainer: nick@clean.io
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
The clean.io Realtime module provides effective anti-malvertising solution for publishers, including, but not limited to,
|
|
10
|
+
blocking unwanted 0- and 1-click redirects, deceptive ads or those with malicious landing pages, and various types of affiliate fraud.
|
|
11
|
+
|
|
12
|
+
Using this module requires prior agreement with [clean.io](https://clean.io) to obtain the necessary distribution key.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# Integration
|
|
16
|
+
|
|
17
|
+
clean.io Realtime module can be built just like any other prebid module:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
gulp build --modules=cleanioRtdProvider,...
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# Configuration
|
|
25
|
+
|
|
26
|
+
When built into prebid.js, this module can be configured through the following `pbjs.setConfig` call:
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
pbjs.setConfig({
|
|
30
|
+
realTimeData: {
|
|
31
|
+
dataProviders: [{
|
|
32
|
+
name: 'clean.io',
|
|
33
|
+
params: {
|
|
34
|
+
cdnUrl: 'https://abc1234567890.cloudfront.net/script.js', ///< Contact clean.io to get your own CDN URL
|
|
35
|
+
protectionMode: 'full', ///< Supported modes are 'full', 'bids' and 'bids-nowait', see below.
|
|
36
|
+
}
|
|
37
|
+
}]
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## Configuration parameters
|
|
44
|
+
|
|
45
|
+
{: .table .table-bordered .table-striped }
|
|
46
|
+
| Name | Type | Scope | Description |
|
|
47
|
+
| :------------ | :------------ | :------------ |:------------ |
|
|
48
|
+
| ``cdnUrl`` | ``string`` | Required | CDN URL of the script, which is to be used for protection. |
|
|
49
|
+
| ``protectionMode`` | ``'full' \| 'bids' \| 'bids-nowait'`` | Required | Integration mode. Please refer to the "Integration modes" section for details. |
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## Integration modes
|
|
53
|
+
|
|
54
|
+
{: .table .table-bordered .table-striped }
|
|
55
|
+
| Integration Mode | Parameter Value | Description |
|
|
56
|
+
| :------------ | :------------ | :------------ |
|
|
57
|
+
| Full page protection | ``'full'`` | Preferred mode. The module will add the protector agent script directly to the page, and it will protect all placements. This mode will make the most out of various behavioral detection mechanisms, and will also prevent typical malicious behaviors. Please note that in this mode, depending on Prebid library naming, Chrome may mistakenly tag non-ad-related content as ads: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/ad_tagging.md. |
|
|
58
|
+
| Bids-only protection | ``'bids'`` | The module will protect specific bid responses, more specifically, the HTML representing ad payload, by wrapping it into the agent script. Please note that in this mode, ads delivered directly, outside of Prebid integration, will not be protected, since the module can only access the ads coming through Prebid. |
|
|
59
|
+
| Bids-only protection with no delay on bid rendering | ``'bids-nowait'`` | Same as above, but in this mode, the script will also *not* wrap those bid responses, which arrived prior to successful preloading of agent script. |
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { deepAccess, isArray } from '../src/utils.js';
|
|
2
|
-
import { config } from '../src/config.js';
|
|
3
2
|
import {registerBidder} from '../src/adapters/bidderFactory.js';
|
|
4
3
|
import { BANNER } from '../src/mediaTypes.js';
|
|
5
4
|
const BIDDER_CODE = 'codefuel';
|
|
@@ -34,8 +33,7 @@ export const spec = {
|
|
|
34
33
|
const devicetype = getDeviceType()
|
|
35
34
|
const publisher = setOnAny(validBidRequests, 'params.publisher');
|
|
36
35
|
const cur = CURRENCY;
|
|
37
|
-
|
|
38
|
-
const endpointUrl = config.getConfig('codefuel.bidderUrl');
|
|
36
|
+
const endpointUrl = 'https://ai-p-codefuel-ds-rtb-us-east-1-k8s.seccint.com/prebid'
|
|
39
37
|
const timeout = bidderRequest.timeout;
|
|
40
38
|
|
|
41
39
|
validBidRequests.forEach(bid => bid.netRevenue = 'net');
|
|
@@ -21,7 +21,7 @@ You will receive the URLs when contacting us.
|
|
|
21
21
|
```
|
|
22
22
|
pbjs.setConfig({
|
|
23
23
|
codefuel: {
|
|
24
|
-
bidderUrl: 'https://ai-
|
|
24
|
+
bidderUrl: 'https://ai-p-codefuel-ds-rtb-us-east-1-k8s.seccint.com/prebid',
|
|
25
25
|
usersyncUrl: 'https://usersync-url.com'
|
|
26
26
|
}
|
|
27
27
|
});
|
|
@@ -74,7 +74,7 @@ pbjs.setConfig({
|
|
|
74
74
|
|
|
75
75
|
pbjs.setConfig({
|
|
76
76
|
codefuel: {
|
|
77
|
-
bidderUrl: 'https://
|
|
77
|
+
bidderUrl: 'https://ai-p-codefuel-ds-rtb-us-east-1-k8s.seccint.com/prebid'
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
```
|
|
@@ -105,7 +105,7 @@ pbjs.setConfig({
|
|
|
105
105
|
|
|
106
106
|
pbjs.setConfig({
|
|
107
107
|
codefuel: {
|
|
108
|
-
bidderUrl: 'https://
|
|
108
|
+
bidderUrl: 'https://ai-p-codefuel-ds-rtb-us-east-1-k8s.seccint.com/prebid'
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
```
|
|
@@ -5,6 +5,7 @@ import { auctionManager } from '../src/auctionManager.js';
|
|
|
5
5
|
import find from 'core-js-pure/features/array/find.js';
|
|
6
6
|
import includes from 'core-js-pure/features/array/includes.js';
|
|
7
7
|
import { getStorageManager } from '../src/storageManager.js';
|
|
8
|
+
import {ajax} from '../src/ajax.js';
|
|
8
9
|
|
|
9
10
|
const BIDDER_CODE = 'craft';
|
|
10
11
|
const URL_BASE = 'https://gacraft.jp/prebid-v3';
|
|
@@ -110,9 +111,10 @@ export const spec = {
|
|
|
110
111
|
},
|
|
111
112
|
|
|
112
113
|
onBidWon: function(bid) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
ajax(bid._prebidWon, null, null, {
|
|
115
|
+
method: 'POST',
|
|
116
|
+
contentType: 'application/json'
|
|
117
|
+
});
|
|
116
118
|
}
|
|
117
119
|
};
|
|
118
120
|
|
|
@@ -94,7 +94,7 @@ export const spec = {
|
|
|
94
94
|
code: 'datablocks',
|
|
95
95
|
|
|
96
96
|
// DATABLOCKS SCOPED OBJECT
|
|
97
|
-
db_obj: {metrics_host: 'prebid.
|
|
97
|
+
db_obj: {metrics_host: 'prebid.dblks.net', metrics: [], metrics_timer: null, metrics_queue_time: 1000, vis_optout: false, source_id: 0},
|
|
98
98
|
|
|
99
99
|
// STORE THE DATABLOCKS BUYERID IN STORAGE
|
|
100
100
|
store_dbid: function(dbid) {
|
|
@@ -388,12 +388,12 @@ export const spec = {
|
|
|
388
388
|
};
|
|
389
389
|
|
|
390
390
|
let sourceId = validRequests[0].params.source_id || 0;
|
|
391
|
-
let host = validRequests[0].params.host || 'prebid.
|
|
391
|
+
let host = validRequests[0].params.host || 'prebid.dblks.net';
|
|
392
392
|
|
|
393
393
|
// RETURN WITH THE REQUEST AND PAYLOAD
|
|
394
394
|
return {
|
|
395
395
|
method: 'POST',
|
|
396
|
-
url: `https://${
|
|
396
|
+
url: `https://${host}/openrtb/?sid=${sourceId}`,
|
|
397
397
|
data: {
|
|
398
398
|
id: bidderRequest.auctionId,
|
|
399
399
|
imp: imps,
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import includes from 'core-js-pure/features/array/includes.js';
|
|
2
|
+
import { config } from '../src/config.js';
|
|
3
|
+
import { getHook } from '../src/hook.js';
|
|
4
|
+
import { _each, isStr, isArray, isPlainObject, hasOwn, deepClone, deepAccess, logWarn, logError } from '../src/utils.js';
|
|
5
|
+
|
|
6
|
+
const shouldBeAString = ' should be a string';
|
|
7
|
+
const shouldBeAnObject = ' should be an object';
|
|
8
|
+
const shouldBeAnArray = ' should be an Array';
|
|
9
|
+
const shouldBeValid = ' is not a valid dchain property';
|
|
10
|
+
const MODE = {
|
|
11
|
+
STRICT: 'strict',
|
|
12
|
+
RELAXED: 'relaxed',
|
|
13
|
+
OFF: 'off'
|
|
14
|
+
};
|
|
15
|
+
const MODES = []; // an array of modes
|
|
16
|
+
_each(MODE, mode => MODES.push(mode));
|
|
17
|
+
|
|
18
|
+
export function checkDchainSyntax(bid, mode) {
|
|
19
|
+
let dchainObj = deepClone(bid.meta.dchain);
|
|
20
|
+
let failPrefix = 'Detected something wrong in bid.meta.dchain object for bid:';
|
|
21
|
+
let failMsg = '';
|
|
22
|
+
const dchainPropList = ['ver', 'complete', 'nodes', 'ext'];
|
|
23
|
+
|
|
24
|
+
function appendFailMsg(msg) {
|
|
25
|
+
failMsg += '\n' + msg;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function printFailMsg() {
|
|
29
|
+
if (mode === MODE.STRICT) {
|
|
30
|
+
logError(failPrefix, bid, '\n', dchainObj, failMsg);
|
|
31
|
+
} else {
|
|
32
|
+
logWarn(failPrefix, bid, `\n`, dchainObj, failMsg);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let dchainProps = Object.keys(dchainObj);
|
|
37
|
+
dchainProps.forEach(prop => {
|
|
38
|
+
if (!includes(dchainPropList, prop)) {
|
|
39
|
+
appendFailMsg(`dchain.${prop}` + shouldBeValid);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (dchainObj.complete !== 0 && dchainObj.complete !== 1) {
|
|
44
|
+
appendFailMsg(`dchain.complete should be 0 or 1`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (!isStr(dchainObj.ver)) {
|
|
48
|
+
appendFailMsg(`dchain.ver` + shouldBeAString);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (hasOwn(dchainObj, 'ext')) {
|
|
52
|
+
if (!isPlainObject(dchainObj.ext)) {
|
|
53
|
+
appendFailMsg(`dchain.ext` + shouldBeAnObject);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (!isArray(dchainObj.nodes)) {
|
|
58
|
+
appendFailMsg(`dchain.nodes` + shouldBeAnArray);
|
|
59
|
+
printFailMsg();
|
|
60
|
+
if (mode === MODE.STRICT) return false;
|
|
61
|
+
} else {
|
|
62
|
+
const nodesPropList = ['asi', 'bsid', 'rid', 'name', 'domain', 'ext'];
|
|
63
|
+
dchainObj.nodes.forEach((node, index) => {
|
|
64
|
+
if (!isPlainObject(node)) {
|
|
65
|
+
appendFailMsg(`dchain.nodes[${index}]` + shouldBeAnObject);
|
|
66
|
+
} else {
|
|
67
|
+
let nodeProps = Object.keys(node);
|
|
68
|
+
nodeProps.forEach(prop => {
|
|
69
|
+
if (!includes(nodesPropList, prop)) {
|
|
70
|
+
appendFailMsg(`dchain.nodes[${index}].${prop}` + shouldBeValid);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (prop === 'ext') {
|
|
74
|
+
if (!isPlainObject(node.ext)) {
|
|
75
|
+
appendFailMsg(`dchain.nodes[${index}].ext` + shouldBeAnObject);
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
if (!isStr(node[prop])) {
|
|
79
|
+
appendFailMsg(`dchain.nodes[${index}].${prop}` + shouldBeAString);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (failMsg.length > 0) {
|
|
88
|
+
printFailMsg();
|
|
89
|
+
if (mode === MODE.STRICT) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function isValidDchain(bid) {
|
|
97
|
+
let mode = MODE.STRICT;
|
|
98
|
+
const dchainConfig = config.getConfig('dchain');
|
|
99
|
+
|
|
100
|
+
if (dchainConfig && isStr(dchainConfig.validation) && MODES.indexOf(dchainConfig.validation) != -1) {
|
|
101
|
+
mode = dchainConfig.validation;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (mode === MODE.OFF) {
|
|
105
|
+
return true;
|
|
106
|
+
} else {
|
|
107
|
+
return checkDchainSyntax(bid, mode);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function addBidResponseHook(fn, adUnitCode, bid) {
|
|
112
|
+
const basicDchain = {
|
|
113
|
+
ver: '1.0',
|
|
114
|
+
complete: 0,
|
|
115
|
+
nodes: []
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
if (deepAccess(bid, 'meta.networkId') && deepAccess(bid, 'meta.networkName')) {
|
|
119
|
+
basicDchain.nodes.push({ name: bid.meta.networkName, bsid: bid.meta.networkId.toString() });
|
|
120
|
+
}
|
|
121
|
+
basicDchain.nodes.push({ name: bid.bidderCode });
|
|
122
|
+
|
|
123
|
+
let bidDchain = deepAccess(bid, 'meta.dchain');
|
|
124
|
+
if (bidDchain && isPlainObject(bidDchain)) {
|
|
125
|
+
let result = isValidDchain(bid);
|
|
126
|
+
|
|
127
|
+
if (result) {
|
|
128
|
+
// extra check in-case mode is OFF and there is a setup issue
|
|
129
|
+
if (isArray(bidDchain.nodes)) {
|
|
130
|
+
bid.meta.dchain.nodes.push({ asi: bid.bidderCode });
|
|
131
|
+
} else {
|
|
132
|
+
logWarn('bid.meta.dchain.nodes did not exist or was not an array; did not append prebid dchain.', bid);
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
// remove invalid dchain
|
|
136
|
+
delete bid.meta.dchain;
|
|
137
|
+
}
|
|
138
|
+
} else {
|
|
139
|
+
bid.meta.dchain = basicDchain;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
fn(adUnitCode, bid);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function init() {
|
|
146
|
+
getHook('addBidResponse').before(addBidResponseHook, 35);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
init();
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# dchain module
|
|
2
|
+
|
|
3
|
+
Refer:
|
|
4
|
+
- https://iabtechlab.com/buyers-json-demand-chain/
|
|
5
|
+
|
|
6
|
+
## Sample code for dchain setConfig and dchain object
|
|
7
|
+
```
|
|
8
|
+
pbjs.setConfig({
|
|
9
|
+
"dchain": {
|
|
10
|
+
"validation": "strict"
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
bid.meta.dchain: {
|
|
17
|
+
"complete": 0,
|
|
18
|
+
"ver": "1.0",
|
|
19
|
+
"ext": {...},
|
|
20
|
+
"nodes": [{
|
|
21
|
+
"asi": "abc",
|
|
22
|
+
"bsid": "123",
|
|
23
|
+
"rid": "d4e5f6",
|
|
24
|
+
"name": "xyz",
|
|
25
|
+
"domain": "mno",
|
|
26
|
+
"ext": {...}
|
|
27
|
+
}, ...]
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Workflow
|
|
32
|
+
The dchain module is not enabled by default as it may not be necessary for all publishers.
|
|
33
|
+
If required, dchain module can be included as following
|
|
34
|
+
```
|
|
35
|
+
$ gulp build --modules=dchain,pubmaticBidAdapter,openxBidAdapter,rubiconBidAdapter,sovrnBidAdapter
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The dchain module will validate a bidder's dchain object (if it was defined). Bidders should assign their dchain object into `bid.meta` field. If the dchain object is valid, it will remain in the bid object for later use.
|
|
39
|
+
|
|
40
|
+
If it was not defined, the dchain will create a default dchain object for prebid.
|
|
41
|
+
|
|
42
|
+
## Validation modes
|
|
43
|
+
- ```strict```: It is the default validation mode. In this mode, dchain object will not be accpeted from adapters if it is invalid. Errors are thrown for invalid dchain object.
|
|
44
|
+
- ```relaxed```: In this mode, errors are thrown for an invalid dchain object but the invalid dchain object is still accepted from adapters.
|
|
45
|
+
- ```off```: In this mode, no validations are performed and dchain object is accepted as is from adapters.
|
|
@@ -162,7 +162,7 @@ function buildImpression(bid) {
|
|
|
162
162
|
impression = {
|
|
163
163
|
id: bid.bidId,
|
|
164
164
|
tagid: bid.params.tagId || '',
|
|
165
|
-
secure: window.location.protocol === 'https' ? 1 : 0,
|
|
165
|
+
secure: window.location.protocol === 'https:' ? 1 : 0,
|
|
166
166
|
displaymanager: 'di_prebid',
|
|
167
167
|
displaymanagerver: DI_M_V,
|
|
168
168
|
ext: buildCustomParams(bid)
|
|
@@ -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
|
+
|
|
@@ -257,10 +257,18 @@ export const spec = {
|
|
|
257
257
|
tagid,
|
|
258
258
|
secure
|
|
259
259
|
};
|
|
260
|
+
|
|
261
|
+
// adding gpid support
|
|
262
|
+
let gpid = deepAccess(bid, 'ortb2Imp.ext.data.adserver.adslot');
|
|
263
|
+
if (!gpid) {
|
|
264
|
+
gpid = deepAccess(bid, 'ortb2Imp.ext.data.pbadslot');
|
|
265
|
+
}
|
|
266
|
+
if (gpid) {
|
|
267
|
+
data.ext = {gpid: gpid.toString()};
|
|
268
|
+
}
|
|
260
269
|
let typeSpecifics = isVideo ? { video: emxAdapter.buildVideo(bid) } : { banner: emxAdapter.buildBanner(bid) };
|
|
261
270
|
let bidfloorObj = bidfloor > 0 ? { bidfloor, bidfloorcur: DEFAULT_CUR } : {};
|
|
262
271
|
let emxBid = Object.assign(data, typeSpecifics, bidfloorObj);
|
|
263
|
-
|
|
264
272
|
emxImps.push(emxBid);
|
|
265
273
|
});
|
|
266
274
|
|