Interstitial
Cordova (Phonegap) Interstitial
Before you begin!
Make sure that you have completed the Cordova Plugin installation before you begin integrating the Interstitial ad unit
Integrating the Interstitial ad unit
Step 1: Define a new Ad object
Make sure to set your app's placementID before loading the ad.
var interstitial = new Appnext.Interstitial(ADD_HERE_YOUR_PLACEMENT_ID,config_options);
Step 2 (optional): Loading an Ad
interstitial.loadAd();
Step 3: Showing the Ad
var onSuccess = function(){
console.log("Ad loaded + show");
}
var onError = function(response){
console.log("Show ad error : "+response);
}
interstitial.showAd(onSuccess,onError);
Step 4 (optional): Callbacks
In order to receive client-side callbacks from the SDK, call those following function:
//Get callback for ad loaded
interstitial.setOnAdLoadedCallback(
function(){
console.log("loaded");
}
);
//Get callback for ad clicked
interstitial.setOnAdClickedCallback(
function(){
console.log("clicked");
}
);
//Get callback for ad closed
interstitial.setOnAdClosedCallback(
function(){
console.log("closed");
}
);
//Get callback for ad error
interstitial.setOnAdErrorCallback(
function(error){
console.log("error: " + error);
}
);
Step 5: Configuring the Interstitial ad unit
By default, the Interstitial configuration will be loaded from Appnext's server. You can change the configuration directly by property or through the setter function.
Example using config and setters
// Using config:
var placement_id = “xxxxxxxxx”
var options = {
"buttonText": "Install",
"buttonColor": "#6AB344",
"skipText": "skip",
"categories": "category1,category2",
"postback": "posbtack",
"autoPlay": true,
"mute": false,
"creativeType": "managed",
"preferredOrientation":"automatic"
}
var interstitial = new Appnext.Interstitial(placement_id,options);
// You can also create an Ad without the options and use setters
//var interstitial = new Appnext.Interstitial(placement_id);
// Using setters:
interstitial.setButtonText("Install now");
interstitial.setButtonColor("#6AB344");
interstitial.setSkipText("Skip");
interstitial.setCategories("category1,category2");
interstitial.setPostback("postback");
interstitial.setAutoPlay(true);
interstitial.setMute(false);
interstitial.setCreativeType("managed");
interstitial.setPreferredOrientation ("automatic");
List of configurable options:
Button Text:
The install but ton's text (default is "Install")
Button Color:
The install button's color - a 6 hex chars starting with # (default is "#6AB344")
Skip Button Text:
Set a custom text for the "skip" button (default is "Skip")
Category:
Set preferred ad categories
Install Postback:
Postback parameters that will be posted to your server after user installed an app (make sure to encode the values)
Mute Video:
Mute the video which is played in the Interstitial (default is "false")
- true
- false
Auto Play Video:
Set video auto-play (default is "true")
- true
- false
Creative Type:
Set creative type for the main section of the Interstitial (default is "managed")
- managed
- video
- static
Preferred Orientation
Set the preferred orientation if both landscape and portrait are supported by the application (default is "automatic")
- automatic
- landscape
- portrait
Important Note!
- Each placement has a Placement ID. If you integrate multiple placements, you will need to use a different Placement ID for each.
- Make sure to use Android Placement IDs in Android project and iOS Placement IDs in iOS project
- It is against our policies to encourage or reward the user for installing the app; we only allow rewards as a means of encouraging users to watch the video ad, so they will voluntarily install the app if they are interested.
App Categories
Android: 1. Action 2. Adventure 3. Arcade 4. Arcade & Action 5. Board 6. Books & Reference 7. Brain & Puzzle 8. Business 9. Card 10. Cards & Casino 11. Casino 12. Casual 13. Comics 14. Communications 15. Education 16. Educational 17. Entertainment 18. Family 19. Finance 20. Health & Fitness 21. Libraries & Demo 22. Lifestyle 23. Live Wallpaper 24. Media & Video 25. Medical 26. Music 27. Music & Audio 28. News & Magazines | 29. Personalization 30. Photography 31. Productivity 32. Puzzle 33. Racing 34. Role Playing 35. Shopping 36. Simulation 37. Social 38. Sports 39. Sports Games 40. Strategy 41. Tools 42. Travel & Local 43. Trivia 44. Weather 45. Word *iOS:** 1. Action 2. Adventure 3. Arcade 4. Board 5. Books 6. Business 7. Card 8. Casino 9. Catalogs 10. Dice | 11. Education 12. Educational 13. Entertainment 14. Family 15. Finance 16. Food & Drink 17. Graphics & Design 18. Health & Fitness 19. Kids 20. Lifestyle 21. Medical 22. Music 23. Navigation 24. News 25. Photo & Video 26. Productivity 27. Puzzle 28. Racing 29. Reference 30. Role Playing 31. Simulation 32. Social Networking 33. Sports 34. Strategy 35. Travel 36. Trivia 37. Utilities 38. Weather |
Make sure to encode (%20) categories with more than 1 word, example: Travel%20%26%20Local
Integration Support
Should you have any problems integrating the product, log a ticket with us by emailing [email protected].
Updated over 7 years ago