• Google Publisher Tag
Guides Reference Samples
  • Google Publisher Tag
  • Guides
  • Reference
  • Samples
  • Overview
  • Basic samples
    • Configure cookie options
    • Configure personalized ads
    • Configure privacy settings
    • Display a test ad
    • Display a web interstitial ad
    • Display an out-of-page ad
  • Advanced samples
    • Collapse empty ad slots
    • Event-based ad requests
    • Lazy loading
    • Refresh ad slots
    • Tag pages with infinite content
  • Home
  • Products
  • Google Publisher Tag
  • Samples

Display a test ad

This example displays a test ad using the Google Publisher Tag library. See Get Started with Google Publisher Tags to learn more about how this sample works.

Sample implementation

View demo
Improve this sample Report an issue

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2021-01-14 UTC.

  • Connect

    • Blog
    • Facebook
    • Medium
    • Twitter
    • YouTube
  • Programs

    • Women Techmakers
    • Google Developer Groups
    • Google Developers Experts
    • Accelerators
    • Developer Student Clubs
  • Developer consoles

    • Google API Console
    • Google Cloud Platform Console
    • Google Play Console
    • Firebase Console
    • Actions on Google Console
    • Cast SDK Developer Console
    • Chrome Web Store Dashboard
Google Developers
  • Android
  • Chrome
  • Firebase
  • Google Cloud Platform
  • All products
  • Terms
  • Privacy
  • Sign up for the Google Developers newsletter Subscribe