AdResultEvent

interface AdResultEvent extends module:events.AdRequestedEvent { adInfo?: AdInfo; demand: AdDemand; elapsedMs: number; id: string; reason?: string; refresh: boolean; requestId: string; }

CustomEvent type for 'nitroAds.adResult' event. Fired exactly once per AdRequestedEvent, within the placement's resultTimeout (default 5000ms, 15000ms for in-stream video) of the request, not counting time spent deferred.

Example

CODE
document.addEventListener('nitroAds.adResult', (event) => {
    if (event.detail.id === 'my-ad' && event.detail.status === 'blocked') {
        showUnblockMessage();
    }
});

Hierarchy


Properties

adInfo: AdInfo

Details on the rendered ad, only when status is filled

demand: AdDemand

Inherited from demand

Demand path serving the request

elapsedMs: number

Milliseconds between adRequested and adResult

id: string

Inherited from id

Placement id

reason: string

Machine readable reason, e.g. scalibur-loader, adunit-fetch, engine-start, geo-deny, media-query

refresh: boolean

Inherited from refresh

True if this request is a refresh of the placement

requestId: string

Inherited from requestId

Ad request id