Skip to end of metadata
Go to start of metadata

OnEvent

onEvent('eventType', 'targetId', function(){})

Defines a callback function to execute on the given event_type.

ParameterDescription

eventType

The event to listen for on the tag. Available options:

  • adRequested: An ad was requested from the Impression Bus.
  • adAvailable: A creative was returned from the Impression Bus but has not yet been shown.
  • adBadRequest: The tag called a placement that doesn't exist.
  • adLoaded: An ad placement has been fully defined and is ready to be shown; apn.showTag has been successfully executed.
  • adNoBid: No bid was received for the ad tag.
  • adRequestFailure: Failure to retrieve the creative. Could indicate a problem with the setup of the ad tag, or a problem contacting the endpoint.
  • adError: Error caused by the creative itself (any first or third party in the chain) that was delivered by AST. Note that the ad may still be shown.
  • adCollapse: Can be triggered by the creative, if the creative contains window.parent.apntag.collapseAd(document.body.id).

targetId

(Optional) The unique identifier of a specific ad slot. Omitting this parameter will execute callback function for all the tags defined on the page for defined eventType.

function

The function to execute when the event is triggered. Some events will allow you to include parameters in the function to receive additional information within the function. See Ad Object API for details.

Example
  • No labels