Simple AdSense Insert


Simple AdSense Insert is a WordPress plugin that provides a basic ability to display AdSense adverts on your blog.

Are you having problems with Simple AdSense Insert? The user voting on the WordPress download page would suggest there are problems, but none have been reported to me! If you are having any kind of issue, then please let me know.

Download

Download Simple AdSense Insert (v1.1, 11/03/2009)

Changelog

Version 1.0

  • Initial release

Version 1.1

  • Tidy up of code

Installation

  1. Upload the entire simple-adsense-insert folder to your wp-content/plugins/ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. There is no options screen – configuration is done in your code and, optionally, by modifying the plugin.

Configuration

If you’ve not done so already, create your AdSense advert. The code you are provided provides the parameters that are required by Simple AdSense Insert. The following is an example of the AdSense code, in this case for my own site…

<script type="text/javascript"><!--
google_ad_client = "pub-0743991857092062";
google_ad_slot = "5828977680";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

If your code looks a lot different to the above and, in particular, you don’t have a google_ad_slot then you may have some old AdSense code – please return to the Google AdSense website and create it again.

The 4 pieces of information you require are the values in google_ad_client, google_ad_slot, google_ad_width and google_ad_height. To display your AdSense advert you will need to insert the following code, where appropriate, into your theme…

<?php simple_adsense_insert('pub-0743991857092062','5302103070','468','60'); ?>

In the above example, I’ve used my credentials, but you will need to use the details that I suggested you note before, as supplied by AdSense.

The first parameter is your publisher ID (i.e. google_ad_client)
The second parameter is the slot (i.e. google_ad_slot)
The third parameter is the width of the advert (i.e. google_ad_width)
The last parameter is the height of the advert (i.e. google_ad_height)

Alternatively, if you wish to ensure that your code still works correctly, even if Simple AdSense Insert is switched off, you can use the following format of code…

If you don’t wish to pass the same details each time (or simply want a single place where some of the details, for example your publisher ID, to be held) then you can hard code these into the plugin. In the wp-content/plugins/simple-adsense-insert/ folder, edit the simple-adsense-insert.php file. You will find 4 lines of code within it…

if ($ad_client=="") {$ad_client="";}
if ($ad_slot=="") {$ad_slot="";}
if ($ad_width=="") {$ad_width="";}
if ($ad_height=="") {$ad_height="";}

To hard code any of the parameters, simply add them into the end of the appropriate line. For example, if I wanted to add my publisher ID in, I would change the first of these lines to read…

if ($ad_client=="") {$ad_client="pub-0743991857092062";}

Then, if you don’t pass a publisher ID, the one above will be used by default. However, beware of using this method as implementing any update to this plugin will wipeout any hard coding changes that you may have made.

Problems/Queries

Please report any problems, or suggestions for enhancements, to me either via my contact form or by commenting on the appropriate entries on my blog.

Updates

Updates to this and any other of my WordPress plugins will be published on this blog.

Subscribe to my WordPress category feed.


Share with Delicious Share with Digg Share with Facebook Share with LinkedIn Share with MySpace Share with reddit Share with StumbleUpon Share with Twitter

Comments

  1. Discount Pro

    This plugin is so useful. I ocassionaly run on it, but this is exactly what I needed in past

  2. Joint88

    Adsense is my main source of income when making money online. nothing beats adsense when it comes to making money online.

Pingbacks & Trackbacks

  1. Jan 29, 2009 - 5:50 pm

  2. Aug 24, 2009 - 7:02 am

Leave a Comment

All these comments are validated before being placed on the site. I will NOT allow any spam to be shown, I do not follow the links myself and obvious self-promotion of your site is not accepted either.

CAPTCHA Image CAPTCHA Audio
Refresh Image