Get Started with Avocarrot

Overview

Examples

Android

Overview

Getting Started

- Integrating Ads

Stream

Native Assets

Banner

Interstitial

Video

- Others

Troubleshooting

- Adapters

Admob Android Adapter

Mopub Android Adapter

iOS

Overview

Getting Started

- Integrating Ads

Stream

Native Assets

Banner

Interstitial

Video

- Others

Troubleshooting

- Adapters

Admob iOS Adapter

Mopub iOS Adapter

API Documentation

Reporting API

Help

Supported Networks & Ad Types

General

Earnings

Payments and Accounting

Integration

Reporting

Mediation Network Optimization

Legal and Privacy

Updates

SDK Change Log

Android Change Log

iOS Change Log

Banner

Updated 2 months ago ​by Chris

Overview

This guide helps you setup Banner ads in your iOS app.


Banner Ads are not yet supported in Avocarrot Exchange. You have to configure other 3rd party ad networks to get Banner demand. Learn more about the supported ad networks and formats here.

Prerequisites

You need an Avocarrot account to complete the tutorial. Create an account
You need to create a Banner ad unit for your app on your Avocarrot dashboard.
You need to setup the Avocarrot SDK. Setup SDK

Setup Banner Mediation

ID of advertising space for testing (STANDARD): "04c447d7-ffb8-4ba1-985e-4d2b9f88cd69"

The ID above is meant for testing purpose only, please replace it with the Ad unit Id of your placement from the dashboard .

Available banner sizes:

  • AVOBannerViewSizeSmall (320x50) (recommended)
  • AVOBannerViewSizeMREC (300x250) 
  • AVOBannerViewSizeLarge (728x90)
  1. Use the following methods in your UIViewController subclass:
    - (AVOBannerView *_Nullable)loadBannerWithSize:(AVOBannerViewSize)size
                                adUnitId:(NSString *_Nonnull)adUnitId
                                success:(void (^ _Nullable)(void))success
                                failure:(void (^ _Nullable)(AVOError *_Nonnull error))failure;
    

    For example:

    #import <AvocarrotBanner/AvocarrotSDK+AVOBannerView.h>
    ...
    [self.bannerView stop];
    self.bannerView = [AvocarrotSDK.sharedSDK loadBannerWithSize:AVOBannerViewSizeSmall
                                           adUnitId:@"04c447d7-ffb8-4ba1-985e-4d2b9f88cd69"
                                           success:nil
                                           failure:nil];
    [self.view addSubview:self.bannerView];
    
    import AvocarrotBanner
    ...
    if bannerView != nil {
        bannerView?.stop()
        bannerView?.removeFromSuperview()
        bannerView = nil
    }
    bannerView = AvocarrotSDK.shared.loadBanner(with: AVOBannerViewSizeSmall,
                                               adUnitId: "04c447d7-ffb8-4ba1-985e-4d2b9f88cd69",
                                             success: nil,
                                             failure: nil)
    
  2. Add the following code to viewDidAppear and viewWillDisappear methods:
    #import <AvocarrotBanner/AvocarrotSDK+AVOBannerView.h>
    ...
    - (void)viewDidAppear:(BOOL)animated {
        [super viewDidAppear:animated];
        [self.bannerView resumeAutoUpdate];
    }
    - (void)viewWillDisappear:(BOOL)animated {
        [super viewWillDisappear:animated];
        [self.bannerView pauseAutoUpdate];
    }
    
    import AvocarrotBanner
    ...
    override func viewDidAppear(animated: Bool) {
        bannerView?.resumeAutoUpdate()
    }
    override func viewDidDisappear(animated: Bool) {
        bannerView?.pauseAutoUpdate()
    }
    
  3. If you want to switch banner auto-update off:
    self.bannerView.autoUpdate = NO;
    
  4. If you want to stop and remove banner from screen:
    [self.bannerView stop];
    

Standard banner events handling

To process banner events, you should implement blocks or subscribe to notifications:

MethodDescriptionNSNotificationCenter key
(void (^ _Nullable)(void))successCalled after the banner is served successfully.
(void (^ _Nullable)(AVOError *_Nonnull error))failureCalled if the banner was not downloaded.
- (instancetype _Nonnull)onClick:(nullable void (^)(void))blockCalled after a click on a banner. After this event app will be minimized and an external browser will be opened.kAVONotification_BannerClicked


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. Log in to your account and update your payment settings.

Was this article useful?