Static Interstitial - tapdaq/cordova-plugin GitHub Wiki
Interstitials are full-screen visuals that appear inside your application.
To load an interstitial, first create the following load callback object:
const loadOpts = {
didLoad: function(response) {
// interstitial is loaded
},
didFailToLoad: function(error, response) {
// interstitial failed to load
}
};
Once that is done, you can call the load method on the Tapdaq interface, passing in the placement tag you with to load an ad for, and the callback object you just created, like so:
Tapdaq.loadInterstitial("my_interstitial_tag", loadOpts);
To display the interstitial we recommend using the didLoad callback. Implement the following code inside your didLoad callback function:
const showOpts = {
willDisplay: function(response) {
},
didDisplay: function(response) {
},
didFailToDisplay: function(error, response) {
},
didClick: function(response) {
},
didClose: function(response) {
}
};
const loadOpts = {
didLoad: function(response) {
Tapdaq.showInterstitial("my_interstitial_tag");
},
didFailToLoad: function(error, response) {
// interstitial failed to load
}
};
It is also possible to check the interstitial is loaded before displaying it to the user, as shown below:
if (Tapdaq.isInterstitialReady("my_interstitial_tag", function(ready) {
if (ready) {
Tapdaq.showInterstitial("my_interstitial_tag");
}
}))
Build your application to iOS and Android, then run your application to test the ad displays correctly.
If you wish to load another interstitial after you have shown one, implement the didClose callback, then pass in the callback object when showing an ad, like so:
const showOpts = {
didClose: function(response) {
Tapdaq.loadInterstitial("my_interstitial_tag", loadOpts);
}
};
Tapdaq.showInterstitial("my_interstitial_tag, showOpts);
If you are having any problems integrating, feel free to contact us on [email protected] and we will be more than happy to help.
Now that you have successfully integrated an interstitial into your app, what would you like to do next?