Back to Publisher API Reference

pbjs.getEvents()

The getEvents method returns a copy of all emitted events since the page loaded.

Kind: static method of pbjs

Args: none

Returns: array of objects

Returned Object Params:

  • eventType (see table below)
  • args (varies for each event type)
  • id (only for bidWon, set to adUnit.code)
  • elapsedTime

The available events are:

Event Description Event argument
auctionInit The auction has started Object containing auction details
auctionEnd The auction has ended Object containing auction details. Since 11.48, timedOutRequests lists the bid requests whose bidders did not respond before the auction timed out (the same requests as bidTimeout), so analytics adapters can read them from this one event.
auctionTimeout The auction has timed out. In case of an auction timeout, you receive this event first, followed by bidTimeout and then auctionEnd Object containing auction details
beforeRequestBids Bids are about to be requested from adapters (added in 3.x) Array of adunits in the auction
beforeBidderHttp bidder network request is about be triggered Array of Bid request objects
bidRequested A bid was requested from a specific bidder Bid request object
bidResponse A bid response has been added to an auction Bid response object
pbsAnalytics Prebid Server has returned extra information for analytics adapters. { seatnonbid, auctionId, atag }
seatNonBid Removed in 11.0 - use pbsAnalytics instead. Prebid Server has returned nonbid information. Must be enabled in s2sConfig.extPrebid None
bidRejected A bid was rejected Bid response object
bidAdjustment A bid was adjusted Bid response object
bidWon A bid has won Bid response object
bidTimeout A bid timed out Array of objects with timed out bids
setTargeting Targeting has been set Hash of targeting values
requestBids Bids have been requested from adapters (i.e. pbjs.requestBids() was called) The argument passed to requestBids, except that adUnits and adUnitCodes are always set and reflect the ad units involved in the auction. Event handlers may not modify adUnitCodes.
addAdUnits Removed in 11.0 - use auctionInit instead. Ad units have been added to the auction. Removed in 11.0. None
adRenderFailed Ad rendering failed Object containing ‘reason’ and ‘message’. Since 11.48, this is also emitted for bids rendered by a renderer when the renderer script fails to load or its render function throws (reason exception).
adRenderSucceeded Ad rendering succeeded Object containing ‘doc’, ‘bid’, and ‘adId’. ‘doc’ is the DOM root containing the ad and may be null if it was rendered in a cross-origin iframe. This event indicates that the render function did not generate an error, it does not guarantee that tracking for this event has occurred yet. For bids rendered by a renderer, since 11.48 it is emitted once the renderer has loaded and rendered, rather than when rendering starts.
auctionDebug An error was logged to the console Object containing ‘type’ and ‘arguments’. Since 11.47, also ‘bidder’: the code of the bidder whose adapter was running when the message was logged, or null.
bidderDone A bidder has signaled they are done responding Bid request object
bidderError A bidder responded with an error Object with the XMLHttpRequest error and the bid request object { error, bidderRequest }
tcf2Enforcement There was a TCF2 enforcement action taken { storageBlocked: ['moduleA', 'moduleB'], biddersBlocked: ['moduleB'], analyticsBlocked: ['moduleC'] }
bidAccepted A bid was accepted and is about to be added to the auction. Fired once per accepted bid, after bid adjustment and before bidResponse; for video and audio bids, before VAST caching. Removed in 11.0 and restored in 11.7. Bid response object
browserIntervention The browser reported an intervention affecting a rendered creative (e.g., heavy-ad unload). { bid, adId, intervention }
bidClick Experimental. A click was observed on a creative rendered by Prebid.js. Requires bidClickTracking (added in 11.50). { bid, adId, adUnitCode, bidder, method, assetId }; method is creativeClick or nativeClick
bidClickInferred Experimental. A click was inferred on desktop from focus moving into a creative’s iframe. Requires the bidClickTracking module with desktopFallback (added in 11.50). { bid, adId, adUnitCode, bidder, method: 'iframeFocus' }

The example below shows how these events can be used.

pbjs.getEvents().forEach(event => {
  console.log("event: "+event.eventType)
});

See Also

Back to Publisher API Reference