prebid.js 9.53.2 → 9.53.3
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/adagioRtdProvider.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/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/aniviewBidAdapter.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/beopBidAdapter.js +1 -1
- package/dist/bidglassBidAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.js +1 -1
- package/dist/bitmediaBidAdapter.js +1 -1
- package/dist/bridBidAdapter.js +1 -1
- package/dist/bridgeuppBidAdapter.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/consumableBidAdapter.js +1 -1
- package/dist/contxtfulBidAdapter.js +1 -1
- package/dist/conversantAnalyticsAdapter.js +1 -1
- package/dist/conversantBidAdapter.js +1 -1
- 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/debugging-standalone.js +1 -1
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/dxkultureBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/equativBidAdapter.js +1 -1
- package/dist/eskimiBidAdapter.js +1 -1
- package/dist/euidIdSystem.js +1 -1
- package/dist/exadsBidAdapter.js +1 -1
- package/dist/excoBidAdapter.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/greenbidsAnalyticsAdapter.js +1 -1
- package/dist/greenbidsBidAdapter.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/imdsBidAdapter.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/inmobiBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/intentIqAnalyticsAdapter.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/lassoBidAdapter.js +1 -1
- package/dist/lifestreetBidAdapter.js +1 -1
- package/dist/liveIntentId.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/madsenseBidAdapter.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/medianetBidAdapter.js +1 -1
- package/dist/medianetUtils.js +1 -1
- package/dist/mediasquareBidAdapter.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/missenaBidAdapter.js +1 -1
- package/dist/mobilefuseBidAdapter.js +1 -1
- package/dist/nextMillenniumBidAdapter.js +1 -1
- package/dist/nexx360Utils.js +1 -1
- package/dist/nobidAnalyticsAdapter.js +1 -1
- package/dist/nobidBidAdapter.js +1 -1
- package/dist/nodalsAiRtdProvider.js +1 -1
- package/dist/not-for-prod/prebid.js +172 -172
- package/dist/objectGuard.js +1 -1
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/openxBidAdapter.js +1 -1
- package/dist/optidigitalBidAdapter.js +1 -1
- package/dist/orbidderBidAdapter.js +1 -1
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/pubmaticAnalyticsAdapter.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubmaticIdSystem.js +1 -1
- package/dist/pubmaticRtdProvider.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pubxaiAnalyticsAdapter.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/riseUtils.js +1 -1
- package/dist/rtdModule.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/showheroes-bsBidAdapter.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/snigelBidAdapter.js +1 -1
- package/dist/sonobiBidAdapter.js +1 -1
- package/dist/sovrnBidAdapter.js +1 -1
- package/dist/sparteoBidAdapter.js +1 -1
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/stvBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/taboolaBidAdapter.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/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/vidazooUtils.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/yahooAdsBidAdapter.js +1 -1
- package/dist/yandexBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/libraries/objectGuard/objectGuard.js +149 -48
- package/libraries/objectGuard/ortbGuard.js +33 -43
- package/modules/adagioAnalyticsAdapter.js +6 -1
- package/modules/adagioBidAdapter.js +12 -5
- package/modules/adagioRtdProvider.js +41 -35
- package/modules/pubmaticAnalyticsAdapter.js +311 -587
- package/modules/pubmaticBidAdapter.js +71 -8
- package/modules/pubmaticIdSystem.js +4 -4
- package/modules/pubmaticRtdProvider.js +12 -60
- package/modules/rtdModule/index.js +1 -5
- package/modules/ttdBidAdapter.js +0 -5
- package/modules/userId/eids.js +1 -1
- package/modules/userId/index.js +32 -1
- package/package.json +1 -1
- package/src/auction.js +3 -0
- package/test/spec/activities/objectGuard_spec.js +156 -32
- package/test/spec/activities/ortbGuard_spec.js +10 -15
- package/test/spec/modules/adagioAnalyticsAdapter_spec.js +94 -24
- package/test/spec/modules/adagioRtdProvider_spec.js +17 -17
- package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +634 -916
- package/test/spec/modules/pubmaticBidAdapter_spec.js +260 -1
- package/test/spec/modules/pubmaticRtdProvider_spec.js +78 -400
- package/test/spec/modules/ttdBidAdapter_spec.js +0 -33
- package/test/spec/modules/userId_spec.js +115 -1
|
@@ -30,6 +30,7 @@ const RENDERER_URL = 'https://pubmatic.bbvms.com/r/'.concat('$RENDERER', '.js');
|
|
|
30
30
|
const MSG_VIDEO_PLCMT_MISSING = 'Video.plcmt param missing';
|
|
31
31
|
const PREBID_NATIVE_DATA_KEY_VALUES = Object.values(PREBID_NATIVE_DATA_KEYS_TO_ORTB);
|
|
32
32
|
const DEFAULT_TTL = 360;
|
|
33
|
+
const DEFAULT_GZIP_ENABLED = true;
|
|
33
34
|
const CUSTOM_PARAMS = {
|
|
34
35
|
'kadpageurl': '', // Custom page url
|
|
35
36
|
'gender': '', // User gender
|
|
@@ -72,6 +73,8 @@ const converter = ortbConverter({
|
|
|
72
73
|
if (!imp.hasOwnProperty('banner') && !imp.hasOwnProperty('video') && !imp.hasOwnProperty('native')) {
|
|
73
74
|
return null;
|
|
74
75
|
}
|
|
76
|
+
imp.ext = imp.ext || {};
|
|
77
|
+
imp.ext.pbcode = adUnitCode;
|
|
75
78
|
if (deals) addPMPDeals(imp, deals);
|
|
76
79
|
if (dctr) addDealCustomTargetings(imp, dctr);
|
|
77
80
|
if (rtd?.jwplayer) addJWPlayerSegmentData(imp, rtd.jwplayer);
|
|
@@ -94,7 +97,9 @@ const converter = ortbConverter({
|
|
|
94
97
|
return imp;
|
|
95
98
|
},
|
|
96
99
|
request(buildRequest, imps, bidderRequest, context) {
|
|
97
|
-
|
|
100
|
+
// Optimize the imps array before building the request
|
|
101
|
+
const optimizedImps = optimizeImps(imps, bidderRequest);
|
|
102
|
+
const request = buildRequest(optimizedImps, bidderRequest, context);
|
|
98
103
|
if (blockedIabCategories.length || request.bcat) {
|
|
99
104
|
const validatedBCategories = validateBlockedCategories([...(blockedIabCategories || []), ...(request.bcat || [])]);
|
|
100
105
|
if (validatedBCategories.length) request.bcat = validatedBCategories;
|
|
@@ -105,7 +110,7 @@ const converter = ortbConverter({
|
|
|
105
110
|
}
|
|
106
111
|
reqLevelParams(request);
|
|
107
112
|
updateUserSiteDevice(request, context?.bidRequests);
|
|
108
|
-
addExtenstionParams(request)
|
|
113
|
+
addExtenstionParams(request, bidderRequest)
|
|
109
114
|
const marketPlaceEnabled = bidderRequest?.bidderCode
|
|
110
115
|
? bidderSettings.get(bidderRequest.bidderCode, 'allowAlternateBidderCodes') : undefined;
|
|
111
116
|
if (marketPlaceEnabled) updateRequestExt(request, bidderRequest);
|
|
@@ -505,8 +510,8 @@ const updateResponseWithCustomFields = (res, bid, ctx) => {
|
|
|
505
510
|
}
|
|
506
511
|
}
|
|
507
512
|
|
|
508
|
-
const addExtenstionParams = (req) => {
|
|
509
|
-
const { profId, verId, wiid
|
|
513
|
+
const addExtenstionParams = (req, bidderRequest) => {
|
|
514
|
+
const { profId, verId, wiid } = conf;
|
|
510
515
|
req.ext = {
|
|
511
516
|
epoch: new Date().getTime(), // Sending epoch timestamp in request.ext object
|
|
512
517
|
wrapper: {
|
|
@@ -514,8 +519,8 @@ const addExtenstionParams = (req) => {
|
|
|
514
519
|
version: verId ? parseInt(verId) : undefined,
|
|
515
520
|
wiid: wiid,
|
|
516
521
|
wv: '$$REPO_AND_VERSION$$',
|
|
517
|
-
|
|
518
|
-
|
|
522
|
+
wp: 'pbjs',
|
|
523
|
+
biddercode: bidderRequest?.bidderCode
|
|
519
524
|
},
|
|
520
525
|
cpmAdjustment: cpmAdjustment
|
|
521
526
|
}
|
|
@@ -569,6 +574,46 @@ const getConnectionType = () => {
|
|
|
569
574
|
return types[connection?.effectiveType] || 0;
|
|
570
575
|
}
|
|
571
576
|
|
|
577
|
+
/**
|
|
578
|
+
* Optimizes the impressions array by consolidating impressions for the same ad unit and media type
|
|
579
|
+
* @param {Array} imps - Array of impression objects
|
|
580
|
+
* @param {Object} bidderRequest - The bidder request object
|
|
581
|
+
* @returns {Array} - Optimized impressions array
|
|
582
|
+
*/
|
|
583
|
+
function optimizeImps(imps, bidderRequest) {
|
|
584
|
+
const optimizedImps = {};
|
|
585
|
+
|
|
586
|
+
bidderRequest.bids.forEach(bid => {
|
|
587
|
+
const correspondingImp = imps.find(imp => imp.id === bid.bidId);
|
|
588
|
+
if (!correspondingImp) return;
|
|
589
|
+
const uniqueKey = bid.adUnitId;
|
|
590
|
+
if (!optimizedImps[uniqueKey]) {
|
|
591
|
+
optimizedImps[uniqueKey] = deepClone(correspondingImp);
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
const baseImp = optimizedImps[uniqueKey];
|
|
595
|
+
|
|
596
|
+
if (isStr(correspondingImp.tagid)) {
|
|
597
|
+
baseImp.tagid = correspondingImp.tagid;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
const copyPropertytoPath = (propPath, propName, toMerge) => {
|
|
601
|
+
if (!correspondingImp[propPath] || !correspondingImp[propPath][propName]) return;
|
|
602
|
+
if (!baseImp[propPath]) baseImp[propPath] = {};
|
|
603
|
+
if (toMerge) {
|
|
604
|
+
if (!baseImp[propPath][propName]) baseImp[propPath][propName] = [];
|
|
605
|
+
baseImp[propPath][propName] = [...baseImp[propPath][propName], ...correspondingImp[propPath][propName]];
|
|
606
|
+
} else {
|
|
607
|
+
baseImp[propPath][propName] = correspondingImp[propPath][propName];
|
|
608
|
+
}
|
|
609
|
+
};
|
|
610
|
+
copyPropertytoPath('ext', 'key_val', false);
|
|
611
|
+
copyPropertytoPath('ext', 'pmZoneId', false);
|
|
612
|
+
copyPropertytoPath('pmp', 'deals', true);
|
|
613
|
+
});
|
|
614
|
+
return Object.values(optimizedImps);
|
|
615
|
+
}
|
|
616
|
+
|
|
572
617
|
// BB stands for Blue BillyWig
|
|
573
618
|
const BB_RENDERER = {
|
|
574
619
|
bootstrapPlayer: function(bid) {
|
|
@@ -641,6 +686,25 @@ const getPublisherId = (bids) =>
|
|
|
641
686
|
? bids.find(bid => bid.params?.publisherId?.trim())?.params.publisherId || null
|
|
642
687
|
: null;
|
|
643
688
|
|
|
689
|
+
function getGzipSetting() {
|
|
690
|
+
// Check bidder-specific configuration
|
|
691
|
+
try {
|
|
692
|
+
const gzipSetting = deepAccess(config.getBidderConfig(), 'pubmatic.gzipEnabled');
|
|
693
|
+
if (gzipSetting !== undefined) {
|
|
694
|
+
const gzipValue = String(gzipSetting).toLowerCase().trim();
|
|
695
|
+
if (gzipValue === 'true' || gzipValue === 'false') {
|
|
696
|
+
const parsedValue = gzipValue === 'true';
|
|
697
|
+
logInfo('PubMatic: Using bidder-specific gzipEnabled setting:', parsedValue);
|
|
698
|
+
return parsedValue;
|
|
699
|
+
}
|
|
700
|
+
logWarn('PubMatic: Invalid gzipEnabled value in bidder config:', gzipSetting);
|
|
701
|
+
}
|
|
702
|
+
} catch (e) { logWarn('PubMatic: Error accessing bidder config:', e); }
|
|
703
|
+
|
|
704
|
+
logInfo('PubMatic: Using default gzipEnabled setting:', DEFAULT_GZIP_ENABLED);
|
|
705
|
+
return DEFAULT_GZIP_ENABLED;
|
|
706
|
+
}
|
|
707
|
+
|
|
644
708
|
const _handleCustomParams = (params, conf) => {
|
|
645
709
|
Object.keys(CUSTOM_PARAMS).forEach(key => {
|
|
646
710
|
const value = params[key];
|
|
@@ -768,7 +832,6 @@ export const spec = {
|
|
|
768
832
|
originalBid.params.wiid = originalBid.params.wiid || bidderRequest.auctionId || wiid;
|
|
769
833
|
bid = deepClone(originalBid);
|
|
770
834
|
_handleCustomParams(bid.params, conf);
|
|
771
|
-
conf.transactionId = bid.ortb2Imp?.ext?.tid;
|
|
772
835
|
const { bcat, acat } = bid.params;
|
|
773
836
|
if (bcat) {
|
|
774
837
|
blockedIabCategories = blockedIabCategories.concat(bcat);
|
|
@@ -785,7 +848,7 @@ export const spec = {
|
|
|
785
848
|
data: data,
|
|
786
849
|
bidderRequest: bidderRequest,
|
|
787
850
|
options: {
|
|
788
|
-
endpointCompression:
|
|
851
|
+
endpointCompression: getGzipSetting()
|
|
789
852
|
},
|
|
790
853
|
};
|
|
791
854
|
return data?.imp?.length ? serverRequest : null;
|
|
@@ -23,7 +23,7 @@ function generateQueryStringParams(config) {
|
|
|
23
23
|
const gdprConsent = gdprDataHandler.getConsentData();
|
|
24
24
|
|
|
25
25
|
const params = {
|
|
26
|
-
publisherId:
|
|
26
|
+
publisherId: String(config.params.publisherId).trim(),
|
|
27
27
|
gdpr: (gdprConsent && gdprConsent?.gdprApplies) ? 1 : 0,
|
|
28
28
|
gdpr_consent: gdprConsent && gdprConsent?.consentString ? encodeURIComponent(gdprConsent.consentString) : '',
|
|
29
29
|
src: 'pbjs_uid',
|
|
@@ -95,13 +95,13 @@ function hasRequiredConfig(config) {
|
|
|
95
95
|
return false;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
//
|
|
98
|
+
// ensure publisherId is a string
|
|
99
99
|
if (config.params.publisherId) {
|
|
100
|
-
config.params.publisherId =
|
|
100
|
+
config.params.publisherId = String(config.params.publisherId).trim();
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
if (!config.params.publisherId) {
|
|
104
|
-
logError(LOG_PREFIX + 'config.params.publisherId (
|
|
104
|
+
logError(LOG_PREFIX + 'config.params.publisherId (String) should be provided.');
|
|
105
105
|
return false;
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { submodule } from '../src/hook.js';
|
|
2
|
-
import { logError, logInfo,
|
|
2
|
+
import { logError, logInfo, isPlainObject, isEmpty, isFn, mergeDeep } from '../src/utils.js';
|
|
3
3
|
import { config as conf } from '../src/config.js';
|
|
4
4
|
import { getDeviceType as fetchDeviceType, getOS } from '../libraries/userAgentUtils/index.js';
|
|
5
5
|
import { getLowEntropySUA } from '../src/fpd/sua.js';
|
|
6
6
|
import { getGlobal } from '../src/prebidGlobal.js';
|
|
7
|
+
import { REJECTION_REASON } from '../src/constants.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @typedef {import('../modules/rtdModule/index.js').RtdSubmodule} RtdSubmodule
|
|
@@ -155,8 +156,7 @@ function findRejectedBidsForAdUnit(auction, code) {
|
|
|
155
156
|
// Find a rejected bid due to price floor
|
|
156
157
|
function findRejectedFloorBid(rejectedBids) {
|
|
157
158
|
return rejectedBids.find(bid => {
|
|
158
|
-
|
|
159
|
-
return errorMessage.includes('price floor') ||
|
|
159
|
+
return bid.rejectionReason === REJECTION_REASON.FLOOR_NOT_MET &&
|
|
160
160
|
(bid.floorData?.floorValue && bid.cpm < bid.floorData.floorValue);
|
|
161
161
|
});
|
|
162
162
|
}
|
|
@@ -182,30 +182,6 @@ function findWinningBid(adUnitCode) {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
// Find a bid with the minimum floor value
|
|
186
|
-
function findBidWithFloor(bids) {
|
|
187
|
-
let bidWithMinFloor = null;
|
|
188
|
-
let minFloorValue = Infinity;
|
|
189
|
-
|
|
190
|
-
if (!bids || !bids.length) return null;
|
|
191
|
-
|
|
192
|
-
for (const bid of bids) {
|
|
193
|
-
if (bid.floorData?.floorValue &&
|
|
194
|
-
!isNaN(parseFloat(bid.floorData.floorValue)) &&
|
|
195
|
-
parseFloat(bid.floorData.floorValue) < minFloorValue) {
|
|
196
|
-
minFloorValue = parseFloat(bid.floorData.floorValue);
|
|
197
|
-
bidWithMinFloor = bid;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// Log the result for debugging
|
|
202
|
-
if (bidWithMinFloor) {
|
|
203
|
-
logInfo(CONSTANTS.LOG_PRE_FIX, `Found bid with minimum floor value: ${minFloorValue}`);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
return bidWithMinFloor;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
185
|
// Find floor value from bidder requests
|
|
210
186
|
function findFloorValueFromBidderRequests(auction, code) {
|
|
211
187
|
if (!auction?.bidderRequests?.length) return 0;
|
|
@@ -368,18 +344,6 @@ function handleRejectedFloorBidScenario(rejectedFloorBid, code) {
|
|
|
368
344
|
};
|
|
369
345
|
}
|
|
370
346
|
|
|
371
|
-
// Identify floored bid scenario and return scenario data
|
|
372
|
-
function handleFlooredBidScenario(bidWithFloor, code) {
|
|
373
|
-
const baseValue = bidWithFloor.floorData.floorValue;
|
|
374
|
-
return {
|
|
375
|
-
scenario: 'floored',
|
|
376
|
-
bidStatus: CONSTANTS.BID_STATUS.FLOORED,
|
|
377
|
-
baseValue,
|
|
378
|
-
multiplierKey: 'FLOORED',
|
|
379
|
-
logMessage: `Floored bid for ad unit: ${code}, Floor value: ${baseValue}`
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
|
|
383
347
|
// Identify no bid scenario and return scenario data
|
|
384
348
|
function handleNoBidScenario(auction, code) {
|
|
385
349
|
const baseValue = findFloorValueFromBidderRequests(auction, code);
|
|
@@ -394,20 +358,9 @@ function handleNoBidScenario(auction, code) {
|
|
|
394
358
|
|
|
395
359
|
// Determine which scenario applies based on bid conditions
|
|
396
360
|
function determineScenario(winningBid, rejectedFloorBid, bidsForAdUnit, auction, code) {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
if (rejectedFloorBid) {
|
|
402
|
-
return handleRejectedFloorBidScenario(rejectedFloorBid, code);
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
const bidWithFloor = findBidWithFloor(bidsForAdUnit);
|
|
406
|
-
if (bidWithFloor?.floorData?.floorValue) {
|
|
407
|
-
return handleFlooredBidScenario(bidWithFloor, code);
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
return handleNoBidScenario(auction, code);
|
|
361
|
+
return winningBid ? handleWinningBidScenario(winningBid, code)
|
|
362
|
+
: rejectedFloorBid ? handleRejectedFloorBidScenario(rejectedFloorBid, code)
|
|
363
|
+
: handleNoBidScenario(auction, code);
|
|
411
364
|
}
|
|
412
365
|
|
|
413
366
|
// Main function that determines bid status and calculates values
|
|
@@ -539,19 +492,18 @@ export const fetchData = async (publisherId, profileId, type) => {
|
|
|
539
492
|
*/
|
|
540
493
|
const init = (config, _userConsent) => {
|
|
541
494
|
initTime = Date.now(); // Capture the initialization time
|
|
542
|
-
|
|
495
|
+
let { publisherId, profileId } = config?.params || {};
|
|
543
496
|
|
|
544
|
-
if (!publisherId || !
|
|
497
|
+
if (!publisherId || !profileId) {
|
|
545
498
|
logError(
|
|
546
|
-
`${CONSTANTS.LOG_PRE_FIX} ${!publisherId ? 'Missing publisher Id.'
|
|
547
|
-
: !isStr(publisherId) ? 'Publisher Id should be a string.'
|
|
548
|
-
: !profileId ? 'Missing profile Id.'
|
|
549
|
-
: 'Profile Id should be a string.'
|
|
550
|
-
}`
|
|
499
|
+
`${CONSTANTS.LOG_PRE_FIX} ${!publisherId ? 'Missing publisher Id.' : 'Missing profile Id.'}`
|
|
551
500
|
);
|
|
552
501
|
return false;
|
|
553
502
|
}
|
|
554
503
|
|
|
504
|
+
publisherId = String(publisherId).trim();
|
|
505
|
+
profileId = String(profileId).trim();
|
|
506
|
+
|
|
555
507
|
if (!isFn(continueAuction)) {
|
|
556
508
|
logError(`${CONSTANTS.LOG_PRE_FIX} continueAuction is not a function. Please ensure to add priceFloors module.`);
|
|
557
509
|
return false;
|
|
@@ -306,7 +306,6 @@ export const setBidRequestsData = timedAuctionHook('rtd', function setBidRequest
|
|
|
306
306
|
let callbacksExpected = prioritySubModules.length;
|
|
307
307
|
let isDone = false;
|
|
308
308
|
let waitTimeout;
|
|
309
|
-
const verifiers = [];
|
|
310
309
|
|
|
311
310
|
if (!relevantSubModules.length) {
|
|
312
311
|
return exitHook();
|
|
@@ -317,9 +316,7 @@ export const setBidRequestsData = timedAuctionHook('rtd', function setBidRequest
|
|
|
317
316
|
|
|
318
317
|
relevantSubModules.forEach(sm => {
|
|
319
318
|
const fpdGuard = guardOrtb2Fragments(reqBidsConfigObj.ortb2Fragments || {}, activityParams(MODULE_TYPE_RTD, sm.name));
|
|
320
|
-
|
|
321
|
-
reqBidsConfigObj.ortb2Fragments = fpdGuard.obj;
|
|
322
|
-
sm.getBidRequestData(reqBidsConfigObj, onGetBidRequestDataCallback.bind(sm), sm.config, _userConsent, timeout);
|
|
319
|
+
sm.getBidRequestData({...reqBidsConfigObj, ortb2Fragments: fpdGuard}, onGetBidRequestDataCallback.bind(sm), sm.config, _userConsent, timeout);
|
|
323
320
|
});
|
|
324
321
|
|
|
325
322
|
function onGetBidRequestDataCallback() {
|
|
@@ -340,7 +337,6 @@ export const setBidRequestsData = timedAuctionHook('rtd', function setBidRequest
|
|
|
340
337
|
}
|
|
341
338
|
isDone = true;
|
|
342
339
|
clearTimeout(waitTimeout);
|
|
343
|
-
verifiers.forEach(fn => fn());
|
|
344
340
|
fn.call(this, reqBidsConfigObj);
|
|
345
341
|
}
|
|
346
342
|
});
|
package/modules/ttdBidAdapter.js
CHANGED
|
@@ -110,11 +110,6 @@ function getUser(bidderRequest, firstPartyData) {
|
|
|
110
110
|
var eids = utils.deepAccess(bidderRequest, 'bids.0.userIdAsEids')
|
|
111
111
|
if (eids && eids.length) {
|
|
112
112
|
utils.deepSetValue(user, 'ext.eids', eids);
|
|
113
|
-
|
|
114
|
-
const tdid = eids.find(eid => eid.source == 'adserver.org')?.uids?.[0]?.id;
|
|
115
|
-
if (tdid) {
|
|
116
|
-
user.buyeruid = tdid
|
|
117
|
-
}
|
|
118
113
|
}
|
|
119
114
|
|
|
120
115
|
utils.mergeDeep(user, firstPartyData.user)
|
package/modules/userId/eids.js
CHANGED
|
@@ -72,7 +72,7 @@ export function createEidsArray(bidRequestUserId, eidConfigs = EID_CONFIG) {
|
|
|
72
72
|
eids = deepClone(values);
|
|
73
73
|
} else if (typeof eidConf === 'function') {
|
|
74
74
|
try {
|
|
75
|
-
eids = eidConf(values);
|
|
75
|
+
eids = deepClone(eidConf(values));
|
|
76
76
|
if (!Array.isArray(eids)) {
|
|
77
77
|
eids = [eids];
|
|
78
78
|
}
|
package/modules/userId/index.js
CHANGED
|
@@ -141,7 +141,7 @@ import {
|
|
|
141
141
|
isPlainObject,
|
|
142
142
|
logError,
|
|
143
143
|
logInfo,
|
|
144
|
-
logWarn
|
|
144
|
+
logWarn, mergeDeep
|
|
145
145
|
} from '../../src/utils.js';
|
|
146
146
|
import {getPPID as coreGetPPID} from '../../src/adserver.js';
|
|
147
147
|
import {defer, PbPromise, delay} from '../../src/utils/promise.js';
|
|
@@ -154,6 +154,7 @@ import {ACTIVITY_ENRICH_EIDS} from '../../src/activities/activities.js';
|
|
|
154
154
|
import {activityParams} from '../../src/activities/activityParams.js';
|
|
155
155
|
import {USERSYNC_DEFAULT_CONFIG} from '../../src/userSync.js';
|
|
156
156
|
import {startAuction} from '../../src/prebid.js';
|
|
157
|
+
import {beforeInitAuction} from '../../src/auction.js';
|
|
157
158
|
|
|
158
159
|
const MODULE_NAME = 'User ID';
|
|
159
160
|
const COOKIE = STORAGE_TYPE_COOKIES;
|
|
@@ -737,6 +738,35 @@ function aliasEidsHook(next, bidderRequests) {
|
|
|
737
738
|
next(bidderRequests);
|
|
738
739
|
}
|
|
739
740
|
|
|
741
|
+
export function adUnitEidsHook(next, auction) {
|
|
742
|
+
// for backwards-compat, add `userIdAsEids` to ad units' bid objects
|
|
743
|
+
// before auction events are fired
|
|
744
|
+
// these are computed similarly to bid requests' `ortb2`, but unlike them,
|
|
745
|
+
// they are not subject to the same activity checks (since they are not intended for bid adapters)
|
|
746
|
+
|
|
747
|
+
const eidsByBidder = {};
|
|
748
|
+
const globalEids = auction.getFPD()?.global?.user?.ext?.eids ?? [];
|
|
749
|
+
function getEids(bidderCode) {
|
|
750
|
+
if (bidderCode == null) return globalEids;
|
|
751
|
+
if (!eidsByBidder.hasOwnProperty(bidderCode)) {
|
|
752
|
+
eidsByBidder[bidderCode] = mergeDeep(
|
|
753
|
+
{eids: []},
|
|
754
|
+
{eids: globalEids},
|
|
755
|
+
{eids: auction.getFPD()?.bidder?.[bidderCode]?.user?.ext?.eids ?? []}
|
|
756
|
+
).eids;
|
|
757
|
+
}
|
|
758
|
+
return eidsByBidder[bidderCode];
|
|
759
|
+
}
|
|
760
|
+
auction.getAdUnits()
|
|
761
|
+
.flatMap(au => au.bids)
|
|
762
|
+
.forEach(bid => {
|
|
763
|
+
const eids = getEids(bid.bidder);
|
|
764
|
+
if (eids.length > 0) {
|
|
765
|
+
bid.userIdAsEids = eids;
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
next(auction);
|
|
769
|
+
}
|
|
740
770
|
/**
|
|
741
771
|
* Is startAuctionHook added
|
|
742
772
|
* @returns {boolean}
|
|
@@ -1262,6 +1292,7 @@ export function init(config, {mkDelay = delay} = {}) {
|
|
|
1262
1292
|
}
|
|
1263
1293
|
});
|
|
1264
1294
|
adapterManager.makeBidRequests.after(aliasEidsHook);
|
|
1295
|
+
beforeInitAuction.before(adUnitEidsHook);
|
|
1265
1296
|
|
|
1266
1297
|
// exposing getUserIds function in global-name-space so that userIds stored in Prebid can be used by external codes.
|
|
1267
1298
|
(getGlobal()).getUserIds = getUserIds;
|
package/package.json
CHANGED
package/src/auction.js
CHANGED
|
@@ -124,6 +124,8 @@ export function resetAuctionState() {
|
|
|
124
124
|
[outstandingRequests, sourceInfo].forEach((ob) => Object.keys(ob).forEach((k) => { delete ob[k] }));
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
export const beforeInitAuction = hook('sync', (auction) => {})
|
|
128
|
+
|
|
127
129
|
/**
|
|
128
130
|
* Creates new auction instance
|
|
129
131
|
*
|
|
@@ -293,6 +295,7 @@ export function newAuction({adUnits, adUnitCodes, callback, cbTimeout, labels, a
|
|
|
293
295
|
let call = {
|
|
294
296
|
bidRequests,
|
|
295
297
|
run: () => {
|
|
298
|
+
beforeInitAuction(this);
|
|
296
299
|
startAuctionTimer();
|
|
297
300
|
|
|
298
301
|
_auctionStatus = AUCTION_IN_PROGRESS;
|