prebid.js 5.17.0 → 6.0.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 +3 -6
- package/README.md +3 -1
- package/browsers.json +1 -8
- package/integrationExamples/gpt/akamaidap_segments_example.html +132 -0
- package/modules/.submodules.json +1 -0
- package/modules/adfBidAdapter.js +21 -16
- package/modules/adgenerationBidAdapter.js +28 -4
- package/modules/adkernelBidAdapter.js +2 -1
- package/modules/admixerBidAdapter.js +11 -0
- 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/aolBidAdapter.js +2 -1
- package/modules/appnexusBidAdapter.js +5 -3
- package/modules/atsAnalyticsAdapter.js +67 -46
- package/modules/atsAnalyticsAdapter.md +1 -0
- package/modules/betweenBidAdapter.js +20 -3
- package/modules/bliinkBidAdapter.js +58 -32
- package/modules/bliinkBidAdapter.md +29 -6
- package/modules/browsiRtdProvider.js +106 -18
- package/modules/cleanioRtdProvider.js +192 -0
- package/modules/cleanioRtdProvider.md +59 -0
- package/modules/codefuelBidAdapter.js +183 -0
- package/modules/codefuelBidAdapter.md +111 -0
- package/modules/connectIdSystem.js +104 -0
- package/modules/connectIdSystem.md +33 -0
- package/modules/cwireBidAdapter.js +272 -0
- package/modules/cwireBidAdapter.md +43 -0
- package/modules/deepintentBidAdapter.js +106 -9
- package/modules/deepintentBidAdapter.md +36 -1
- package/modules/deltaprojectsBidAdapter.js +252 -0
- package/modules/deltaprojectsBidAdapter.md +32 -0
- package/modules/dgkeywordRtdProvider.js +0 -1
- package/modules/engageyaBidAdapter.js +157 -0
- package/modules/gridBidAdapter.js +1 -0
- package/modules/gumgumBidAdapter.js +8 -0
- package/modules/inskinBidAdapter.js +7 -3
- package/modules/ixBidAdapter.js +8 -1
- package/modules/jixieBidAdapter.js +8 -2
- package/modules/justpremiumBidAdapter.js +6 -1
- package/modules/limelightDigitalBidAdapter.js +22 -2
- package/modules/livewrappedAnalyticsAdapter.js +53 -3
- package/modules/mediakeysBidAdapter.js +2 -1
- package/modules/multibid/index.js +3 -3
- package/modules/nativoBidAdapter.js +6 -2
- package/modules/nextMillenniumBidAdapter.js +12 -3
- package/modules/oguryBidAdapter.js +36 -7
- package/modules/openxBidAdapter.js +34 -22
- 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/pixfutureBidAdapter.js +24 -4
- package/modules/pixfutureBidAdapter.md +127 -0
- package/modules/playwireBidAdapter.md +61 -0
- package/modules/prebidServerBidAdapter/index.js +1 -1
- package/modules/proxistoreBidAdapter.js +4 -6
- package/modules/publinkIdSystem.js +11 -6
- package/modules/pubmaticBidAdapter.js +9 -0
- package/modules/pubmaticBidAdapter.md +1 -1
- package/modules/rtdModule/index.js +2 -2
- package/modules/sonobiBidAdapter.js +7 -0
- package/modules/sortableBidAdapter.js +1 -0
- package/modules/talkadsBidAdapter.js +129 -0
- package/modules/talkadsBidAdapter.md +60 -0
- package/modules/teadsBidAdapter.js +3 -0
- package/modules/tripleliftBidAdapter.js +22 -5
- package/modules/trustxBidAdapter.js +8 -6
- package/modules/undertoneBidAdapter.js +9 -5
- package/modules/undertoneBidAdapter.md +5 -1
- package/modules/unicornBidAdapter.js +3 -3
- 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/visxBidAdapter.js +15 -22
- package/modules/yahoosspBidAdapter.js +637 -0
- package/modules/yahoosspBidAdapter.md +795 -0
- package/modules/yieldlabBidAdapter.js +48 -3
- package/modules/yieldlabBidAdapter.md +16 -1
- package/modules/yieldmoSyntheticInventoryModule.js +46 -0
- package/modules/yieldmoSyntheticInventoryModule.md +68 -0
- package/package.json +1 -1
- package/src/adapterManager.js +5 -0
- 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/adgenerationBidAdapter_spec.js +121 -50
- 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 +2 -1
- package/test/spec/modules/atsAnalyticsAdapter_spec.js +42 -9
- package/test/spec/modules/betweenBidAdapter_spec.js +41 -0
- package/test/spec/modules/bliinkBidAdapter_spec.js +87 -36
- 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/cwireBidAdapter_spec.js +246 -0
- 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 +286 -0
- package/test/spec/modules/gumgumBidAdapter_spec.js +5 -1
- package/test/spec/modules/ixBidAdapter_spec.js +13 -3
- package/test/spec/modules/jixieBidAdapter_spec.js +13 -11
- package/test/spec/modules/justpremiumBidAdapter_spec.js +9 -2
- package/test/spec/modules/limelightDigitalBidAdapter_spec.js +155 -1
- package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +67 -12
- package/test/spec/modules/multibid_spec.js +31 -31
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +13 -1
- package/test/spec/modules/oguryBidAdapter_spec.js +125 -37
- package/test/spec/modules/openxBidAdapter_spec.js +85 -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/publinkIdSystem_spec.js +6 -6
- package/test/spec/modules/pubmaticBidAdapter_spec.js +39 -1
- package/test/spec/modules/sonobiBidAdapter_spec.js +34 -1
- package/test/spec/modules/sortableBidAdapter_spec.js +11 -0
- package/test/spec/modules/talkadsBidAdapter_spec.js +231 -0
- 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 +3 -3
- package/test/spec/modules/undertoneBidAdapter_spec.js +52 -0
- package/test/spec/modules/unicornBidAdapter_spec.js +4 -4
- package/test/spec/modules/ventesBidAdapter_spec.js +845 -0
- package/test/spec/modules/videobyteBidAdapter_spec.js +2 -2
- package/test/spec/modules/visxBidAdapter_spec.js +48 -4
- package/test/spec/modules/yahoosspBidAdapter_spec.js +1332 -0
- package/test/spec/modules/yieldlabBidAdapter_spec.js +65 -1
- package/test/spec/modules/yieldmoSyntheticInventoryModule_spec.js +89 -0
- package/test/spec/unit/core/adapterManager_spec.js +32 -0
- 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
- package/modules/turktelekomBidAdapter.md +0 -49
- package/yarn.lock +0 -13122
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module adds clean.io provider to the real time data module
|
|
3
|
+
* The {@link module:modules/realTimeData} module is required
|
|
4
|
+
* The module will wrap bid responses markup in clean.io agent script for protection
|
|
5
|
+
* @module modules/cleanioRtdProvider
|
|
6
|
+
* @requires module:modules/realTimeData
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { submodule } from '../src/hook.js';
|
|
10
|
+
import { logError, generateUUID, insertElement } from '../src/utils.js';
|
|
11
|
+
|
|
12
|
+
// ============================ MODULE STATE ===============================
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @type {function(): void}
|
|
16
|
+
* Page-wide initialization step / strategy
|
|
17
|
+
*/
|
|
18
|
+
let onModuleInit = () => {};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @type {function(Object): void}
|
|
22
|
+
* Bid response mutation step / strategy.
|
|
23
|
+
*/
|
|
24
|
+
let onBidResponse = () => {};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @type {number}
|
|
28
|
+
* 0 for unknown, 1 for preloaded, -1 for error.
|
|
29
|
+
*/
|
|
30
|
+
let preloadStatus = 0;
|
|
31
|
+
|
|
32
|
+
// ============================ MODULE LOGIC ===============================
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Page initialization step which just preloads the script, to be available whenever we start processing the bids.
|
|
36
|
+
* @param {string} scriptURL The script URL to preload
|
|
37
|
+
*/
|
|
38
|
+
function pageInitStepPreloadScript(scriptURL) {
|
|
39
|
+
const linkElement = document.createElement('link');
|
|
40
|
+
linkElement.rel = 'preload';
|
|
41
|
+
linkElement.as = 'script';
|
|
42
|
+
linkElement.href = scriptURL;
|
|
43
|
+
linkElement.onload = () => { preloadStatus = 1; };
|
|
44
|
+
linkElement.onerror = () => { preloadStatus = -1; };
|
|
45
|
+
insertElement(linkElement);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Page initialization step which adds the protector script to the whole page. With that, there is no need wrapping bids, and the coverage is better.
|
|
50
|
+
* @param {string} scriptURL The script URL to add to the page for protection
|
|
51
|
+
*/
|
|
52
|
+
function pageInitStepProtectPage(scriptURL) {
|
|
53
|
+
const scriptElement = document.createElement('script');
|
|
54
|
+
scriptElement.type = 'text/javascript';
|
|
55
|
+
scriptElement.src = scriptURL;
|
|
56
|
+
insertElement(scriptElement);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Bid processing step which alters the ad HTML to contain bid-specific information, which can be used to identify the creative later.
|
|
61
|
+
* @param {Object} bidResponse Bid response data
|
|
62
|
+
*/
|
|
63
|
+
function bidWrapStepAugmentHtml(bidResponse) {
|
|
64
|
+
bidResponse.ad = `<!-- pbad://creativeId=${bidResponse.creativeId || ''}&bidderCode=${bidResponse.bidderCode || ''}&cpm=${bidResponse.cpm || ''} -->\n${bidResponse.ad}`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Bid processing step which applies creative protection by wrapping the ad HTML.
|
|
69
|
+
* @param {string} scriptURL
|
|
70
|
+
* @param {number} requiredPreload
|
|
71
|
+
* @param {Object} bidResponse
|
|
72
|
+
*/
|
|
73
|
+
function bidWrapStepProtectByWrapping(scriptURL, requiredPreload, bidResponse) {
|
|
74
|
+
// Still prepend bid info, it's always helpful to have creative data in its payload
|
|
75
|
+
bidWrapStepAugmentHtml(bidResponse);
|
|
76
|
+
|
|
77
|
+
// If preloading failed, or if configuration requires us to finish preloading -
|
|
78
|
+
// we should not process this bid any further
|
|
79
|
+
if (preloadStatus < requiredPreload) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const sid = generateUUID();
|
|
84
|
+
bidResponse.ad = `
|
|
85
|
+
<script type="text/javascript"
|
|
86
|
+
src="${scriptURL}"
|
|
87
|
+
data-api-integration-mode="prebid"
|
|
88
|
+
data-api-session-uuid="${sid}">
|
|
89
|
+
</script>
|
|
90
|
+
<script type="text/javascript">
|
|
91
|
+
var ad = "${encodeURIComponent(bidResponse.ad)}";
|
|
92
|
+
var agent = window["${sid}"];
|
|
93
|
+
if (agent && typeof agent.put === "function") {
|
|
94
|
+
agent.put(ad);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
document.open();
|
|
98
|
+
document.write(decodeURIComponent(ad));
|
|
99
|
+
document.close();
|
|
100
|
+
}
|
|
101
|
+
</script>
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Custom error class to differentiate validation errors
|
|
107
|
+
*/
|
|
108
|
+
class ConfigError extends Error { }
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The function to be called upon module init. Depending on the passed config, initializes properly init/bid steps or throws ConfigError.
|
|
112
|
+
* @param {Object} config
|
|
113
|
+
*/
|
|
114
|
+
function readConfig(config) {
|
|
115
|
+
if (!config.params) {
|
|
116
|
+
throw new ConfigError('Missing config parameters for clean.io RTD module provider.');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (typeof config.params.cdnUrl !== 'string' || !/^https?:\/\//.test(config.params.cdnUrl)) {
|
|
120
|
+
throw new ConfigError('Parameter "cdnUrl" is a required string parameter, which should start with "http(s)://".');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (typeof config.params.protectionMode !== 'string') {
|
|
124
|
+
throw new ConfigError('Parameter "protectionMode" is a required string parameter.');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const scriptURL = config.params.cdnUrl;
|
|
128
|
+
|
|
129
|
+
switch (config.params.protectionMode) {
|
|
130
|
+
case 'full':
|
|
131
|
+
onModuleInit = () => pageInitStepProtectPage(scriptURL);
|
|
132
|
+
onBidResponse = (bidResponse) => bidWrapStepAugmentHtml(bidResponse);
|
|
133
|
+
break;
|
|
134
|
+
|
|
135
|
+
case 'bids':
|
|
136
|
+
onModuleInit = () => pageInitStepPreloadScript(scriptURL);
|
|
137
|
+
onBidResponse = (bidResponse) => bidWrapStepProtectByWrapping(scriptURL, 0, bidResponse);
|
|
138
|
+
break;
|
|
139
|
+
|
|
140
|
+
case 'bids-nowait':
|
|
141
|
+
onModuleInit = () => pageInitStepPreloadScript(scriptURL);
|
|
142
|
+
onBidResponse = (bidResponse) => bidWrapStepProtectByWrapping(scriptURL, 1, bidResponse);
|
|
143
|
+
break;
|
|
144
|
+
|
|
145
|
+
default:
|
|
146
|
+
throw new ConfigError('Parameter "protectionMode" must be one of "full" | "bids" | "bids-nowait".');
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// ============================ MODULE REGISTRATION ===============================
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* The function which performs submodule registration.
|
|
154
|
+
*/
|
|
155
|
+
function beforeInit() {
|
|
156
|
+
submodule('realTimeData', /** @type {RtdSubmodule} */ ({
|
|
157
|
+
name: 'clean.io',
|
|
158
|
+
|
|
159
|
+
init: (config, userConsent) => {
|
|
160
|
+
try {
|
|
161
|
+
readConfig(config);
|
|
162
|
+
onModuleInit();
|
|
163
|
+
return true;
|
|
164
|
+
} catch (err) {
|
|
165
|
+
if (err instanceof ConfigError) {
|
|
166
|
+
logError(err.message);
|
|
167
|
+
}
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
onBidResponseEvent: (bidResponse, config, userConsent) => {
|
|
173
|
+
onBidResponse(bidResponse);
|
|
174
|
+
}
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Exporting local (and otherwise encapsulated to this module) functions
|
|
180
|
+
* for testing purposes
|
|
181
|
+
*/
|
|
182
|
+
export const __TEST__ = {
|
|
183
|
+
pageInitStepPreloadScript,
|
|
184
|
+
pageInitStepProtectPage,
|
|
185
|
+
bidWrapStepAugmentHtml,
|
|
186
|
+
bidWrapStepProtectByWrapping,
|
|
187
|
+
ConfigError,
|
|
188
|
+
readConfig,
|
|
189
|
+
beforeInit,
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
beforeInit();
|
|
@@ -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. |
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { deepAccess, isArray } from '../src/utils.js';
|
|
2
|
+
import { config } from '../src/config.js';
|
|
3
|
+
import {registerBidder} from '../src/adapters/bidderFactory.js';
|
|
4
|
+
import { BANNER } from '../src/mediaTypes.js';
|
|
5
|
+
const BIDDER_CODE = 'codefuel';
|
|
6
|
+
const CURRENCY = 'USD';
|
|
7
|
+
|
|
8
|
+
export const spec = {
|
|
9
|
+
code: BIDDER_CODE,
|
|
10
|
+
supportedMediaTypes: [ BANNER ],
|
|
11
|
+
aliases: ['ex'], // short code
|
|
12
|
+
/**
|
|
13
|
+
* Determines whether or not the given bid request is valid.
|
|
14
|
+
*
|
|
15
|
+
* @param {BidRequest} bid The bid params to validate.
|
|
16
|
+
* @return boolean True if this is a valid bid, and false otherwise.
|
|
17
|
+
*/
|
|
18
|
+
isBidRequestValid: function(bid) {
|
|
19
|
+
if (bid.nativeParams) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return !!(bid.params.placementId || (bid.params.member && bid.params.invCode));
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* Make a server request from the list of BidRequests.
|
|
26
|
+
*
|
|
27
|
+
* @param {validBidRequests[]} - an array of bids
|
|
28
|
+
* @return ServerRequest Info describing the request to the server.
|
|
29
|
+
*/
|
|
30
|
+
buildRequests: function(validBidRequests, bidderRequest) {
|
|
31
|
+
const page = bidderRequest.refererInfo.referer;
|
|
32
|
+
const domain = getDomainFromURL(page)
|
|
33
|
+
const ua = navigator.userAgent;
|
|
34
|
+
const devicetype = getDeviceType()
|
|
35
|
+
const publisher = setOnAny(validBidRequests, 'params.publisher');
|
|
36
|
+
const cur = CURRENCY;
|
|
37
|
+
// const endpointUrl = 'http://localhost:5000/prebid'
|
|
38
|
+
const endpointUrl = config.getConfig('codefuel.bidderUrl');
|
|
39
|
+
const timeout = bidderRequest.timeout;
|
|
40
|
+
|
|
41
|
+
validBidRequests.forEach(bid => bid.netRevenue = 'net');
|
|
42
|
+
|
|
43
|
+
const imps = validBidRequests.map((bid, idx) => {
|
|
44
|
+
const imp = {
|
|
45
|
+
id: idx + 1 + ''
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (bid.params.tagid) {
|
|
49
|
+
imp.tagid = bid.params.tagid
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (bid.sizes) {
|
|
53
|
+
imp.banner = {
|
|
54
|
+
format: transformSizes(bid.sizes)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return imp;
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const request = {
|
|
62
|
+
id: bidderRequest.auctionId,
|
|
63
|
+
site: { page, domain, publisher },
|
|
64
|
+
device: { ua, devicetype },
|
|
65
|
+
source: { fd: 1 },
|
|
66
|
+
cur: [cur],
|
|
67
|
+
tmax: timeout,
|
|
68
|
+
imp: imps,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
method: 'POST',
|
|
73
|
+
url: endpointUrl,
|
|
74
|
+
data: request,
|
|
75
|
+
bids: validBidRequests,
|
|
76
|
+
options: {
|
|
77
|
+
withCredentials: false
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
/**
|
|
82
|
+
* Unpack the response from the server into a list of bids.
|
|
83
|
+
*
|
|
84
|
+
* @param {ServerResponse} serverResponse A successful response from the server.
|
|
85
|
+
* @return {Bid[]} An array of bids which were nested inside the server.
|
|
86
|
+
*/
|
|
87
|
+
interpretResponse: (serverResponse, { bids }) => {
|
|
88
|
+
if (!serverResponse.body) {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
const { seatbid, cur } = serverResponse.body;
|
|
92
|
+
|
|
93
|
+
const bidResponses = flatten(seatbid.map(seat => seat.bid)).reduce((result, bid) => {
|
|
94
|
+
result[bid.impid - 1] = bid;
|
|
95
|
+
return result;
|
|
96
|
+
}, []);
|
|
97
|
+
|
|
98
|
+
return bids.map((bid, id) => {
|
|
99
|
+
const bidResponse = bidResponses[id];
|
|
100
|
+
if (bidResponse) {
|
|
101
|
+
const bidObject = {
|
|
102
|
+
requestId: bid.bidId,
|
|
103
|
+
cpm: bidResponse.price,
|
|
104
|
+
creativeId: bidResponse.crid,
|
|
105
|
+
ttl: 360,
|
|
106
|
+
netRevenue: true,
|
|
107
|
+
currency: cur,
|
|
108
|
+
mediaType: BANNER,
|
|
109
|
+
ad: bidResponse.adm,
|
|
110
|
+
width: bidResponse.w,
|
|
111
|
+
height: bidResponse.h,
|
|
112
|
+
meta: { advertiserDomains: bid.adomain ? bid.adomain : [] }
|
|
113
|
+
};
|
|
114
|
+
return bidObject;
|
|
115
|
+
}
|
|
116
|
+
}).filter(Boolean);
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Register the user sync pixels which should be dropped after the auction.
|
|
121
|
+
*
|
|
122
|
+
* @param {SyncOptions} syncOptions Which user syncs are allowed?
|
|
123
|
+
* @param {ServerResponse[]} serverResponses List of server's responses.
|
|
124
|
+
* @return {UserSync[]} The user syncs which should be dropped.
|
|
125
|
+
*/
|
|
126
|
+
getUserSyncs: function(syncOptions, serverResponses, gdprConsent, uspConsent) {
|
|
127
|
+
return [];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
}
|
|
131
|
+
registerBidder(spec);
|
|
132
|
+
|
|
133
|
+
function getDomainFromURL(url) {
|
|
134
|
+
let anchor = document.createElement('a');
|
|
135
|
+
anchor.href = url;
|
|
136
|
+
return anchor.hostname;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function getDeviceType() {
|
|
140
|
+
if ((/ipad|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase()))) {
|
|
141
|
+
return 5; // 'tablet'
|
|
142
|
+
}
|
|
143
|
+
if ((/iphone|ipod|android|blackberry|opera|mini|windows\sce|palm|smartphone|iemobile/i.test(navigator.userAgent.toLowerCase()))) {
|
|
144
|
+
return 4; // 'mobile'
|
|
145
|
+
}
|
|
146
|
+
return 2; // 'desktop'
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function setOnAny(collection, key) {
|
|
150
|
+
for (let i = 0, result; i < collection.length; i++) {
|
|
151
|
+
result = deepAccess(collection[i], key);
|
|
152
|
+
if (result) {
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function flatten(arr) {
|
|
159
|
+
return [].concat(...arr);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* Turn bid request sizes into ut-compatible format */
|
|
163
|
+
function transformSizes(requestSizes) {
|
|
164
|
+
if (!isArray(requestSizes)) {
|
|
165
|
+
return [];
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (requestSizes.length === 2 && !isArray(requestSizes[0])) {
|
|
169
|
+
return [{
|
|
170
|
+
w: parseInt(requestSizes[0], 10),
|
|
171
|
+
h: parseInt(requestSizes[1], 10)
|
|
172
|
+
}];
|
|
173
|
+
} else if (isArray(requestSizes[0])) {
|
|
174
|
+
return requestSizes.map(item =>
|
|
175
|
+
({
|
|
176
|
+
w: parseInt(item[0], 10),
|
|
177
|
+
h: parseInt(item[1], 10)
|
|
178
|
+
})
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return [];
|
|
183
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
Module Name: Codefuel Adapter
|
|
5
|
+
Module Type: Bidder Adapter
|
|
6
|
+
Maintainer: hayimm@codefuel.com
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
# Description
|
|
10
|
+
|
|
11
|
+
Module that connects to Codefuel bidder to fetch bids.
|
|
12
|
+
Display format is supported but not native format. Using OpenRTB standard.
|
|
13
|
+
|
|
14
|
+
# Configuration
|
|
15
|
+
|
|
16
|
+
## Bidder and usersync URLs
|
|
17
|
+
|
|
18
|
+
The Codefuel adapter does not work without setting the correct bidder.
|
|
19
|
+
You will receive the URLs when contacting us.
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
pbjs.setConfig({
|
|
23
|
+
codefuel: {
|
|
24
|
+
bidderUrl: 'https://ai-i-codefuel-ds-rtb-us-east-1-k8s-internal.seccint.com/prebid',
|
|
25
|
+
usersyncUrl: 'https://usersync-url.com'
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# Test Native Parameters
|
|
32
|
+
```
|
|
33
|
+
var adUnits = [
|
|
34
|
+
code: '/19968336/prebid_native_example_1',
|
|
35
|
+
mediaTypes: {
|
|
36
|
+
native: {
|
|
37
|
+
image: {
|
|
38
|
+
required: false,
|
|
39
|
+
sizes: [100, 50]
|
|
40
|
+
},
|
|
41
|
+
title: {
|
|
42
|
+
required: false,
|
|
43
|
+
len: 140
|
|
44
|
+
},
|
|
45
|
+
sponsoredBy: {
|
|
46
|
+
required: false
|
|
47
|
+
},
|
|
48
|
+
clickUrl: {
|
|
49
|
+
required: false
|
|
50
|
+
},
|
|
51
|
+
body: {
|
|
52
|
+
required: false
|
|
53
|
+
},
|
|
54
|
+
icon: {
|
|
55
|
+
required: false,
|
|
56
|
+
sizes: [50, 50]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
bids: [{
|
|
61
|
+
bidder: 'codefuel',
|
|
62
|
+
params: {
|
|
63
|
+
publisher: {
|
|
64
|
+
id: '2706', // required
|
|
65
|
+
name: 'Publishers Name',
|
|
66
|
+
domain: 'publisher.com'
|
|
67
|
+
},
|
|
68
|
+
tagid: 'tag-id',
|
|
69
|
+
bcat: ['IAB1-1'],
|
|
70
|
+
badv: ['example.com']
|
|
71
|
+
}
|
|
72
|
+
}]
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
pbjs.setConfig({
|
|
76
|
+
codefuel: {
|
|
77
|
+
bidderUrl: 'https://prebidtest.zemanta.com/api/bidder/prebidtest/bid/'
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
# Test Display Parameters
|
|
83
|
+
```
|
|
84
|
+
var adUnits = [
|
|
85
|
+
code: '/19968336/prebid_display_example_1',
|
|
86
|
+
mediaTypes: {
|
|
87
|
+
banner: {
|
|
88
|
+
sizes: [[300, 250]]
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
bids: [{
|
|
92
|
+
bidder: 'codefuel',
|
|
93
|
+
params: {
|
|
94
|
+
publisher: {
|
|
95
|
+
id: '2706', // required
|
|
96
|
+
name: 'Publishers Name',
|
|
97
|
+
domain: 'publisher.com'
|
|
98
|
+
},
|
|
99
|
+
tagid: 'tag-id',
|
|
100
|
+
bcat: ['IAB1-1'],
|
|
101
|
+
badv: ['example.com']
|
|
102
|
+
},
|
|
103
|
+
}]
|
|
104
|
+
];
|
|
105
|
+
|
|
106
|
+
pbjs.setConfig({
|
|
107
|
+
codefuel: {
|
|
108
|
+
bidderUrl: 'https://prebidtest.zemanta.com/api/bidder/prebidtest/bid/'
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
```
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module adds support for Yahoo ConnectID to the user ID module system.
|
|
3
|
+
* The {@link module:modules/userId} module is required
|
|
4
|
+
* @module modules/connectIdSystem
|
|
5
|
+
* @requires module:modules/userId
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {ajax} from '../src/ajax.js';
|
|
9
|
+
import {submodule} from '../src/hook.js';
|
|
10
|
+
import {logError, formatQS} from '../src/utils.js';
|
|
11
|
+
import includes from 'core-js-pure/features/array/includes.js';
|
|
12
|
+
|
|
13
|
+
const MODULE_NAME = 'connectId';
|
|
14
|
+
const VENDOR_ID = 25;
|
|
15
|
+
const PLACEHOLDER = '__PIXEL_ID__';
|
|
16
|
+
const UPS_ENDPOINT = `https://ups.analytics.yahoo.com/ups/${PLACEHOLDER}/fed`;
|
|
17
|
+
|
|
18
|
+
function isEUConsentRequired(consentData) {
|
|
19
|
+
return !!(consentData && consentData.gdpr && consentData.gdpr.gdprApplies);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** @type {Submodule} */
|
|
23
|
+
export const connectIdSubmodule = {
|
|
24
|
+
/**
|
|
25
|
+
* used to link submodule with config
|
|
26
|
+
* @type {string}
|
|
27
|
+
*/
|
|
28
|
+
name: MODULE_NAME,
|
|
29
|
+
/**
|
|
30
|
+
* @type {Number}
|
|
31
|
+
*/
|
|
32
|
+
gvlid: VENDOR_ID,
|
|
33
|
+
/**
|
|
34
|
+
* decode the stored id value for passing to bid requests
|
|
35
|
+
* @function
|
|
36
|
+
* @returns {{connectId: string} | undefined}
|
|
37
|
+
*/
|
|
38
|
+
decode(value) {
|
|
39
|
+
return (typeof value === 'object' && value.connectid)
|
|
40
|
+
? {connectId: value.connectid} : undefined;
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* Gets the Yahoo ConnectID
|
|
44
|
+
* @function
|
|
45
|
+
* @param {SubmoduleConfig} [config]
|
|
46
|
+
* @param {ConsentData} [consentData]
|
|
47
|
+
* @returns {IdResponse|undefined}
|
|
48
|
+
*/
|
|
49
|
+
getId(config, consentData) {
|
|
50
|
+
const params = config.params || {};
|
|
51
|
+
if (!params || typeof params.he !== 'string' ||
|
|
52
|
+
(typeof params.pixelId === 'undefined' && typeof params.endpoint === 'undefined')) {
|
|
53
|
+
logError('The connectId submodule requires the \'he\' and \'pixelId\' parameters to be defined.');
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const data = {
|
|
58
|
+
'1p': includes([1, '1', true], params['1p']) ? '1' : '0',
|
|
59
|
+
he: params.he,
|
|
60
|
+
gdpr: isEUConsentRequired(consentData) ? '1' : '0',
|
|
61
|
+
gdpr_consent: isEUConsentRequired(consentData) ? consentData.gdpr.consentString : '',
|
|
62
|
+
us_privacy: consentData && consentData.uspConsent ? consentData.uspConsent : ''
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
if (params.pixelId) {
|
|
66
|
+
data.pixelId = params.pixelId
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const resp = function (callback) {
|
|
70
|
+
const callbacks = {
|
|
71
|
+
success: response => {
|
|
72
|
+
let responseObj;
|
|
73
|
+
if (response) {
|
|
74
|
+
try {
|
|
75
|
+
responseObj = JSON.parse(response);
|
|
76
|
+
} catch (error) {
|
|
77
|
+
logError(error);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
callback(responseObj);
|
|
81
|
+
},
|
|
82
|
+
error: error => {
|
|
83
|
+
logError(`${MODULE_NAME}: ID fetch encountered an error`, error);
|
|
84
|
+
callback();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const endpoint = UPS_ENDPOINT.replace(PLACEHOLDER, params.pixelId);
|
|
88
|
+
let url = `${params.endpoint || endpoint}?${formatQS(data)}`;
|
|
89
|
+
connectIdSubmodule.getAjaxFn()(url, callbacks, null, {method: 'GET', withCredentials: true});
|
|
90
|
+
};
|
|
91
|
+
return {callback: resp};
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Return the function used to perform XHR calls.
|
|
96
|
+
* Utilised for each of testing.
|
|
97
|
+
* @returns {Function}
|
|
98
|
+
*/
|
|
99
|
+
getAjaxFn() {
|
|
100
|
+
return ajax;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
submodule('userId', connectIdSubmodule);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
## Yahoo ConnectID User ID Submodule
|
|
2
|
+
|
|
3
|
+
Yahoo ConnectID user ID Module.
|
|
4
|
+
|
|
5
|
+
### Prebid Params
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
pbjs.setConfig({
|
|
9
|
+
userSync: {
|
|
10
|
+
userIds: [{
|
|
11
|
+
name: 'connectId',
|
|
12
|
+
storage: {
|
|
13
|
+
name: 'connectId',
|
|
14
|
+
type: 'html5',
|
|
15
|
+
expires: 15
|
|
16
|
+
},
|
|
17
|
+
params: {
|
|
18
|
+
pixelId: 58776,
|
|
19
|
+
he: '0bef996248d63cea1529cb86de31e9547a712d9f380146e98bbd39beec70355a'
|
|
20
|
+
}
|
|
21
|
+
}]
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
## Parameter Descriptions for the `usersync` Configuration Section
|
|
26
|
+
The below parameters apply only to the Yahoo ConnectID user ID Module.
|
|
27
|
+
|
|
28
|
+
| Param under usersync.userIds[] | Scope | Type | Description | Example |
|
|
29
|
+
| --- | --- | --- | --- | --- |
|
|
30
|
+
| name | Required | String | ID value for the Yahoo ConnectID module - `"connectId"` | `"connectId"` |
|
|
31
|
+
| params | Required | Object | Data for Yahoo ConnectID initialization. | |
|
|
32
|
+
| params.pixelId | Required | Number | The Yahoo supplied publisher specific pixel Id | `8976` |
|
|
33
|
+
| params.he | Required | String | The SHA-256 hashed user email address | `"529cb86de31e9547a712d9f380146e98bbd39beec"` |
|