Get Started with Avocarrot

Overview

Examples

Android

Overview

- Avocarrot Exchange SDK

Setup Exchange SDK

Stream

Native Assets

Exchange Troubleshooting

- Avocarrot Mediation SDK

Setup Mediation

Stream Ads Mediation

Native ads Mediation

Native Assets Mediation

Banner Mediation

Interstitial Mediation

Video Mediation

Supported Networks & Ad Types

Mediation Troubleshooting

iOS

Overview

- Avocarrot Exchange SDK

Setup SDK

Stream

Native Assets

Exchange Troubleshooting

- Avocarrot Mediation

Getting Started With Mediation

Stream Ads Mediation

Native Ads Mediation

Banner Ads Mediation

Interstitial Ads Mediation

Video Ads Mediation

Supported Networks & Ad Types

Mediation Troubleshooting

API Documentation

Reporting API

Help

FAQ

Updates

SDK Change Log

Android Change Log

iOS Change Log

Interstitial Ads Mediation

Updated 2 months ago ​by Chris

Overview

This guide helps you setup Interstitial mediation.

Prerequisites

You need an Avocarrot account to complete the tutorial. Create an account
You need to setup the Mediation SDK. Setup Mediation SDK

Set up Interstitial Mediation

ID of advertising space for testing (INTERSTITIAL): "2cb34a73-0012-4264-9526-bde1fce2ba92".

The ID above is meant for testing purpose only, please replace it with the Ad unit Id of your placement from the dashboard.
Interstitial size is defined automatically, depending on the screen size.

Use the following methods in your UIViewController subclass:

- (void)loadInterstitialWithAdUnitId:(NSString *_Nonnull)adUnitId
        success:(void (^ _Nullable)(AVOInterstitial *_Nonnull interstitial))success
        failure:(void (^ _Nullable)(AVOError *_Nonnull error))failure;
- (void)loadInterstitialAndShowWithDelayWithAdUnitId:(NSString *_Nonnull)adUnitId
        forViewController:(UIViewController *_Nonnull)viewController
        success:(void (^ _Nullable)(AVOInterstitial *_Nonnull interstitial))success
        failure:(void (^ _Nullable)(AVOError *_Nonnull error))failure;               

Two different presentation methods are available for interstitials. These are as follows:

  • loadInterstitialWithAdUnitId
  • loadInterstitialAndShowWithDelayWithAdUnitId

The loadInterstitialWithAdUnitId method is to load the interstitial and call the success block if the interstitial loaded. You can show the interstitial from this block immediately. The loadInterstitialAndShowWithDelayWithAdUnitId method loads the interstitial, calls the success block and shows it after a delay, which returns from the server. From the success block you can save it to your UIViewController subclass property, show it immediately or do nothing.

Note: If delay is not specified, the interstitial will be shown immediately after the load is finished.

For example:

#import <AvocarrotInterstitial/AvocarrotSDK+AVOInterstitial.h>
...
__weak typeof(self) weakSelf = self;
[AvocarrotSDK.sharedSDK loadInterstitialWithAdUnitId:@"2cb34a73-0012-4264-9526-bde1fce2ba92"
                     success:^(AVOInterstitial * _Nonnull interstitial) {
                        weakSelf.intestitial = interstitial;
                        [interstitial showFromViewController:weakSelf];
                    } failure:nil];
[AvocarrotSDK.sharedSDK loadInterstitialAndShowWithDelayWithAdUnitId:@"2cb34a73-0012-4264-9526-bde1fce2ba92"
                     forViewController:self
                     success:^(AVOInterstitial * _Nonnull interstitial) {
                       weakSelf.intestitial = interstitial;
                     } failure:nil];
import AvocarrotInterstitial
...
AvocarrotSDK.shared.loadInterstitial(withAdUnitId: "2cb34a73-0012-4264-9526-bde1fce2ba92",
                                  success: { [unowned self] (interstitial) in
                                      self.interstitial = interstitial
                                      interstitial.show(from: self)
                               }, failure: nil)
AvocarrotSDK.shared.loadInterstitialAndShowWithDelay(withAdUnitId: "2cb34a73-0012-4264-9526-bde1fce2ba92",
                                                  for: self,
                                                  success: { [unowned self] (interstitial) in
                                                      self.interstitial = interstitial
                                               }, failure: nil)

Interstitial events handling

To process interstitial events, you should implement blocks or subscribe to notifications. The following is available:

MethodDescriptionNSNotificationCenter key
(void (^ _Nullable)(AVOInterstitial*_Nonnull interstitial))successCalled after the interstitial is served. After this method is called, the interstitial is ready to be displayed.
(void (^ _Nullable)(AVOError *_Nonnull error))failureCalled if the interstitial was not downloaded.
- (instancetype _Nonnull)onClick:(nullable void (^)(void))blockCalled after a click on the interstitial. After this event the app will be minimized and an external browser will be opened.kAVONotification_InterstitialClicked
- (instancetype _Nonnull)onDidHide:(nullable void (^)(void))blockCalled after the interstitial disappears from the screen.kAVONotification_InterstitialDidHide
- (instancetype _Nonnull)onDidShow:(nullable void (^)(void))blockCalled after the interstitial is displayed.kAVONotification_InterstitialDidShow
- (instancetype _Nonnull)onWillHide:(nullable void (^)(void))blockCalled after the tap on the “close” button, directly before the interstitial disappears.kAVONotification_InterstitialWillHide
- (instancetype _Nonnull)onWillLoad:(nullable void (^)(void))blockCalled before sending interstitial request to server.kAVONotification_InterstitialWillLoad
- (instancetype _Nonnull)onWillShow:(nullable void (^)(void))blockCalled before displaying the interstitial.kAVONotification_InterstitialWillShow

Advanced Customization

Go Live!

  1. Remove sandbox. If you have received a sample ad then simply disable the Sandbox mode by including the following instruction in your code:
    AvocarrotSDK.testMode = NO
    You should disable Sandbox mode ONLY when you are done with the integration and you are ready to publish your app. It is against Avocarrot's policies to use live ads during development, and doing so could get your Avocarrot account banned.
  2. Publish app. You are now ready to upload your app and start making money! If you have submitted your app in the Google Play/ Apple Store and you can see live ads, then you have nothing to worry about. Just wait until the impressions threshold has been reached and the app will be shown as live in your dashboard as well.
  3. Update payment details. Login to your account and update your payment settings.

Was this article useful?