<br />

The Google Mobile Ads SDK supports monetizing your apps with an [Ad Exchange
property](https://support.google.com/admanager/answer/6321605). This guide shows you
how to configure your apps for all ad formats supported by Ad Exchange.

## Prerequisites

- [Complete the
  prerequisites](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/quick-start#app_prerequisites).
- [Import the Google Mobile Ads
  SDK](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/quick-start#import_the_mobile_ads_sdk).
- [Update your
  `Info.plist`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/quick-start#update_your_infoplist).

## Configure your app for accessing Ad Exchange

Update your app's Info.plist file to set the `GADApplicationIdentifier` key with
a string value of your Ad Manager app ID ([identified in the Ad Manager
UI](https://support.google.com/admanager/answer/1656921)).

Note also that failure to set the `GADApplicationIdentifier` key in the
info.plist file as shown above results in a crash with the message:

    Terminating app due to uncaught exception 'GADInvalidInitializationException',
    reason: 'The Google Mobile Ads SDK was initialized without an application ID.
    Google AdMob publishers, follow instructions at
    https://goo.gle/admob-ios-update-plist to set a valid
    application ID. Google Ad Manager publishers, follow instructions at
    https://goo.gle/ad-manager-ios-update-plist.'

Next, you can [select an ad
format](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/quick-start#select_an_ad_format) to
display. The rest of this guide implements the [banner
format](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/banner) to illustrate how you
can load an ad from Ad Exchange. The same steps can apply to any ad formats
supported by the Google Mobile Ads SDK.

## Load an ad from Ad Exchange

You can use an Ad Exchange web property code with a trailing forward slash, in
place of an ad unit ID. For example, `ca-mb-app-pub-5629679302779023/`.

<br />

In order to load and display banner ads, `GAMBannerView` requires an `adUnitID`.
You can set this property to an Ad Exchange web property ID as follow:

```objective-c
override func viewDidLoad() {
  super.viewDidLoad()
  ...

  bannerView.adUnitID = "ca-mb-app-pub-5629679302779023/"
  bannerView.rootViewController = self
}
```

<br />

Once the `GAMBannerView` is in place and its properties configured, you can
[load an ad](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/banner.md.txt#load_an_ad) and customize the
behavior of your ad using [ad
events](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/banner#ad_events).

Note that failure to add a trailing forward slash to the Ad Exchange web
property code results in an ad request error with the message:

    Invalid Request. Cannot determine request type. Is your ad unit id correct?

You can also convert an Ad Exchange web property code into an ad unit.
Afterwards, use the Ad Manager UI to [generate an Ad Exchange
Tag](https://support.google.com/admanager/answer/7501422) and copy it into your
app. The generated tag should have the Ad Exchange web property code, followed
by descendant ad unit IDs without a trailing forward slash, for example:
`ca-mb-app-pub-5629679302779023/banner`.

That's it! Your app is now ready to load and display banner ads from Ad Exchange.

In addition, you can use an Ad Exchange web property to load and display other
ad formats from Ad Exchange by following respective guides:

- [Interstitial](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/quick-start.md.txt#interstitial)
- [Native](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/quick-start.md.txt#native)
- [Rewarded](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/quick-start.md.txt#rewarded)

## (Approved European publishers only) Add price floors

You can [submit a request for the "Price floors"
feature](https://support.google.com/admanager/answer/7501422#submit-request).

Once approved, you can include a public floor or private floor in the ad request
using the `pubf` and `pvtf` parameters respectively. In the following code
example, replace "123" with the floor prices in micros and your [network's
default currency](https://support.google.com/admanager/answer/177495). Example of how
micros are applied: if your default currency is USD, entering "6000000" is the
equivalent of $6.00.

### Swift

```swift
let extras = AdNetworkExtras()
extras.additionalParameters = ["pubf": "123", "pvtf": "123"]

let request = AdManagerRequest()
request.register(extras)
```

### Objective-C

```objective-c
GADAdNetworkExtras *extras = [[GADAdNetworkExtras alloc] init];
extras.additionalParameters = @{@"pubf": @"123", @"pvtf": @"123"};

GAMRequest *request = [GAMRequest request];
[request registerAdNetworkExtras:extras];
```