Skip to content

Events

The SDK notifies the app about every step of playback. Event names are the same on all platforms; only the delivery method differs: Android, iOS, browser.

Event order is described under Ad lifecycle.

Event list

EventWhen it arrivesData
AdTagStartLoadingVAST tag loading started
AdTagLoadedVAST tag loadedad_is_no_banner
AdLoadedCreative loaded and ready to playsee below
AdStartedAd playback started (once per pod)ad_number
AdCreativeStartedAn ad started playing (for each ad in the pod)ad_number
AdFirstQuartile25% of the ad watchedad_number
AdMidpoint50% of the ad watchedad_number
AdThirdQuartile75% of the ad watchedad_number
AdCompleteAd watched to the endad_number, ad_is_last, ad_is_pod
AdPausedPlayback paused
AdResumedPlayback resumed
AdSkippableStateChangedThe ad became skippablestatus
AdSkippedThe ad was skippedad_number
AdClickClick-through on the adurl, ad_number
AdClosedThe user closed the creative
AdDisableThe "disable ads" button was pressed
AdSetURLThe video file for playback was selectedad_media_file_url
AdErrorLoading or playback errorsee below
AdDestroyedAd playback finished, resources releasedad_is_last
AdPodCompletedThe whole ad pod finished showingad_pod_length, ad_pod_showed_count, ad_is_last
AdsEndedAll ad playback finished (browser only)

Fields

FieldTypeDescription
ad_numbernumberThe ad's position in the pod, starting at 1. -1 for a single-ad response.
ad_is_lastbooleanThe ad is the last one in the pod.
ad_is_podbooleanThe ad is a pod of multiple ads.
ad_is_no_bannerbooleanThe response contains no ad.
statusbooleanWhether the ad can be skipped. The SDK sends the event with true when the ad becomes skippable.
urlstringClick-through link to the advertiser's site.
ad_media_file_urlstringURL of the selected video file.
ad_pod_lengthnumberNumber of creatives in the pod.
ad_pod_showed_countnumberHow many creatives of the pod were shown.

AdLoaded

FieldTypeDescription
ad_creative_src_urlstringCreative URL.
ad_creative_banner_idstringBanner ID.
ad_creative_typestringCreative type.
ad_creative_duration_secnumberDuration in seconds.
ad_creative_duration_msecnumberDuration in milliseconds.
ad_media_file_src_urlstringVideo file URL.
ad_numbernumberThe ad's position in the pod.
ad_is_no_bannerbooleanThe response contains no ad.
ad_is_podbooleanThe ad is a pod of multiple ads.
ad_is_lastbooleanThe ad is the last one in the pod.
ad_pod_lengthnumberNumber of ads in the pod.
eridstringThe creative's ERID, or an empty string.

AdError

FieldTypeDescription
codestringError code, see Errors.
messagestringError description.
typestringadLoadError — loading error, adShowError — playback error.
ad_is_no_bannerbooleanThe response contains no ad.
ad_is_lastbooleanThe ad is the last one in the pod.
ad_numbernumberThe ad's position in the pod.

Android

The SDK calls methods on the window.Android JavaScript interface. Arguments are passed positionally. Declare methods with exactly the number of arguments shown in the table.

EventCall
AdTagStartLoadingAdTagStartLoading()
AdTagLoadedAdTagLoaded(), then AdCreativeVastLoaded(ad_is_no_banner)
AdLoadedAdCreativeLoaded(ad_creative_src_url, ad_creative_type, ad_creative_banner_id, ad_is_no_banner, ad_is_pod, ad_pod_length, ad_is_last, erid, ad_creative_duration_msec), then AdLoaded(ad_media_file_src_url)
AdStartedAdStarted(ad_number)
AdCreativeStartedAdCreativeStarted(ad_number)
AdFirstQuartileAdFirstQuartile(ad_number)
AdMidpointAdMidpoint(ad_number)
AdThirdQuartileAdThirdQuartile(ad_number)
AdCompleteAdComplete(ad_number)
AdPausedAdPaused()
AdResumedAdResumed()
AdSkippableStateChangedAdSkippableStateChanged(status)
AdSkippedAdSkipped(ad_number)
AdClickAdClick(url, ad_number)
AdClosedAdClosed()
AdDisableAdDisable()
AdSetURLAdSetURL(ad_media_file_url)
AdErrorAdError(code, message, type, ad_is_no_banner, ad_is_last, ad_number)
AdDestroyedAdDestroyed(ad_is_last)
AdPodCompletedAdPodCompleted(ad_is_last)

AdError arrives once, including when the error happens before the ad loads (for example, the page address has no url). The SDK calls the six-argument method. If the app declared only the legacy AdError(code, message, type, ad_is_no_banner) or AdError(code, message, type) signature, the SDK calls that one instead.

iOS

The SDK sends messages to the AdEventsHandler handler:

js
window.webkit.messageHandlers.AdEventsHandler.postMessage({ name: 'AdLoaded', ...data });

The name field holds the event name; the remaining fields are the event data from the list.

json
{
  "name": "AdComplete",
  "ad_number": 1,
  "ad_is_last": true,
  "ad_is_pod": false
}

Browser

Subscribe via loader.on(). The handler receives an object with data from the list.

js
loader.on('AdClick', ({ url, ad_number }) => {
  window.open(url, '_blank');
});