Interstitial
Step-1: Integration Reference
- Interstitial ads are generally full-screen, and the calling time is when the page is switched. Generally, there are two types of pictures and videos, and some channels will have customized interstitial screens
- Interstitial ads are provided by third-party advertising platforms and generally do not support customization or modification
- Interstitial ads generally need to be preloaded. When the display opportunity comes, check whether there is an available ad by calling the
isAdReady
method. When there is an available ad, call theshowAdWithSceneId:
method to display the ad
STEPS
- Create
TradPlusAdInterstitial
object - Load interstitial ads
loadAd
- Register
TradPlusADInterstitialDelegate
callbacks to get callbacks for ad loading, displaying, clicking, closing, etc. - Show interstitial ad
showAdWithSceneId:
NOTES
- It is forbidden to execute the ad loading method in
tpInterstitialAdOneLayerLoad : didFailWithError:
callback, otherwise it will cause an infinite loop. - Prohibit the method of directly performing ad display in
tpInterstitialAdLoaded
callback. The SDK has an automatic replenishment function when the advertisement expires. IfshowAdWithSceneId:
is executed intpInterstitialAdLoaded
callback, developers will not be able to precisely control the timing of ad display.
Step-2: TradPlusAdInterstitial API description
1. Loading & Displaying Ad
- Params & Explanation
Params | Explanation |
---|---|
adUnitID | adUnitID is the ad slot ID created by TradPlus background, SDK will pull the configuration and request advertisements according to the ad slot ID |
sceneId | sceneId is the advertising scene ID is an optional parameter, the default is nil, developers need to use it together with - (void)showAdWithSceneId:(nullable NSString *)sceneId; If you want to use the advertising scene Please refer to: Advertising Scenario Description |
- Methods & Explanation
Methods | Explanation |
---|---|
- (void)setAdUnitID:(NSString *)adUnitID; | Set Ad Unit ID |
- (void)loadAd; | Request Interstitial ad |
- (BOOL)isReady; | Check if there is an available adtrue means there is an ad availableflase means there is no ad available |
- (void)entryAdScenario:(nullable NSString *)sceneId; | Enter AdScene Ad Scene is used to count the number of times of entering AdScenario and the number of times of displaying ads after entering the scene, so please enter the scene accurately location call. |
- (void)showAdWithSceneId:(nullable NSString *)sceneId; | Show Interstitial ad |
2. Listeners & Callbacks
- Params & Explanation
Params | Explanation |
---|---|
adInfo | Information such as advertising space ID, third-party advertising platform, ecpm, etc. For details, please refer to Callback Information Description |
error | The error message returned is TP encapsulation: For details, see: Error Code Description |
TradPlusADInterstitialDelegate
callback interface and description
Methods | Explanation |
---|---|
- (void)tpInterstitialAdLoaded:(NSDictionary *)adInfo; | When the interstitial ad is loaded, it will be called back when the first ad source is loaded successfully, and it will only be called back once in a loading process |
- (void)tpInterstitialAdLoadFailWithError:(NSError *)error; | The interstitial ad failed to load, and the error message in TP package was returned. For details, see: Error Code Description tpInterstitialAdOneLayerLoad:didFailWithError: returns the error information from the third party source |
- (void)tpInterstitialAdImpression:(NSDictionary *)adInfo; | Ad show succeeded.Valid show recognized by the third-party |
- (void)tpInterstitialAdShow:(NSDictionary *)adInfo didFailWithError:(NSError *)error; | Interstitial Ad show error |
- (void)tpInterstitialAdClicked:(NSDictionary *)adInfo; | Interstitial Ad Clicked |
- (void)tpInterstitialAdDismissed:(NSDictionary *)adInfo; | Interstitial Ad Dismissed |
TradPlusADInterstitialDelegate
callback interface and description (optional)
Methods | Explanation |
---|---|
- (void)tpInterstitialAdStartLoad:(NSDictionary *)adInfo; | v7.6.0+ new start loading process |
- (void)tpInterstitialAdIsLoading:(NSDictionary *)adInfo; | v8.7.0+New If you receive this callback after calling load, it means that the ad slot is still in the loading state, please wait for the callback of the last round of load results before Trigger a new round of ad loading. |
v7.6.0+ Deprecated Please use tpInterstitialAdOneLayerStartLoad: | |
- (void)tpInterstitialAdOneLayerStartLoad:(NSDictionary *)adInfo; | Callback once when each ad source starts loading. Added in v7.6.0+. Replace the original callback interface: tpInterstitialAdLoadStart:(NSDictionary *)adInfo; |
- (void)tpInterstitialAdBidStart:(NSDictionary *)adInfo; | Bidding Starts |
v7.6.0+Deprecated Please use tpInterstitialAdBidEnd:error: | |
- (void)tpInterstitialAdBidEnd:(NSDictionary *)adInfo error:(NSError *)error; | Bidding End,error = nil means success |
- (void)tpInterstitialAdOneLayerLoaded:(NSDictionary *)adInfo; | When each ad source is loaded successfully, it will be called back once. |
- (void)tpInterstitialAdOneLayerLoad:(NSDictionary *)adInfo didFailWithError:(NSError *)error; | When each ad source fails to load, it will call back once and return the error information of the three sources |
- (void)tpInterstitialAdAllLoaded:(BOOL)success; | The loading process is all over |
- (void)tpInterstitialAdPlayStart:(NSDictionary *)adInfo; | video playback starts |
- (void)tpInterstitialAdPlayEnd:(NSDictionary *)adInfo; | Video playback ends |
Step-3: Sample Codes
Reference: TradPlusAdInterstitialViewController
#import <TradPlusAds/TradPlusAdInterstitial.h>
@interface TradPlusAdInterstitialViewController ()<TradPlusADInterstitialDelegate>
@property (nonatomic, strong)TradPlusAdInterstitial *interstitial;
@end
@implementation TradPlusAdInterstitialViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.interstitial = [[TradPlusAdInterstitial alloc] init];
//Set ad slot ID
[self.interstitial setAdUnitID:@"your ad unit ID"];
//Set proxy
self.interstitial.delegate = self;
//It takes some time to load the ad, you can load the ad in advance before displaying the ad
[self. interstitialAd loadAd];
}
- (void)showInterstitialAd
{
//Call the isAdReady method to check whether there is an available ad, and when there is an available ad, call the showAdWithSceneId: method to display the ad
if (self. interstitialAd. isAdReady)
{
[self.interstitial showAdWithSceneId:nil];
}
}
#pragma mark - TradPlusADInterstitialDelegate
//Ad Loaded
- (void)tpInterstitialAdLoaded:(NSDictionary *)adInfo
{
}
//Ad Loading Error
- (void)tpInterstitialAdLoadFailWithError:(NSError *)error
{
}
//Ad show succeeded.Valid show recognized by the third-party
- (void)tpInterstitialAdImpression:(NSDictionary *)adInfo
{
}
// Ad Show Error
- (void)tpInterstitialAdShow:(NSDictionary *)adInfo didFailWithError:(NSError *)error
{
}
//Ad Clicked
- (void)tpInterstitialAdClicked:(NSDictionary *)adInfo
{
}
//Ad close
- (void)tpInterstitialAdDismissed:(NSDictionary *)adInfo
{
}