Interactive

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.

Interactive

Interactive ad allows users to play Html5 games and get all kinds of coupons advertisers offer.

Step 1. Add the Delegate

The AdTiming SDK fires several events to inform you of Interactive Ad activity. To display Interactive Ads, you need to create a brand new AdTimingInteractiveAd object, setup its delegate and load the ads. The following snippet demonstrates how to use the AdTimingInteractiveAd class to create Interactive Ad objects and implement the AdTimingInteractiveAdDelegate to receive Interactive Ad events.

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

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

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

 

2. Implement the following callback functions in your code to process ad logic when receive the status of your ad. For example invoke show function to serve Ad to your users when the Interactive Ad is ready.  

/// Invoked when Interactive Ad is available.
- (void)adtimingInteractiveChangedAvailability:(BOOL)available { 
     if(available){
        NSLog(@"InteractiveAd is Available");
     } 
}

/// Sent immediately when a interactive ad is opened.
- (void)adtimingInteractiveDidOpen:(AdTimingScene *)scene{
     NSLog(@"InteractiveAd is Open");
}

/// Sent immediately when a interactive ad starts to play.
- (void)adtimingInteractiveDidShow:(AdTimingScene *)scene{
     NSLog(@"InteractiveAd Start Play");
}

/// Sent after a interstitial ad has been clicked.
- (void)adtimingInteractiveDidClick:(AdTimingScene *)scene{
     NSLog(@"InteractiveAd Did Click");
}

/// Sent after a interactive ad has been closed.
- (void)adtimingInteractiveDidClose:(AdTimingScene *)scene{
     NSLog(@"InteractiveAd Did Close");
}

/// Sent after a interactive ad has failed to play.
- (void)adtimingInteractiveDidFailToShow:(AdTimingScene *)scene withError:(NSError *)error{
     NSLog(@"InteractiveAd failed to play");
}
/// Invoked when interactive Ad is available.
func adtimingInteractiveChangedAvailability(_ available: Bool) {
    if available {
         print("InteractiveAd is Available");
    }
 }

 /// Sent immediately when a interactive Ad is opened.
func adtimingInteractiveDidOpen(_ scene: AdTimingScene) {
      print(@"InteractiveAd is Open");
 }

 /// Sent immediately when a interactive AD starts to play.
func adtimingInteractiveDidShow(_ scene: AdTimingScene) {
      print(@"InteractiveAd Start Play");
}

 /// Sent after a interactive Ad has been clicked.
func adtimingInteractiveDidClick(_ scene: AdTimingScene) {
      print(@"InteractiveAd Did Click");
 }

  /// Sent after a interactive ad has been closed.
func adtimingInteractiveDidClose(_ scene: AdTimingScene) {
      print(@"InteractiveAd Did Close");
}

 /// Sent after a interactive ad has failed to play.
func adtimingInteractiveDidFail(toShow scene: AdTimingScene, withError error: Error) {
      print(@"InteractiveAd 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 application lifecycle if only SDK is integrated and initiated successfully. By correctly implementing the AdTimingInteractiveAdDelegate , you will be notified about the ad availability through the AdTimingInteractiveChangedAvailability callback.

- (void)adtimingInteractiveChangedAvailability:(BOOL)available{
    if(available){
       NSLog(@"InteractiveAd is Available");
    }
}
func adtimingInteractiveChangedAvailability(_ available: Bool) {
    if available {
         print("InteractiveAd 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 Interactive ad is Ready.
[[AdTimingInteractiveAd sharedInstance] isReady];
AdTimingInteractiveAd.sharedInstance().isReady()

  

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

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

Scene is a new concept being introduced for rewarded video and interstitial ads in Version 4.0. It is used to represent different ad scenarios in your app.

You can use Scene-based frequency control, user rewards and data statistic etc. Go to AdTiming UI to create multiple Scenes in Settings of Placement.

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 Interactive ad button to prompt the user to watch an ad when the placement is capped, you must call the below method to verify if a specific placement has reached its ad limit.

/// Indicates whether the scene has reached the display frequency.
[[AdTimingInteractiveAd sharedInstance] isCappedForScene:@"YOUR_SCENE_NAME"];
AdTimingInteractiveAd.sharedInstance().isCapped(forScene:"YOUR_SCENE_NAME")
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.