| 1 |
$Id: README.txt,v 1.22 2008/08/18 15:46:11 jcnventura Exp $ |
$Id: README.txt,v 1.18 2008/02/10 01:24:19 kbahey Exp $ |
| 2 |
|
|
| 3 |
Copyright 2005-2008 Khalid Baheyeldin (http://2bits.com) |
Copyright 2005-2008 http://2bits.com |
|
Copyright 2008 Joao Ventura (http://www.venturas.org) |
|
| 4 |
|
|
| 5 |
Description |
Description |
| 6 |
----------- |
----------- |
| 7 |
This module provides web site admins the factility to display Google AdSense |
This module provides web site admins the factility to display Google AdSense |
| 8 |
ads on their web site, thus earning revenue. |
ads on their web site, thus earning revenue. |
| 9 |
|
|
|
|
|
| 10 |
Resources |
Resources |
| 11 |
--------- |
--------- |
| 12 |
You can read the module author's collection of articles on resources for |
You can read the module author's collection of articles on resources for |
| 15 |
|
|
| 16 |
http://baheyeldin.com/click/476/0 |
http://baheyeldin.com/click/476/0 |
| 17 |
|
|
|
|
|
| 18 |
Prerequisites |
Prerequisites |
| 19 |
------------- |
------------- |
| 20 |
You must signup for a Google AdSense account. If you do not have an account, |
You must signup for a Google AdSense account. If you do not have an account, please |
| 21 |
please consider using the author's referral link for signup at the following |
consider using the author's referral link for signup at the following URL: |
|
URL: |
|
| 22 |
|
|
| 23 |
http://baheyeldin.com/click/476/0 |
http://baheyeldin.com/click/476/0 |
| 24 |
|
|
| 32 |
Configuration |
Configuration |
| 33 |
------------- |
------------- |
| 34 |
To enable this module, visit Administer -> Site building -> Modules, and |
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 |
enable adsense, and one of the other modules in the Adsense group. |
|
marked as '(old)' are not using the new 'Managed Ads' feature of Google |
|
|
AdSense, so you should only use them if you have ads in the old format or if |
|
|
you know what you're doing. |
|
| 36 |
|
|
| 37 |
To configure it, go to Administer -> Site configuration -> AdSense. |
To configure it, go to Administer -> Site configuration -> AdSense. |
| 38 |
|
|
| 46 |
the Adsense Client ID used for the particular page view. |
the Adsense Client ID used for the particular page view. |
| 47 |
|
|
| 48 |
You can decide to select a different Adsense Client ID based on the content |
You can decide to select a different Adsense Client ID based on the content |
| 49 |
type, the user's role, the level of user points, the taxonomy of content page, |
type, the user's role, the level of user points, the taxonomy of content |
| 50 |
connecting to Google's API, or anything else imaginable. |
page, connecting to Google's API, or anything else imaginable. |
| 51 |
|
|
| 52 |
To do so, your module must implement a hook called 'adsense', as follows: |
To do so, your module must implement a hook called 'adsense', as follows: |
| 53 |
|
|
| 54 |
Assuming your module is called: your_module.module, you must have the |
Assuming your module is called: your_module.module, you will have the |
| 55 |
following function in it. The function has an $op argument that you |
following function in it. The function has an $op argument that you |
| 56 |
should check: |
should check: |
| 57 |
|
|
| 58 |
function your_module_adsense($op, $args = array()) { |
function your_module_adsense($op) { |
| 59 |
static $client_id = NULL; |
if ($op == 'settings') { |
| 60 |
|
// Add here form elements for your module's settings |
| 61 |
switch ($op) { |
// These can also contain markup elements for help text |
| 62 |
case 'settings': |
// These are standard FormAPI elements. |
| 63 |
return array( |
return $form; |
| 64 |
'name' => 'Module name', |
} |
|
'desc' => 'Anything about your module', |
|
|
); |
|
|
break; |
|
|
case 'client_id': |
|
|
if (!$client_id) { |
|
|
// We cache the client ID on this page load, to make sure all of the |
|
|
// client IDs on one page are the same |
|
|
// Here you can use whatever logic you want to select a Google |
|
|
// Adsense client ID. |
|
|
// If the args parameter is not NULL, a format specific slot ID + |
|
|
// Publisher ID needs to be returned in an array with 'slot' and |
|
|
// 'client' fields. |
|
|
// If the args parameter is NULL, return only the Publisher ID as a |
|
|
// string. |
|
|
$client_id = your_logic($args); |
|
|
} |
|
| 65 |
|
|
| 66 |
return $client_id; |
if ($op == 'client_id') { |
| 67 |
|
// Here you can use whatever logic you want to select a Google Adsense |
| 68 |
|
// client ID |
| 69 |
|
return $client_id; |
| 70 |
} |
} |
| 71 |
} |
} |
| 72 |
|
|
| 73 |
Your module's settings form must be of type MENU_LOCAL_TASK and located in |
See the adsense_basic.module for an example of how to write your own module. |
|
'admin/settings/adsense/id/your_module'. |
|
| 74 |
|
|
| 75 |
After you install the module, it should appear on the adsense module settings |
After you install the module, it should appear on the adsense module settings |
| 76 |
page, along with other modules. You should be able to select it, and configure |
page, along with other modules. You should be able to select it, and configure |
| 77 |
it. |
it. |
| 78 |
|
|
|
|
|
| 79 |
Bugs/Features/Patches |
Bugs/Features/Patches |
| 80 |
--------------------- |
--------------------- |
| 81 |
If you want to report bugs, feature requests, or submit a patch, please do |
If you want to report bugs, feature requests, or submit a patch, please do |
| 83 |
http://drupal.org/project/adsense |
http://drupal.org/project/adsense |
| 84 |
|
|
| 85 |
|
|
| 86 |
Authors |
Author |
| 87 |
------- |
------ |
| 88 |
Khalid Baheyeldin (http://baheyeldin.com/khalid and http://2bits.com) |
Khalid Baheyeldin (http://baheyeldin.com/khalid and http://2bits.com) |
|
Joao Ventura (http://www.venturas.org) |
|
| 89 |
|
|
| 90 |
If you use this module, find it useful, and want to send the authors a thank |
If you use this module, find it useful, and want to send the author a thank |
| 91 |
you note, then use the Feedback/Contact page at the URLs above. |
you note, then use the Feedback/Contact page at the URL above. |
| 92 |
|
|
| 93 |
The authors can also be contacted for paid customizations of this and other |
The author can also be contacted for paid customizations of this and other |
| 94 |
modules. |
modules. |
| 95 |
|
|