The output returns an HTML comment (e.g. <!--adsense: page not in match list-->) when a page is not in the "Show on only the listed pages" list. Drupal's normal behavior is NOT to output a block when its content is empty. However, because of these HTML comments, the content is NOT empty, so Drupal outputs the block div along with a title (if present), etc. etc... This means that likely there will be a box where the adsense would otherwise be.

You can get around this by using the block system to set the areas of the site that should (not) have adsense blocks, but it can be counterintuitive for some users. I understand that the comment can be helpful for debugging when AdSense is placed in content, however the AdSense module should probably take this into account when outputting blocks. And/or there should probably be a "add HTML comments" setting that can be turned off...

My $.02

Comments

kbahey’s picture

Status: Active » Needs review

Here is a patch that ties the HTML comment with the "Enable test mode"settings, under Advanced.

So, if you do not have "enable test mode" set, it should do what you want.

Give it a spin and see if does what you want.

Index: adsense.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/adsense/adsense.module,v
retrieving revision 1.50.2.15
diff -u -F^f -r1.50.2.15 adsense.module
--- adsense.module      4 Jan 2007 19:28:45 -0000       1.50.2.15
+++ adsense.module      4 Mar 2007 17:21:50 -0000
@@ -473,6 +473,8 @@ function adsense_admin_settings() {
 function adsense_display($format = '160x600', $group = 1, $channel = 1) {
   static $num_adsense_on_this_page;

+  $ad = NULL;
+
   if (!_adsense_validate_dimensions($format)) {
       $ad = '<!--adsense: invalid format: ' . $format . '-->';
   }
@@ -485,11 +487,12 @@ function adsense_display($format = '160x
           // Ad should be displayed
           // Check cache first
           $num_adsense_on_this_page++;
-
           $ad = _adsense_get_ad($format, $group, $channel);
         }
         else {
-          $ad = '<!--adsense: page not in match list-->';
+          if (variable_get(ADSENSE_TEST_MODE, 0)) {
+            $ad = '<!--adsense: page not in match list-->';
+          }
         }
       }
       else {
@@ -506,11 +509,17 @@ function adsense_display($format = '160x
           $ad = '<!--adsense: ads disabled -->';
         }
       }
+      else {
+        if (variable_get(ADSENSE_TEST_MODE, 0)) {
+          $ad = '<!--adsense: page not in match list-->';
+        }
+      }
     }
   }

   return $ad;
 }
+
 function _adsense_get_ad($format, $group, $channel) {
   $sharing = variable_get(ADSENSE_REVENUE_ENABLE, 0);
   if ($sharing) {
jcnventura’s picture

Status: Needs review » Closed (fixed)

This problem no longer occurs in the current versions.