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 = << This module provides web site admins the factility to display Google AdSense ads on their web site,
thus earning revenue. 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. 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. Most of Adsense's ad formats are supported. 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. 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. 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.
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: 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: Make sure you enclose it in PHP tags. You could also use the longer format that protects you against deleting or disabling the module: 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: Where: All fields are required, unlike when using the adsense_display()
function above. Example:
Display a 468x60 banner with the colors defined in group 1, and with
channel ID 2 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: Display the ad code of the block with ID 7.
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:
Display the contents of the flexiblock in location 2 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: The site administrator will not see ads displayed as long as they are logged in. This is by design, in
order not to skew the page views, and not to accidentally click on ads (against Google's policy). Log out
to see the ads. You can use the advanced options to disable ads and configure a placeholder when you are developing or
theming to know where the ads will appear. If ads are not displayed, that could be caused by several things:Prerequisites
Configuration
Supported formats
Displaying AdSense ads
Using blocks
Using custom PHP code
print adsense_display('120x600', 1, 2);
if (module_exists('adsense')) {
print adsense_display('120x600', 2, 4);
}
Using themes
print adsense_display('468x60');
if (module_exists('adsense')) {
print adsense_display('120x600', 2, 4);
}
Using tags
[adsense:468x60:1:2]
[adsense:block:7]
[adsense:flexiblock:2]
AdSense clicks
Notes
Known Issues
Module Weight
Unless configured otherwise, Drupal normally calls modules in alphabetical order. Insofar as Adsense starts with "a," this may occasionally cause conflicts with other installed modules. For example, with image_attach (a function of the image module), Adsense will normally be invoked first ("a" coming before "i"); this may interfere with inline styling of images attached to posts.
Solution: Install and configure the Module Weight module and configure modules to load in the desired order. In this case, giving Image Attach a weight of -1 should resolve the issue.
EOF; return $output; }