Ad code implementation
If no targeted ads are available for your page, Google will show a transparent space instead of ads. However, you can set up backup ads to display a color, image, HTML page, or ad server if Google isn't able to show targeted ads. This way, you can make sure that your advertising space is always being used effectively.
While creating or editing an ad unit on your My ads page, you can specify any of the following as a backup ad:
- Color: You can effectively make your ad unit disappear by matching the backup ad color to the background color of your page. When customizing your ad unit settings, in the "Backup ads" section, click the Fill space with a solid color. Then enter any hexadecimal color code or use our simple color picker.
- Image: You can use any static image as your backup ad. In the "Backup ads" section, select Show ads from another URL and enter the URL of the image in the text box, including
http://and ending with the image file name. For example:
When you're creating the image, make sure that the dimensions are the same as the ad format that will display it. If your image is bigger than the ad format, the image will be cropped at the right and bottom edges. So, if you're creating a backup image for a 240x120 ad format, make sure that your image is also 240 pixels by 120 pixels.
- HTML page: This is useful if you'd like to implement a clickable image as your backup ad. The HTML page will contain the information required to load your image and link it to any destination.
View detailed instructions
Using an HTML page as your backup ad is most useful for creating a clickable image ad. You'll specify the path to an HTML page that contains the information necessary for loading the image, as well as the link code.
There are two steps involved in setting an HTML page as your backup ad:
- Creating the HTML page
You'll need to create a simple HTML page that loads your desired image, and contains the hyperlink code. There are a few tricks to successfully creating this code:
- Use absolute URLs: we suggest using absolute URLs when you're coding this HTML page. An absolute URL is one that includes the entire, fully-defined path. This ensures that you won't run into any errors when placing the code on various pages of your site.
target="_top":this code tells your browser which window to use when loading the destination page of your clickable image. If you don't include this tag in your code (and we'll show you where to include it below) your browser will try to load your destination within the ad format itself.
We've included a sample HTML page below. Note the absolute URLs, as well as the
- Specifying the HTML page as your backup ad
Once you've created and saved your HTML page, you'll need to upload it to your server. This page can be hosted anywhere online, as long as it's accessible from the internet.
In the backup ads text box, simply enter the fully defined path to the saved HTML page. For example:
- Creating the HTML page
And remember: you can't specify Google ads as your backup ads.