@@ -115,7 +115,7 @@ function formatSource(src) {
115
115
return src . toLowerCase ( ) ;
116
116
}
117
117
118
- function sendMessage ( auctionId , bidWonId ) {
118
+ function sendMessage ( auctionId , bidWonId , trigger ) {
119
119
function formatBid ( bid ) {
120
120
return utils . pick ( bid , [
121
121
'bidder' ,
@@ -163,6 +163,7 @@ function sendMessage(auctionId, bidWonId) {
163
163
let auctionCache = cache . auctions [ auctionId ] ;
164
164
let referrer = config . getConfig ( 'pageUrl' ) || ( auctionCache && auctionCache . referrer ) ;
165
165
let message = {
166
+ trigger,
166
167
eventTimeMillis : Date . now ( ) ,
167
168
integration : rubiConf . int_type || DEFAULT_INTEGRATION ,
168
169
version : '$prebid.version$' ,
@@ -301,8 +302,10 @@ function sendMessage(auctionId, bidWonId) {
301
302
message . bidsWon = bidsWon ;
302
303
}
303
304
305
+ message . eventTiming = Math . round ( utils . getPerformanceNow ( ) - auctionCache . endTs ) ;
304
306
auctionCache . sent = true ;
305
307
} else if ( bidWonId && auctionCache && auctionCache . bids [ bidWonId ] ) {
308
+ message . eventTiming = Math . round ( utils . getPerformanceNow ( ) - auctionCache . endTs ) ;
306
309
message . bidsWon = [
307
310
formatBidWon ( auctionCache . bids [ bidWonId ] )
308
311
] ;
@@ -497,9 +500,9 @@ function subscribeToGamSlots() {
497
500
clearTimeout ( cache . timeouts [ auctionId ] ) ;
498
501
delete cache . timeouts [ auctionId ] ;
499
502
if ( rubiConf . analyticsEventDelay > 0 ) {
500
- setTimeout ( ( ) => sendMessage . call ( rubiconAdapter , auctionId ) , rubiConf . analyticsEventDelay )
503
+ setTimeout ( ( ) => sendMessage . call ( rubiconAdapter , auctionId , undefined , 'delayedGam' ) , rubiConf . analyticsEventDelay )
501
504
} else {
502
- sendMessage . call ( rubiconAdapter , auctionId )
505
+ sendMessage . call ( rubiconAdapter , auctionId , undefined , 'gam' )
503
506
}
504
507
}
505
508
} ) ;
@@ -749,7 +752,7 @@ let rubiconAdapter = Object.assign({}, baseAdapter, {
749
752
750
753
// check if this BID_WON missed the boat, if so send by itself
751
754
if ( auctionCache . sent === true ) {
752
- sendMessage . call ( this , args . auctionId , args . requestId ) ;
755
+ sendMessage . call ( this , args . auctionId , args . requestId , 'soloBidWon' ) ;
753
756
} else if ( ! rubiConf . waitForGamSlots && Object . keys ( auctionCache . bidsWon ) . reduce ( ( memo , adUnitCode ) => {
754
757
// only send if we've received bidWon events for all adUnits in auction
755
758
memo = memo && auctionCache . bidsWon [ adUnitCode ] ;
@@ -758,13 +761,15 @@ let rubiconAdapter = Object.assign({}, baseAdapter, {
758
761
clearTimeout ( cache . timeouts [ args . auctionId ] ) ;
759
762
delete cache . timeouts [ args . auctionId ] ;
760
763
761
- sendMessage . call ( this , args . auctionId ) ;
764
+ sendMessage . call ( this , args . auctionId , undefined , 'allBidWons' ) ;
762
765
}
763
766
break ;
764
767
case AUCTION_END :
768
+ // see how long it takes for the payload to come fire
769
+ cache . auctions [ args . auctionId ] . endTs = utils . getPerformanceNow ( ) ;
765
770
// start timer to send batched payload just in case we don't hear any BID_WON events
766
771
cache . timeouts [ args . auctionId ] = setTimeout ( ( ) => {
767
- sendMessage . call ( this , args . auctionId ) ;
772
+ sendMessage . call ( this , args . auctionId , undefined , 'auctionEnd' ) ;
768
773
} , rubiConf . analyticsBatchTimeout || SEND_TIMEOUT ) ;
769
774
break ;
770
775
case BID_TIMEOUT :
0 commit comments