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 AdMob account, so there's no risk of your account generating invalid traffic when using these ad units. Here are sample ad units for each format:

Ad format Sample ad unit ID
Banner ca-app-pub-3940256099942544/6300978111
Interstitial ca-app-pub-3940256099942544/1033173712
Rewarded Video ca-app-pub-3940256099942544/1712485313
Native Advanced ca-app-pub-3940256099942544/2247696110
Native Express (Small template): ca-app-pub-3940256099942544/4270592515
(Large template): ca-app-pub-3940256099942544/8897359316

These ad units point to specific test creatives.

Enable test devices

The alternative way of serving test ads is to keep your regular ad unit ID, but configure your device as a test device. When a device is configured as a test device, the Google Mobile Ads SDK automatically substitutes in the aforementioned sample ad unit ID, limiting that device to receiving test ads.

Follow the steps below to configure 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 = @[ kGADSimulatorID ];
    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. To enable test ads for simulators, pass kGADSimulatorID as a test device:

Swift

let request = GADRequest()
request.testDevices = [ kGADSimulatorID,                       // All simulators
                        "2077ef9a63d2b398840261c8221a0c9b" ];  // Sample device ID

Objective-C

GADRequest *request = [GADRequest request];
request.testDevices = @[ kGADSimulatorID,                       // All simulators
                         @"AC98C820A50B4AD8A2106EDE96FB87D4" ]; // Sample device ID

Send feedback about...

AdMob for iOS
AdMob for iOS
Need help? Visit our support page.