prebid.js 7.18.0 → 7.19.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/33acrossBidAdapter.js +1 -1
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adfBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adqueryIdSystem.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adtrgtmeBidAdapter.js +1 -1
- package/dist/adxcgBidAdapter.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/{andBeyondMediaBidAdapter.js → beyondmediaBidAdapter.js} +1 -1
- package/dist/bidglassBidAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.js +1 -1
- package/dist/bridgewellBidAdapter.js +1 -1
- package/dist/brightMountainMediaBidAdapter.js +1 -1
- package/dist/carodaBidAdapter.js +1 -1
- package/dist/cleanioRtdProvider.js +1 -1
- package/dist/colossussspBidAdapter.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consumableBidAdapter.js +1 -1
- package/dist/conversantAnalyticsAdapter.js +1 -0
- package/dist/conversantBidAdapter.js +1 -1
- package/dist/craftBidAdapter.js +1 -1
- package/dist/criteoBidAdapter.js +1 -1
- package/dist/debugging-standalone.js +1 -1
- package/dist/debugging.js +1 -1
- package/dist/dependencies.json +6 -0
- package/dist/dgkeywordRtdProvider.js +1 -1
- package/dist/dianomiBidAdapter.js +1 -1
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/enrichmentFpdModule.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/fpd.js +1 -0
- package/dist/glimpseBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/gridNMBidAdapter.js +1 -1
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/inmarBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/ixBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.js +1 -1
- package/dist/lassoBidAdapter.js +1 -1
- package/dist/lifestreetBidAdapter.js +1 -1
- package/dist/liveIntentIdSystem.js +1 -1
- package/dist/liveyieldAnalyticsAdapter.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.js +1 -1
- package/dist/malltvAnalyticsAdapter.js +1 -1
- package/dist/marsmediaBidAdapter.js +1 -1
- package/dist/mediafuseBidAdapter.js +1 -1
- package/dist/mediakeysBidAdapter.js +1 -1
- package/dist/mediasquareBidAdapter.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/nativoBidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +123 -121
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/parrableIdSystem.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebid-core.js +1 -1
- package/dist/prebidServerBidAdapter.js +1 -1
- package/dist/publinkIdSystem.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/rhythmoneBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rubiconAnalyticsAdapter.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/smaatoBidAdapter.js +1 -1
- package/dist/smartadserverBidAdapter.js +1 -1
- package/dist/smartxBidAdapter.js +1 -1
- package/dist/smilewantedBidAdapter.js +1 -1
- package/dist/sonobiBidAdapter.js +1 -1
- package/dist/sovrnAnalyticsAdapter.js +1 -1
- package/dist/sovrnBidAdapter.js +1 -1
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/synacormediaBidAdapter.js +1 -1
- package/dist/taboolaBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.js +1 -1
- package/dist/trionBidAdapter.js +1 -1
- package/dist/tripleliftBidAdapter.js +1 -1
- package/dist/ttdBidAdapter.js +1 -1
- package/dist/ucfunnelAnalyticsAdapter.js +1 -1
- package/dist/underdogmediaBidAdapter.js +1 -1
- package/dist/undertoneBidAdapter.js +1 -1
- package/dist/vidazooBidAdapter.js +1 -1
- 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/yahoosspBidAdapter.js +1 -1
- package/dist/yandexBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/libraries/fpd/sua.js +98 -0
- package/modules/adfBidAdapter.js +1 -1
- package/modules/adkernelAdnBidAdapter.js +1 -0
- package/modules/adqueryIdSystem.js +8 -8
- package/modules/adxcgBidAdapter.js +1 -1
- package/modules/amxBidAdapter.js +1 -1
- package/modules/{andBeyondMediaBidAdapter.js → beyondmediaBidAdapter.js} +0 -0
- package/modules/{andBeyondMediaBidAdapter.md → beyondmediaBidAdapter.md} +1 -1
- package/modules/cleanioRtdProvider.js +3 -4
- package/modules/colossussspBidAdapter.js +2 -1
- package/modules/conversantAnalyticsAdapter.js +560 -0
- package/modules/conversantAnalyticsAdapter.md +47 -0
- package/modules/criteoBidAdapter.js +1 -1
- package/modules/debugging/bidInterceptor.js +2 -2
- package/modules/debugging/debugging.js +10 -2
- package/modules/dgkeywordRtdProvider.js +21 -3
- package/modules/dianomiBidAdapter.js +1 -1
- package/modules/enrichmentFpdModule.js +33 -14
- package/modules/finativeBidAdapter.js +1 -1
- package/modules/gridBidAdapter.js +187 -117
- package/modules/improvedigitalBidAdapter.js +2 -2
- package/modules/ixBidAdapter.js +94 -23
- package/modules/liveIntentIdSystem.js +39 -5
- package/modules/mediakeysBidAdapter.js +6 -1
- package/modules/mediakeysBidAdapter.md +50 -40
- package/modules/nativoBidAdapter.js +1 -1
- package/modules/prebidServerBidAdapter/index.js +44 -13
- package/modules/readpeakBidAdapter.js +1 -1
- package/modules/rubiconBidAdapter.js +2 -3
- package/modules/seedingAllianceBidAdapter.js +1 -1
- package/modules/sharethroughBidAdapter.js +1 -1
- package/modules/taboolaBidAdapter.js +1 -1
- package/modules/talkadsBidAdapter.js +1 -0
- package/modules/truereachBidAdapter.js +1 -0
- package/modules/ttdBidAdapter.js +1 -1
- package/modules/vuukleBidAdapter.js +34 -3
- package/modules/yahoosspBidAdapter.js +3 -1
- package/modules/yandexBidAdapter.js +31 -8
- package/package.json +2 -2
- package/src/adapterManager.js +2 -4
- package/src/cpmBucketManager.js +22 -3
- package/src/native.js +1 -5
- package/src/prebid.js +3 -3
- package/test/spec/cpmBucketManager_spec.js +239 -177
- package/test/spec/fpd/sua_spec.js +244 -0
- package/test/spec/modules/adfBidAdapter_spec.js +2 -3
- package/test/spec/modules/adqueryIdSystem_spec.js +0 -2
- package/test/spec/modules/adxcgBidAdapter_spec.js +2 -3
- package/test/spec/modules/amxBidAdapter_spec.js +3 -2
- package/test/spec/modules/{andBeyondMediaBidAdapter_spec.js → beyondmediaBidAdapter_spec.js} +1 -1
- package/test/spec/modules/colossussspBidAdapter_spec.js +4 -2
- package/test/spec/modules/conversantAnalyticsAdapter_spec.js +963 -0
- package/test/spec/modules/debugging_mod_spec.js +9 -0
- package/test/spec/modules/dgkeywordRtdProvider_spec.js +83 -1
- package/test/spec/modules/dianomiBidAdapter_spec.js +2 -3
- package/test/spec/modules/enrichmentFpdModule_spec.js +50 -7
- package/test/spec/modules/fpdModule_spec.js +9 -0
- package/test/spec/modules/gridBidAdapter_spec.js +87 -31
- package/test/spec/modules/ixBidAdapter_spec.js +221 -2
- package/test/spec/modules/liveIntentIdMinimalSystem_spec.js +62 -8
- package/test/spec/modules/liveIntentIdSystem_spec.js +62 -8
- package/test/spec/modules/mediakeysBidAdapter_spec.js +20 -3
- package/test/spec/modules/nativoBidAdapter_spec.js +13 -2
- package/test/spec/modules/prebidServerBidAdapter_spec.js +159 -4
- package/test/spec/modules/seedtagBidAdapter_spec.js +15 -18
- package/test/spec/modules/sharethroughBidAdapter_spec.js +2 -1
- package/test/spec/modules/taboolaBidAdapter_spec.js +2 -2
- package/test/spec/modules/ttdBidAdapter_spec.js +3 -3
- package/test/spec/modules/vuukleBidAdapter_spec.js +87 -0
- package/test/spec/modules/yahoosspBidAdapter_spec.js +3 -1
- package/test/spec/modules/yandexBidAdapter_spec.js +8 -5
- package/test/spec/native_spec.js +5 -0
- package/test/spec/unit/pbjs_api_spec.js +44 -0
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
import { parseSizesInput } from '../src/utils.js';
|
|
1
|
+
import { parseSizesInput, deepAccess } from '../src/utils.js';
|
|
2
2
|
import { registerBidder } from '../src/adapters/bidderFactory.js';
|
|
3
|
+
import { BANNER } from '../src/mediaTypes.js';
|
|
4
|
+
import { config } from '../src/config.js';
|
|
3
5
|
|
|
4
6
|
const BIDDER_CODE = 'vuukle';
|
|
5
7
|
const URL = 'https://pb.vuukle.com/adapter';
|
|
6
8
|
const TIME_TO_LIVE = 360;
|
|
9
|
+
const VENDOR_ID = 1004;
|
|
7
10
|
|
|
8
11
|
export const spec = {
|
|
9
12
|
code: BIDDER_CODE,
|
|
13
|
+
gvlid: VENDOR_ID,
|
|
14
|
+
supportedMediaTypes: [ BANNER ],
|
|
10
15
|
|
|
11
16
|
isBidRequestValid: function(bid) {
|
|
12
17
|
return true
|
|
13
18
|
},
|
|
14
19
|
|
|
15
|
-
buildRequests: function(bidRequests) {
|
|
20
|
+
buildRequests: function(bidRequests, bidderRequest) {
|
|
21
|
+
bidderRequest = bidderRequest || {};
|
|
16
22
|
const requests = bidRequests.map(function (bid) {
|
|
17
23
|
const parseSized = parseSizesInput(bid.sizes);
|
|
18
24
|
const arrSize = parseSized[0].split('x');
|
|
@@ -25,10 +31,27 @@ export const spec = {
|
|
|
25
31
|
rnd: Math.random(),
|
|
26
32
|
bidId: bid.bidId,
|
|
27
33
|
source: 'pbjs',
|
|
34
|
+
schain: JSON.stringify(bid.schain),
|
|
35
|
+
requestId: bid.bidderRequestId,
|
|
36
|
+
tmax: bidderRequest.timeout,
|
|
37
|
+
gdpr: (bidderRequest.gdprConsent && bidderRequest.gdprConsent.gdprApplies) ? 1 : 0,
|
|
38
|
+
consentGiven: vuukleGetConsentGiven(bidderRequest.gdprConsent),
|
|
28
39
|
version: '$prebid.version$',
|
|
29
|
-
v:
|
|
40
|
+
v: 2,
|
|
30
41
|
};
|
|
31
42
|
|
|
43
|
+
if (bidderRequest.uspConsent) {
|
|
44
|
+
params.uspConsent = bidderRequest.uspConsent;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (config.getConfig('coppa') === true) {
|
|
48
|
+
params.coppa = 1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (bidderRequest.gdprConsent && bidderRequest.gdprConsent.consentString) {
|
|
52
|
+
params.consent = bidderRequest.gdprConsent.consentString;
|
|
53
|
+
}
|
|
54
|
+
|
|
32
55
|
return {
|
|
33
56
|
method: 'GET',
|
|
34
57
|
url: URL,
|
|
@@ -65,3 +88,11 @@ export const spec = {
|
|
|
65
88
|
},
|
|
66
89
|
}
|
|
67
90
|
registerBidder(spec);
|
|
91
|
+
|
|
92
|
+
function vuukleGetConsentGiven(gdprConsent) {
|
|
93
|
+
let consentGiven = 0;
|
|
94
|
+
if (typeof gdprConsent !== 'undefined') {
|
|
95
|
+
consentGiven = deepAccess(gdprConsent, `vendorData.vendor.consents.${VENDOR_ID}`) ? 1 : 0;
|
|
96
|
+
}
|
|
97
|
+
return consentGiven;
|
|
98
|
+
}
|
|
@@ -237,7 +237,9 @@ function generateOpenRtbObject(bidderRequest, bid) {
|
|
|
237
237
|
device: {
|
|
238
238
|
dnt: 0,
|
|
239
239
|
ua: navigator.userAgent,
|
|
240
|
-
ip: deepAccess(bid, 'params.bidOverride.device.ip') || deepAccess(bid, 'params.ext.ip') || undefined
|
|
240
|
+
ip: deepAccess(bid, 'params.bidOverride.device.ip') || deepAccess(bid, 'params.ext.ip') || undefined,
|
|
241
|
+
w: window.screen.width,
|
|
242
|
+
h: window.screen.height
|
|
241
243
|
},
|
|
242
244
|
regs: {
|
|
243
245
|
ext: {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {formatQS, deepAccess} from '../src/utils.js';
|
|
1
|
+
import { formatQS, deepAccess, triggerPixel } from '../src/utils.js';
|
|
2
2
|
import { registerBidder } from '../src/adapters/bidderFactory.js';
|
|
3
3
|
|
|
4
4
|
const BIDDER_CODE = 'yandex';
|
|
5
|
-
const BIDDER_URL = 'https://bs
|
|
5
|
+
const BIDDER_URL = 'https://bs.yandex.ru/metadsp';
|
|
6
6
|
const DEFAULT_TTL = 180;
|
|
7
|
+
const DEFAULT_CURRENCY = 'EUR';
|
|
7
8
|
const SSP_ID = 10500;
|
|
8
9
|
|
|
9
10
|
export const spec = {
|
|
@@ -19,9 +20,13 @@ export const spec = {
|
|
|
19
20
|
const consentString = deepAccess(bidderRequest, 'gdprConsent.consentString');
|
|
20
21
|
|
|
21
22
|
let referrer = '';
|
|
23
|
+
let domain = '';
|
|
24
|
+
let page = '';
|
|
25
|
+
|
|
22
26
|
if (bidderRequest && bidderRequest.refererInfo) {
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
referrer = bidderRequest.refererInfo.ref;
|
|
28
|
+
domain = bidderRequest.refererInfo.domain;
|
|
29
|
+
page = bidderRequest.refererInfo.page;
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
return validBidRequests.map((bidRequest) => {
|
|
@@ -30,17 +35,25 @@ export const spec = {
|
|
|
30
35
|
|
|
31
36
|
const queryParams = {
|
|
32
37
|
'imp-id': impId,
|
|
33
|
-
'target-ref': targetRef ||
|
|
38
|
+
'target-ref': targetRef || domain,
|
|
34
39
|
'ssp-id': SSP_ID,
|
|
35
40
|
};
|
|
36
41
|
if (gdprApplies !== undefined) {
|
|
37
42
|
queryParams['gdpr'] = 1;
|
|
38
43
|
queryParams['tcf-consent'] = consentString;
|
|
39
44
|
}
|
|
45
|
+
|
|
46
|
+
const floorInfo = bidRequest.getFloor ? bidRequest.getFloor({
|
|
47
|
+
currency: DEFAULT_CURRENCY
|
|
48
|
+
}) : {};
|
|
49
|
+
const bidfloor = floorInfo.floor;
|
|
50
|
+
const bidfloorcur = floorInfo.currency;
|
|
51
|
+
|
|
40
52
|
const imp = {
|
|
41
53
|
id: impId,
|
|
54
|
+
bidfloor,
|
|
55
|
+
bidfloorcur,
|
|
42
56
|
};
|
|
43
|
-
|
|
44
57
|
const bannerParams = deepAccess(bidRequest, 'mediaTypes.banner');
|
|
45
58
|
if (bannerParams) {
|
|
46
59
|
const [ w, h ] = bannerParams.sizes[0];
|
|
@@ -58,7 +71,8 @@ export const spec = {
|
|
|
58
71
|
id: bidRequest.bidId,
|
|
59
72
|
imp: [imp],
|
|
60
73
|
site: {
|
|
61
|
-
|
|
74
|
+
ref_url: referrer,
|
|
75
|
+
page_url: page,
|
|
62
76
|
},
|
|
63
77
|
},
|
|
64
78
|
options: {
|
|
@@ -84,7 +98,7 @@ export const spec = {
|
|
|
84
98
|
let prBid = {
|
|
85
99
|
requestId: bidRequest.bidId,
|
|
86
100
|
cpm: rtbBid.price,
|
|
87
|
-
currency: cur ||
|
|
101
|
+
currency: cur || DEFAULT_CURRENCY,
|
|
88
102
|
width: rtbBid.w,
|
|
89
103
|
height: rtbBid.h,
|
|
90
104
|
creativeId: rtbBid.adid,
|
|
@@ -102,6 +116,15 @@ export const spec = {
|
|
|
102
116
|
return prBid;
|
|
103
117
|
});
|
|
104
118
|
},
|
|
119
|
+
|
|
120
|
+
onBidWon: function (bid) {
|
|
121
|
+
const nurl = bid['nurl'];
|
|
122
|
+
|
|
123
|
+
if (!nurl) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
triggerPixel(nurl);
|
|
127
|
+
}
|
|
105
128
|
}
|
|
106
129
|
|
|
107
130
|
registerBidder(spec);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prebid.js",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.19.0",
|
|
4
4
|
"description": "Header Bidding Management Library",
|
|
5
5
|
"main": "src/prebid.js",
|
|
6
6
|
"scripts": {
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"express": "^4.15.4",
|
|
127
127
|
"fun-hooks": "^0.9.9",
|
|
128
128
|
"just-clone": "^1.0.2",
|
|
129
|
-
"live-connect-js": "2.
|
|
129
|
+
"live-connect-js": "2.4.0"
|
|
130
130
|
},
|
|
131
131
|
"optionalDependencies": {
|
|
132
132
|
"fsevents": "^2.3.2"
|
package/src/adapterManager.js
CHANGED
|
@@ -357,8 +357,6 @@ adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, request
|
|
|
357
357
|
|
|
358
358
|
let counter = 0;
|
|
359
359
|
|
|
360
|
-
// $.source.tid MUST be a unique UUID and also THE SAME between all PBS Requests for a given Auction
|
|
361
|
-
const sourceTid = generateUUID();
|
|
362
360
|
_s2sConfigs.forEach((s2sConfig) => {
|
|
363
361
|
if (s2sConfig && uniqueServerBidRequests[counter] && getS2SBidderSet(s2sConfig).has(uniqueServerBidRequests[counter].bidderCode)) {
|
|
364
362
|
// s2s should get the same client side timeout as other client side requests.
|
|
@@ -374,7 +372,7 @@ adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, request
|
|
|
374
372
|
let uniqueServerRequests = serverBidRequests.filter(serverBidRequest => serverBidRequest.uniquePbsTid === uniquePbsTid);
|
|
375
373
|
|
|
376
374
|
if (s2sAdapter) {
|
|
377
|
-
let s2sBidRequest = {
|
|
375
|
+
let s2sBidRequest = {'ad_units': adUnitsS2SCopy, s2sConfig, ortb2Fragments};
|
|
378
376
|
if (s2sBidRequest.ad_units.length) {
|
|
379
377
|
let doneCbs = uniqueServerRequests.map(bidRequest => {
|
|
380
378
|
bidRequest.start = timestamp();
|
|
@@ -387,7 +385,7 @@ adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, request
|
|
|
387
385
|
// fire BID_REQUESTED event for each s2s bidRequest
|
|
388
386
|
uniqueServerRequests.forEach(bidRequest => {
|
|
389
387
|
// add the new sourceTid
|
|
390
|
-
events.emit(CONSTANTS.EVENTS.BID_REQUESTED, {...bidRequest, tid:
|
|
388
|
+
events.emit(CONSTANTS.EVENTS.BID_REQUESTED, {...bidRequest, tid: bidRequest.auctionId});
|
|
391
389
|
});
|
|
392
390
|
|
|
393
391
|
// make bid requests
|
package/src/cpmBucketManager.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {find} from './polyfill.js';
|
|
2
|
-
import { isEmpty } from './utils.js';
|
|
2
|
+
import { isEmpty, logWarn } from './utils.js';
|
|
3
|
+
import { config } from './config.js';
|
|
3
4
|
|
|
4
5
|
const _defaultPrecision = 2;
|
|
5
6
|
const _lgPriceConfig = {
|
|
@@ -118,6 +119,11 @@ function getCpmTarget(cpm, bucket, granularityMultiplier) {
|
|
|
118
119
|
const precision = typeof bucket.precision !== 'undefined' ? bucket.precision : _defaultPrecision;
|
|
119
120
|
const increment = bucket.increment * granularityMultiplier;
|
|
120
121
|
const bucketMin = bucket.min * granularityMultiplier;
|
|
122
|
+
let roundingFunction = Math.floor;
|
|
123
|
+
let customRoundingFunction = config.getConfig('cpmRoundingFunction');
|
|
124
|
+
if (typeof customRoundingFunction === 'function') {
|
|
125
|
+
roundingFunction = customRoundingFunction;
|
|
126
|
+
}
|
|
121
127
|
|
|
122
128
|
// start increments at the bucket min and then add bucket min back to arrive at the correct rounding
|
|
123
129
|
// note - we're padding the values to avoid using decimals in the math prior to flooring
|
|
@@ -125,10 +131,23 @@ function getCpmTarget(cpm, bucket, granularityMultiplier) {
|
|
|
125
131
|
// (eg 4.01 / 0.01 = 400.99999999999994)
|
|
126
132
|
// min precison should be 2 to move decimal place over.
|
|
127
133
|
let pow = Math.pow(10, precision + 2);
|
|
128
|
-
let
|
|
129
|
-
let cpmTarget
|
|
134
|
+
let cpmToRound = ((cpm * pow) - (bucketMin * pow)) / (increment * pow);
|
|
135
|
+
let cpmTarget;
|
|
136
|
+
let invalidRounding;
|
|
137
|
+
// It is likely that we will be passed {cpmRoundingFunction: roundingFunction()}
|
|
138
|
+
// rather than the expected {cpmRoundingFunction: roundingFunction}. Default back to floor in that case
|
|
139
|
+
try {
|
|
140
|
+
cpmTarget = (roundingFunction(cpmToRound) * increment) + bucketMin;
|
|
141
|
+
} catch (err) {
|
|
142
|
+
invalidRounding = true;
|
|
143
|
+
}
|
|
144
|
+
if (invalidRounding || typeof cpmTarget !== 'number') {
|
|
145
|
+
logWarn('Invalid rounding function passed in config');
|
|
146
|
+
cpmTarget = (Math.floor(cpmToRound) * increment) + bucketMin;
|
|
147
|
+
}
|
|
130
148
|
// force to 10 decimal places to deal with imprecise decimal/binary conversions
|
|
131
149
|
// (for example 0.1 * 3 = 0.30000000000000004)
|
|
150
|
+
|
|
132
151
|
cpmTarget = Number(cpmTarget.toFixed(10));
|
|
133
152
|
return cpmTarget.toFixed(precision);
|
|
134
153
|
}
|
package/src/native.js
CHANGED
|
@@ -449,11 +449,7 @@ export function getAllAssetsMessage(data, adObject, {getNativeReq = getNativeReq
|
|
|
449
449
|
* appropriate for sending in adserver targeting or placeholder replacement.
|
|
450
450
|
*/
|
|
451
451
|
function getAssetValue(value) {
|
|
452
|
-
|
|
453
|
-
return value.url;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
return value;
|
|
452
|
+
return value?.url || value;
|
|
457
453
|
}
|
|
458
454
|
|
|
459
455
|
function getNativeKeys(adUnit) {
|
package/src/prebid.js
CHANGED
|
@@ -662,10 +662,10 @@ export const startAuction = hook('async', function ({ bidsBackHandler, timeout:
|
|
|
662
662
|
|
|
663
663
|
const bidders = allBidders.filter(bidder => !s2sBidders.has(bidder));
|
|
664
664
|
|
|
665
|
-
adUnit.
|
|
666
|
-
|
|
665
|
+
const tid = adUnit.ortb2Imp?.ext?.tid || generateUUID();
|
|
666
|
+
adUnit.transactionId = tid;
|
|
667
667
|
// Populate ortb2Imp.ext.tid with transactionId. Specifying a transaction ID per item in the ortb impression array, lets multiple transaction IDs be transmitted in a single bid request.
|
|
668
|
-
deepSetValue(adUnit, 'ortb2Imp.ext.tid',
|
|
668
|
+
deepSetValue(adUnit, 'ortb2Imp.ext.tid', tid);
|
|
669
669
|
|
|
670
670
|
bidders.forEach(bidder => {
|
|
671
671
|
const adapter = bidderRegistry[bidder];
|