Adding Iframe Loaded Events for Fullpage Interstitials
Once you have clicked on Create in the New Zone screen, you will be presented with the snippet for your new ad zone.
Desktop Fullpage Interstitial and Mobile Fullpage Interstitial zones will be presented with an extra script to be added if needed.
This script adds an event listener to the event called ‘message’ that is triggered when the iframe is loaded on user's browser.
This event listener allows you to programmatically execute any action you may need on your website, the event data contains the properties id
that is an md5 of the iframe url parameter and loaded
being true.
Example - Fullpage Interstitial
Action to execute = Display message Iframe loaded! when the Iframe gets loaded.
<script type="application/javascript" data-idzone="4362883" data-ad_frequency_count="20" data-ad_frequency_period="60" data-type="desktop" data-browser_settings="1" data-ad_trigger_method="3" src="https://a.examplesite.com/fp-interstitial.js"></script>
<a href="https://www.exads.com">Visit exads.com!</a>
<script type="application/javascript">
window.addEventListener('message', function(event) {
if (event.data.id && event.data.loaded) {
console.log("Iframe loaded!")
}
});
</script>