Ad code implementation
If no Google ads are available for your ad unit
You can choose what happens to your ad unit if Google has no targeted ads are available. By default, Google will try to collapse the ad space on your page or if that's not possible show a blank space. Alternatively, you can choose to display a solid color or another HTML page. This way, you can make sure that your advertising space is always being used effectively.
When you create or edit an ad unit, in the "If no ads available" section, choose one of the following options:
- Collapse the ad unit, otherwise show blank space
This is the default option.
- Collapse the ad unit, otherwise show color
You can effectively make your unfilled ad unit disappear by matching its color to the background color of your page. You can either use the color picker or enter a hexadecimal color code.
- Show other URL
Show a static image
To show a static image, enter the URL of your image, including
http://and ending with the image file name. For example:
Make sure your image has the same dimensions as the ad format that will display it. For example, if you're creating an image for a 240x120 ad format, make sure your image is also 240 pixels by 120 pixels. If your image is larger it will be cropped at the right and bottom edges.
Show a clickable image
To show a clickable image, enter the full URL of the HTML page that contains the information to load your image, as well as the hyperlink code. For example:
Here's an example page with the HTML code for a clickable image. To create your own code, make sure you:
- Use an absolute URL: An absolute URL is one that includes the entire, fully-defined path.
target="_top": This tells your browser which window to use when loading the destination page of your clickable image. If you don't include this tag, your browser will try to load your destination within the ad format itself.
Your HTML page can be hosted anywhere online, as long as it's accessible from the internet.
Note that you can't specify Google ads as your other URL option.