@@ -26,6 +26,7 @@ exports.kgpvMap = kgpvMap;
26
26
27
27
var refThis = this ;
28
28
var onEventAdded = false ;
29
+ var onAuctionEndEventAdded = false ;
29
30
var isPrebidPubMaticAnalyticsEnabled = CONFIG . isPrebidPubMaticAnalyticsEnabled ( ) ;
30
31
var isSingleImpressionSettingEnabled = CONFIG . isSingleImpressionSettingEnabled ( ) ;
31
32
var defaultAliases = CONSTANTS . DEFAULT_ALIASES ;
@@ -314,13 +315,36 @@ function pbBidRequestHandler(pbBid){
314
315
} ) ;
315
316
}
316
317
// endRemoveIf(removeLegacyAnalyticsRelatedCode)
317
-
318
+
318
319
// removeIf(removeLegacyAnalyticsRelatedCode)
319
320
/* start-test-block */
320
321
exports . pbBidRequestHandler = pbBidRequestHandler ;
321
322
/* end-test-block */
322
323
// endRemoveIf(removeLegacyAnalyticsRelatedCode)
323
324
325
+ // removeIf(removeLegacyAnalyticsRelatedCode)
326
+ function pbAuctionEndHandler ( args ) {
327
+ window . PWT . newAdUnits = window . PWT . newAdUnits || { } ;
328
+ args . adUnits . forEach ( function ( adUnit ) {
329
+ if ( ! ! adUnit . pubmaticAutoRefresh ) {
330
+ if ( ! window . PWT . newAdUnits [ window . PWT . bidMap [ adUnit . code ] . impressionID ] ) {
331
+ window . PWT . newAdUnits [ window . PWT . bidMap [ adUnit . code ] . impressionID ] = { } ;
332
+ }
333
+ if ( ! window . PWT . newAdUnits [ window . PWT . bidMap [ adUnit . code ] . impressionID ] [ adUnit . code ] ) {
334
+ window . PWT . newAdUnits [ window . PWT . bidMap [ adUnit . code ] . impressionID ] [ adUnit . code ] = { }
335
+ }
336
+ window . PWT . newAdUnits [ window . PWT . bidMap [ adUnit . code ] . impressionID ] [ adUnit . code ] . pubmaticAutoRefresh = adUnit . pubmaticAutoRefresh ;
337
+ }
338
+ } ) ;
339
+ }
340
+ // endRemoveIf(removeLegacyAnalyticsRelatedCode)
341
+
342
+ // removeIf(removeLegacyAnalyticsRelatedCode)
343
+ /* start-test-block */
344
+ exports . pbAuctionEndHandler = pbAuctionEndHandler ;
345
+ /* end-test-block */
346
+ // endRemoveIf(removeLegacyAnalyticsRelatedCode)
347
+
324
348
// removeIf(removeLegacyAnalyticsRelatedCode)
325
349
function getPBCodeWithWidthAndHeight ( divID , adapterID , width , height ) {
326
350
return divID + "@" + adapterID + "@" + width + "X" + height ;
@@ -803,7 +827,8 @@ function assignGdprConfigIfRequired(prebidConfig){
803
827
prebidConfig [ "consentManagement" ] [ 'gdpr' ] = {
804
828
cmpApi : CONFIG . getCmpApi ( ) ,
805
829
timeout : CONFIG . getGdprTimeout ( ) ,
806
- allowAuctionWithoutConsent : CONFIG . getAwc ( ) // Auction without consent
830
+ allowAuctionWithoutConsent : CONFIG . getAwc ( ) , // Auction without consent
831
+ defaultGdprScope : true
807
832
} ;
808
833
}
809
834
}
@@ -866,7 +891,8 @@ function enablePrebidPubMaticAnalyticIfRequired(){
866
891
options : {
867
892
publisherId : CONFIG . getPublisherId ( ) ,
868
893
profileId : CONFIG . getProfileID ( ) ,
869
- profileVersionId : CONFIG . getProfileDisplayVersionID ( )
894
+ profileVersionId : CONFIG . getProfileDisplayVersionID ( ) ,
895
+ identityOnly : ( CONFIG . isUserIdModuleEnabled ( ) ? 1 : 0 )
870
896
}
871
897
} ) ;
872
898
}
@@ -948,6 +974,21 @@ function addOnBidResponseHandler(){
948
974
exports . addOnBidResponseHandler = addOnBidResponseHandler ;
949
975
// endRemoveIf(removeLegacyAnalyticsRelatedCode)
950
976
977
+ // removeIf(removeLegacyAnalyticsRelatedCode)
978
+ function addOnAuctionEndHandler ( ) {
979
+ if ( util . isFunction ( window [ pbNameSpace ] . onEvent ) ) {
980
+ if ( ! onAuctionEndEventAdded ) {
981
+ window [ pbNameSpace ] . onEvent ( 'auctionEnd' , refThis . pbAuctionEndHandler ) ;
982
+ onAuctionEndEventAdded = true ;
983
+ }
984
+ } else {
985
+ util . logWarning ( "PreBid js onEvent method is not available" ) ;
986
+ return ;
987
+ }
988
+ }
989
+ exports . addOnAuctionEndHandler = addOnAuctionEndHandler ;
990
+ // endRemoveIf(removeLegacyAnalyticsRelatedCode)
991
+
951
992
// removeIf(removeLegacyAnalyticsRelatedCode)
952
993
function addOnBidRequestHandler ( ) {
953
994
if ( util . isFunction ( window [ pbNameSpace ] . onEvent ) ) {
@@ -996,6 +1037,7 @@ function setPrebidConfig(){
996
1037
refThis . assignCurrencyConfigIfRequired ( prebidConfig ) ;
997
1038
refThis . assignSchainConfigIfRequired ( prebidConfig ) ;
998
1039
refThis . assignSingleRequestConfigForBidders ( prebidConfig ) ;
1040
+ refThis . assignPackagingInventoryConfig ( prebidConfig ) ;
999
1041
// if usePBSAdapter is 1 then add s2sConfig
1000
1042
if ( CONFIG . usePBSAdapter ( ) ) {
1001
1043
refThis . gets2sConfig ( prebidConfig ) ;
@@ -1057,12 +1099,25 @@ function gets2sConfig(prebidConfig){
1057
1099
macros : CONFIG . createMacros ( )
1058
1100
}
1059
1101
}
1102
+ // adding support for marketplace
1103
+ if ( ! ! CONFIG . getMarketplaceBidders ( ) ) {
1104
+ prebidConfig [ "s2sConfig" ] [ "allowUnknownBidderCodes" ] = true ;
1105
+ prebidConfig [ "s2sConfig" ] [ "extPrebid" ] [ "alternatebiddercodes" ] = {
1106
+ enabled : true ,
1107
+ bidders : {
1108
+ pubmatic : {
1109
+ enabled : true ,
1110
+ allowedbiddercodes : CONFIG . getMarketplaceBidders ( )
1111
+ }
1112
+ }
1113
+ }
1114
+ }
1060
1115
}
1061
1116
1062
1117
exports . gets2sConfig = gets2sConfig ;
1063
1118
1064
1119
function getFloorsConfiguration ( prebidConfig ) {
1065
- if ( CONFIG . isFloorPriceModuleEnabled ( ) == true ) {
1120
+ if ( CONFIG . isFloorPriceModuleEnabled ( ) == true && CONFIG . getFloorSource ( ) !== CONSTANTS . COMMON . EXTERNAL_FLOOR_WO_CONFIG ) {
1066
1121
prebidConfig [ "floors" ] = {
1067
1122
enforcement : {
1068
1123
enforceJS : CONFIG . getFloorType ( )
@@ -1101,6 +1156,15 @@ function checkForYahooSSPBidder(prebidConfig){
1101
1156
1102
1157
exports . checkForYahooSSPBidder = checkForYahooSSPBidder ;
1103
1158
1159
+
1160
+ function assignPackagingInventoryConfig ( prebidConfig ) {
1161
+ prebidConfig [ "viewabilityScoreGeneration" ] = {
1162
+ enabled : true
1163
+ }
1164
+ }
1165
+
1166
+ exports . assignPackagingInventoryConfig = assignPackagingInventoryConfig ;
1167
+
1104
1168
function getPbjsAdServerTargetingConfig ( ) {
1105
1169
// Todo: Handle send-all bids feature enabled case
1106
1170
// we will need to add bidder specific keys?? do we?
@@ -1234,7 +1298,11 @@ function setPbjsBidderSettingsIfRequired(){
1234
1298
CONFIG . forEachAdapter ( function ( adapterID ) {
1235
1299
if ( window [ pbNameSpace ] . bidderSettings . hasOwnProperty ( adapterID ) === false ) {
1236
1300
window [ pbNameSpace ] . bidderSettings [ adapterID ] = { } ;
1237
-
1301
+ // adding marketplace params
1302
+ if ( adapterID === "pubmatic" && ! ! CONFIG . getMarketplaceBidders ( ) ) {
1303
+ window [ pbNameSpace ] . bidderSettings [ adapterID ] [ 'allowAlternateBidderCodes' ] = true ;
1304
+ window [ pbNameSpace ] . bidderSettings [ adapterID ] [ 'allowedAlternateBidderCodes' ] = CONFIG . getMarketplaceBidders ( ) ;
1305
+ }
1238
1306
// adding bidCpmAdjustment
1239
1307
window [ pbNameSpace ] . bidderSettings [ adapterID ] [ 'bidCpmAdjustment' ] = function ( bidCpm , bid ) {
1240
1308
return window . parseFloat ( ( bidCpm * CONFIG . getAdapterRevShare ( adapterID ) ) . toFixed ( CONSTANTS . COMMON . BID_PRECISION ) ) ;
@@ -1333,6 +1401,7 @@ function fetchBids(activeSlots){
1333
1401
// we do not want this call when we have PrebidAnalytics enabled
1334
1402
refThis . addOnBidResponseHandler ( ) ;
1335
1403
refThis . addOnBidRequestHandler ( ) ;
1404
+ refThis . addOnAuctionEndHandler ( ) ;
1336
1405
}
1337
1406
// endRemoveIf(removeLegacyAnalyticsRelatedCode)
1338
1407
0 commit comments