<br />

This guide explains how to receive test ads for your ads integration. It's
recommended that you use test ads during development so you can test
clickthrough behavior without affecting your reservation campaigns' stats or
charging advertisers.

## Prerequisite

Before you continue, [set up Google Mobile Ads SDK](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/quick-start.md.txt).

## Demo ad units

The quickest way to enable testing is to use Google-provided demo ad units.
These ad units are not associated with your Ad Manager
account, so there's no risk of your account generating invalid traffic when
using these ad units.

> [!IMPORTANT]
> **Key Point:** Make sure you replace these IDs with your own ad unit ID before publishing your app.

Here are demo ad units that point to specific test creatives for each format:

| Ad format | Demo ad unit ID |
|---|---|
| [App Open](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/app-open.md.txt) | `/21775744923/example/app-open` |
| [Anchored Adaptive Banner](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/banner.md.txt) | `/21775744923/example/adaptive-banner` |
| [Inline Adaptive Banner](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/banner/inline-adaptive.md.txt) | `/21775744923/example/adaptive-banner` |
| [Fixed Size Banner](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/banner/fixed-size.md.txt) | `/21775744923/example/fixed-size-banner` |
| [Interstitial](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/interstitial.md.txt) | `/21775744923/example/interstitial` |
| [Rewarded Ads](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/rewarded.md.txt) | `/21775744923/example/rewarded` |
| [Rewarded Interstitial](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/rewarded-interstitial.md.txt) | `/21775744923/example/rewarded-interstitial` |
| [Native](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/native.md.txt) | `/21775744923/example/native` |
| [Native Video](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/native/video-ads.md.txt) | `/21775744923/example/native-video` |
| [Picture-in-picture](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/picture-in-picture.md.txt) | `/21775744923/example/picture-in-picture` |

Key Point: These demo ad units are configured to serve direct-sold ads in Ad Manager, and direct-sold ads do not return AdChoices.

## Enable test devices (Test mode)

If you want to do more rigorous testing with production-looking ads, you can
now configure your device as a test device and use your own ad unit IDs that
you've created in the Ad Manager UI.


Follow the steps below to add your device as a test device.

> [!IMPORTANT]
> **Key Point:** iOS simulators are automatically configured as test devices.

### Add your test device programmatically

If you want to test ads in your app as you're developing, follow the
steps below to programmatically register your test device.

1. Load your ads-integrated app and make an ad request.
2. Check the console for a message that looks like this:

   ```
   <Google> To get test ads on this device, set:
   GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers =
   @[ @"2077ef9a63d2b398840261c8221a0c9b" ];
   ```
   Copy your test device ID to your clipboard.
3. Modify your code to set the test device ID through
   [`testDeviceIdentifiers`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GADRequestConfiguration.md.txt#testdeviceidentifiers):

   ### Swift

   ```swift
   let testDeviceIdentifiers = ["2077ef9a63d2b398840261c8221a0c9b"]
   MobileAds.shared.requestConfiguration.testDeviceIdentifiers = testDeviceIdentifiers
   ```

   ### Objective-C

   ```objective-c
   NSArray *testDeviceIdentifiers = @[ @"2077ef9a63d2b398840261c8221a0c9b" ];
   GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers = testDeviceIdentifiers;
   ```

   > [!CAUTION]
   > **Caution:** Be sure to remove the code that sets these test devices before you release your app.

4. Re-run your app. If the ad is a Google ad, you'll see a **Test mode** label
   centered at the top of the ad (banner, interstitial, or rewarded ad):

   ![](https://developers.google.com/static/admob/images/ios-testad-0-admanager.png)

   > [!NOTE]
   > **Note:** To see the **Test mode** label, you need to be using an SDK version of 7.59.0 or higher. In versions 7.26.0 to 7.58.0 the label will say Test Ad.

   For native advanced ads, the headline asset is prepended with the string
   **Test mode**.

   ![](https://developers.google.com/static/admob/images/native-testad-ios.png)

Ads with this **Test mode** label are safe to click. Requests, impressions, and
clicks on ads in test mode won't show up in your account's reports.

> [!NOTE]
> **Note:** Mediated ads do *NOT* render a **Test mode** label. See the following section for details.

## Testing with mediation

Google's demo ad units only show Google ads. To test your mediation
configuration, you must use the [enable test devices](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/test-ads.md.txt#enable_test_devices)
approach.

Mediated ads do *not* render a **Test mode** label. You are responsible for
ensuring that test mode is enabled for each of your mediation networks so that
these networks don't flag your account for invalid activity. See each network's
respective [mediation guide](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/mediation.md.txt) for
more information.

If you aren't sure whether a mediation ad network adapter provides a test mode,
it is safest to avoid clicking on ads from that network during development. You
can use the
[`adNetworkClassName`](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GADBannerView.md.txt#adnetworkclassname)
property on any of the ad formats to figure out which ad network served the
current ad.