Interstitial
Appnext iOS SDK - Interstitial ad unit
Ad Unit Integration
Make sure to complete the Getting Started with the iOS SDK steps before you begin
Step 1: Add import statement
Add the following import statement in your pre-compiled header or in your .m/.h file where you intend to instantiate and use the Appnext SDK. If your application is written in swift add it to your bridging-header.
#import <AppnextLib/AppnextLib.h>
Step 2: Define a new Ad
Make sure to set your app's placementID before loading the ad.
AppnextInterstitialAd *interstitial = [[AppnextInterstitialAd alloc] initWithPlacementID:ADD_HERE_YOUR_PLACEMENT_ID];
Step 3 (optional): Loading an Ad
[interstitial loadAd];
Step 4: Showing the Ad
if (interstitial.adIsLoaded)
{
[interstitial showAd];
} else
{
// continue...
}
Step 5 (optional): Delegates
In order to receive client-side callbacks, the client can set a delegate for each Ad:
interstitial.delegate = self;
For Interstitial the delegate need to conform to:
@protocol AppnextAdDelegate <NSObject>
@optional
- (void) adLoaded:(AppnextAd *)ad;
- (void) adOpened:(AppnextAd *)ad;
- (void) adClosed:(AppnextAd *)ad;
- (void) adClicked:(AppnextAd *)ad;
- (void) adUserWillLeaveApplication:(AppnextAd *)ad;
- (void) adError:(AppnextAd *)ad error:(NSString *)error;
@end
Possible errors returned to client in AppnextAdDelegate
method adError:error
:
static NSString * const kAdErrorNoInternetConnection = @"No internet connection";
static NSString * const kAdErrorNoPlacementID = @"Placement ID cannot be empty";
static NSString * const kAdErrorDownloadingResources = @"Error Downloading Resources";
static NSString * const kAdErrorAdNotReady = @"Ad not ready";
static NSString * const kAdErrorPreparingViews = @"Error Preparing Views";
static NSString * const kAdErrorLoadingAd = @"Error Loading Ad";
static NSString * const kAdErrorBadParameters = @"Bad parameters";
static NSString * const kAdErrorEmptyResponse = @"Empty response";
static NSString * const kAdErrorNoAds = @"No ads";
static NSString * const kAdErrorFailedLoadingAds = @"Failed loading ads";
static NSString * const kAdErrorNoSuitableAd = @"No suitable ad";
static NSString * const kAdErrorVideoFileNameNotValid = @"Video file name not valid";
Configuring the Appnext Interstitial
Custom Configuration
By default, the SDK configuration will be loaded from Appnext's server. You can change the configuration directly by property or through the setter function.
Define the Interstitial configuration instance:
AppnextInterstitialAdConfiguration *interstitialConfig = [[AppnextInterstitialAdConfiguration alloc] init];
Examples
Interstitial config example:
AppnextInterstitialAdConfiguration *config = [[AppnextInterstitialAdConfiguration alloc] init];
[config setButtonText:@"Install"];
[config setButtonColor:@"#689f38"];
[config setSkipText:@"Skip"];
[config setCategories:@"category1,category2"];
[config setPostback:@"postback"];
[config setAutoPlay:YES];
[config setCreativeType:ANCreativeTypeManaged];
[config setPreferredOrientation:kPreferredOrientationTypeStringAutomatic];
[config setClickInApp:YES];
// Or You can alternatively set the property directly
//config.buttonText = @"Install";
//config.buttonColor = @"#689f38";
//config.skipText = @"Skip";
//config.categories = @"category1,category2";
//config.postback = @"postback";
//config.autoPlay = YES;
//config.creativeType = ANCreativeTypeManaged;
//config.preferredOrientation = kPreferredOrientationTypeStringAutomatic;
AppnextInterstitialAd *interstitial = [[AppnextInterstitialAd alloc] initWithConfig:config placementID:ADD_HERE_YOUR_PLACEMENT_ID];
interstitial.delegate = self;
// You can also set the property after the ad is created on the ad itself
//[interstitial setButtonText:@"Install"];
//[interstitial setButtonColor:@"#689f38"];
//[interstitial setSkipText:@"Skip"];
//[interstitial setCategories:@"category1,category2"];
//[interstitial setPostback:@"postback"];
//[interstitial setAutoPlay:YES];
//[interstitial setCreativeType:ANCreativeTypeManaged];
//[interstitial setPreferredOrientation:kPreferredOrientationTypeStringAutomatic];
List of configuration options
Button Text:
The install button'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
Click in-app
Determines the App Store loading method, when set to "YES" - the App Store will open "in-app" within the running app, Otherwise the App Store will open outside the running app
Install Postback:
Postback parameters that will be posted to your server after user installed an app (make sure to encode the values)
Auto Play Video:
Set video auto-play (default is "YES")
- YES
- NO
Creative Type:
Set creative type for the main section of the Interstitial (default is ANCreativeTypeManaged)
- ANCreativeTypeNotSet
- ANCreativeTypeManaged
- ANCreativeTypeVideo
- ANCreativeTypeStatic
Preferred Orientation
Set the preferred orientation if both landscape and portrait are supported by the application (default is kPreferredOrientationTypeStringAutomatic)
- kPreferredOrientationTypeStringAutomatic = @"automatic"
- kPreferredOrientationTypeStringLandscape = @"landscape"
- kPreferredOrientationTypeStringPortrait = @"portrait"
- kPreferredOrientationTypeStringNotSet = @"not_set"
Integration Support
Should you have any problems integrating the product, log a ticket with us by emailing [email protected].
Important Note
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.
Example Project
Please see example project AppnextNewNativeLibSDKTest
inside the SDK zip file here.
App Categories
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 7 months ago