Test Ads

This guide explains how to enable test ads in your ads integration. It is important to enable test ads during development so that you can click on them without charging Google advertisers. If you click on too many ads without being in test mode, you risk your account being flagged for invalid activity.

There are two ways to get test ads:

  1. Use one of Google's sample ad units.
  2. Use your own ad unit and enable test devices.

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 Exchange 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 ca-app-pub-3940256099942544/2934735716
Interstitial ca-app-pub-3940256099942544/4411468910
Rewarded Video /6499/example/rewarded-video-backfill
Native /6499/example/native-backfill

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 Exchange 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 GADRequest with your test device ID. This method takes an array of device IDs.

    Swift

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

    Objective-C

    GADRequest *request = [GADRequest 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.

Send feedback about...

Google Mobile Ads SDK for Ad Exchange iOS Apps
Need help? Visit our support page.