Cross Promotion

Before You Start

Before integrating ads unit in your app, you must:

  • In the OpenMediation UI, create an app and create an ad placement. You can follow guides here.
  • Follow our steps to iOS SDK Integration by integrating the OpenMediation 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.

Cross Promotion 

For developers, every APP has a certain life cycle. When the APP decides to stop maintenance or launch a new APP, it needs to divert the users of the current APP to the new APP. At this time, Cross Promotion is needed.

Step 1. Add the Delegate

The OpenMediation SDK fires several events to inform you of Ad activity. To show Ad to your user, you need to setup its Delegate before loading the ads to receive Ad status. The following snippets demonstrates how to configure Delegate for OMCrossPromotion object and implement the OMCrossPromotionDelegate to receive Ad events.

1. Add the following code to add your Delegate to OMCrossPromotion object and register to the receive 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.

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

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

/// Invoked when promotion is available.
- (void)omCrossPromotionChangedAvailability:(BOOL)available{
     if(available){
       NSLog(@"CrossPromotion Ad is Available");
     }
}

/// Sent immediately when a promotion ad will appear.
- (void)omCrossPromotionWillAppear:(OMScene *)scene{
     NSLog(@"CrossPromotion Ad Will Appear");
}

/// Sent after a promotion ad has been clicked.
- (void)omCrossPromotionDidClick:(OMScene *)scene{
     NSLog(@"CrossPromotion Ad Did Click");
}

/// Sent after a promotion ad did disappear.
- (void)omCrossPromotionDidDisappear:(OMScene *)scene{
     NSLog(@"CrossPromotion Ad Did Disappear");
}

/// Sent after a promotion ad has failed to play.
- (void)omCrossPromotionDidFailToShow:(OMScene *)scene withError:(NSError *)error{
     NSLog(@"CrossPromotion Ad failed to play");
}
/// Invoked when promotion ad is available.
func omCrossPromotionChangedAvailability(_ available: Bool) {
    if available {
         print("CrossPromotion Ad is Available")
    }
 }

 /// Sent immediately when a promotion ad will appear.
func omCrossPromotionWillAppear(_ scene: OMScene) {
      print(@"CrossPromotion Ad Will Appear")
 }

 /// Sent after a promotion ad has been clicked.
func omCrossPromotionDidClick(_ scene: OMScene) {
      print(@"CrossPromotion Ad Did Click")
 }

 /// Sent after a promotion ad did disappear.
func omCrossPromotionDidDisappear(_ scene: OMScene) {
      print(@"CrossPromotion Ad Did Disappear")
 }

 /// Sent after a promotion ad has failed to play.
func omCrossPromotionDidFail(toShow scene: OMScene, withError error: Error) {
      print(@"CrossPromotion Ad failed to play")
 }

 

Step 2. Check Ad Availability (Optional)

Ad Availability

OpenMediation SDK automatic loads ads for you to cache the Cross Promotion Ads during the application's lifecycle if only SDK is integrated and initiated successfully. By correctly implementing the OMCrossPromotionDelegate, you will be notified about the ad availability through the OMCrossPromotionChangedAvailability callback.

- (void)omCrossPromotionChangedAvailability:(BOOL)available{
    if(available){
       NSLog(@"CrossPromotion Ad is Available");
    }
}
func omCrossPromotionChangedAvailability(_ available: Bool) {
    if available {
       print("CrossPromotion Ad 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 Promotion Ad is ready to show through the isReady method.

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

 

Step 3. Show a Promotion Ad

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

 if ([[OMCrossPromotion sharedInstance] isReady]) {
     [[OMCrossPromotion sharedInstance] showAdWithScreenPoint:CGPointMake(0.5, 0.5) angle:20 scene:@"YOUR_SCENE_NAME"];
}
if OMCrossPromotion.sharedInstance().isReady() {
    OMCrossPromotion.sharedInstance().show(with: "VIEW_CONTROLLER", angle:20, scene: "YOUR_SCENE_NAME")
}

Scene is a new concept being introduced for rewarded video and interstitial ads. 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 OpenMediation 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 " ".

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

Comments

0 comments

Article is closed for comments.