Inline Ads

Inline Ads, commonly referred to as “banners” or “rectangles”, are ad units that appear inline with other app content. Inline Ads are often found at the top or bottom of your screen while reading articles and searching through content. We recommend using Inline Ads on both smartphones and tablets in cases where the user is reading and/or interacting with content on the same screen for a period of time.

New in SDK 6, Lightbox Video!

With SDK 6, inline ad placements are capable of displaying a custom new ad unit called Lightbox. This ad unit takes advantage of native device functionality and gives publishers access to video demand historically only found with interstitial inventory. These new units are desirable to advertisers and provide a premium eCPM for publishers without any additional integration work. To ensure a placement is able to receive these ads, please reach out to your Millennial Media Account Manager or our support team.

Basic Integration

NOTE: Items in source like <YOUR_PLACEMENT_ID> must be replaced with your information.

1. Add the following code to your view controller’s header (.h) file.
#import <UIKit/UIKit.h>
#import <MMAdSDK/MMAdSDK.h>

// This code will automatically determine the size of your device and display the appropriate ad size. 
#define MILLENNIAL_BANNER_AD_SIZE ((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) ? MMInlineAdSizeLeaderboard : MMInlineAdSizeBanner)

@interface ViewController : UIViewController <MMInlineDelegate>

@property (strong, nonatomic) MMInlineAd *inlineAd;

@end
2. Add the following code to the appropriate place in your view controller’s .m file.
- (void)viewDidLoad {
    [super viewDidLoad];

    self.inlineAd = [[MMInlineAd alloc] initWithPlacementId:@"<YOUR_PLACEMENT_ID>"
                                                     adSize:MILLENNIAL_BANNER_AD_SIZE]; 
    self.inlineAd.delegate = self;
    [self.view addSubview:self.inlineAd.view];
    [self.inlineAd request:nil];
}

- (UIViewController *)viewControllerForPresentingModalView {
    return self;
}

- (void)dealloc {
   [_inlineAd removeFromSuperview];
   _inlineAd.delegate = nil;
   _inlineAd = nil;
}

Additional Topics