prebid.js 9.2.0 → 9.3.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/dist/33acrossAnalyticsAdapter.js +1 -1
- package/dist/33acrossBidAdapter.js +1 -1
- package/dist/33acrossIdSystem.js +1 -1
- package/dist/BTBidAdapter.js +1 -1
- package/dist/adagioAnalyticsAdapter.js +1 -1
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adagioUtils.js +1 -1
- package/dist/addefendBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adlooxRtdProvider.js +1 -1
- package/dist/adnuntiusBidAdapter.js +1 -1
- package/dist/adqueryBidAdapter.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adstirBidAdapter.js +1 -1
- package/dist/adtrgtmeBidAdapter.js +1 -1
- package/dist/adxcgAnalyticsAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/adyoulikeBidAdapter.js +1 -1
- package/dist/agmaAnalyticsAdapter.js +1 -1
- package/dist/ajaBidAdapter.js +1 -1
- package/dist/amxBidAdapter.js +1 -1
- package/dist/amxIdSystem.js +1 -1
- package/dist/appierAnalyticsAdapter.js +1 -1
- package/dist/appnexusBidAdapter.js +1 -1
- package/dist/asoBidAdapter.js +1 -1
- package/dist/axonixBidAdapter.js +1 -1
- package/dist/bidglassBidAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.js +1 -1
- package/dist/bridBidAdapter.js +1 -1
- package/dist/bridgewellBidAdapter.js +1 -1
- package/dist/brightMountainMediaBidAdapter.js +1 -1
- package/dist/carodaBidAdapter.js +1 -1
- package/dist/chtnwBidAdapter.js +1 -1
- package/dist/chunk-core.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consentManagement.js +1 -0
- package/dist/consentManagementGpp.js +1 -1
- package/dist/consentManagementTcf.js +1 -1
- package/dist/consumableBidAdapter.js +1 -1
- package/dist/conversantAnalyticsAdapter.js +1 -1
- package/dist/conversantBidAdapter.js +1 -1
- package/dist/copper6sspBidAdapter.js +1 -0
- package/dist/craftBidAdapter.js +1 -1
- package/dist/criteoBidAdapter.js +1 -1
- package/dist/cwireBidAdapter.js +1 -1
- package/dist/dailymotionBidAdapter.js +1 -1
- package/dist/dependencies.json +18 -4
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/dxkultureBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/euidIdSystem.js +1 -1
- package/dist/exadsBidAdapter.js +1 -1
- package/dist/feedadBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/freewheel-sspBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/greenbidsAnalyticsAdapter.js +1 -1
- package/dist/greenbidsRtdProvider.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/hypelabBidAdapter.js +1 -1
- package/dist/id5AnalyticsAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/illuminBidAdapter.js +1 -1
- package/dist/imdsBidAdapter.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/intentIqIdSystem.js +1 -1
- package/dist/ixBidAdapter.js +1 -1
- package/dist/jixieBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/kargoBidAdapter.js +1 -1
- package/dist/kimberliteBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.js +1 -1
- package/dist/kueezRtbBidAdapter.js +1 -1
- package/dist/lassoBidAdapter.js +1 -1
- package/dist/lifestreetBidAdapter.js +1 -1
- package/dist/liveIntentIdSystem.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.js +1 -1
- package/dist/luceadBidAdapter.js +1 -1
- package/dist/mabidderBidAdapter.js +1 -1
- package/dist/magniteAnalyticsAdapter.js +1 -1
- package/dist/malltvAnalyticsAdapter.js +1 -1
- package/dist/marsmediaBidAdapter.js +1 -1
- package/dist/mediafuseBidAdapter.js +1 -1
- package/dist/medianetAnalyticsAdapter.js +1 -1
- package/dist/medianetBidAdapter.js +1 -1
- package/dist/mediasquareBidAdapter.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/missenaBidAdapter.js +1 -1
- package/dist/nexx360BidAdapter.js +1 -1
- package/dist/nobidAnalyticsAdapter.js +1 -1
- package/dist/nobidBidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +172 -167
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/openwebBidAdapter.js +1 -1
- package/dist/openxBidAdapter.js +1 -1
- package/dist/optidigitalBidAdapter.js +1 -1
- package/dist/orakiBidAdapter.js +1 -0
- package/dist/orbidderBidAdapter.js +1 -1
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/pairIdSystem.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebidServerBidAdapter.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/publirBidAdapter.js +1 -1
- package/dist/pubmaticAnalyticsAdapter.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pxyzBidAdapter.js +1 -1
- package/dist/quantcastBidAdapter.js +1 -1
- package/dist/readpeakBidAdapter.js +1 -1
- package/dist/relaidoBidAdapter.js +1 -1
- package/dist/retailspotBidAdapter.js +1 -1
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- package/dist/seedingAllianceBidAdapter.js +1 -1
- package/dist/seedtagBidAdapter.js +1 -1
- package/dist/sharethroughAnalyticsAdapter.js +1 -1
- package/dist/sharethroughBidAdapter.js +1 -1
- package/dist/shinezBidAdapter.js +1 -1
- package/dist/shinezRtbBidAdapter.js +1 -1
- package/dist/smaatoBidAdapter.js +1 -1
- package/dist/smartadserverBidAdapter.js +1 -1
- package/dist/smartxBidAdapter.js +1 -1
- package/dist/smartyadsBidAdapter.js +1 -1
- package/dist/smartyadsUtils.js +1 -0
- package/dist/smilewantedBidAdapter.js +1 -1
- package/dist/snigelBidAdapter.js +1 -1
- package/dist/sonobiBidAdapter.js +1 -1
- package/dist/sovrnBidAdapter.js +1 -1
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/stnBidAdapter.js +1 -1
- package/dist/stvBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/taboolaBidAdapter.js +1 -1
- package/dist/tagorasBidAdapter.js +1 -1
- package/dist/tappxBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.js +1 -1
- package/dist/terceptAnalyticsAdapter.js +1 -1
- package/dist/themoneytizerBidAdapter.js +1 -1
- package/dist/trionBidAdapter.js +1 -1
- package/dist/tripleliftBidAdapter.js +1 -1
- package/dist/ttdBidAdapter.js +1 -1
- package/dist/twistDigitalBidAdapter.js +1 -1
- package/dist/ucfunnelAnalyticsAdapter.js +1 -1
- package/dist/uid2IdSystem.js +1 -1
- package/dist/underdogmediaBidAdapter.js +1 -1
- package/dist/undertoneBidAdapter.js +1 -1
- package/dist/unrulyBidAdapter.js +1 -1
- package/dist/userId.js +1 -1
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/vidazooUtils.js +1 -0
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/visxBidAdapter.js +1 -1
- package/dist/vuukleBidAdapter.js +1 -1
- package/dist/widespaceBidAdapter.js +1 -1
- package/dist/winrBidAdapter.js +1 -1
- package/dist/yahooAdsBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/dist/yuktamediaAnalyticsAdapter.js +1 -1
- package/libraries/consentManagement/cmUtils.js +38 -0
- package/libraries/smartyadsUtils/getAdUrlByRegion.js +32 -0
- package/libraries/vidazooUtils/bidderUtils.js +481 -0
- package/libraries/vidazooUtils/constants.js +7 -0
- package/modules/addefendBidAdapter.js +1 -2
- package/modules/adlooxRtdProvider.js +1 -1
- package/modules/adnuntiusBidAdapter.js +1 -0
- package/modules/adxcgAnalyticsAdapter.js +1 -2
- package/modules/consentManagementGpp.js +2 -38
- package/modules/consentManagementTcf.js +7 -38
- package/modules/conversantAnalyticsAdapter.js +1 -2
- package/modules/copper6sspBidAdapter.js +19 -0
- package/modules/copper6sspBidAdapter.md +79 -0
- package/modules/criteoBidAdapter.js +10 -3
- package/modules/id5AnalyticsAdapter.js +1 -2
- package/modules/intentIqIdSystem.js +408 -50
- package/modules/intentIqIdSystem.md +92 -0
- package/modules/liveIntentIdSystem.js +2 -2
- package/modules/mabidderBidAdapter.js +1 -2
- package/modules/medianetAnalyticsAdapter.js +1 -2
- package/modules/medianetBidAdapter.js +1 -1
- package/modules/orakiBidAdapter.js +19 -0
- package/modules/orakiBidAdapter.md +79 -0
- package/modules/orbidderBidAdapter.js +4 -2
- package/modules/pairIdSystem.js +27 -10
- package/modules/pixfutureBidAdapter.js +1 -2
- package/modules/prebidServerBidAdapter/index.js +1 -1
- package/modules/seedtagBidAdapter.js +4 -0
- package/modules/smartadserverBidAdapter.js +3 -0
- package/modules/smartyadsBidAdapter.js +6 -110
- package/modules/snigelBidAdapter.js +1 -2
- package/modules/tappxBidAdapter.js +1 -2
- package/modules/terceptAnalyticsAdapter.js +1 -2
- package/modules/twistDigitalBidAdapter.js +1 -12
- package/modules/userId/index.js +31 -21
- package/modules/vidazooBidAdapter.js +26 -468
- package/modules/yahooAdsBidAdapter.js +4 -1
- package/modules/yuktamediaAnalyticsAdapter.js +1 -2
- package/package.json +1 -1
- package/test/spec/fpd/gdpr_spec.js +24 -2
- package/test/spec/modules/adnuntiusBidAdapter_spec.js +6 -3
- package/test/spec/modules/conversantAnalyticsAdapter_spec.js +1 -1
- package/test/spec/modules/copper6sspBidAdapter_spec.js +514 -0
- package/test/spec/modules/intentIqIdSystem_spec.js +264 -36
- package/test/spec/modules/orakiBidAdapter_spec.js +510 -0
- package/test/spec/modules/seedtagBidAdapter_spec.js +27 -0
- package/test/spec/modules/smartadserverBidAdapter_spec.js +7 -0
- package/test/spec/modules/smartyadsBidAdapter_spec.js +6 -83
- package/test/spec/modules/twistDigitalBidAdapter_spec.js +5 -3
- package/test/spec/modules/userId_spec.js +86 -47
- package/test/spec/modules/vidazooBidAdapter_spec.js +21 -23
- package/test/spec/modules/yahooAdsBidAdapter_spec.js +1 -1
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import {
|
|
2
|
+
_each,
|
|
3
|
+
deepAccess,
|
|
4
|
+
formatQS,
|
|
5
|
+
isArray,
|
|
6
|
+
isFn,
|
|
7
|
+
parseSizesInput,
|
|
8
|
+
parseUrl,
|
|
9
|
+
triggerPixel,
|
|
10
|
+
uniques
|
|
11
|
+
} from '../../src/utils.js';
|
|
12
|
+
import {chunk} from '../chunk/chunk.js';
|
|
13
|
+
import {CURRENCY, DEAL_ID_EXPIRY, SESSION_ID_KEY, TTL_SECONDS, UNIQUE_DEAL_ID_EXPIRY} from './constants.js';
|
|
14
|
+
import {bidderSettings} from '../../src/bidderSettings.js';
|
|
15
|
+
import {config} from '../../src/config.js';
|
|
16
|
+
import {BANNER, VIDEO} from '../../src/mediaTypes.js';
|
|
17
|
+
|
|
18
|
+
export function createSessionId() {
|
|
19
|
+
return 'wsid_' + parseInt(Date.now() * Math.random());
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function getTopWindowQueryParams() {
|
|
23
|
+
try {
|
|
24
|
+
const parsedUrl = parseUrl(window.top.document.URL, {decodeSearchAsString: true});
|
|
25
|
+
return parsedUrl.search;
|
|
26
|
+
} catch (e) {
|
|
27
|
+
return '';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function extractCID(params) {
|
|
32
|
+
return params.cId || params.CID || params.cID || params.CId || params.cid || params.ciD || params.Cid || params.CiD;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function extractPID(params) {
|
|
36
|
+
return params.pId || params.PID || params.pID || params.PId || params.pid || params.piD || params.Pid || params.PiD;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function extractSubDomain(params) {
|
|
40
|
+
return params.subDomain || params.SubDomain || params.Subdomain || params.subdomain || params.SUBDOMAIN || params.subDOMAIN;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function isBidRequestValid(bid) {
|
|
44
|
+
const params = bid.params || {};
|
|
45
|
+
return !!(extractCID(params) && extractPID(params));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function tryParseJSON(value) {
|
|
49
|
+
try {
|
|
50
|
+
return JSON.parse(value);
|
|
51
|
+
} catch (e) {
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function setStorageItem(storage, key, value, timestamp) {
|
|
57
|
+
try {
|
|
58
|
+
const created = timestamp || Date.now();
|
|
59
|
+
const data = JSON.stringify({value, created});
|
|
60
|
+
storage.setDataInLocalStorage(key, data);
|
|
61
|
+
} catch (e) {
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function getStorageItem(storage, key) {
|
|
66
|
+
try {
|
|
67
|
+
return tryParseJSON(storage.getDataFromLocalStorage(key, null));
|
|
68
|
+
} catch (e) {
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function getCacheOpt(storage, useKey) {
|
|
75
|
+
let data = storage.getDataFromLocalStorage(useKey, null);
|
|
76
|
+
if (!data) {
|
|
77
|
+
data = String(Date.now());
|
|
78
|
+
storage.setDataInLocalStorage(useKey, data, null);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return data;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function getUniqueDealId(storage, key, expiry = UNIQUE_DEAL_ID_EXPIRY) {
|
|
85
|
+
const storageKey = `u_${key}`;
|
|
86
|
+
const now = Date.now();
|
|
87
|
+
const data = getStorageItem(storage, storageKey);
|
|
88
|
+
let uniqueId;
|
|
89
|
+
|
|
90
|
+
if (!data || !data.value || now - data.created > expiry) {
|
|
91
|
+
uniqueId = `${key}_${now.toString()}`;
|
|
92
|
+
setStorageItem(storage, storageKey, uniqueId);
|
|
93
|
+
} else {
|
|
94
|
+
uniqueId = data.value;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return uniqueId;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function getNextDealId(storage, key, expiry = DEAL_ID_EXPIRY) {
|
|
101
|
+
try {
|
|
102
|
+
const data = getStorageItem(storage, key);
|
|
103
|
+
let currentValue = 0;
|
|
104
|
+
let timestamp;
|
|
105
|
+
|
|
106
|
+
if (data && data.value && Date.now() - data.created < expiry) {
|
|
107
|
+
currentValue = data.value;
|
|
108
|
+
timestamp = data.created;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const nextValue = currentValue + 1;
|
|
112
|
+
setStorageItem(storage, key, nextValue, timestamp);
|
|
113
|
+
return nextValue;
|
|
114
|
+
} catch (e) {
|
|
115
|
+
return 0;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function hashCode(s, prefix = '_') {
|
|
120
|
+
const l = s.length;
|
|
121
|
+
let h = 0
|
|
122
|
+
let i = 0;
|
|
123
|
+
if (l > 0) {
|
|
124
|
+
while (i < l) {
|
|
125
|
+
h = (h << 5) - h + s.charCodeAt(i++) | 0;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return prefix + h;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function onBidWon(bid) {
|
|
132
|
+
if (!bid.nurl) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const wonBid = {
|
|
136
|
+
adId: bid.adId,
|
|
137
|
+
creativeId: bid.creativeId,
|
|
138
|
+
auctionId: bid.auctionId,
|
|
139
|
+
transactionId: bid.transactionId,
|
|
140
|
+
adUnitCode: bid.adUnitCode,
|
|
141
|
+
cpm: bid.cpm,
|
|
142
|
+
currency: bid.currency,
|
|
143
|
+
originalCpm: bid.originalCpm,
|
|
144
|
+
originalCurrency: bid.originalCurrency,
|
|
145
|
+
netRevenue: bid.netRevenue,
|
|
146
|
+
mediaType: bid.mediaType,
|
|
147
|
+
timeToRespond: bid.timeToRespond,
|
|
148
|
+
status: bid.status,
|
|
149
|
+
};
|
|
150
|
+
const qs = formatQS(wonBid);
|
|
151
|
+
const url = bid.nurl + (bid.nurl.indexOf('?') === -1 ? '?' : '&') + qs;
|
|
152
|
+
triggerPixel(url);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Create the spec function for getting user syncs
|
|
157
|
+
*
|
|
158
|
+
* The options object accepts the following fields:
|
|
159
|
+
*
|
|
160
|
+
* - iframeSyncUrl
|
|
161
|
+
* - imageSyncUrl
|
|
162
|
+
*
|
|
163
|
+
* @param options
|
|
164
|
+
*/
|
|
165
|
+
export function createUserSyncGetter(options = {
|
|
166
|
+
iframeSyncUrl: '',
|
|
167
|
+
imageSyncUrl: ''
|
|
168
|
+
}) {
|
|
169
|
+
return function getUserSyncs(syncOptions, responses, gdprConsent = {}, uspConsent = '', gppConsent = {}) {
|
|
170
|
+
const syncs = [];
|
|
171
|
+
const {iframeEnabled, pixelEnabled} = syncOptions;
|
|
172
|
+
const {gdprApplies, consentString = ''} = gdprConsent;
|
|
173
|
+
const {gppString, applicableSections} = gppConsent;
|
|
174
|
+
|
|
175
|
+
const cidArr = responses.filter(resp => deepAccess(resp, 'body.cid')).map(resp => resp.body.cid).filter(uniques);
|
|
176
|
+
let params = `?cid=${encodeURIComponent(cidArr.join(','))}&gdpr=${gdprApplies ? 1 : 0}&gdpr_consent=${encodeURIComponent(consentString || '')}&us_privacy=${encodeURIComponent(uspConsent || '')}`;
|
|
177
|
+
|
|
178
|
+
if (gppString && applicableSections?.length) {
|
|
179
|
+
params += '&gpp=' + encodeURIComponent(gppString);
|
|
180
|
+
params += '&gpp_sid=' + encodeURIComponent(applicableSections.join(','));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (iframeEnabled && options.iframeSyncUrl) {
|
|
184
|
+
syncs.push({
|
|
185
|
+
type: 'iframe',
|
|
186
|
+
url: `${options.iframeSyncUrl}/${params}`
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
if (pixelEnabled && options.imageSyncUrl) {
|
|
190
|
+
syncs.push({
|
|
191
|
+
type: 'image',
|
|
192
|
+
url: `${options.imageSyncUrl}/${params}`
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
return syncs;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export function appendUserIdsToRequestPayload(payloadRef, userIds) {
|
|
200
|
+
let key;
|
|
201
|
+
_each(userIds, (userId, idSystemProviderName) => {
|
|
202
|
+
key = `uid.${idSystemProviderName}`;
|
|
203
|
+
switch (idSystemProviderName) {
|
|
204
|
+
case 'lipb':
|
|
205
|
+
payloadRef[key] = userId.lipbid;
|
|
206
|
+
break;
|
|
207
|
+
case 'id5id':
|
|
208
|
+
payloadRef[key] = userId.uid;
|
|
209
|
+
break;
|
|
210
|
+
default:
|
|
211
|
+
payloadRef[key] = userId;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export function getVidazooSessionId(storage) {
|
|
217
|
+
return getStorageItem(storage, SESSION_ID_KEY) || '';
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout, webSessionId, storage, bidderVersion, bidderCode, getUniqueRequestData) {
|
|
221
|
+
const {
|
|
222
|
+
params,
|
|
223
|
+
bidId,
|
|
224
|
+
userId,
|
|
225
|
+
adUnitCode,
|
|
226
|
+
schain,
|
|
227
|
+
mediaTypes,
|
|
228
|
+
ortb2Imp,
|
|
229
|
+
bidderRequestId,
|
|
230
|
+
bidRequestsCount,
|
|
231
|
+
bidderRequestsCount,
|
|
232
|
+
bidderWinsCount
|
|
233
|
+
} = bid;
|
|
234
|
+
const {ext} = params;
|
|
235
|
+
let {bidFloor} = params;
|
|
236
|
+
const hashUrl = hashCode(topWindowUrl);
|
|
237
|
+
const uniqueRequestData = isFn(getUniqueRequestData) ? getUniqueRequestData(hashUrl) : {};
|
|
238
|
+
const uniqueDealId = getUniqueDealId(storage, hashUrl);
|
|
239
|
+
const pId = extractPID(params);
|
|
240
|
+
const isStorageAllowed = bidderSettings.get(bidderCode, 'storageAllowed');
|
|
241
|
+
|
|
242
|
+
const gpid = deepAccess(bid, 'ortb2Imp.ext.gpid') || deepAccess(bid, 'ortb2Imp.ext.data.pbadslot', '');
|
|
243
|
+
const cat = deepAccess(bidderRequest, 'ortb2.site.cat', []);
|
|
244
|
+
const pagecat = deepAccess(bidderRequest, 'ortb2.site.pagecat', []);
|
|
245
|
+
const contentData = deepAccess(bidderRequest, 'ortb2.site.content.data', []);
|
|
246
|
+
const userData = deepAccess(bidderRequest, 'ortb2.user.data', []);
|
|
247
|
+
|
|
248
|
+
if (isFn(bid.getFloor)) {
|
|
249
|
+
const floorInfo = bid.getFloor({
|
|
250
|
+
currency: 'USD',
|
|
251
|
+
mediaType: '*',
|
|
252
|
+
size: '*'
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
if (floorInfo.currency === 'USD') {
|
|
256
|
+
bidFloor = floorInfo.floor;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
let data = {
|
|
261
|
+
url: encodeURIComponent(topWindowUrl),
|
|
262
|
+
uqs: getTopWindowQueryParams(),
|
|
263
|
+
cb: Date.now(),
|
|
264
|
+
bidFloor: bidFloor,
|
|
265
|
+
bidId: bidId,
|
|
266
|
+
referrer: bidderRequest.refererInfo.ref,
|
|
267
|
+
adUnitCode: adUnitCode,
|
|
268
|
+
publisherId: pId,
|
|
269
|
+
sizes: sizes,
|
|
270
|
+
uniqueDealId: uniqueDealId,
|
|
271
|
+
bidderVersion: bidderVersion,
|
|
272
|
+
prebidVersion: '$prebid.version$',
|
|
273
|
+
res: `${screen.width}x${screen.height}`,
|
|
274
|
+
schain: schain,
|
|
275
|
+
mediaTypes: mediaTypes,
|
|
276
|
+
isStorageAllowed: isStorageAllowed,
|
|
277
|
+
gpid: gpid,
|
|
278
|
+
cat: cat,
|
|
279
|
+
contentData,
|
|
280
|
+
userData: userData,
|
|
281
|
+
pagecat: pagecat,
|
|
282
|
+
transactionId: ortb2Imp?.ext?.tid,
|
|
283
|
+
bidderRequestId: bidderRequestId,
|
|
284
|
+
bidRequestsCount: bidRequestsCount,
|
|
285
|
+
bidderRequestsCount: bidderRequestsCount,
|
|
286
|
+
bidderWinsCount: bidderWinsCount,
|
|
287
|
+
bidderTimeout: bidderTimeout,
|
|
288
|
+
webSessionId: webSessionId,
|
|
289
|
+
...uniqueRequestData
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
appendUserIdsToRequestPayload(data, userId);
|
|
293
|
+
|
|
294
|
+
const sua = deepAccess(bidderRequest, 'ortb2.device.sua');
|
|
295
|
+
|
|
296
|
+
if (sua) {
|
|
297
|
+
data.sua = sua;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (bidderRequest.gdprConsent) {
|
|
301
|
+
if (bidderRequest.gdprConsent.consentString) {
|
|
302
|
+
data.gdprConsent = bidderRequest.gdprConsent.consentString;
|
|
303
|
+
}
|
|
304
|
+
if (bidderRequest.gdprConsent.gdprApplies !== undefined) {
|
|
305
|
+
data.gdpr = bidderRequest.gdprConsent.gdprApplies ? 1 : 0;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if (bidderRequest.uspConsent) {
|
|
309
|
+
data.usPrivacy = bidderRequest.uspConsent;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
if (bidderRequest.gppConsent) {
|
|
313
|
+
data.gppString = bidderRequest.gppConsent.gppString;
|
|
314
|
+
data.gppSid = bidderRequest.gppConsent.applicableSections;
|
|
315
|
+
} else if (bidderRequest.ortb2?.regs?.gpp) {
|
|
316
|
+
data.gppString = bidderRequest.ortb2.regs.gpp;
|
|
317
|
+
data.gppSid = bidderRequest.ortb2.regs.gpp_sid;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (bidderRequest.paapi?.enabled) {
|
|
321
|
+
const fledge = deepAccess(bidderRequest, 'ortb2Imp.ext.ae');
|
|
322
|
+
if (fledge) {
|
|
323
|
+
data.fledge = fledge;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
_each(ext, (value, key) => {
|
|
328
|
+
data['ext.' + key] = value;
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
return data;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export function createInterpretResponseFn(bidderCode) {
|
|
335
|
+
return function interpretResponse(serverResponse, request) {
|
|
336
|
+
if (!serverResponse || !serverResponse.body) {
|
|
337
|
+
return [];
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
const singleRequestMode = config.getConfig(`${bidderCode}.singleRequest`);
|
|
341
|
+
const reqBidId = deepAccess(request, 'data.bidId');
|
|
342
|
+
const {results} = serverResponse.body;
|
|
343
|
+
|
|
344
|
+
let output = [];
|
|
345
|
+
|
|
346
|
+
try {
|
|
347
|
+
results.forEach((result, i) => {
|
|
348
|
+
const {
|
|
349
|
+
creativeId,
|
|
350
|
+
ad,
|
|
351
|
+
price,
|
|
352
|
+
exp,
|
|
353
|
+
width,
|
|
354
|
+
height,
|
|
355
|
+
currency,
|
|
356
|
+
bidId,
|
|
357
|
+
nurl,
|
|
358
|
+
advertiserDomains,
|
|
359
|
+
metaData,
|
|
360
|
+
mediaType = BANNER
|
|
361
|
+
} = result;
|
|
362
|
+
if (!ad || !price) {
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
const response = {
|
|
367
|
+
requestId: (singleRequestMode && bidId) ? bidId : reqBidId,
|
|
368
|
+
cpm: price,
|
|
369
|
+
width: width,
|
|
370
|
+
height: height,
|
|
371
|
+
creativeId: creativeId,
|
|
372
|
+
currency: currency || CURRENCY,
|
|
373
|
+
netRevenue: true,
|
|
374
|
+
ttl: exp || TTL_SECONDS,
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
if (nurl) {
|
|
378
|
+
response.nurl = nurl;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if (metaData) {
|
|
382
|
+
Object.assign(response, {
|
|
383
|
+
meta: metaData
|
|
384
|
+
})
|
|
385
|
+
} else {
|
|
386
|
+
Object.assign(response, {
|
|
387
|
+
meta: {
|
|
388
|
+
advertiserDomains: advertiserDomains || []
|
|
389
|
+
}
|
|
390
|
+
})
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
if (mediaType === BANNER) {
|
|
394
|
+
Object.assign(response, {
|
|
395
|
+
ad: ad,
|
|
396
|
+
});
|
|
397
|
+
} else {
|
|
398
|
+
Object.assign(response, {
|
|
399
|
+
vastXml: ad,
|
|
400
|
+
mediaType: VIDEO
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
output.push(response);
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
return output;
|
|
407
|
+
} catch (e) {
|
|
408
|
+
return [];
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
export function createBuildRequestsFn(createRequestDomain, createUniqueRequestData, webSessionId, storage, bidderCode, bidderVersion) {
|
|
414
|
+
function buildRequest(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout) {
|
|
415
|
+
const {params} = bid;
|
|
416
|
+
const cId = extractCID(params);
|
|
417
|
+
const subDomain = extractSubDomain(params);
|
|
418
|
+
const data = buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout, webSessionId, storage, bidderVersion, bidderCode, createUniqueRequestData);
|
|
419
|
+
const dto = {
|
|
420
|
+
method: 'POST', url: `${createRequestDomain(subDomain)}/prebid/multi/${cId}`, data: data
|
|
421
|
+
};
|
|
422
|
+
return dto;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function buildSingleRequest(bidRequests, bidderRequest, topWindowUrl, bidderTimeout) {
|
|
426
|
+
const {params} = bidRequests[0];
|
|
427
|
+
const cId = extractCID(params);
|
|
428
|
+
const subDomain = extractSubDomain(params);
|
|
429
|
+
const data = bidRequests.map(bid => {
|
|
430
|
+
const sizes = parseSizesInput(bid.sizes);
|
|
431
|
+
return buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout, webSessionId, storage, bidderVersion, bidderCode, createUniqueRequestData)
|
|
432
|
+
});
|
|
433
|
+
const chunkSize = Math.min(20, config.getConfig(`${bidderCode}.chunkSize`) || 10);
|
|
434
|
+
|
|
435
|
+
const chunkedData = chunk(data, chunkSize);
|
|
436
|
+
return chunkedData.map(chunk => {
|
|
437
|
+
return {
|
|
438
|
+
method: 'POST',
|
|
439
|
+
url: `${createRequestDomain(subDomain)}/prebid/multi/${cId}`,
|
|
440
|
+
data: {
|
|
441
|
+
bids: chunk
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
return function buildRequests(validBidRequests, bidderRequest) {
|
|
448
|
+
// TODO: does the fallback make sense here?
|
|
449
|
+
const topWindowUrl = bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation;
|
|
450
|
+
const bidderTimeout = config.getConfig('bidderTimeout');
|
|
451
|
+
|
|
452
|
+
const singleRequestMode = config.getConfig('vidazoo.singleRequest');
|
|
453
|
+
|
|
454
|
+
const requests = [];
|
|
455
|
+
|
|
456
|
+
if (singleRequestMode) {
|
|
457
|
+
// banner bids are sent as a single request
|
|
458
|
+
const bannerBidRequests = validBidRequests.filter(bid => isArray(bid.mediaTypes) ? bid.mediaTypes.includes(BANNER) : bid.mediaTypes[BANNER] !== undefined);
|
|
459
|
+
if (bannerBidRequests.length > 0) {
|
|
460
|
+
const singleRequests = buildSingleRequest(bannerBidRequests, bidderRequest, topWindowUrl, bidderTimeout);
|
|
461
|
+
requests.push(...singleRequests);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
// video bids are sent as a single request for each bid
|
|
465
|
+
|
|
466
|
+
const videoBidRequests = validBidRequests.filter(bid => bid.mediaTypes[VIDEO] !== undefined);
|
|
467
|
+
videoBidRequests.forEach(validBidRequest => {
|
|
468
|
+
const sizes = parseSizesInput(validBidRequest.sizes);
|
|
469
|
+
const request = buildRequest(validBidRequest, topWindowUrl, sizes, bidderRequest, bidderTimeout);
|
|
470
|
+
requests.push(request);
|
|
471
|
+
});
|
|
472
|
+
} else {
|
|
473
|
+
validBidRequests.forEach(validBidRequest => {
|
|
474
|
+
const sizes = parseSizesInput(validBidRequest.sizes);
|
|
475
|
+
const request = buildRequest(validBidRequest, topWindowUrl, sizes, bidderRequest, bidderTimeout);
|
|
476
|
+
requests.push(request);
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
return requests;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const CURRENCY = 'USD';
|
|
2
|
+
export const TTL_SECONDS = 60 * 5;
|
|
3
|
+
export const DEAL_ID_EXPIRY = 1000 * 60 * 15;
|
|
4
|
+
export const UNIQUE_DEAL_ID_EXPIRY = 1000 * 60 * 60;
|
|
5
|
+
export const SESSION_ID_KEY = 'vidSid';
|
|
6
|
+
export const OPT_CACHE_KEY = 'vdzwopt';
|
|
7
|
+
export const OPT_TIME_KEY = 'vdzHum';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {registerBidder} from '../src/adapters/bidderFactory.js';
|
|
2
|
-
import {getGlobal} from '../src/prebidGlobal.js';
|
|
3
2
|
|
|
4
3
|
const BIDDER_CODE = 'addefend';
|
|
5
4
|
|
|
@@ -17,7 +16,7 @@ export const spec = {
|
|
|
17
16
|
},
|
|
18
17
|
buildRequests: function(validBidRequests, bidderRequest) {
|
|
19
18
|
let bid = {
|
|
20
|
-
v:
|
|
19
|
+
v: 'v' + '$prebid.version$',
|
|
21
20
|
auctionId: false,
|
|
22
21
|
pageId: false,
|
|
23
22
|
gdpr_applies: bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies ? bidderRequest.gdprConsent.gdprApplies : 'true',
|
|
@@ -106,7 +106,7 @@ function getBidRequestData(reqBidsConfigObj, callback, config, userConsent) {
|
|
|
106
106
|
|
|
107
107
|
// buildUrl creates PHP style multi-parameters and includes undefined... (╯°□°)╯ ┻━┻
|
|
108
108
|
const url = buildUrl(mergeDeep(parseUrl(`${API_ORIGIN}/q`), { search: {
|
|
109
|
-
'v':
|
|
109
|
+
'v': 'pbjs-v' + '$prebid.version$',
|
|
110
110
|
'c': config.params.clientid,
|
|
111
111
|
'p': config.params.platformid,
|
|
112
112
|
't': config.params.tagid,
|
|
@@ -252,6 +252,7 @@ export const spec = {
|
|
|
252
252
|
|
|
253
253
|
const bidderConfig = config.getConfig();
|
|
254
254
|
if (bidderConfig.useCookie === false) queryParamsAndValues.push('noCookies=true');
|
|
255
|
+
if (bidderConfig.advertiserTransparency === true) queryParamsAndValues.push('advertiserTransparency=true');
|
|
255
256
|
if (bidderConfig.maxDeals > 0) queryParamsAndValues.push('ds=' + Math.min(bidderConfig.maxDeals, MAXIMUM_DEALS_LIMIT));
|
|
256
257
|
|
|
257
258
|
const bidRequests = {};
|
|
@@ -3,7 +3,6 @@ import { ajax } from '../src/ajax.js';
|
|
|
3
3
|
import adapter from '../libraries/analyticsAdapter/AnalyticsAdapter.js';
|
|
4
4
|
import adapterManager from '../src/adapterManager.js';
|
|
5
5
|
import { EVENTS } from '../src/constants.js';
|
|
6
|
-
import {getGlobal} from '../src/prebidGlobal.js';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Analytics adapter from adxcg.com
|
|
@@ -123,7 +122,7 @@ function send (data) {
|
|
|
123
122
|
ats: adxcgAnalyticsAdapter.context.auctionTimestamp,
|
|
124
123
|
aav: adxcgAnalyticsVersion,
|
|
125
124
|
iob: intersectionObserverAvailable(window) ? '1' : '0',
|
|
126
|
-
pbv:
|
|
125
|
+
pbv: '$prebid.version$',
|
|
127
126
|
sz: window.screen.width + 'x' + window.screen.height
|
|
128
127
|
}
|
|
129
128
|
});
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
import {deepSetValue, isEmpty, isNumber, isPlainObject, isStr, logError, logInfo, logWarn} from '../src/utils.js';
|
|
8
8
|
import {config} from '../src/config.js';
|
|
9
9
|
import {gppDataHandler} from '../src/adapterManager.js';
|
|
10
|
-
import {timedAuctionHook} from '../src/utils/perfMetrics.js';
|
|
11
10
|
import {enrichFPD} from '../src/fpd/enrichment.js';
|
|
12
11
|
import {getGlobal} from '../src/prebidGlobal.js';
|
|
13
12
|
import {cmpClient, MODE_CALLBACK} from '../libraries/cmp/cmpClient.js';
|
|
14
13
|
import {GreedyPromise} from '../src/utils/promise.js';
|
|
15
14
|
import {buildActivityParams} from '../src/activities/params.js';
|
|
15
|
+
import {consentManagementHook} from '../libraries/consentManagement/cmUtils.js';
|
|
16
16
|
|
|
17
17
|
const DEFAULT_CMP = 'iab';
|
|
18
18
|
const DEFAULT_CONSENT_TIMEOUT = 10000;
|
|
@@ -228,20 +228,6 @@ function loadConsentData(cb) {
|
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
/**
|
|
232
|
-
* Like `loadConsentData`, but cache and re-use previously loaded data.
|
|
233
|
-
* @param cb
|
|
234
|
-
*/
|
|
235
|
-
function loadIfMissing(cb) {
|
|
236
|
-
if (consentData) {
|
|
237
|
-
logInfo('User consent information already known. Pulling internally stored information...');
|
|
238
|
-
// eslint-disable-next-line standard/no-callback-literal
|
|
239
|
-
cb(false);
|
|
240
|
-
} else {
|
|
241
|
-
loadConsentData(cb);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
231
|
/**
|
|
246
232
|
* If consentManagement module is enabled (ie included in setConfig), this hook function will attempt to fetch the
|
|
247
233
|
* user's encoded consent string from the supported CMP. Once obtained, the module will store this
|
|
@@ -250,29 +236,7 @@ function loadIfMissing(cb) {
|
|
|
250
236
|
* @param {object} reqBidsConfigObj required; This is the same param that's used in pbjs.requestBids.
|
|
251
237
|
* @param {function} fn required; The next function in the chain, used by hook.js
|
|
252
238
|
*/
|
|
253
|
-
export const requestBidsHook =
|
|
254
|
-
loadIfMissing(function (shouldCancelAuction, errMsg, ...extraArgs) {
|
|
255
|
-
if (errMsg) {
|
|
256
|
-
let log = logWarn;
|
|
257
|
-
if (shouldCancelAuction) {
|
|
258
|
-
log = logError;
|
|
259
|
-
errMsg = `${errMsg} Canceling auction as per consentManagement config.`;
|
|
260
|
-
}
|
|
261
|
-
log(errMsg, ...extraArgs);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
if (shouldCancelAuction) {
|
|
265
|
-
fn.stopTiming();
|
|
266
|
-
if (typeof reqBidsConfigObj.bidsBackHandler === 'function') {
|
|
267
|
-
reqBidsConfigObj.bidsBackHandler();
|
|
268
|
-
} else {
|
|
269
|
-
logError('Error executing bidsBackHandler');
|
|
270
|
-
}
|
|
271
|
-
} else {
|
|
272
|
-
fn.call(this, reqBidsConfigObj);
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
});
|
|
239
|
+
export const requestBidsHook = consentManagementHook('gpp', () => consentData, loadConsentData);
|
|
276
240
|
|
|
277
241
|
function processCmpData(consentData) {
|
|
278
242
|
if (
|
|
@@ -8,11 +8,11 @@ import {deepSetValue, isNumber, isPlainObject, isStr, logError, logInfo, logWarn
|
|
|
8
8
|
import {config} from '../src/config.js';
|
|
9
9
|
import {gdprDataHandler} from '../src/adapterManager.js';
|
|
10
10
|
import {includes} from '../src/polyfill.js';
|
|
11
|
-
import {timedAuctionHook} from '../src/utils/perfMetrics.js';
|
|
12
11
|
import {registerOrtbProcessor, REQUEST} from '../src/pbjsORTB.js';
|
|
13
12
|
import {enrichFPD} from '../src/fpd/enrichment.js';
|
|
14
13
|
import {getGlobal} from '../src/prebidGlobal.js';
|
|
15
14
|
import {cmpClient} from '../libraries/cmp/cmpClient.js';
|
|
15
|
+
import {consentManagementHook} from '../libraries/consentManagement/cmUtils.js';
|
|
16
16
|
|
|
17
17
|
const DEFAULT_CMP = 'iab';
|
|
18
18
|
const DEFAULT_CONSENT_TIMEOUT = 10000;
|
|
@@ -22,6 +22,7 @@ export let userCMP;
|
|
|
22
22
|
export let consentTimeout;
|
|
23
23
|
export let gdprScope;
|
|
24
24
|
export let staticConsentData;
|
|
25
|
+
let dsaPlatform = false;
|
|
25
26
|
let actionTimeout;
|
|
26
27
|
|
|
27
28
|
let consentData;
|
|
@@ -156,20 +157,6 @@ function loadConsentData(cb) {
|
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
|
|
159
|
-
/**
|
|
160
|
-
* Like `loadConsentData`, but cache and re-use previously loaded data.
|
|
161
|
-
* @param cb
|
|
162
|
-
*/
|
|
163
|
-
function loadIfMissing(cb) {
|
|
164
|
-
if (consentData) {
|
|
165
|
-
logInfo('User consent information already known. Pulling internally stored information...');
|
|
166
|
-
// eslint-disable-next-line standard/no-callback-literal
|
|
167
|
-
cb(false);
|
|
168
|
-
} else {
|
|
169
|
-
loadConsentData(cb);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
160
|
/**
|
|
174
161
|
* If consentManagement module is enabled (ie included in setConfig), this hook function will attempt to fetch the
|
|
175
162
|
* user's encoded consent string from the supported CMP. Once obtained, the module will store this
|
|
@@ -178,29 +165,7 @@ function loadIfMissing(cb) {
|
|
|
178
165
|
* @param {object} reqBidsConfigObj required; This is the same param that's used in pbjs.requestBids.
|
|
179
166
|
* @param {function} fn required; The next function in the chain, used by hook.js
|
|
180
167
|
*/
|
|
181
|
-
export const requestBidsHook =
|
|
182
|
-
loadIfMissing(function (shouldCancelAuction, errMsg, ...extraArgs) {
|
|
183
|
-
if (errMsg) {
|
|
184
|
-
let log = logWarn;
|
|
185
|
-
if (shouldCancelAuction) {
|
|
186
|
-
log = logError;
|
|
187
|
-
errMsg = `${errMsg} Canceling auction as per consentManagement config.`;
|
|
188
|
-
}
|
|
189
|
-
log(errMsg, ...extraArgs);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (shouldCancelAuction) {
|
|
193
|
-
fn.stopTiming();
|
|
194
|
-
if (typeof reqBidsConfigObj.bidsBackHandler === 'function') {
|
|
195
|
-
reqBidsConfigObj.bidsBackHandler();
|
|
196
|
-
} else {
|
|
197
|
-
logError('Error executing bidsBackHandler');
|
|
198
|
-
}
|
|
199
|
-
} else {
|
|
200
|
-
fn.call(this, reqBidsConfigObj);
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
});
|
|
168
|
+
export const requestBidsHook = consentManagementHook('gdpr', () => consentData, loadConsentData);
|
|
204
169
|
|
|
205
170
|
/**
|
|
206
171
|
* This function checks the consent data provided by CMP to ensure it's in an expected state.
|
|
@@ -282,6 +247,7 @@ export function setConsentConfig(config) {
|
|
|
282
247
|
|
|
283
248
|
// if true, then gdprApplies should be set to true
|
|
284
249
|
gdprScope = config.defaultGdprScope === true;
|
|
250
|
+
dsaPlatform = !!config.dsaPlatform;
|
|
285
251
|
|
|
286
252
|
logInfo('consentManagement module has been activated...');
|
|
287
253
|
|
|
@@ -315,6 +281,9 @@ export function enrichFPDHook(next, fpd) {
|
|
|
315
281
|
}
|
|
316
282
|
deepSetValue(ortb2, 'user.ext.consent', consent.consentString);
|
|
317
283
|
}
|
|
284
|
+
if (dsaPlatform) {
|
|
285
|
+
deepSetValue(ortb2, 'regs.ext.dsa.dsarequired', 3);
|
|
286
|
+
}
|
|
318
287
|
return ortb2;
|
|
319
288
|
}));
|
|
320
289
|
}
|