Alternative to blank AdSense ads

When you have a new page on your site, AdSense sometimes takes a few minutes to decide what ads to display on your site. Other times, there just isn't ad advertisement to fit your content. In both cases, Google displays a public service ad. Since AdSense gives you the option to display alternative content, why not take advantage of it to show an ad from a company that will show an ad, even when it doesn't match your content?

I display Yahoo ads when Google ads aren't available. To do so, I added a google_alternate_ad_url to the javascript variable section:

<script type="text/javascript"><!--google_ad_client = "pub-1105343943158891";google_alternate_ad_url = "http://deekayen.net/themes/deekayen2/Yahoo_468x60.html";google_ad_width = 468;google_ad_height = 60;google_ad_format = "468x60_as";google_ad_type = "text_image";google_ad_channel ="8323300172";google_color_border = "FFFFFF";google_color_bg = "FFFFFF";google_color_link = "006699";google_color_url = "006699";google_color_text = "333333";//--></script>

The catch is that if you are displaying a 468x60 ad (as in the example above), AdSense's ad space is only 468x60, so your alternate ad has to fit in that space. Ideally, put another 468x60 in the space, but a 234x60 ad would also work (with some space left over). The content of the Yahoo_468x60.html file is a complete HTML document:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title></title></head><body><script language="JavaScript" type="text/javascript"><!--ctxt_ad_partner = "1426196321";ctxt_ad_section = "13473";ctxt_ad_bg = "FFFFFF";ctxt_ad_width = 468;ctxt_ad_height = 60;ctxt_ad_bc = "FFFFFF";ctxt_ad_cc = "FFFFFF";ctxt_ad_lc = "006699";ctxt_ad_tc = "333333";ctxt_ad_uc = "006699";// --></script><script language="JavaScript" src="http://ypn-js.overture.com/partner/js/ypn.js"></script></body></html>

Implement that, and when AdSense doesn't have an ad for you, it'll display a Yahoo ad. For a 160x600 AdSense ad, you'll need to make yourself a different Yahoo_160x600.html file with a tower Yahoo alternative ad script.


Topics:

This can also be done within Adsense.

Adsense allows you to accomplish the same thing within your account settings. By default, Google shows public service ads (PSAs) if no targeted ads are available. By specifying a color, image, HTML page, or ad server of your choice, you can make sure that your advertising space is always being used effectively.

The three alternate ads options are:
1. Show public service ads
2. Show ads from another URL
3. Fill space with a solid color

Collapsing ad units are an optional advanced feature of alternate ads too.

reply

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Allowed HTML tags: <hr /> <a> <p> <em> <strong> <cite> <code> <blockquote> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
Your post will remain unpublished until David examines it himself to check for spam.