Example
interstitial = Cocoon.Ad.createInterstitial();
interstitial.on("load", function(){
console.log("Interstitial loaded");
});
interstitial.on("fail", function(){
console.log("Interstitial failed");
});
interstitial.on("show", function(){
console.log("Interstitial shown");
});
interstitial.on("dismiss", function(){
console.log("Interstitial dismissed");
});
interstitial.on("click", function(){
console.log("Interstitial clicked");
});
interstitial.load();
Methods
-
<static> isReady()
-
Checks if the interstitial is loaded and ready
Example
var ready = interstitial.isReady();
-
<static> load()
-
Loads an interstitial ad.
Example
interstitial = Cocoon.Ad.createInterstitial(settings); interstitial.load();
-
<static> show()
-
Shows the interstitial ad.
Example
interstitial = Cocoon.Ad.createInterstitial(settings); interstitial.show();
Events
-
On click
-
Triggered when an interstitial is clicked.
Example
interstitial.on("click", function(){ console.log("Interstitial clicked"); }); -
On dismiss
-
Triggered when an interstitial is closed.
Example
interstitial.on("dimissed", function(){ console.log("Interstitial dimissed"); }); -
On fail
-
Triggered when the loading process of an interstitial has failed.
Example
interstitial.on("fail", function(error){ console.log("Interstitial failed to load: " + JSON.stringify(error)); }); -
On load
-
Triggered when a new interstitial is loaded.
Example
banner.on("load", function(){ console.log("Interstitial loaded"); }); -
On reward
-
Triggered when an video reward is completed.
Example
interstitial.on("reward", function(reward, error){ if (reward && reward.amount > 0) { console.log("Reward completed. Earned " + reward.amount + " items"); } }); -
On show
-
Triggered when a new interstitial is shown.
Example
interstitial.on("show", function(){ console.log("Interstitial shown"); });