| 1 |
$Id: README.txt,v 1.23 2008/11/06 15:11:24 kbahey Exp $
|
| 2 |
|
| 3 |
Copyright 2005-2008 Khalid Baheyeldin (http://2bits.com)
|
| 4 |
Copyright 2008 Joao Ventura (http://www.venturas.org)
|
| 5 |
|
| 6 |
Description
|
| 7 |
-----------
|
| 8 |
This module provides web site admins the factility to display Google AdSense
|
| 9 |
ads on their web site, thus earning revenue.
|
| 10 |
|
| 11 |
|
| 12 |
Resources
|
| 13 |
---------
|
| 14 |
You can read the module author's collection of articles on resources for
|
| 15 |
using Google Adsense with Drupal. They contain hints and tips on how to use
|
| 16 |
the module, as well as Adsense in general.
|
| 17 |
|
| 18 |
http://baheyeldin.com/click/476/0
|
| 19 |
|
| 20 |
|
| 21 |
Prerequisites
|
| 22 |
-------------
|
| 23 |
You must signup for a Google AdSense account.
|
| 24 |
|
| 25 |
|
| 26 |
Installation
|
| 27 |
------------
|
| 28 |
To install, copy the adsense directory and all its contents to your modules
|
| 29 |
directory.
|
| 30 |
|
| 31 |
|
| 32 |
Configuration
|
| 33 |
-------------
|
| 34 |
To enable this module, visit Administer -> Site building -> Modules, and
|
| 35 |
enable adsense, and one of the other modules in the Adsense group. The modules
|
| 36 |
marked as '(old)' are not using the new 'Managed Ads' feature of Google
|
| 37 |
AdSense, so you should only use them if you have ads in the old format or if
|
| 38 |
you know what you're doing.
|
| 39 |
|
| 40 |
To configure it, go to Administer -> Site configuration -> AdSense.
|
| 41 |
|
| 42 |
Follow the online instructions on that page on how to display ads and the
|
| 43 |
various ways to do so.
|
| 44 |
|
| 45 |
|
| 46 |
API
|
| 47 |
---
|
| 48 |
The adsense module provides developers with an API that can be used to control
|
| 49 |
the Adsense Client ID used for the particular page view.
|
| 50 |
|
| 51 |
You can decide to select a different Adsense Client ID based on the content
|
| 52 |
type, the user's role, the level of user points, the taxonomy of content page,
|
| 53 |
connecting to Google's API, or anything else imaginable.
|
| 54 |
|
| 55 |
To do so, your module must implement a hook called 'adsense', as follows:
|
| 56 |
|
| 57 |
Assuming your module is called: your_module.module, you must have the
|
| 58 |
following function in it. The function has an $op argument that you
|
| 59 |
should check:
|
| 60 |
|
| 61 |
function your_module_adsense($op, $args = array()) {
|
| 62 |
static $client_id = NULL;
|
| 63 |
|
| 64 |
switch ($op) {
|
| 65 |
case 'settings':
|
| 66 |
return array(
|
| 67 |
'name' => 'Module name',
|
| 68 |
'desc' => 'Anything about your module',
|
| 69 |
);
|
| 70 |
break;
|
| 71 |
case 'client_id':
|
| 72 |
if (!$client_id) {
|
| 73 |
// We cache the client ID on this page load, to make sure all of the
|
| 74 |
// client IDs on one page are the same
|
| 75 |
// Here you can use whatever logic you want to select a Google
|
| 76 |
// Adsense client ID.
|
| 77 |
// If the args parameter is not NULL, a format specific slot ID +
|
| 78 |
// Publisher ID needs to be returned in an array with 'slot' and
|
| 79 |
// 'client' fields.
|
| 80 |
// If the args parameter is NULL, return only the Publisher ID as a
|
| 81 |
// string.
|
| 82 |
$client_id = your_logic($args);
|
| 83 |
}
|
| 84 |
|
| 85 |
return $client_id;
|
| 86 |
}
|
| 87 |
}
|
| 88 |
|
| 89 |
Your module's settings form must be of type MENU_LOCAL_TASK and located in
|
| 90 |
'admin/settings/adsense/publisher/your_module'.
|
| 91 |
|
| 92 |
After you install the module, it should appear on the adsense module settings
|
| 93 |
page, along with other modules. You should be able to select it, and configure
|
| 94 |
it.
|
| 95 |
|
| 96 |
|
| 97 |
Bugs/Features/Patches
|
| 98 |
---------------------
|
| 99 |
If you want to report bugs, feature requests, or submit a patch, please do
|
| 100 |
so at the project page on the Drupal web site.
|
| 101 |
http://drupal.org/project/adsense
|
| 102 |
|
| 103 |
|
| 104 |
Authors
|
| 105 |
-------
|
| 106 |
Khalid Baheyeldin (http://baheyeldin.com/khalid and http://2bits.com)
|
| 107 |
Joao Ventura (http://www.venturas.org)
|
| 108 |
|
| 109 |
If you use this module, find it useful, and want to send the authors a thank
|
| 110 |
you note, then use the Feedback/Contact page at the URLs above.
|
| 111 |
|
| 112 |
The authors can also be contacted for paid customizations of this and other
|
| 113 |
modules.
|