Rewarded Video

Before You Start

Before integrating ads unit in your app, you must:

  • In the AdTiming UI, create an account, create an app, and create an ad placement using the format 'Rewarded Video'. You can follow guides here.
  • Follow our steps to iOS SDK Integration by integrating the AdTiming SDK into your project.
  • If you use mediation, go to Add Mediation Networks and make sure you have added the ad networks' SDKs and the corresponding adapters you wish to work with in your app.

New in Version

For Rewarded Video, Interstitial and Interactive Ad, the SDK will cache ads automatically and maintain ad inventory regularly, such as pre-loading after initialization, loading after ad served and timing loading etc. You do not need to invoke the load method anymore with version 4.0.0 and above. The new APIs are easier to use.

Rewarded Video

Rewarded video ads with strong interactive ability has become the mainstream form of mobile advertising industry. It is becoming increasingly common for mobile game developers to rely more on built-in ads than IAP to monetize.

The AdTiming Rewarded Video ad unit offers an engaging ad experience that rewards your users with valuable virtual content in exchange for a completed view. This user-initiated ad unit is great for gaming apps, and enhances users' app experience.

Step 1. Add the Delegate

The AdTiming SDK fires several events to inform you of Ad activity. To show Ad to your user, you need to set up its Delegate before loading the ads to receive Ad status. The following snippets demonstrates how to configure Delegate for AdTimingRewardedVideo object and implement the AdTimingRewardedVideoDelegate to receive Ad events.

1. Add the following code to add your Delegate to AdTimingRewardedVideo object and register to the received events. The SDK will notify the Delegate of all possible events listed in section 2 below.

Note: Here we use "self" which means the callback function is implemented in the current object.

[[AdTimingRewardedVideo sharedInstance] addDelegate:self];
AdTimingRewardedVideo.sharedInstance().add(self)

2. Implement the following callback function in your code to process ad logic when receiving the activity of your ad. For example invoke show function to serve Ad to your users when the rewarded video ad is ready.

/// Invoked when rewarded video is available.
 - (void)adtimingRewardedVideoChangedAvailability:(BOOL)available{
    if(available){
         NSLog(@"VideoAd is Available");
    }
 }

 /// Sent immediately when a rewarded video is opened.
 - (void)adtimingRewardedVideoDidOpen:(AdTimingScene *)scene{
      NSLog(@"VideoAd is Open");
 }

 /// Sent immediately when a rewarded video starts to play.
 - (void)adtimingRewardedVideoPlayStart:(AdTimingScene *)scene{
      NSLog(@"VideoAd Start Play");


 /// Sent after a rewarded video has been clicked.
 - (void)adtimingRewardedVideoDidClick:(AdTimingScene *)scene{
      NSLog(@"VideoAd Did Click");
 }

 /// Send after a rewarded video has been completed.
 - (void)adtimingRewardedVideoPlayEnd:(AdTimingScene *)scene{
      NSLog(@"VideoAd Play End");
 }

 /// Sent after a rewarded video has been closed.
 - (void)adtimingRewardedVideoDidClose:(AdTimingScene *)scene{
      NSLog(@"VideoAd Did Close");
 }

 /// Sent after a user has been granted a reward.
 - (void)adtimingRewardedVideoDidReceiveReward:(AdTimingScene *)scene{
      NSLog(@"Receive a reward");
 }

 /// Sent after a rewarded video has failed to play.
 - (void)adtimingRewardedVideoDidFailToShow:(AdTimingScene *)scene withError:(NSError *)error{
      NSLog(@"VideoAd failed to play");
 }
/// Invoked when rewarded video is available.
func adtimingRewardedVideoChangedAvailability(_ available: Bool) {
    if available {
         print("VideoAd is Available")
    }
 }

 /// Sent immediately when a rewarded video is opened.
func adtimingRewardedVideoDidOpen(_ scene: AdTimingScene) {
      print(@"VideoAd is Open")
 }

 /// Sent immediately when a rewarded video starts to play.
func adtimingRewardedVideoPlayStart(_ scene: AdTimingScene) {
      print(@"VideoAd Start Play")
}

 /// Sent after a rewarded video has been clicked.
func adtimingRewardedVideoDidClick(_ scene: AdTimingScene) {
      print(@"VideoAd Did Click")
 }

 /// Send after a rewarded video has been completed.
func adtimingRewardedVideoPlayEnd(_ scene: AdTimingScene) {
      print(@"VideoAd Play End")
 }

 /// Sent after a rewarded video has been closed.
func adtimingRewardedVideoDidClose(_ scene: AdTimingScene) {
      print(@"VideoAd Did Close")
 }

 /// Sent after a user has been granted a reward.
func adtimingRewardedVideoDidReceiveReward(_ scene: AdTimingScene) {
      print(@"Receive a reward")
 }

 /// Sent after a rewarded video has failed to play.
func adtimingRewardedVideoDidFail(toShow scene: AdTimingScene, withError error: Error) {
      print(@"VideoAd failed to play")
 }

 

Step 2. Check Ad Availability (Optional)

Ad Availability

AdTiming SDK automatic loads ads for you to cache the Rewared Video Ads during the application's lifecycle if only SDK is integrated and initiated successfully. By correctly implementing the AdTimingRewardedVideoDelegate, you will be notified about the ad availability through the AdTimingRewardedVideoChangedAvailability callback. 

- (void)adtimingRewardedVideoChangedAvailability:(BOOL)available{
      if(available){
         NSLog(@"VideoAd is Available");
      }
}
func adtimingRewardedVideoChangedAvailability(_ available: Bool) {
    if available {
       print("VideoAd is Available")
    }
 }

 

Another way to check if the ad is avalible is by calling the isReady function directly. After you call the Add the Delegate in Step 1, you will be notified whether the video is ready to show through the isReady method.

/// Check AdTimingRewardedVideo video is Ready.
[[AdTimingRewardedVideo sharedInstance] isReady];
AdTimingRewardedVideo.sharedInstance().isReady()

 

Step 3. Show a Rewarded Video Ad

We strongly recommend checking the ad's availibility by calling the isReady method before you serve Rewarded Video Ads, as shown in the following code:

if ([[AdTimingRewardedVideo sharedInstance] isReady]) {
     [[AdTimingRewardedVideo sharedInstance] showWithViewController:@"VIEW_CONTROLLER" scene:@"YOUR_SCENE_NAME"];
}
if AdTimingRewardedVideo.sharedInstance().isReady() {
    AdTimingRewardedVideo.sharedInstance().show(with: "VIEW_CONTROLLER", scene: "VIEW_CONTROLLER")
}

Notes: Scene is optional,if you don't want to use it just ignore the sceneName parameter or use value " ".

 

Step 4. Capping and Pacing (Optional)

You can use scene capping and pacing to improve your app's user experience by limiting the amount of ads served within a defined time frame.  You can configure capping and pacing settings for selected scenes in placement setting.

Important! To ensure you don't show the Rewarded Video button to prompt the user to watch an ad when the placement is capped, you must call the following method to verify if a specific placement has reached its ad limit.

/// Indicates whether the scene has reached the display frequency.
[[AdTimingRewardedVideo sharedInstance] isCappedForScene:@"YOUR_SCENE_NAME"];
AdTimingRewardedVideo.sharedInstance().isCapped(forScene:"YOUR_SCENE_NAME")

 

Step 5. Configure Rewarded Video Ad Callback

AdTiming SDK supports the Rewarded Video Ad Server-side Callbacks. You can do this by defining a unique, private endpoint for us, and specify information that you want the AdTiming server to pass. The way this works is the app on a user's device will contact AdTiming servers for validation of a reward. Once a user has been validated by the AdTiming server, we will send notification to the endpoint defined in your dashboard. Since a user's device will never be in contact with your server, this method prevents tampering with the reward events sent to your endpoint.

rv_ios_callbalc_en.png

Endpoint Format

http://yourendpoint.com?variable_name_you_define={content}

{content} - This is the information that you want the Adtiming server to pass.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.