Native Ads

This document outlines the high level requirements for native ads integration.

Native ads let you easily monetize your app in a way that’s consistent with its existing design. The MoPub SDK gives you access to an ad’s individual assets so you can design the ad layout to be consistent with the look and feel of your app. The SDK automatically handles image caching and metrics tracking so you can focus on how, when, and where to display ads.

Prerequisites

Before integrating native ads into your app, ensure you have completed the following items:

  1. Read the Best Practices page for guidelines on how native ads can be displayed in your app.
  2. Follow the iOS Getting Started Guide, create an account on MoPub and integrate the MoPub SDK into your project.

Choose an Integration Method

MoPub offers two integration methods for native ads:

Ad Placer

This apporach automatically wraps the TableView and CollectionView data source and delegate, takes fewer than 10 lines of code to integrate and allows you to control the location of the ad from the MoPub interface.

You can view the ad placer native ads integration document here.

Manual

This apporach is best for cases where you want to insert an ad into something other than a TableView or CollectionView. With the manual integration, you have to manually request and receive ads, handle caching and handle not showing empty spaces in case the ad request doesn’t fill.

You can view the manual native ads integration document here.

Ad Placer

This document describes how to incorporate native advertisements into your application with the ad placer products. If can be completed in 3 steps:

  1. Define the layout of your ad
  2. Place and load ads into your stream
  3. Replace table and collection view methods with mp versions

Define the Layout of Your Ad

Each native ad format is rendered onto a view by a renderer that conforms to the MPNativeAdRenderer protocol. Renderers can be customized through their associated settings objects that conform to the MPNativeAdRendererSettings protocol.

You must implement and provide a viewSizeHandler block to your renderer settings object in order to ensure that your views are sized correctly.

Renderers and their settings are tied together in the MPNativeAdRendererConfiguration object which is used when initializing your ad placer objects.

Most renderers require you to supply a UIView subclass that adopts the MPNativeAdRenderingProtocol protocol to the renderer’s settings object.

Advertising content can be displayed in any new or existing UIView subclass that implements the MPNativeAdRendering protocol. The protocol allows you to specify what elements of your UI should be used for each native ad element.

The native ad renderer associated with your ad will ask your view for a UI element via protocol methods for each native ad element. Typically, a native ad has a base set of assets (as configured on the MoPub website):

  • title
  • main text
  • call-to-action text
  • icon image URL
  • main image URL
  • privacy information icon

The MoPub SDK automatically handles tap events on the privacy information icon. You are required to display a privacy information icon in your view.

// YourNativeAdView.h

@interface YourNativeAdView : UIView <MPNativeAdRendering>

@property (strong, nonatomic) UILabel *titleLabel;
@property (strong, nonatomic) UILabel *mainTextLabel;
@property (strong, nonatomic) UILabel *callToActionLabel;
@property (strong, nonatomic) UIImageView *iconImageView;
@property (strong, nonatomic) UIImageView *mainImageView;
@property (strong, nonatomic) UIImageView *privacyInformationIconImageView;

@end

// YourNativeAdView.m

@implementation YourNativeAdView



- (void)layoutSubviews
{
    [super layoutSubviews];
    // layout your views
}

- (UILabel *)nativeMainTextLabel
{
    return self.mainTextLabel;
}

- (UILabel *)nativeTitleTextLabel
{
    return self.titleLabel;
}

- (UILabel *)nativeCallToActionTextLabel
{
    return self.callToActionLabel;
}

- (UIImageView *)nativeIconImageView
{
    return self.iconImageView;
}

- (UIImageView *)nativeMainImageView
{
    return self.mainImageView;
}

- (UIImageView *)nativePrivacyInformationIconImageView
{
    return self.privacyInformationIconImageView;
}

@end

(Optional) Rendering Custom Assets for Direct-Sold Ads

When creating a direct-sold ad creative on the MoPub website, you have the option of adding custom assets to supplement the pre-defined ones described above. The SDK will call layoutCustomAssetsWithProperties:imageLoader: on your view that implements MPNativeAdRendering giving you an opportunity to display custom assets within your view.

The example below demonstrates how to access custom text that you have provided:

- (void)layoutCustomAssetsWithProperties:(NSDictionary *)customProperties imageLoader:(MPNativeAdRenderingImageLoader *)imageLoader
{
    self.customTextLabel.text = customProperties[@"customText"];

    // To load custom images, you can use the imageLoader's convenience method -loadImageForURL:intoImageView:.
    [imageLoader loadImageForURL:[NSURL URLWithString:customProperties[@"customImage"]] intoImageView:self.customImageView];
}

MPNativeAdRendering class documentation available here.

Optional method + (UINib *)nibForAd must be implemented if you use a nib for your native ad view.

Place and load ads (via UITableView)

The MoPub SDK provides a helper class, MPTableViewAdPlacer, that handles requesting ads from MoPub and inserting them into your existing UITableView subclass.

When an instance of MPTableViewAdPlacer is initialized with a table view, it wraps the table view’s data source and delegate in order to insert ads and adjust the positions of your regular content cells.

In your UITableView feed UIViewController’s viewDidLoad

  1. Create and configure an MPStaticNativeAdRendererSettings object with a viewSizeHandler implementation and a rendering view class that adheres to the MPNativeAdRendering protocol.

     MPStaticNativeAdRendererSettings *settings = [[MPStaticNativeAdRendererSettings alloc] init];
    
     settings.renderingViewClass = [YourNativeAdView class]; settings.viewSizeHandler = ^(CGFloat maxWidth) { return CGSizeMake(maxWidth, 312.0f); };
    
  2. Call rendererConfigurationWithRendererSettings: on the renderer you are using with your settings to create an MPNativeAdRendererConfiguration object.

     MPNativeAdRendererConfiguration *config = [MPStaticNativeAdRenderer rendererConfigurationWithRendererSettings:settings];
    
  3. Set up your preferred ad positioning in the MoPub UI in the ad unit settings page. The ad placer will automatically use the positioning it receives from those settings. If you wish to set up ad positioning through code in your app, follow the steps outlined here.

  4. Instantiate your MPTableViewAdPlacer with your UITableView instance and an array containing you renderer configuration. Make sure to set your view controller as the ad placer’s delegate.

     self.placer = [MPTableViewAdPlacer placerWithTableView:self.tableView viewController:self rendererConfigurations:@[config]];
     self.placer.delegate = self;
    

    self.tableView is the UITableView that contains your feed.

  5. Add targeting parameters to provide more information about your ad to the advertiser, and conserve bandwidth by getting only the right assets.

     MPNativeAdRequestTargeting *targeting = [MPNativeAdRequestTargeting targeting];
     targeting.desiredAssets = [NSSet setWithObjects:kAdIconImageKey, kAdMainImageKey, kAdCTATextKey, kAdTextKey, kAdTitleKey, nil];
    

    See more details on passing information like location in our Data Passing doc.

  6. Instruct your MPTableViewAdPlacer instance to begin loading ads and placing them into your feed, using the ad unit ID you created in the MoPub dashboard.

     [self.placer loadAdsForAdUnitID:@"YOUR_ADUNIT_ID" targeting:targeting];
    

    To test your implementation, you can also use the test ad unit ID: here. It will always return a static MoPub native creative.

  7. Replace UITableView Method Calls Replace calls to the following UITableView methods with the MoPub SDK category equivalents.

    Instead of:

     [self.tableView selectRowAtIndexPath:myIndexPath];
    

    Use:

     [self.tableView mp_selectRowAtIndexPath:myIndexPath];
    

    These methods work just like the regular UITableView methods, except that they make adjustments to the NSIndexPath parameters to handle the fact that your stream has extra ad rows.

    IMPORTANT: The following replacements are mandatory. If you skip this step, you will see problems related to your content row positions being out of sync with your table view.

    ORIGINAL REPLACEMENT
    setDelegate: mp_setDelegate:
    delegate mp_delegate
    setDataSource: mp_setDataSource:
    dataSource mp_dataSource
    reloadData mp_reloadData
    rectForRowAtIndexPath: mp_rectForRowAtIndexPath:
    indexPathForRowAtPoint: mp_indexPathForRowAtPoint:
    indexPathForCell: mp_indexPathForCell:
    indexPathsForRowsInRect: mp_indexPathsForRowsInRect:
    cellForRowAtIndexPath: mp_cellForRowAtIndexPath:
    visibleCells mp_visibleCells
    indexPathsForVisibleRows: mp_indexPathsForVisibleRows:
    scrollToRowAtIndexPath:atScrollPosition:animated: mp_scrollToRowAtIndexPath:atScrollPositions:animated:
    beginUpdates mp_beginUpdates
    endUpdates mp_endUpdates
    insertSections:withRowAnimation: mp_insertSections:withRowAnimation:
    deleteSections:withRowAnimation: mp_deleteSections:withRowAnimation:
    reloadSections:withRowAnimation: mp_reloadSections:withRowAnimation:
    moveSection:toSection: mp_moveSection:toSection:
    insertRowsAtIndexPaths:withRowAnimation: mp_insertRowsAtIndexPaths:withRowAnimation:
    deleteRowsAtIndexPaths:withRowAnimation: mp_deleteRowsAtIndexPaths:withRowAnimation:
    reloadRowsAtIndexPaths:withRowAnimation: mp_reloadRowsAtIndexPaths:withRowAnimation:
    moveRowAtIndexPath:toIndexPath: mp_moveRowAtIndexPath:toIndexPath:
    indexPathForSelectedRow: mp_indexPathForSelectedRow:
    indexPathsForSelectedRows: mp_indexPathsForSelectedRows:
    selectRowAtIndexPath:animated:scrollPosition: mp_selectRowAtIndexPath:animated:scrollPosition:
    deselectRowAtIndexPath:animated: mp_deselectRowAtIndexPath:animated:
    dequeueReusableCellWithIdentifier:forIndexPath: mp_dequeueReusableCellWithIdentifier:forIndexPath:

Example Code:

- (void)viewDidLoad
{
    [super viewDidLoad];

    [self startLoadingFeed];

    MPStaticNativeAdRendererSettings *settings = [[MPStaticNativeAdRendererSettings alloc] init];
    settings.renderingViewClass = [YourNativeAdView class];
    settings.viewSizeHandler = ^(CGFloat maximumWidth) {
        return CGSizeMake(maximumWidth, 312.0f);
    };

    MPNativeAdRendererConfiguration *config = [MPStaticNativeAdRenderer rendererConfigurationWithRendererSettings:settings];

    self.placer = [MPTableViewAdPlacer placerWithTableView:self.tableView
                                            viewController:self
                                   rendererConfigurations:@[config]];
    self.placer.delegate = self;
    [self.placer loadAdsForAdUnitID:@"YOUR_ADUNIT_ID"];
}

This will ensure that the ads appear based on the settings in your ad unit settings page.

Place and load ads (via UICollectionView)

The MoPub SDK provides a helper class, MPCollectionViewAdPlacer, that handles requesting ads from MoPub and inserting them into your existing UICollectionView subclass.

When an instance of MPCollectionViewAdPlacer is initialized with a collection view, it wraps the collection view’s data source and delegate in order to insert ads and adjust the positions of your regular content cells.

In your UICollectionView feed’s UIViewController’s viewDidLoad:

  1. Create and configure an MPStaticNativeAdRendererSettings object with viewSizeHandler implementation and a rendering view class that adheres to the MPNativeAdRendering protocol.

     MPStaticNativeAdRendererSettings *settings = [[MPStaticNativeAdRendererSettings alloc] init];
    
     settings.renderingViewClass = [YourNativeAdView class]; settings.viewSizeHandler = ^(CGFloat maxWidth) { return CGSizeMake(70.0f, 113.0f); };
    
  2. Call rendererConfigurationWithRendererSettings: on the renderer you are using with your settings to create an MPNativeAdRendererConfiguration object.

     MPNativeAdRendererConfiguration *config = [MPStaticNativeAdRenderer rendererConfigurationWithRendererSettings:settings];
    
  3. Set up your preferred ad positioning in the MoPub UI in the ad unit settings page. The ad placer will automatically use the positioning it receives from those settings. If you wish to set up ad positioning through code in your app, follow the steps outlined here.

  4. Instantiate your MPCollectionViewAdPlacer with your UICollectionView subclass and your MPServerAdPositioning object. Make sure to set your view controller as the ad placer’s delegate.

     self.placer = [MPCollectionViewAdPlacer placerWithCollectionView:self.collectionView viewController:self rendererConfigurations:@[config]];
     self.placer.delegate = self;
    

    self.collectionView is the UICollectionView that contains your feed.

  5. Add targeting parameters to provide more information about your ad to the advertiser, and conserve bandwidth by getting only the right assets.

     MPNativeAdRequestTargeting *targeting = [MPNativeAdRequestTargeting targeting];
     targeting.desiredAssets = [NSSet setWithObjects:kAdIconImageKey, kAdMainImageKey, kAdCTATextKey, kAdTextKey, kAdTitleKey, nil];
    

    See more details on passing information like location in our Data Passing doc.

  6. Instruct your MPCollectionViewAdPlacer instance to begin loading ads and placing them into your feed, using the ad unit ID you got from the MoPub dashboard.

     [self.placer loadAdsForAdUnitID:@"YOUR_ADUNIT_ID" targeting:targeting];
    

    To test your implementation, you can also use the test ad unit ID: here. It will always return a static MoPub native creative.

  7. Replace UICollectionView Method Calls:

    Replace calls to the following UICollectionView methods with the MoPub SDK category equivalents.

    Instead of:

     [self.collectionView selectItemAtIndexPath:myIndexPath];
    

    Use:

     [self.collectionView mp_selectItemAtIndexPath:myIndexPath];
    

    These methods work just like the regular UICollectionView methods, except that they make adjustments to the NSIndexPath parameters to handle the fact that your stream has extra ad items.

    IMPORTANT: The following replacements are mandatory. If you skip this step, you will see problems related to your content item positions being out of sync with your collection view.

    ORIGINAL REPLACEMENT
    setDelegate: mp_setDelegate:
    delegate mp_delegate
    setDataSource: mp_setDataSource:
    dataSource mp_dataSource
    dequeueReusableCellWithReuseIdentifier:forIndexPath: mp_dequeueReusableCellWithReuseIdentifier:forIndexPath:
    indexPathsForSelectedItems mp_indexPathsForSelectedItems
    selectItemAtIndexPath:animated:scrollPosition: mp_selectItemAtIndexPath:animated:scrollPosition:
    deselectItemAtIndexPath:animated: mp_deselectItemAtIndexPath:animated:
    reloadData mp_reloadData
    layoutAttributesForItemAtIndexPath: mp_layoutAttributesForItemAtIndexPath:
    indexPathForItemAtPoint: mp_indexPathForItemAtPoint:
    indexPathForCell: mp_indexPathForCell:
    cellForItemAtIndexPath: mp_cellForItemAtIndexPath:
    visibleCells mp_visibleCells
    indexPathsForVisibleItems mp_indexPathsForVisibleItems
    scrollToItemAtIndexPath:atScrollPosition:animated: mp_scrollToItemAtIndexPath:atScrollPosition:animated:
    insertSections: mp_insertSections:
    deleteSections: mp_deleteSections:
    reloadSections: mp_reloadSections:
    moveSection:toSection: mp_moveSection:toSection:
    insertItemsAtIndexPaths: mp_insertItemsAtIndexPaths:
    deleteItemsAtIndexPaths: mp_deleteItemsAtIndexPaths:
    reloadItemsAtIndexPaths: mp_reloadItemsAtIndexPaths:
    moveItemAtIndexPath:toIndexPath: mp_moveItemAtIndexPath:toIndexPath:

Example Code:

- (void)viewDidLoad
{
    [super viewDidLoad];

    [self startLoadingFeed];
    MPStaticNativeAdRendererSettings *settings = [[MPStaticNativeAdRendererSettings alloc] init];
    settings.renderingViewClass = [YourNativeAdView class];
    settings.viewSizeHandler = ^(CGFloat maximumWidth) {
        return CGSizeMake(maximumWidth, 77.0f);
    };

    MPNativeAdRendererConfiguration *config = [MPStaticNativeAdRenderer rendererConfigurationWithRendererSettings:settings];

    self.placer = [MPCollectionViewAdPlacer placerWithCollectionView:self.collectionView
                                                      viewController:self
                                             rendererConfigurations:@[config]];
    self.placer.delegate = self;
    [self.placer loadAdsForAdUnitID:self.adUnitID];
}

This will ensure that the ads appear based on your native ad unit settings.

Defining Ad Positions

Next, you’ll need to define where in your feed you’d like ads to appear to balance ads with your content. We provides sever-side and client-side positioning approaches. In which you can specify:

  • Starting positions in the feed where you always want to display ads and
  • Set the interval at which how often an ad should appear

This allows you to achieve the optimal balance of ads for your app without changing your app code or releasing a new version. To set up server-side positioning:

  1. Update your native ad unit settings page. In the example below, your ads will appear in positions 1, 4, and 7 (where 0 is the position of the first ad). After position 7, your ads will appear every 5 positions. Server-Side Positioning

  2. Create an MPServerAdPositioning object. This object informs the MPTableViewAdPlacer about where to place ads within the table view.

     MPServerAdPositioning *positioning = [MPServerAdPositioning positioning];
    

Client-side Positioning

  1. Create an MPClientAdPositioning object. This object informs the MPTableViewAdPlacer about where to place ads within the table view.

     MPClientAdPositioning *positioning = [MPClientAdPositioning positioning];
    
  2. If you want ads to appear at certain fixed positions within your feed, use addFixedIndexPath: to specify those NSIndexPaths.

     [positioning addFixedIndexPath:[NSIndexPath indexPathForRow:1 inSection:0]];
    

    This will ensure that an ad appears at row 1 section 0 of your feed.

  3. Use enableRepeatingPositionsWithInterval: to instruct the MPTableViewAdPlacer to insert ads at the specified interval as more items are loaded into your feed.

     [positioning enableRepeatingPositionsWithInterval:5];
    

    This will ensure that an ad appears as every 5th row in your feed. Note that repeating ads will only be inserted after the last fixed position ad.

Pass in AdPlacer initialization

Initialize your ad placer object with either Server-side or Client-side positioning object:

  • For MPTableViewAdPlacer:

      self.placer = [MPTableViewAdPlacer placerWithTableView:self.tableView viewController:self adPositioning:positioning rendererConfigurations:@[config]];
    
  • For MPCollectionViewAdPlacer:

      self.placer = [MPCollectionViewAdPlacer placerWithCollectionView:self.collectionView viewController:self adPositioning:positioning rendererConfigurations:@[config]];
    

Please ensure you are using the provided APIs to have impressions and clicks be tracked automatically.

Receiving Delegate Callbacks

Both collection view and table view ad placers include optional delegate callbacks that you can use to be notified of events such as when an ad will present a modal, an ad modal dismisses, and when the app will background due to user interaction with an ad.

Manual

This document describes how to manually incorporate native advertisements into your application. It be completed in 3 steps:

  1. Define the layout of your ad
  2. Request the native ad
  3. Render and display your native ad

Essentials

The foundation of the MoPub native ad lies in the four classes:

  • MPNativeAdRequest - provides a simple, block-based interface for asynchronously fetching ads.
  • MPNativeAd - provides an interface for retrieving a rendered native ad view.
  • MPNativeAdRenderer - the base class for all types of renderers that instruct the SDK on how it should render a given native ad format.
  • MPNativeAdRendererConfiguration - links a renderer and its settings to specific ad formats.

Define the Layout of Your Ad

Advertising content can be displayed in any new or existing UIView subclass that implements the MPNativeAdRendering protocol. This protocol allows you to specify what elements of your UI should be used for each native ad element.

The native ad renderer associated with your ad will ask your view for a UI element via protocol methods for each native ad element. Typically, a native ad has a base set of assets (as configured on the MoPub website):

  • title
  • main text
  • call-to-action text
  • icon image URL
  • main image URL

A MoPub native ad also contains an asset for privacy information icons. The MoPub SDK automatically handles tap events on the privacy information icon. You are required to display a privacy information icon in your view.

// YourNativeAdView.h

@interface YourNativeAdView : UIView <MPNativeAdRendering>

@property (strong, nonatomic) UILabel *titleLabel;
@property (strong, nonatomic) UILabel *mainTextLabel;
@property (strong, nonatomic) UILabel *callToActionLabel;
@property (strong, nonatomic) UIImageView *iconImageView;
@property (strong, nonatomic) UIImageView *mainImageView;
@property (strong, nonatomic) UIImageView *privacyInformationIconImageView;

@end

// YourNativeAdView.m

@implementation YourNativeAdView

...

- (void)layoutSubviews
{
    [super layoutSubviews];
    // layout your views
}

- (UILabel *)nativeMainTextLabel
{
    return self.mainTextLabel;
}

- (UILabel *)nativeTitleTextLabel
{
    return self.titleLabel;
}

- (UILabel *)nativeCallToActionTextLabel
{
    return self.callToActionLabel;
}

- (UIImageView *)nativeIconImageView
{
    return self.iconImageView;
}

- (UIImageView *)nativeMainImageView
{
    return self.mainImageView;
}

- (UIImageView *)nativePrivacyInformationIconImageView
{
    return self.privacyInformationIconImageView;
}

@end

(Optional) Rendering Custom Assets for Direct-Sold Ads

When creating a direct-sold ad creative on the MoPub website, you have the option of adding custom assets to supplement the pre-defined ones described above. The SDK will call layoutCustomAssetsWithProperties:imageLoader: on your view that implements MPNativeAdRendering giving you an opportunity to display custom assets within your view.

The example below demonstrates how to layout custom text and a custom image.

- (void)layoutCustomAssetsWithProperties:(NSDictionary *)customProperties imageLoader:(MPNativeAdRenderingImageLoader *)imageLoader
{
    self.customTextLabel.text = customProperties[@"customText"];

    // To load custom images, you can use the imageLoader's convenience method -loadImageForURL:intoImageView:.
    [imageLoader loadImageForURL:[NSURL URLWithString:customProperties[@"customImage"]] intoImageView:self.customImageView];
}

Requesting and Displaying Native Ads

  1. Create and configure an MPStaticNativeAdRendererSettings object with a rendering view class that adheres to the MPNativeAdRendering protocol.

     MPStaticNativeAdRendererSettings *settings = [[MPStaticNativeAdRendererSettings alloc] init];
    
     settings.renderingViewClass = [YourNativeAdView class];
    
  2. Call rendererConfigurationWithRendererSettings: on the renderer you are using with your settings to create an MPNativeAdRendererConfiguration object.

     MPNativeAdRendererConfiguration *config = [MPStaticNativeAdRenderer rendererConfigurationWithRendererSettings:settings];
    
  3. Create an MPNativeAdRequest object using the +requestWithAdUnitIdentifier:rendererConfigurations: method.

     MPNativeAdRequest *adRequest = [MPNativeAdRequest requestWithAdUnitIdentifier:@"YOUR_AD_UNIT_ID" rendererConfigurations:@[config]];
    
  4. Import MPNativeAdConstants.h to enable native ads targeting and set an MPNativeAdRequestTargeting object on the request in order to provide targeting information, such as location and the native ad elements you would like to receive.

     MPNativeAdRequestTargeting *targeting = [MPNativeAdRequestTargeting targeting];
    

    Choose which native ad elements you want to receive from the Marketplace to conserve device bandwidth and provide information about your ad to the Marketplace.

     targeting.desiredAssets = [NSSet setWithObjects:kAdTitleKey, kAdTextKey, kAdCTATextKey, kAdIconImageKey, kAdMainImageKey, kAdStarRatingKey, nil]; //The constants correspond to the 6 elements of MoPub native ads
    

    Optionally, provide the geo-location to the advertiser.

     targeting.location = [self getCurrentLocation]; // developer-provided location
     adRequest.targeting = targeting;
    
  5. Start the request via -startWithCompletionHandler:, providing a completion block to handle the results of the request. If the request is successful, the completion block’s MPNativeAd parameter will represent an object that contains the ad’s assets. You must store a reference to the MPNativeAd object in your view controller. Set your current view controller as the native ad’s delegate and call retrieveAdViewWithError: to get a rendered native ad view. Finally add the rendered view to your view hierarchy.

     [adRequest startWithCompletionHandler:^(MPNativeAdRequest *request, MPNativeAd *response, NSError *error) {
         if (error) {
             // Handle error.
         } else {
             self.nativeAd = response;
             self.nativeAd.delegate = self;
             UIView *nativeAdView = [response retrieveAdViewWithError:nil];
             nativeAdView.frame = self.yourNativeAdViewContainer.bounds;
             [self.yourNativeAdViewContainer addSubview:nativeAdView];
         }
     }];
    
  6. Implement the MPNativeAd delegate method - (UIViewController *)viewControllerForPresentingModalView and return the view controller that you wish to use to present ad modals which is typically self.

Please ensure you are using the provided APIs to have impressions and clicks be tracked automatically.

Receiving Delegate Callbacks

MPNativeAdDelegate includes optional delegate callbacks that you can use to be notified of events such as when an ad will present a modal, an ad modal dismisses, and when the app will background due to user interaction with an ad.

Best Practices

Hide Blank Ad Views

Your application should avoid displaying ad views that have not yet been configured with assets. In addition, it should adapt gracefully when ad requests fail due to lack of inventory or connectivity issues.

For example, if your application displays ads in a table view, you should ensure that failed ad requests do not cause unnecessary blank cells or gaps in the table.

Avoid Excessive Ad Requests

Making requests for ads which are never displayed to the user will consume unnecessary resources and may negatively impact your revenue. Therefore, your application should make an effort to request ads only when they are likely to be displayed. In particular, avoid caching large quantities of ads for long periods of time.

Last updated October 10, 2018

TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.

© 2018 MoPub Inc.