Adaptive Creative functionality allows developers to control and customize the ad experience with events.
Download
Javascript | Description | Example |
parent.postMessage("download","*")
|
Sends an event to Adaptive Creative to initiate a download/click based on user interaction. | Used in an HTML element:
Used in a Javascript code block:
|
parent.postMessage("complete","*")
|
Sends an event to Adaptive Creative which notifies that the creative experience has completed (based on the user having experienced a significant duration of the ad). | Used in a Javascript code block:
|
Events
Specific events are posted to the creative to allow the user experience to be updated based on the user environment. You can use the following event handlers to change the creative experience.
Type | Javascript | Description | Example |
Initialisation |
ad-event-init
|
Event is triggered once communication between the parent index.html and child ad.html has been established and completed. Use this event to ensure VungleHelper global variable is correctly defined (more information on Vungle Helper). |
|
Ad Experience
|
ad-event-pause
|
Event is triggered when either the application is closed by the user, or the privacy page is displayed. Use this event to pause animations, audio or video in the creative so they don't continue to play outside the ad experience. |
|
ad-event-resume
|
Event is triggered when either the application is resumed by the user, or the privacy page is closed. Use this event to resume animations, audio or video in the creative so they begin to play once the creative is once again visible to the user. |
|
Vungle Helper
A global variable called VungleHelper provides additional creative capabilities to enhance the ad experience.
VungleHelper may not be immediately accessible when ad.html is loading, as there is a short delay in communication between the parent index.html and child ad.html files. You should always use the ad-event-init event to guarantee VungleHelper accessibility. |
Javascript | Description | Example |
VungleHelper.closeDelay
|
Endcard close button delay. Returns a number (in seconds). |
|
VungleHelper.rewardedAd
|
Displays if the ad is rewarded or not. Returns true/false. |
|