Google AdSense

From PaulGuWiki

Jump to: navigation, search

Contents

Google AdSense 3.0

AdSense extension Questions and Comments

Any questions, concerns, and comments

Please feel free to post to MediaWiki Community Forums to receive a quick answer. Your support is important, please tell me what you think.

What's AdSense?

Google AdSense is the program that can give you advertising revenue from each page on your website -- with a minimal investment in time and no additional resources. (Google)

AdSense delivers relevant text and image ads that are precisely targeted to your site and your site content. And when you add a Google search box to your site, AdSense delivers relevant text ads that are targeted to the Google search results pages generated by your visitors’ search request. (Google)

Details can be found at Google AdSense Tour.

What can this extension do?

  • Add all types of Google AdSense as many as you like
  • Put AdSense anywhere in your content page by specifying the position
  • Display AdSense for content with specific Unit ID
  • Display AdSense for custom search with specific Unit ID
  • Display AdSense for Video with specific Unit ID for category
  • Overwrite the default Adsense width and height on the fly
  • Very detail of error message for good usability

Live Examples

Display AdSense for custom search on the left

<google uid="S01" position="left"></google> will show a Google custom search for your domain on the left.


Display AdSense for content on the left for size 120x600

<google uid="C07" position="left"></google> will display a specific Google AdSense Unit 7 on the left.



The main content is here ...

Display AdSense for content in the middle for size 728x90

<google uid="C01"></google> will display a specific Google AdSense Unit 1 in the middle.


Display AdSense for content on the left for size 234x60

<google uid="C06" position="left"></google> will display a specific Google AdSense Unit 6 on the left.


Display Video ads for Entertainment category in the middle

<google uid="V02"></google> will display a YouTube Ads in the middle.


Display Video ads for Sports category on the right

<google uid="V03" position="right"></google> will display a YouTube Ads on the right.


As you can see from the example, it's very flexible and easy to add any type of Google AdSense according your need. Also you can specify the position of the ads, as well as size of the ads.

Download the latest extension

Here is the link

How to install it?

Here are the very simple steps:

  1. Download the extension file from above link, and unzip it into your “extensions” directory. It should create a “GoogleAdSense” folder contains all extension files.
  2. Add this to the end of LocalSettings.php:
include_once('extensions/GoogleAdSense/GoogleAdSense.php');

Install and customize according to your AdSense?

Open file GoogleAdSense.php and find the section below:

// Your Adsense Publisher ID
// ------------------------------
// This is located at Top Right corner under your AdSense account.
$PUBLISHER_ID= "pub-xxxxxxxxxxxxxxxx";
 
// Your Adsense Unit IDs
// ------------------------------
// These are under AdSense Setup --> Manage Ads
// If you don't have them, click on Get Ads to create them
// C01, C02 ... are content ads unit ID
// S01, S02 ... are Google Custom Search unit string, which is inside 
// the generated adsense code, it's located at the end of Publisher ID
// V01, V02 ... are Video unit string, which is inside 
// the generated code, it's located at the end of "watch_custom_player?id="
//
$ADSENSE_UNITS = array(
	// Text and image ads - 728x90
	'C01' => array('unitID' => 'xxx', 'width' => '728', 'height' => '90', 'position' => 'none'),
	// Text and image ads - 728x90
	'C02' => array('unitID' => 'xxx', 'width' => '728', 'height' => '90', 'position' => 'none'),
	// Text and image ads - 728x90
	'C03' => array('unitID' => 'xxx', 'width' => '728', 'height' => '90', 'position' => 'none'),
	// Text ads - 728x90
	'C04' => array('unitID' => 'xxx', 'width' => '728', 'height' => '90', 'position' => 'none'),
	// Ad links - 728x90
	'C05' => array('unitID' => 'xxx', 'width' => '728', 'height' => '90', 'position' => 'none'),
	// Text and image ads - 234x60
	'C06' => array('unitID' => 'xxx', 'width' => '234', 'height' => '60', 'position' => 'none'),
	// Text and image ads - 120x600
	'C07' => array('unitID' => 'xxx', 'width' => '120', 'height' => '600', 'position' => 'none'),
	// Search your domain - 400x29
	'S01' => array('unitID' => 'xxx', 'width' => '400', 'height' => '29', 'position' => 'none'),
	// Search web - 400x29
	'S02' => array('unitID' => 'xxx', 'width' => '400', 'height' => '29', 'position' => 'none'),
	// Video Unit - Auto - 488x485
	'V01' => array('unitID' => 'xxx', 'width' => '488', 'height' => '485', 'position' => 'none'),
	// Video Unit - Entertainment - 488x485
	'V02' => array('unitID' => 'xxx', 'width' => '488', 'height' => '485', 'position' => 'none'),
	// Video Unit - Sports - 488x485
	'V03' => array('unitID' => 'xxx', 'width' => '488', 'height' => '485', 'position' => 'none'),
);
  • Change PUBLISHER_ID to your Publisher ID.
  • Add Adsense Unit IDs as many as you want, also specify the size of each ad unit.


Wow, you are done! Sit down, relax and wait for your revenue.

modified on 11 July 2009 at 14:26 ••• total 50,015 views ••• Top