You are here

README.txt in Google AdSense integration 6

Same filename in this branch
  1. 6 README.txt
  2. 6 contrib/README.txt
Same filename and directory in other branches
  1. 5.3 README.txt
  2. 5 README.txt
  3. 5.2 README.txt
Copyright 2005-2008 Khalid Baheyeldin (http://2bits.com)
Copyright 2008      Joao Ventura      (http://www.venturas.org)

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


Resources
---------
You can read the module author's collection of articles on resources for
using Google Adsense with Drupal. They contain hints and tips on how to use
the module, as well as Adsense in general.

http://baheyeldin.com/click/476/0


Prerequisites
-------------
You must signup for a Google AdSense account.


Installation
------------
To install, copy the adsense directory and all its contents to your modules
directory.


Configuration
-------------
To enable this module, visit Administer -> Site building -> Modules, and
enable adsense, and one of the other modules in the Adsense group. The modules
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.

To configure it, go to Administer -> Site configuration -> AdSense.

Follow the online instructions on that page on how to display ads and the
various ways to do so.


API
---
The adsense module provides developers with an API that can be used to control
the Adsense Client ID used for the particular page view.

You can decide to select a different Adsense Client ID based on the content
type, the user's role, the level of user points, the taxonomy of content page,
connecting to Google's API, or anything else imaginable.

To do so, your module must implement a hook called 'adsense', as follows:

Assuming your module is called: your_module.module, you must have the
following function in it. The function has an $op argument that you
should check:

function your_module_adsense($op, $args = array()) {
  static $client_id = NULL;

  switch ($op) {
    case 'settings':
        return array(
          '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);
      }

      return $client_id;
  }
}

Your module's settings form must be of type MENU_LOCAL_TASK and located in
'admin/settings/adsense/publisher/your_module'.

After you install the module, it should appear on the adsense module settings
page, along with other modules. You should be able to select it, and configure
it.


Bugs/Features/Patches
---------------------
If you want to report bugs, feature requests, or submit a patch, please do
so at the project page on the Drupal web site.
http://drupal.org/project/adsense


Authors
-------
Khalid Baheyeldin (http://baheyeldin.com/khalid and http://2bits.com)
Joao Ventura      (http://venturas.org)

If you use this module, find it useful, and want to send the authors a thank
you note, then use the Feedback/Contact page at the URLs above.

The authors can also be contacted for paid customizations of this and other
modules.

File

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