Test Ads

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

Prerequisite

Sample ad units

The quickest way to enable testing is to use Google-provided test 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. Here are sample ad units that point to specific test creatives for each format:

Ad format Sample ad unit ID
Banner /6499/example/banner
Interstitial /6499/example/interstitial
Rewarded Video /6499/example/rewarded-video
Custom Rendering /6499/example/native
Custom Rendering Video /6499/example/native-video

Enable test devices

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.

Add 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, call:
    request.testDevices = @[ @"2077ef9a63d2b398840261c8221a0c9b" ];
    Copy your test device ID to your clipboard.
  3. Modify your code to set testDevices on your DFPRequest with your test device ID. This method takes an array of device IDs.

    Swift

    let request = DFPRequest()
    request.testDevices = [ "2077ef9a63d2b398840261c8221a0c9b" ] // Sample device ID
    

    Objective-C

    DFPRequest *request = [DFPRequest request];
    request.testDevices = @[ @"2077ef9a63d2b398840261c8221a0c9b" ]; // Sample device ID
  4. Re-run your app. If the ad is a Google ad, you'll see a Test Ad label centered at the top of the ad (banner, interstitial, or rewarded video):

    For native advanced ads, the headline asset is prepended with the string "Test Ad".

Ads with this Test Ad label are safe to click. Requests, impressions, and clicks on test ads will not show up in your account's reports.

Testing with mediation

Google's sample ad units only show Google ads. To test your mediation configuration, you must use the enable test devices approach.

Mediated ads do NOT render a Test Ad label. You are responsible for ensuring that test ads are 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 for more information.

If you aren't sure whether a mediation ad network adapter supports test ads, it is safest to avoid clicking on ads from that network during development. You can use the adNetworkClassName property on any of the ad formats to figure out which ad network served the current ad.

Send feedback about...

Mobile Ads SDK for iOS
Mobile Ads SDK for iOS
Need help? Visit our support page.