prebid.js 6.7.0 → 6.11.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/{haloRtdProvider_example.html → hadronRtdProvider_example.html} +9 -9
- package/integrationExamples/gpt/idImportLibrary_example.html +2 -2
- package/integrationExamples/gpt/userId_example.html +2 -2
- package/integrationExamples/gpt/weboramaRtdProvider_example.html +154 -115
- package/integrationExamples/gpt/x-domain/creative.html +63 -29
- package/modules/.submodules.json +3 -0
- package/modules/adagioBidAdapter.js +0 -8
- package/modules/adagioBidAdapter.md +1 -1
- package/modules/adkernelBidAdapter.js +2 -1
- package/modules/adnuntiusRtdProvider.js +96 -0
- package/modules/adnuntiusRtdProvider.md +41 -0
- package/modules/adotBidAdapter.js +516 -567
- package/modules/adotBidAdapter.md +6 -44
- package/modules/adpod.js +12 -14
- package/modules/adyoulikeBidAdapter.js +2 -0
- package/modules/appnexusBidAdapter.js +14 -2
- package/modules/asealBidAdapter.js +58 -0
- package/modules/asealBidAdapter.md +52 -0
- package/modules/brandmetricsRtdProvider.js +168 -0
- package/modules/brandmetricsRtdProvider.md +40 -0
- package/modules/conversantBidAdapter.js +7 -0
- package/modules/criteoBidAdapter.js +9 -0
- package/modules/currency.js +27 -5
- package/modules/displayioBidAdapter.js +157 -0
- package/modules/displayioBidAdapter.md +148 -0
- package/modules/dspxBidAdapter.js +69 -29
- package/modules/dspxBidAdapter.md +2 -1
- package/modules/e_volutionBidAdapter.js +158 -0
- package/modules/gridBidAdapter.js +15 -1
- package/modules/gumgumBidAdapter.js +52 -38
- package/modules/hadronIdSystem.js +96 -0
- package/modules/hadronIdSystem.md +35 -0
- package/modules/hadronRtdProvider.js +254 -0
- package/modules/hadronRtdProvider.md +126 -0
- package/modules/haloIdSystem.md +4 -35
- package/modules/haloRtdProvider.md +3 -126
- package/modules/imRtdProvider.js +10 -0
- package/modules/improvedigitalBidAdapter.js +5 -0
- package/modules/interactiveOffersBidAdapter.js +9 -6
- package/modules/iqzoneBidAdapter.js +10 -3
- package/modules/iqzoneBidAdapter.md +16 -0
- package/modules/ixBidAdapter.js +2 -6
- package/modules/kubientBidAdapter.js +50 -19
- package/modules/lunamediahbBidAdapter.js +32 -4
- package/modules/malltvBidAdapter.js +7 -3
- package/modules/malltvBidAdapter.md +64 -51
- package/modules/mass.js +3 -5
- package/modules/mediakeysBidAdapter.js +0 -5
- package/modules/medianetAnalyticsAdapter.js +1 -1
- package/modules/mediasquareBidAdapter.js +9 -1
- package/modules/nextMillenniumBidAdapter.js +1 -0
- package/modules/oguryBidAdapter.js +7 -14
- package/modules/prebidServerBidAdapter/index.js +61 -39
- package/modules/priceFloors.js +20 -12
- package/modules/pubmaticBidAdapter.js +1 -1
- package/modules/richaudienceBidAdapter.js +8 -3
- package/modules/riseBidAdapter.js +17 -6
- package/modules/rtbhouseBidAdapter.js +2 -0
- package/modules/rubiconAnalyticsAdapter.js +5 -0
- package/modules/rubiconBidAdapter.js +2 -2
- package/modules/sizeMappingV2.js +1 -8
- package/modules/sortableAnalyticsAdapter.js +5 -4
- package/modules/sovrnBidAdapter.js +93 -18
- package/modules/sovrnBidAdapter.md +80 -2
- package/modules/sspBCBidAdapter.js +53 -20
- package/modules/telariaBidAdapter.js +22 -29
- package/modules/trustpidSystem.js +197 -0
- package/modules/trustpidSystem.md +45 -0
- package/modules/undertoneBidAdapter.js +17 -1
- package/modules/userId/eids.js +16 -1
- package/modules/userId/eids.md +10 -2
- package/modules/userId/userId.md +17 -2
- package/modules/vibrantmediaBidAdapter.js +220 -0
- package/modules/vibrantmediaBidAdapter.md +92 -0
- package/modules/vidoomyBidAdapter.js +8 -0
- package/modules/vidoomyBidAdapter.md +4 -2
- package/modules/weboramaRtdProvider.js +264 -34
- package/modules/weboramaRtdProvider.md +110 -40
- package/modules/yahoosspBidAdapter.js +3 -1
- package/modules/yieldoneBidAdapter.js +6 -0
- package/package.json +2 -1
- package/src/adRendering.js +38 -0
- package/src/adapterManager.js +24 -19
- package/src/adapters/bidderFactory.js +14 -11
- package/src/adloader.js +2 -1
- package/src/auction.js +138 -115
- package/src/auctionIndex.js +85 -0
- package/src/auctionManager.js +3 -0
- package/src/bidderSettings.js +69 -0
- package/src/bidfactory.js +18 -6
- package/src/native.js +29 -21
- package/src/prebid.js +3 -19
- package/src/secureCreatives.js +128 -45
- package/src/targeting.js +11 -2
- package/src/utils.js +14 -17
- package/src/video.js +10 -11
- package/src/videoCache.js +10 -9
- package/test/fixtures/fixtures.js +2 -1
- package/test/helpers/indexStub.js +28 -0
- package/test/helpers/syncPromise.js +71 -0
- package/test/spec/auctionmanager_spec.js +268 -89
- package/test/spec/config_spec.js +24 -1
- package/test/spec/modules/adagioBidAdapter_spec.js +0 -10
- package/test/spec/modules/adnuntiusRtdProvider_spec.js +145 -0
- package/test/spec/modules/adotBidAdapter_spec.js +294 -3124
- package/test/spec/modules/adpod_spec.js +91 -156
- package/test/spec/modules/adyoulikeBidAdapter_spec.js +4 -0
- package/test/spec/modules/appnexusBidAdapter_spec.js +27 -0
- package/test/spec/modules/asealBidAdapter_spec.js +144 -0
- package/test/spec/modules/brandmetricsRtdProvider_spec.js +191 -0
- package/test/spec/modules/conversantBidAdapter_spec.js +54 -2
- package/test/spec/modules/criteoBidAdapter_spec.js +21 -0
- package/test/spec/modules/currency_spec.js +36 -15
- package/test/spec/modules/displayioBidAdapter_spec.js +239 -0
- package/test/spec/modules/dspxBidAdapter_spec.js +20 -15
- package/test/spec/modules/e_volutionBidAdapter_spec.js +242 -0
- package/test/spec/modules/eids_spec.js +2 -2
- package/test/spec/modules/gridBidAdapter_spec.js +18 -0
- package/test/spec/modules/gumgumBidAdapter_spec.js +49 -3
- package/test/spec/modules/hadronIdSystem_spec.js +57 -0
- package/test/spec/modules/hadronRtdProvider_spec.js +762 -0
- package/test/spec/modules/imRtdProvider_spec.js +30 -1
- package/test/spec/modules/improvedigitalBidAdapter_spec.js +19 -0
- package/test/spec/modules/iqzoneBidAdapter_spec.js +1 -0
- package/test/spec/modules/ixBidAdapter_spec.js +1 -1
- package/test/spec/modules/kubientBidAdapter_spec.js +182 -84
- package/test/spec/modules/lunamediahbBidAdapter_spec.js +27 -1
- package/test/spec/modules/mass_spec.js +2 -14
- package/test/spec/modules/mediakeysBidAdapter_spec.js +9 -5
- package/test/spec/modules/mediasquareBidAdapter_spec.js +25 -1
- package/test/spec/modules/oguryBidAdapter_spec.js +63 -5
- package/test/spec/modules/prebidServerBidAdapter_spec.js +43 -6
- package/test/spec/modules/priceFloors_spec.js +83 -24
- package/test/spec/modules/pubmaticBidAdapter_spec.js +40 -0
- package/test/spec/modules/riseBidAdapter_spec.js +30 -4
- package/test/spec/modules/rubiconAnalyticsAdapter_spec.js +31 -1
- package/test/spec/modules/rubiconBidAdapter_spec.js +1 -1
- package/test/spec/modules/sortableAnalyticsAdapter_spec.js +2 -3
- package/test/spec/modules/sovrnBidAdapter_spec.js +413 -333
- package/test/spec/modules/sspBCBidAdapter_spec.js +7 -7
- package/test/spec/modules/telariaBidAdapter_spec.js +1 -3
- package/test/spec/modules/trustpidSystem_spec.js +232 -0
- package/test/spec/modules/undertoneBidAdapter_spec.js +55 -2
- package/test/spec/modules/userId_spec.js +39 -39
- package/test/spec/modules/vibrantmediaBidAdapter_spec.js +1237 -0
- package/test/spec/modules/vidoomyBidAdapter_spec.js +7 -1
- package/test/spec/modules/weboramaRtdProvider_spec.js +536 -20
- package/test/spec/modules/yahoosspBidAdapter_spec.js +10 -0
- package/test/spec/modules/yieldoneBidAdapter_spec.js +33 -0
- package/test/spec/native_spec.js +62 -40
- package/test/spec/unit/core/adapterManager_spec.js +22 -0
- package/test/spec/unit/core/auctionIndex_spec.js +129 -0
- package/test/spec/unit/core/bidderFactory_spec.js +65 -12
- package/test/spec/unit/core/bidderSettings_spec.js +123 -0
- package/test/spec/unit/core/targeting_spec.js +93 -0
- package/test/spec/unit/pbjs_api_spec.js +80 -42
- package/test/spec/unit/secureCreatives_spec.js +143 -24
- package/test/spec/videoCache_spec.js +18 -19
- package/test/spec/video_spec.js +51 -61
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module adds TrustPid provided by Vodafone Sales and Services Limited to the User ID module
|
|
3
|
+
* The {@link module:modules/userId} module is required
|
|
4
|
+
* @module modules/trustpidSystem
|
|
5
|
+
* @requires module:modules/userId
|
|
6
|
+
*/
|
|
7
|
+
import { logInfo, logError } from '../src/utils.js';
|
|
8
|
+
import { submodule } from '../src/hook.js';
|
|
9
|
+
import { getStorageManager } from '../src/storageManager.js';
|
|
10
|
+
|
|
11
|
+
const MODULE_NAME = 'trustpid';
|
|
12
|
+
const LOG_PREFIX = 'Trustpid module'
|
|
13
|
+
let mnoAcronym = '';
|
|
14
|
+
let mnoDomain = '';
|
|
15
|
+
|
|
16
|
+
export const storage = getStorageManager(null, MODULE_NAME);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Handle an event for an iframe.
|
|
20
|
+
* Takes the body.url parameter from event and returns the string domain.
|
|
21
|
+
* i.e.: "fc.vodafone.de"
|
|
22
|
+
* @param event
|
|
23
|
+
*/
|
|
24
|
+
function messageHandler(event) {
|
|
25
|
+
let msg;
|
|
26
|
+
try {
|
|
27
|
+
if (event && event.data && typeof event.data === 'string' && event.data) {
|
|
28
|
+
msg = JSON.parse(event.data);
|
|
29
|
+
if (msg.msgType === 'MNOSELECTOR' && msg.body && msg.body.url) {
|
|
30
|
+
let URL = msg.body.url.split('//');
|
|
31
|
+
let domainURL = URL[1].split('/');
|
|
32
|
+
mnoDomain = domainURL[0];
|
|
33
|
+
logInfo(`${LOG_PREFIX}: Message handler set domain to ${mnoDomain}`);
|
|
34
|
+
getDomainAcronym(mnoDomain);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
} catch (e) {
|
|
38
|
+
logError(e);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Properly sets the trustpid acronym depending on the domain value.
|
|
44
|
+
* @param domain
|
|
45
|
+
*/
|
|
46
|
+
function getDomainAcronym(domain) {
|
|
47
|
+
let acronym = '';
|
|
48
|
+
const prefix = '-';
|
|
49
|
+
switch (domain) {
|
|
50
|
+
case 'tmi.mno.link':
|
|
51
|
+
acronym = 'ndye';
|
|
52
|
+
break;
|
|
53
|
+
case 'tmi.vodafone.de':
|
|
54
|
+
acronym = 'pqnx';
|
|
55
|
+
break;
|
|
56
|
+
case 'tmi.telekom.de':
|
|
57
|
+
acronym = 'avgw';
|
|
58
|
+
break;
|
|
59
|
+
case 'tmi.tmid.es':
|
|
60
|
+
acronym = 'kjws';
|
|
61
|
+
break;
|
|
62
|
+
case 'uat.mno.link':
|
|
63
|
+
acronym = 'xxxx';
|
|
64
|
+
break;
|
|
65
|
+
case 'es.tmiservice.orange.com':
|
|
66
|
+
acronym = 'aplw';
|
|
67
|
+
break;
|
|
68
|
+
default:
|
|
69
|
+
return 'none';
|
|
70
|
+
}
|
|
71
|
+
return mnoAcronym = prefix + acronym;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Set a listener to handle the iframe response message.
|
|
75
|
+
window.addEventListener('message', messageHandler, false);
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Get the "umid" from html5 local storage to make it available to the UserId module.
|
|
79
|
+
* @param config
|
|
80
|
+
* @returns {{trustpid: (*|string), acr: (string)}}
|
|
81
|
+
*/
|
|
82
|
+
function getTrustpidFromStorage() {
|
|
83
|
+
// Get the domain either from localStorage or global
|
|
84
|
+
let domain = JSON.parse(storage.getDataFromLocalStorage('fcIdConnectDomain')) || mnoDomain;
|
|
85
|
+
logInfo(`${LOG_PREFIX}: Local storage domain: ${domain}`);
|
|
86
|
+
|
|
87
|
+
if (!domain) {
|
|
88
|
+
logInfo(`${LOG_PREFIX}: Local storage domain not found, returning null`);
|
|
89
|
+
return {
|
|
90
|
+
trustpid: null,
|
|
91
|
+
acr: null,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Get the acronym from global
|
|
96
|
+
let acronym = mnoAcronym;
|
|
97
|
+
// if acronym is empty, but "domain" is available, get the acronym from domain
|
|
98
|
+
if (!acronym) {
|
|
99
|
+
getDomainAcronym(domain);
|
|
100
|
+
acronym = mnoAcronym;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
logInfo(`${LOG_PREFIX}: Domain acronym found: ${acronym}`);
|
|
104
|
+
|
|
105
|
+
// Domain is correct in both local storage and idGraph, but no acronym is existing for the domain
|
|
106
|
+
if (domain && !acronym) {
|
|
107
|
+
return {
|
|
108
|
+
trustpid: null,
|
|
109
|
+
acr: null
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
let fcIdConnectObject;
|
|
114
|
+
let fcIdConnectData = JSON.parse(storage.getDataFromLocalStorage('fcIdConnectData'));
|
|
115
|
+
logInfo(`${LOG_PREFIX}: Local storage fcIdConnectData: ${JSON.stringify(fcIdConnectData)}`);
|
|
116
|
+
|
|
117
|
+
if (fcIdConnectData &&
|
|
118
|
+
fcIdConnectData.connectId &&
|
|
119
|
+
Array.isArray(fcIdConnectData.connectId.idGraph) &&
|
|
120
|
+
fcIdConnectData.connectId.idGraph.length > 0) {
|
|
121
|
+
fcIdConnectObject = fcIdConnectData.connectId.idGraph.find(item => {
|
|
122
|
+
return item.domain === domain;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
logInfo(`${LOG_PREFIX}: Local storage fcIdConnectObject for domain: ${JSON.stringify(fcIdConnectObject)}`);
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
trustpid: (fcIdConnectObject && fcIdConnectObject.umid)
|
|
129
|
+
? fcIdConnectObject.umid
|
|
130
|
+
: null,
|
|
131
|
+
acr: acronym,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** @type {Submodule} */
|
|
136
|
+
export const trustpidSubmodule = {
|
|
137
|
+
/**
|
|
138
|
+
* Used to link submodule with config
|
|
139
|
+
* @type {string}
|
|
140
|
+
*/
|
|
141
|
+
name: MODULE_NAME,
|
|
142
|
+
/**
|
|
143
|
+
* Decodes the stored id value for passing to bid requests.
|
|
144
|
+
* @function
|
|
145
|
+
* @returns {{trustpid: string} | null}
|
|
146
|
+
*/
|
|
147
|
+
decode(bidId) {
|
|
148
|
+
logInfo(`${LOG_PREFIX}: Decoded ID value ${JSON.stringify(bidId)}`);
|
|
149
|
+
return bidId.trustpid ? bidId : null;
|
|
150
|
+
},
|
|
151
|
+
/**
|
|
152
|
+
* Get the id from helper function and initiate a new user sync.
|
|
153
|
+
* @param config
|
|
154
|
+
* @returns {{callback: result}|{id: {trustpid: string}}}
|
|
155
|
+
*/
|
|
156
|
+
getId: function(config) {
|
|
157
|
+
const data = getTrustpidFromStorage();
|
|
158
|
+
if (data.trustpid) {
|
|
159
|
+
logInfo(`${LOG_PREFIX}: Local storage ID value ${JSON.stringify(data)}`);
|
|
160
|
+
return {id: {trustpid: data.trustpid + data.acr}};
|
|
161
|
+
} else {
|
|
162
|
+
if (!config) {
|
|
163
|
+
config = {};
|
|
164
|
+
}
|
|
165
|
+
if (!config.params) {
|
|
166
|
+
config.params = {};
|
|
167
|
+
}
|
|
168
|
+
if (typeof config.params.maxDelayTime === 'undefined' || config.params.maxDelayTime === null) {
|
|
169
|
+
config.params.maxDelayTime = 1000;
|
|
170
|
+
}
|
|
171
|
+
// Current delay and delay step in milliseconds
|
|
172
|
+
let currentDelay = 0;
|
|
173
|
+
const delayStep = 50;
|
|
174
|
+
const result = (callback) => {
|
|
175
|
+
const data = getTrustpidFromStorage();
|
|
176
|
+
if (!data.trustpid) {
|
|
177
|
+
if (currentDelay > config.params.maxDelayTime) {
|
|
178
|
+
logInfo(`${LOG_PREFIX}: No trustpid value set after ${config.params.maxDelayTime} max allowed delay time`);
|
|
179
|
+
callback(null);
|
|
180
|
+
} else {
|
|
181
|
+
currentDelay += delayStep;
|
|
182
|
+
setTimeout(() => {
|
|
183
|
+
result(callback);
|
|
184
|
+
}, delayStep);
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
const dataToReturn = { trustpid: data.trustpid + data.acr };
|
|
188
|
+
logInfo(`${LOG_PREFIX}: Returning ID value data of ${JSON.stringify(dataToReturn)}`);
|
|
189
|
+
callback(dataToReturn);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
return { callback: result };
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
submodule('userId', trustpidSubmodule);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
## trustpid User Id Submodule
|
|
2
|
+
|
|
3
|
+
trustpid User Id Module.
|
|
4
|
+
|
|
5
|
+
First, make sure to add the trustpid submodule to your Prebid.js package with:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
gulp build --modules=userId,adfBidAdapter,trustpidSystem
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The following configuration parameters are available:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
pbjs.setConfig({
|
|
15
|
+
userSync: {
|
|
16
|
+
userIds: [
|
|
17
|
+
{
|
|
18
|
+
name: 'trustpid',
|
|
19
|
+
params: {
|
|
20
|
+
maxDelayTime: 1000,
|
|
21
|
+
},
|
|
22
|
+
bidders: ["adf"],
|
|
23
|
+
storage: {
|
|
24
|
+
type: "html5",
|
|
25
|
+
name: "trustpid",
|
|
26
|
+
expires: 1, //days
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Parameter Descriptions
|
|
35
|
+
|
|
36
|
+
| Param under userSync.userIds[] | Scope | Type | Description | Example |
|
|
37
|
+
| --- | --- | --- | --- | --- |
|
|
38
|
+
| name | Required | String | The name of the module | `"trustpid"`
|
|
39
|
+
| params | Required | Object | Object with configuration parameters for trustpid User Id submodule | - |
|
|
40
|
+
| params.maxDelayTime | Required | Integer | Max amount of time (in seconds) before looking into storage for data | 2500 |
|
|
41
|
+
| bidders | Required | Array of Strings | An array of bidder codes to which this user ID may be sent. Currently required and supporting AdformOpenRTB | `["adf"]` |
|
|
42
|
+
| storage | Required | Object | Local storage configuration object | - |
|
|
43
|
+
| storage.type | Required | String | Type of the storage that would be used to store user ID. Must be `"html5"` to utilise HTML5 local storage. | `"html5"` |
|
|
44
|
+
| storage.name | Required | String | The name of the key in local storage where the user ID will be stored. | `"trustpid"` |
|
|
45
|
+
| storage.expires | Required | Integer | How long (in days) the user ID information will be stored. For safety reasons, this information is required.| `1` |
|
|
@@ -12,6 +12,20 @@ const FRAME_USER_SYNC = 'https://cdn.undertone.com/js/usersync.html';
|
|
|
12
12
|
const PIXEL_USER_SYNC_1 = 'https://usr.undertone.com/userPixel/syncOne?id=1&of=2';
|
|
13
13
|
const PIXEL_USER_SYNC_2 = 'https://usr.undertone.com/userPixel/syncOne?id=2&of=2';
|
|
14
14
|
|
|
15
|
+
function getBidFloor(bidRequest, mediaType) {
|
|
16
|
+
if (typeof bidRequest.getFloor !== 'function') {
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const floor = bidRequest.getFloor({
|
|
21
|
+
currency: 'USD',
|
|
22
|
+
mediaType: mediaType,
|
|
23
|
+
size: '*'
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return (floor && floor.currency === 'USD' && floor.floor) || 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
15
29
|
function getCanonicalUrl() {
|
|
16
30
|
try {
|
|
17
31
|
let doc = window.top.document;
|
|
@@ -134,6 +148,9 @@ export const spec = {
|
|
|
134
148
|
params: bidReq.params
|
|
135
149
|
};
|
|
136
150
|
const videoMediaType = deepAccess(bidReq, 'mediaTypes.video');
|
|
151
|
+
const mediaType = videoMediaType ? VIDEO : BANNER;
|
|
152
|
+
bid.mediaType = mediaType;
|
|
153
|
+
bid.bidfloor = getBidFloor(bidReq, mediaType);
|
|
137
154
|
if (videoMediaType) {
|
|
138
155
|
bid.video = {
|
|
139
156
|
playerSize: deepAccess(bidReq, 'mediaTypes.video.playerSize') || null,
|
|
@@ -142,7 +159,6 @@ export const spec = {
|
|
|
142
159
|
maxDuration: deepAccess(bidReq, 'params.video.maxDuration') || null,
|
|
143
160
|
skippable: deepAccess(bidReq, 'params.video.skippable') || null
|
|
144
161
|
};
|
|
145
|
-
bid.mediaType = 'video';
|
|
146
162
|
}
|
|
147
163
|
payload['x-ut-hb-params'].push(bid);
|
|
148
164
|
});
|
package/modules/userId/eids.js
CHANGED
|
@@ -5,6 +5,15 @@ const USER_IDS_CONFIG = {
|
|
|
5
5
|
|
|
6
6
|
// key-name : {config}
|
|
7
7
|
|
|
8
|
+
// trustpid
|
|
9
|
+
'trustpid': {
|
|
10
|
+
source: 'trustpid.com',
|
|
11
|
+
atype: 1,
|
|
12
|
+
getValue: function (data) {
|
|
13
|
+
return data;
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
|
|
8
17
|
// intentIqId
|
|
9
18
|
'intentIqId': {
|
|
10
19
|
source: 'intentiq.com',
|
|
@@ -146,7 +155,13 @@ const USER_IDS_CONFIG = {
|
|
|
146
155
|
atype: 1
|
|
147
156
|
},
|
|
148
157
|
|
|
149
|
-
//
|
|
158
|
+
// hadronId
|
|
159
|
+
'hadronId': {
|
|
160
|
+
source: 'audigent.com',
|
|
161
|
+
atype: 1
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
// haloId (deprecated in 7.0, use hadronId)
|
|
150
165
|
'haloId': {
|
|
151
166
|
source: 'audigent.com',
|
|
152
167
|
atype: 1
|
package/modules/userId/eids.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
```
|
|
4
4
|
userIdAsEids = [
|
|
5
|
+
{
|
|
6
|
+
source: 'trustpid.com',
|
|
7
|
+
uids: [{
|
|
8
|
+
id: 'some-random-id-value',
|
|
9
|
+
atype: 1
|
|
10
|
+
}]
|
|
11
|
+
},
|
|
12
|
+
|
|
5
13
|
{
|
|
6
14
|
source: 'pubcid.org',
|
|
7
15
|
uids: [{
|
|
@@ -28,7 +36,7 @@ userIdAsEids = [
|
|
|
28
36
|
atype: 1
|
|
29
37
|
}]
|
|
30
38
|
},
|
|
31
|
-
|
|
39
|
+
|
|
32
40
|
{
|
|
33
41
|
source: 'neustar.biz',
|
|
34
42
|
uids: [{
|
|
@@ -203,7 +211,7 @@ userIdAsEids = [
|
|
|
203
211
|
id: 'some-random-id-value',
|
|
204
212
|
atype: 3
|
|
205
213
|
}]
|
|
206
|
-
},
|
|
214
|
+
},
|
|
207
215
|
{
|
|
208
216
|
source: 'kpuid.com',
|
|
209
217
|
uids: [{
|
package/modules/userId/userId.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
## User ID Example Configuration
|
|
2
2
|
|
|
3
3
|
Example showing `cookie` storage for user id data for each of the submodules
|
|
4
|
+
|
|
4
5
|
```
|
|
5
6
|
pbjs.setConfig({
|
|
6
7
|
userSync: {
|
|
@@ -147,10 +148,23 @@ pbjs.setConfig({
|
|
|
147
148
|
```
|
|
148
149
|
|
|
149
150
|
Example showing `localStorage` for user id data for some submodules
|
|
151
|
+
|
|
150
152
|
```
|
|
151
153
|
pbjs.setConfig({
|
|
152
154
|
userSync: {
|
|
153
|
-
userIds: [
|
|
155
|
+
userIds: [
|
|
156
|
+
{
|
|
157
|
+
name: 'trustpid',
|
|
158
|
+
params: {
|
|
159
|
+
maxDelayTime: 2500
|
|
160
|
+
},
|
|
161
|
+
bidders: ['adform'],
|
|
162
|
+
storage: {
|
|
163
|
+
type: 'html5',
|
|
164
|
+
name: 'trustpid',
|
|
165
|
+
expires: 60
|
|
166
|
+
}
|
|
167
|
+
}, {
|
|
154
168
|
name: "unifiedId",
|
|
155
169
|
params: {
|
|
156
170
|
partner: "prebid",
|
|
@@ -278,7 +292,7 @@ pbjs.setConfig({
|
|
|
278
292
|
name: "knssoId",
|
|
279
293
|
expires: 30
|
|
280
294
|
},
|
|
281
|
-
}
|
|
295
|
+
}
|
|
282
296
|
},
|
|
283
297
|
{
|
|
284
298
|
name: 'imuid',
|
|
@@ -312,6 +326,7 @@ pbjs.setConfig({
|
|
|
312
326
|
```
|
|
313
327
|
|
|
314
328
|
Example showing how to configure a `value` object to pass directly to bid adapters
|
|
329
|
+
|
|
315
330
|
```
|
|
316
331
|
pbjs.setConfig({
|
|
317
332
|
userSync: {
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Vibrant Media Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Prebid Adapter for sending bid requests to the prebid server and bid responses back to the client
|
|
5
|
+
*
|
|
6
|
+
* Note: Only BANNER and VIDEO are currently supported by the prebid server.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {logError, logInfo} from '../src/utils.js';
|
|
10
|
+
import {registerBidder} from '../src/adapters/bidderFactory.js';
|
|
11
|
+
import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
|
|
12
|
+
import {OUTSTREAM} from '../src/video.js';
|
|
13
|
+
|
|
14
|
+
const BIDDER_CODE = 'vibrantmedia';
|
|
15
|
+
const VIBRANT_MEDIA_PREBID_URL = 'https://prebid.intellitxt.com/prebid';
|
|
16
|
+
const SUPPORTED_MEDIA_TYPES = [BANNER, NATIVE, VIDEO];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Returns whether the given bid request contains at least one supported media request, which has valid data. (We can
|
|
20
|
+
* ignore invalid/unsupported ones, as they will be filtered out by the prebid server.)
|
|
21
|
+
*
|
|
22
|
+
* @param {*} bidRequest the bid requests sent by the Prebid API.
|
|
23
|
+
*
|
|
24
|
+
* @return {boolean} true if the given bid request contains at least one supported media request with valid details,
|
|
25
|
+
* otherwise false.
|
|
26
|
+
*/
|
|
27
|
+
const areValidSupportedMediaTypesPresent = function(bidRequest) {
|
|
28
|
+
const mediaTypes = Object.keys(bidRequest.mediaTypes);
|
|
29
|
+
|
|
30
|
+
return mediaTypes.some(function(mediaType) {
|
|
31
|
+
if (mediaType === BANNER) {
|
|
32
|
+
return true;
|
|
33
|
+
} else if (mediaType === VIDEO) {
|
|
34
|
+
return (bidRequest.mediaTypes[VIDEO].context === OUTSTREAM);
|
|
35
|
+
} else if (mediaType === NATIVE) {
|
|
36
|
+
return !!bidRequest.mediaTypes[NATIVE].image;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return false;
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Returns whether the given URL contains just a domain, and not (for example) a subdirectory or query parameters.
|
|
45
|
+
* @param {string} url the URL to check.
|
|
46
|
+
* @returns {boolean} whether the URL contains just a domain.
|
|
47
|
+
*/
|
|
48
|
+
const isBaseUrl = function(url) {
|
|
49
|
+
const urlMinusScheme = url.substring(url.indexOf('://') + 3);
|
|
50
|
+
const endOfDomain = urlMinusScheme.indexOf('/');
|
|
51
|
+
return (endOfDomain === -1) || (endOfDomain === (urlMinusScheme.length - 1));
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Returns transformed bid requests that are in a format native to the prebid server.
|
|
56
|
+
*
|
|
57
|
+
* @param {*[]} bidRequests the bid requests sent by the Prebid API.
|
|
58
|
+
*
|
|
59
|
+
* @returns {*[]} the transformed bid requests.
|
|
60
|
+
*/
|
|
61
|
+
const transformBidRequests = function(bidRequests) {
|
|
62
|
+
const transformedBidRequests = [];
|
|
63
|
+
|
|
64
|
+
bidRequests.forEach(function(bidRequest) {
|
|
65
|
+
const params = bidRequest.params || {};
|
|
66
|
+
const transformedBidRequest = {
|
|
67
|
+
code: bidRequest.adUnitCode || bidRequest.code,
|
|
68
|
+
id: bidRequest.placementId || params.placementId || params.invCode,
|
|
69
|
+
requestId: bidRequest.bidId || bidRequest.transactionId,
|
|
70
|
+
bidder: bidRequest.bidder,
|
|
71
|
+
mediaTypes: bidRequest.mediaTypes,
|
|
72
|
+
bids: bidRequest.bids,
|
|
73
|
+
sizes: bidRequest.sizes
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
transformedBidRequests.push(transformedBidRequest);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
return transformedBidRequests;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/** @type {BidderSpec} */
|
|
83
|
+
export const spec = {
|
|
84
|
+
code: BIDDER_CODE,
|
|
85
|
+
supportedMediaTypes: SUPPORTED_MEDIA_TYPES,
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Transforms the 'raw' bid params into ones that this adapter can use, prior to creating the bid request.
|
|
89
|
+
*
|
|
90
|
+
* @param {object} bidParams the params to transform.
|
|
91
|
+
*
|
|
92
|
+
* @returns {object} the bid params.
|
|
93
|
+
*/
|
|
94
|
+
transformBidParams: function(bidParams) {
|
|
95
|
+
return bidParams;
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Determines whether or not the given bid request is valid. For all bid requests passed to the buildRequests
|
|
100
|
+
* function, each will have been passed to this function and this function will have returned true.
|
|
101
|
+
*
|
|
102
|
+
* @param {object} bid the bid params to validate.
|
|
103
|
+
*
|
|
104
|
+
* @return {boolean} true if this is a valid bid, otherwise false.
|
|
105
|
+
* @see SUPPORTED_MEDIA_TYPES
|
|
106
|
+
*/
|
|
107
|
+
isBidRequestValid: function(bid) {
|
|
108
|
+
const areBidRequestParamsValid = !!(bid.params.placementId || (bid.params.member && bid.params.invCode));
|
|
109
|
+
return areBidRequestParamsValid && areValidSupportedMediaTypesPresent(bid);
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Return a prebid server request from the list of bid requests.
|
|
114
|
+
*
|
|
115
|
+
* @param {BidRequest[]} validBidRequests an array of bids validated via the isBidRequestValid function.
|
|
116
|
+
* @param {BidderRequest} bidderRequest an object with data common to all bid requests.
|
|
117
|
+
*
|
|
118
|
+
* @return ServerRequest Info describing the request to the prebid server.
|
|
119
|
+
*/
|
|
120
|
+
buildRequests: function(validBidRequests, bidderRequest) {
|
|
121
|
+
const transformedBidRequests = transformBidRequests(validBidRequests);
|
|
122
|
+
|
|
123
|
+
var url = window.parent.location.href;
|
|
124
|
+
|
|
125
|
+
if ((window.self === window.top) && (!url || (url.substr(0, 4) !== 'http') || isBaseUrl(url))) {
|
|
126
|
+
url = document.URL;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
url = encodeURIComponent(url);
|
|
130
|
+
|
|
131
|
+
const prebidData = {
|
|
132
|
+
url,
|
|
133
|
+
gdpr: bidderRequest.gdprConsent,
|
|
134
|
+
usp: bidderRequest.uspConsent,
|
|
135
|
+
window: {
|
|
136
|
+
width: window.innerWidth,
|
|
137
|
+
height: window.innerHeight,
|
|
138
|
+
},
|
|
139
|
+
biddata: transformedBidRequests,
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
method: 'POST',
|
|
144
|
+
url: VIBRANT_MEDIA_PREBID_URL,
|
|
145
|
+
data: JSON.stringify(prebidData)
|
|
146
|
+
};
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Translate the Kormorant prebid server response into a list of bids.
|
|
151
|
+
*
|
|
152
|
+
* @param {ServerResponse} serverResponse a successful response from the prebid server.
|
|
153
|
+
* @param {BidRequest} bidRequest the original bid request associated with this response.
|
|
154
|
+
*
|
|
155
|
+
* @return {Bid[]} an array of bids returned by the prebid server, translated into the expected Prebid.js format.
|
|
156
|
+
*/
|
|
157
|
+
interpretResponse: function(serverResponse, bidRequest) {
|
|
158
|
+
const bids = serverResponse.body;
|
|
159
|
+
|
|
160
|
+
bids.forEach(function(bid) {
|
|
161
|
+
bid.adResponse = serverResponse;
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
return bids;
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Called if the Prebid API gives up waiting for a prebid server response.
|
|
169
|
+
*
|
|
170
|
+
* Example timeout data:
|
|
171
|
+
*
|
|
172
|
+
* [{
|
|
173
|
+
* "bidder": "example",
|
|
174
|
+
* "bidId": "51ef8751f9aead",
|
|
175
|
+
* "params": {
|
|
176
|
+
* ...
|
|
177
|
+
* },
|
|
178
|
+
* "adUnitCode": "div-gpt-ad-1460505748561-0",
|
|
179
|
+
* "timeout": 3000,
|
|
180
|
+
* "auctionId": "18fd8b8b0bd757"
|
|
181
|
+
* }]
|
|
182
|
+
*
|
|
183
|
+
* @param {{}} timeoutData data relating to the timeout.
|
|
184
|
+
*/
|
|
185
|
+
onTimeout: function(timeoutData) {
|
|
186
|
+
logError('Timed out waiting for bids: ' + JSON.stringify(timeoutData));
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Called when a bid returned by the prebid server is successful.
|
|
191
|
+
*
|
|
192
|
+
* Example bid won data:
|
|
193
|
+
*
|
|
194
|
+
* {
|
|
195
|
+
* "bidder": "example",
|
|
196
|
+
* "width": 300,
|
|
197
|
+
* "height": 250,
|
|
198
|
+
* "adId": "330a22bdea4cac",
|
|
199
|
+
* "mediaType": "banner",
|
|
200
|
+
* "cpm": 0.28
|
|
201
|
+
* "ad": "...",
|
|
202
|
+
* "requestId": "418b37f85e772c",
|
|
203
|
+
* "adUnitCode": "div-gpt-ad-1460505748561-0",
|
|
204
|
+
* "size": "350x250",
|
|
205
|
+
* "adserverTargeting": {
|
|
206
|
+
* "hb_bidder": "example",
|
|
207
|
+
* "hb_adid": "330a22bdea4cac",
|
|
208
|
+
* "hb_pb": "0.20",
|
|
209
|
+
* "hb_size": "350x250"
|
|
210
|
+
* }
|
|
211
|
+
* }
|
|
212
|
+
*
|
|
213
|
+
* @param {*} bidData the data associated with the won bid. See example above for data format.
|
|
214
|
+
*/
|
|
215
|
+
onBidWon: function(bidData) {
|
|
216
|
+
logInfo('Bid won: ' + JSON.stringify(bidData));
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
registerBidder(spec);
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
## Overview
|
|
2
|
+
|
|
3
|
+
**Module Name:** Vibrant Media Bidder Adapter
|
|
4
|
+
|
|
5
|
+
**Module Type:** Bidder Adapter
|
|
6
|
+
|
|
7
|
+
**Maintainer:** kormorant@vibrantmedia.com
|
|
8
|
+
|
|
9
|
+
## Description
|
|
10
|
+
|
|
11
|
+
Module that allows Vibrant Media to provide ad bids for banner, native and video (outstream only).
|
|
12
|
+
|
|
13
|
+
## Test Parameters
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
var adUnits = [
|
|
17
|
+
// Banner ad unit
|
|
18
|
+
{
|
|
19
|
+
code: 'test-banner',
|
|
20
|
+
mediaTypes: {
|
|
21
|
+
banner: {
|
|
22
|
+
sizes: [[300, 250], [300, 600]]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
bids: [{
|
|
26
|
+
bidder: 'vibrantmedia',
|
|
27
|
+
params: {
|
|
28
|
+
placementId: 12345
|
|
29
|
+
}
|
|
30
|
+
}]
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
// Video (outstream) ad unit
|
|
34
|
+
{
|
|
35
|
+
code: 'test-video-outstream',
|
|
36
|
+
sizes: [[300, 250]],
|
|
37
|
+
mediaTypes: {
|
|
38
|
+
video: {
|
|
39
|
+
playerSize: [[300, 250]],
|
|
40
|
+
context: 'outstream',
|
|
41
|
+
minduration: 1, // Minimum ad duration, in seconds
|
|
42
|
+
maxduration: 60, // Maximum ad duration, in seconds
|
|
43
|
+
skip: 0, // 1 - true, 0 - false
|
|
44
|
+
skipafter: 5, // Number of seconds before the video can be skipped
|
|
45
|
+
playbackmethod: [2], // Auto-play without sound
|
|
46
|
+
protocols: [1, 2, 3] // VAST 1.0, 2.0 and 3.0
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
bids: [
|
|
50
|
+
{
|
|
51
|
+
bidder: 'vibrantmedia',
|
|
52
|
+
params: {
|
|
53
|
+
placementId: 67890,
|
|
54
|
+
video: {
|
|
55
|
+
skippable: true,
|
|
56
|
+
playback_method: 'auto_play_sound_off'
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
// Native ad unit
|
|
64
|
+
{
|
|
65
|
+
code: 'test-native',
|
|
66
|
+
mediaTypes: {
|
|
67
|
+
native: {
|
|
68
|
+
image: {
|
|
69
|
+
required: true,
|
|
70
|
+
sizes: [300, 250]
|
|
71
|
+
},
|
|
72
|
+
title: {
|
|
73
|
+
required: true
|
|
74
|
+
},
|
|
75
|
+
sponsoredBy: {
|
|
76
|
+
required: true
|
|
77
|
+
},
|
|
78
|
+
clickUrl: {
|
|
79
|
+
required: true
|
|
80
|
+
},
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
bids: [{
|
|
84
|
+
bidder: 'vibrantmedia',
|
|
85
|
+
params: {
|
|
86
|
+
placementId: 13579,
|
|
87
|
+
allowSmallerSizes: true
|
|
88
|
+
}
|
|
89
|
+
}]
|
|
90
|
+
}
|
|
91
|
+
];
|
|
92
|
+
```
|