This guide is intended for publishers who want to use AdMob to monetize an iOS app that's built with Firebase. If you don't plan to include Firebase in your app, see the standalone AdMob version of this guide instead.
Importing and initializing the Google Mobile Ads SDK is the first step toward displaying AdMob ads and earning revenue. Once that's done, you can choose an ad format (such as native or rewarded video) and get a detailed set of steps for implementing it.
Prerequisites
- Install the Firebase SDK.
- Create an AdMob account and register an app.
- Link the app to a Firebase project.
Import the Mobile Ads SDK
Add the dependencies for the Mobile Ads SDK to your project's podfile:
pod 'Firebase/Analytics'
pod 'Firebase/AdMob'
Then from the command line run:
pod install --repo-update
Update your Info.plist
In your app's Info.plist file, add a GADApplicationIdentifier key with a
string value of your AdMob app ID.
You can make this change programmatically:
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>
Or, edit it in the property list editor:

Initialize mobile ads
Before loading ads, call the startWithCompletionHandler: method on the
GADMobileAds.sharedInstance,
which initializes the SDK and calls back a completion handler once
initialization is complete (or after a 30-second timeout). This only needs to be
done once, ideally at app launch. You should call startWithCompletionHandler:
as early as possible.
Here's an example of how to call the startWithCompletionHandler: method in
your AppDelegate:
Swift
import Firebase
...
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Use Firebase library to configure APIs.
FirebaseApp.configure()
// Initialize the Google Mobile Ads SDK.
GADMobileAds.sharedInstance().start(completionHandler: nil)
return true
}
}
Objective-C
@import Firebase;
...
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Use Firebase library to configure APIs.
[FIRApp configure];
// Initialize the Google Mobile Ads SDK.
[[GADMobileAds sharedInstance] startWithCompletionHandler:nil];
return YES;
}
@end
Choose an ad format
The Mobile Ads SDK is now imported and initialized, and you're ready to implement an ad. AdMob offers a number of different ad formats, so you can choose the one that best fits your app's user experience.
Banner
Banner ads are rectangular image or text ads that occupy a spot within an app's layout. They stay on screen while users are interacting with the app, and can refresh automatically after a certain period of time. If you're new to mobile advertising, they're a great place to start.
Interstitial
Interstitials are full-screen ads that cover the interface of an app until closed by the user. They're best used at natural pauses in the flow of an app's execution, such as in between levels of a game or just after completing a task.
Native
Native is a component-based ad format that gives you the freedom to customize the way assets like headlines and calls to action are presented in their apps. By choosing fonts, colors, and other details for yourself, you can create natural, unobtrusive ad presentations that can add to a rich user experience.
Native is currently in a closed beta with a limited group of publishers.
Rewarded Video
Rewarded video ads are full screen video ads that users have the option of watching in full in exchange for in-app rewards.

