uid; // Get the ad formats $headers = array(t('Ad type'), t('Dimensions')); $rows = array(); foreach (adsense_ad_formats() as $format => $data) { $rows[] = array($data['desc'], $format); } // Create the ad format text $ad_formats_text = theme('table', $headers, $rows); $referral_link = 'http://baheyeldin.com/click/476/1'; $output = <<Overview

This module provides web site admins the factility to display Google AdSense ads on their web site, thus earning revenue.

Prerequisites

You must have a Google AdSense account before using this module. If you do not have an account, then please consider using the modules author's referral link, which provides us with a referral fee from Google at absolutely no cost to you. This page also contains various useful links and resources on AdSense, and how to optimize your site for it.

Configuration

To use this module, you need to select one of the Adsense Client ID selection modules first, and configure it correctly. See below for a list of available modules, and their settings page.

Supported formats

Most of Adsense's ad formats are supported.

$ad_formats_text

Displaying AdSense ads

There are several ways to display ads, summarized as follows:

Ads can be displayed in pre-defined blocks, in custom blocks, in content or in any phptemplate based theme.

Using blocks

The easiest way to get started with this module is to use one or more of the pre-defined blocks.

Visit the blocks configuration page, and click on the configure link of one of the AdSense blocks. You must select a format, a group, and a channel.

Enable the block, and specify a region for it to be displayed in.

Using custom PHP code

To display ads, you call the function adsense_display() and supply it with the following arguments.

To display ads in blocks, add a new block, make its type "PHP", and enclose it in PHP tags.

print adsense_display('120x600', 1, 2);

If you want to make sure that you do not get errors if the AdSense module is accidentally disabled or deleted, then use the longer form:

if (module_exists('adsense')) {
  print adsense_display('120x600', 2, 4);
}

Using themes

You must use a phptemplate-based theme to display ads from within the theme. This requires some familiarity with PHP. Edit the appropriate .tpl.php file in your theme directory, and add:

print adsense_display('468x60');

Make sure you enclose it in PHP tags.

You could also use the longer format that protects you against deleting or disabling the module:

if (module_exists('adsense')) {
  print adsense_display('120x600', 2, 4);
}

Using tags

The tags feature allows placement of ads anywhere in the content. Please note that content here means any part that is passed through Drupal's filter system. Text in the slogan, mission, and footer is normally not filtered the same way as text in nodes, so you cannot put tags in those places.

To enable the tags feature, you have to enable the "AdSense tag" filter in the input format you are using (such as Full HTML or Filtered HTML) from Administer -> Site configuration -> Input formats. Then you have to insert the appropriate tag in your node where you would like the ad to appear.

Note that filters sometimes may have conflicts, and changing the order can make AdSense work in some cases.

The tag syntax comes in these variants:

1. [adsense:format:group:channel]

Where:

All fields are required, unlike when using the adsense_display() function above.

Example:

[adsense:468x60:1:2]

Display a 468x60 banner with the colors defined in group 1, and with channel ID 2

2. [adsense:block:block_id]

Where:

This allows more fine grained visibility control via the block mechanism. The block does not need to be enabled, and therefore will be hidden from the sidebars and other regions. The title of the block will not be displayed.

All fields are required.

Example:

[adsense:block:7]

Display the ad code of the block with ID 7.

3. [adsense:flexiblock:location]

This is provided for backward compatibility, but will be deprecated in a future release. Use the normal block filter instead.

Where:

All fields are required.

Example:

[adsense:flexiblock:2]

Display the contents of the flexiblock in location 2

AdSense clicks

AdSense clicks are now tracked, and the IP address and timestamp are recorded for each click. This should help with fraud detection. There are three reports under Administer -> Logs: the default one shows click details, "By date" shows the number of clicks per day by day, and "Top pages" shows the top pages of a site that get clicks, the total number of clicks it got, and the last click date/time.

Note that there are some potential limitations with click tracking:

Notes

Known Issues

EOF; return $output; }