@@ -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
] ;
@@ -496,9 +499,9 @@ function subscribeToGamSlots() {
496
499
clearTimeout ( cache . timeouts [ auctionId ] ) ;
497
500
delete cache . timeouts [ auctionId ] ;
498
501
if ( rubiConf . analyticsEventDelay > 0 ) {
499
- setTimeout ( ( ) => sendMessage . call ( rubiconAdapter , auctionId ) , rubiConf . analyticsEventDelay )
502
+ setTimeout ( ( ) => sendMessage . call ( rubiconAdapter , auctionId , undefined , 'delayedGam' ) , rubiConf . analyticsEventDelay )
500
503
} else {
501
- sendMessage . call ( rubiconAdapter , auctionId )
504
+ sendMessage . call ( rubiconAdapter , auctionId , undefined , 'gam' )
502
505
}
503
506
}
504
507
} ) ;
@@ -748,7 +751,7 @@ let rubiconAdapter = Object.assign({}, baseAdapter, {
748
751
749
752
// check if this BID_WON missed the boat, if so send by itself
750
753
if ( auctionCache . sent === true ) {
751
- sendMessage . call ( this , args . auctionId , args . requestId ) ;
754
+ sendMessage . call ( this , args . auctionId , args . requestId , 'soloBidWon' ) ;
752
755
} else if ( ! rubiConf . waitForGamSlots && Object . keys ( auctionCache . bidsWon ) . reduce ( ( memo , adUnitCode ) => {
753
756
// only send if we've received bidWon events for all adUnits in auction
754
757
memo = memo && auctionCache . bidsWon [ adUnitCode ] ;
@@ -757,13 +760,15 @@ let rubiconAdapter = Object.assign({}, baseAdapter, {
757
760
clearTimeout ( cache . timeouts [ args . auctionId ] ) ;
758
761
delete cache . timeouts [ args . auctionId ] ;
759
762
760
- sendMessage . call ( this , args . auctionId ) ;
763
+ sendMessage . call ( this , args . auctionId , undefined , 'allBidWons' ) ;
761
764
}
762
765
break ;
763
766
case AUCTION_END :
767
+ // see how long it takes for the payload to come fire
768
+ cache . auctions [ args . auctionId ] . endTs = utils . getPerformanceNow ( ) ;
764
769
// start timer to send batched payload just in case we don't hear any BID_WON events
765
770
cache . timeouts [ args . auctionId ] = setTimeout ( ( ) => {
766
- sendMessage . call ( this , args . auctionId ) ;
771
+ sendMessage . call ( this , args . auctionId , undefined , 'auctionEnd' ) ;
767
772
} , rubiConf . analyticsBatchTimeout || SEND_TIMEOUT ) ;
768
773
break ;
769
774
case BID_TIMEOUT :
0 commit comments