Summary: Talk page for GoogleAdsense.
Maintainer: XES
Users: +1 (View / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.


I extended the recipe a bit so that you can fill in the size of your advert. However I had to get ride of the Keep() function to get the variables substituted. Leaving out the Keep() doesn't seem to affect the good working of the code. But it will be interpreted by other layout rules which may have undesired effects.

//google adsense markup
// usage (:adsense <width> <height>:)
Markup('GoogleAdsense', 'block',
        '/\\(:adsense (\\d+) (\\d+):\\)/',
        "<script type='text/javascript'><!--
google_ad_client = 'pub-#####';
google_ad_width = $1;
google_ad_height = $2;
google_ad_format = '$1x$2_as';
google_ad_type = 'text';
google_ad_channel = '######';
<script type='text/javascript'
</script>") ;

(:adsense 468 60:)
Be aware that you can only use Google adsense permitted widths and heights e.g.
468 60
234 60
728 90

failing this will give a empty adsens space

Bart January 31, 2007, at 05:06 PM

Other extension proposal

I extended the GoogleAdsense recipe extended by Bart (see above). I had use of ParseArgs() to add different attribute to the markup. Thus you can have extended (:adsense <attributes>... :) markup in your wiki page or template page to have Google AdSense sponsorship.

New Features

  • (new) Support for XHTML page with "application/xhtml+xml" content-type.
  • (new) Support Google AdSense for referrals
  • (new) Support Google AdSense for searches
  • Every wiki page can hold different Google AdSense stuff
  • Separate configuration/customizations for per-group-customization?, for example:
    • in local/Site.php: $GoogleAdsenseChannel='chanelA';
    • in local/Cookbook.php: $GoogleAdsenseChannel='chanelB';

This recipe is available on my website: (link broken as of 2023-12). If you use, or have tested, this contribution, please send me your feedback. Thx.

Dfolio November 30, 2007, at 14:56 AM
Since my previous post was absolutly deprecated against the recipe proposed on my site, I just put above my proposed features.

Talk page for the GoogleAdsense recipe (users).