Rewarded Video
Step-1: Integration Reference
- Rewarded video ads are generally full-screen 15-30s videos, and the calling time is when rewarding the user or obtaining certain items, the user will send the reward to the user after watching the advertisement
- Rewarded video ads are provided by third-party advertising platforms and generally do not support customization or modification
- Rewarded video 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
TradPlusAdRewarded
object - Load rewarded video ad
loadAd
- Register
TradPlusADRewardedDelegate
callbacks to get callbacks for ad loading, displaying, clicking, closing, etc. - Show rewarded video ad
showAdWithSceneId:
NOTES
- It is forbidden to execute the ad loading method in the
tpRewardedAdOneLayerLoad: didFailWithError:
callback, otherwise it will cause an infinite loop. - Do not directly perform ad display methods in the
tpRewardedAdLoaded
callback. The SDK has an automatic replenishment function when the advertisement expires. IfshowAdWithSceneId:
is executed intpRewardedAdLoaded
callback, developers will not be able to precisely control the timing of ad display.
Step-2: TradPlusAdRewarded 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 rewarded video ads for this ad slot |
- (BOOL)isReady; | Check if there is an available ad in this ad slottrue 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 rewarded video ads for this ad slot |
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 |
TradPlusADRewardedDelegate
callback interface and description
Methods | Explanation |
---|---|
- (void)tpRewardedAdLoaded:(NSDictionary *)adInfo; | When the rewarded video 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)tpRewardedAdLoadFailWithError:(NSError *)error; | The rewarded video ad failed to load, and the error message in TP package was returned: For details, see: Error Code Description tpRewardedAdOneLayerLoad:didFailWithError: returns the error message of the three-party source |
- (void)tpRewardedAdImpression:(NSDictionary *)adInfo; | The rewarded video ad is successfully displayed, and the effective display approved by the three parties |
- (void)tpRewardedAdShow:(NSDictionary *)adInfo didFailWithError:(NSError *)error; | Rewarded video ad show failed |
- (void)tpRewardedAdClicked:(NSDictionary *)adInfo; | Rewarded video ad clicked |
- (void)tpRewardedAdDismissed:(NSDictionary *)adInfo; | Rewarded video ad dismissed |
- (void)tpRewardedAdReward:(NSDictionary *)adInfo; | Completion Reward |
TradPlusADRewardedDelegate
callback interface and description (optional)
Methods | Explanation |
---|---|
- (void)tpRewardedAdStartLoad:(NSDictionary *)adInfo; | v7.6.0+ new Start loading process |
v7.6.0+ Deprecated Please use tpRewardedAdOneLayerStartLoad: | |
- (void)tpRewardedAdOneLayerStartLoad:(NSDictionary *)adInfo; | Callback once when each ad source starts loading. v7.6.0+new replaces the original callback interface: tpRewardedAdLoadStart:(NSDictionary *)adInfo; |
- (void)tpRewardedAdIsLoading:(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. |
- (void)tpRewardedAdPlayAgainReward:(NSDictionary *)adInfo; | Look at the completion reward of another one (Kuaishou, Pangolin) **v7.8.0+ Added ** TradPlusADRewardedPlayAgainDelegate unified callback |
- (void)tpRewardedAdBidStart:(NSDictionary *)adInfo; | Bidding starts |
v7.6.0+Deprecated Please use tpRewardedAdBidEnd:error: | |
- (void)tpRewardedAdBidEnd:(NSDictionary *)adInfo error:(NSError *)error; | Bidding end error = nil means success |
- (void)tpRewardedAdOneLayerLoaded:(NSDictionary *)adInfo; | When each ad source is successfully loaded, it will be called back once. |
- (void)tpRewardedAdOneLayerLoad:(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)tpRewardedAdAllLoaded:(BOOL)success; | The loading process is all over |
- (void)tpRewardedAdPlayStart:(NSDictionary *)adInfo; | video playback starts |
- (void)tpRewardedAdPlayEnd:(NSDictionary *)adInfo; | Video playback ends |
- v7.8.0 Added
TradPlusADRewardedPlayAgainDelegate
callback to handle related callbacks in China
self.rewardedVideoAd.playAgainDelegate = self;
TradPlusADRewardedPlayAgainDelegate
callback interface and description
Methods | Explanation |
---|---|
- (void)tpRewardedAdPlayAgainImpression:(NSDictionary *)adInfo; | "Watch Again" ad impression |
- (void)tpRewardedAdPlayAgainShow:(NSDictionary *)adInfo didFailWithError:(NSError *)error; | "Watch Again" ad failed to show |
- (void)tpRewardedAdPlayAgainClicked:(NSDictionary *)adInfo; | "Watch Again" ad was clicked |
- (void)tpRewardedAdPlayAgainReward:(NSDictionary *)adInfo; | "Watch Again" ad completion rewards, pangolins and fast hands if there are advanced rewards, will be stored in reward_info of adInfo |
- (void)tpRewardedAdPlayAgainPlayStart:(NSDictionary *)adInfo; | "Watch Again" ad video playback starts |
- (void)tpRewardedAdPlayAgainPlayEnd:(NSDictionary *)adInfo; | "Watch Again" ad video ends |
3. Clear cached ads (v7.1.0+ new API)
Main usage scenario: After a game or app switches users, it is necessary to clear the rewarded video ad cache that has been loaded before.
[TradPlus clearCacheWithPlacementId:@"your placement D"]];
4. Server-side reward verification
- TPSDK will be transparently transmitted to the third-party SDK through this API
- TradPlus server incentive callback and third-party advertising platform server incentive callback are now supported. To ensure the accuracy of server incentives, developers are recommended to use third-party advertising first Platform's server incentive callback. Please refer to Rewarded Video Server Incentive (S2S) Description
- Params & Explanation
Params | Explanation |
---|---|
userID | *Required (user unique ID) can use the account system or the APP to automatically generate a UUID to identify the user's unique ID. |
customData | (user-defined data)Transfer information according to the requirements of the third-party platform. |
- (void)setServerSideVerificationOptionsWithUserID:(nonnull NSString *)userID customData:(nullable NSString *)customData;
Step-3: Sample Codes
Reference: TradPlusAdRewardedViewController
#import <TradPlusAds/TradPlusAdRewarded.h>
@interface TradPlusAdRewardedViewController ()<TradPlusADRewardedDelegate,TradPlusADRewardedPlayAgainDelegate>
@property (nonatomic, strong) TradPlusAdRewarded *rewardedVideoAd;
@end
@implementation TradPlusAdRewardedViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.rewardedVideoAd = [[TradPlusAdRewarded alloc] init];
//Set ad slot ID
[self.rewardedVideoAd setAdUnitID:@"Your Ad Unit ID"];
//Set proxy
self.rewardedVideoAd.delegate = self;
//It takes some time to load the ad, you can load the ad in advance before displaying the ad
[self. rewardedVideoAd loadAd];
}
- (void)showRewardVideoAd
{
//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. rewardedVideoAd. isAdReady)
{
[self.rewardedVideoAd showAdWithSceneId:nil];
}
}
#pragma mark - TradPlusADRewardedDelegate
//Ad Loaded
- (void)tpRewardedAdLoaded:(NSDictionary *)adInfo
{
}
//Ad Loading Error
- (void)tpRewardedAdLoadFailWithError:(NSError *)error
{
}
//Ad show succeeded.Valid show recognized by the third-party
- (void)tpRewardedAdImpression:(NSDictionary *)adInfo
{
}
// Ad Show Error
- (void)tpRewardedAdShow:(NSDictionary *)adInfo didFailWithError:(NSError *)error
{
}
//Ad Clicked
- (void)tpRewardedAdClicked:(NSDictionary *)adInfo
{
}
//Ad Close
- (void)tpRewardedAdDismissed:(NSDictionary *)adInfo
{
}
@end