GoogleAdsense

Summary:How to add Google AdSense data to your wiki
Version:0.1
Prerequisites:This should work for at least PmWiki 2.1 and up
Status:pre-alpha
Maintainer:XES
License: CC0
Categories:Includes, Google
Discussion: GoogleAdsense-Talk

Questions answered by this recipe

How do I put my Google AdSense ads on my wiki site?

Description

Custom markup to pull in Google ads.

Notes

In config.php, I added:

//long google block markup
Markup('Google1', 'block',
        '/\\(:Google1:\\)/',
        Keep("<script type='text/javascript'><!--
google_ad_client = 'pub-########';
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = '120x600_as';
google_ad_type = 'text_image';
google_ad_channel ='';
//--></script>
<script type='text/javascript'
 src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>
</script>"));

The trick is to change all the quotes in the Google paste text to single quotes, then place it within the double quotes of the Keep() function.

Note that I used 'pub-########' because this was done on a client's site and it's not my account number in the text. You will be given code by Google which will contain a number.

Then in a sidebar (I used the Triad skin's Site.RightBar:

(:Google1:)

Release Notes

  • 2006-11-12 - pre-alpha - just instructions, no downloads - XES November 12, 2006, at 12:51 PM

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

To Do

Make this a full plug-in style recipe where the orientation of the ads and the AdSense code can be pasted in to the markup, allowing different authors to have different AdSense codes in their own groups or pages on the same site.

See Also

Contributors

Comments

See Discussion at GoogleAdsense-Talk

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.