Publisher/Code
Quick Start
1. Serve Ads
Maximize Fill Rate
Reference Links
Jump to:
Step 1: Serve Ads in fewer than 10 minutes
You can serve interstitial and banner ads very quickly and with little effort using Flurry AppSpot. The following 3 steps are common to all ad types served through Flurry AppSpot.
- Download the Flurry iOS SDK. This download will contain both the Flurry Analytics and Flurry AppSpot modular libraries
- Add the Flurry Analytics and AppSpot libs to your project by dragging the Flurry/ and FlurryAds/ folders into your project’s file folder (NOTE: If you are upgrading the Flurry iOS SDK, be sure to remove all existing Flurry library folders before starting.).
- Incorporate the following two lines of Flurry code:
#import "Flurry.h"
#import "FlurryAds.h"
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[Flurry startSession:@"YOUR_API_KEY"];
// Pointer to your rootViewController
[FlurryAds initialize:window.rootViewController];
// Your code
}
#import "Flurry.h" #import "FlurryAds.h" - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [Flurry startSession:@"YOUR_API_KEY"]; // Pointer to your rootViewController [FlurryAds initialize:window.rootViewController]; // Your code }
Display Interstitials
This section will show an example interstitial integration. The basic steps involve fetching an ad, checking if the ad is available, followed by displaying the ad.
/**
* You can integrate interstitials in any placement in your app, but for
* testing purposes we present integration within your ViewController
*/
#import "FlurryAdDelegate.h"
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// Register yourself as a delegate for ad callbacks
[FlurryAds setAdDelegate:self];
// Fetch fullscreen ads early when a later display is likely. For
// example, at the beginning of a level.
[FlurryAds fetchAdForSpace:@”INTERSTITIAL_MAIN_VIEW”
frame:self.view.frame size:FULLSCREEN];
}
-(void) viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
// Reset delegate
[FlurryAds setAdDelegate:nil];
}
/**
* Invoke a takeover at a natural pause in your app. For example, when a
* level is completed, an article is read or a button is pressed. We will
* mock the display of a takeover when a button is pressed.
*/
-(IBAction) showFullScreenAdClickedButton:(id)sender {
// Check if ad is ready. If so, display the ad
if ([FlurryAds adReadyForSpace:@"INTERSTITIAL_MAIN_VIEW"]) {
[FlurryAds displayAdForSpace:@"INTERSTITIAL_MAIN_VIEW"
onView:self.view];
} else {
// Fetch an ad
[FlurryAds fetchAdForSpace:@"INTERSTITIAL_MAIN_VIEW"
frame:self.view.frame size:FULLSCREEN];
}
}
/*
* It is recommended to pause app activities when an interstitial is shown.
* Listen to should display delegate.
*/
- (BOOL) spaceShouldDisplay:(NSString*)adSpace interstitial:(BOOL)
interstitial {
if (interstitial) {
// Pause app state here
}
// Continue ad display
return YES;
}
/*
* Resume app state when the interstitial is dismissed.
*/
- (void)spaceDidDismiss:(NSString *)adSpace interstitial:(BOOL)interstitial {
if (interstitial) {
// Resume app state here
}
}
/** * You can integrate interstitials in any placement in your app, but for * testing purposes we present integration within your ViewController */ #import "FlurryAdDelegate.h" - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; // Register yourself as a delegate for ad callbacks [FlurryAds setAdDelegate:self]; // Fetch fullscreen ads early when a later display is likely. For // example, at the beginning of a level. [FlurryAds fetchAdForSpace:@”INTERSTITIAL_MAIN_VIEW” frame:self.view.frame size:FULLSCREEN]; } -(void) viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; // Reset delegate [FlurryAds setAdDelegate:nil]; } /** * Invoke a takeover at a natural pause in your app. For example, when a * level is completed, an article is read or a button is pressed. We will * mock the display of a takeover when a button is pressed. */ -(IBAction) showFullScreenAdClickedButton:(id)sender { // Check if ad is ready. If so, display the ad if ([FlurryAds adReadyForSpace:@"INTERSTITIAL_MAIN_VIEW"]) { [FlurryAds displayAdForSpace:@"INTERSTITIAL_MAIN_VIEW" onView:self.view]; } else { // Fetch an ad [FlurryAds fetchAdForSpace:@"INTERSTITIAL_MAIN_VIEW" frame:self.view.frame size:FULLSCREEN]; } } /* * It is recommended to pause app activities when an interstitial is shown. * Listen to should display delegate. */ - (BOOL) spaceShouldDisplay:(NSString*)adSpace interstitial:(BOOL) interstitial { if (interstitial) { // Pause app state here } // Continue ad display return YES; } /* * Resume app state when the interstitial is dismissed. */ - (void)spaceDidDismiss:(NSString *)adSpace interstitial:(BOOL)interstitial { if (interstitial) { // Resume app state here } }
Display Banners
The following section will illustrate the method to show banners within your app.
/**
* Banners can be displayed with a single method. Here we will show how you
* would display banners when a view appears and remove it when the view
* disappears.
*/
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// Fetch and display banner ad
[FlurryAds fetchAndDisplayAdForSpace:@”BANNER_MAIN_VIEW”
view:self.view size:BANNER_BOTTOM];
}
-(void) viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
// Reset delegate
[FlurryAds removeAdFromSpace:@"BANNER_MAIN_VIEW"];
}
/** * Banners can be displayed with a single method. Here we will show how you * would display banners when a view appears and remove it when the view * disappears. */ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; // Fetch and display banner ad [FlurryAds fetchAndDisplayAdForSpace:@”BANNER_MAIN_VIEW” view:self.view size:BANNER_BOTTOM]; } -(void) viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; // Reset delegate [FlurryAds removeAdFromSpace:@"BANNER_MAIN_VIEW"]; }


