I get the following error when creating a new page. The error stops once GA has registered a visit. It is only where the page has the provided block on it (views works OK.)

Notice: Undefined variable: debuggeron in google_analytics_counter_construct_content() (line 604 of /public_html/sites/all/modules/google_analytics_counter/google_analytics_counter.module).

(Deleting 'AND $debuggeron <> 1' from line 604 makes the error message go away - but I'm probably breaking something else!)

Comments

moltra’s picture

I am getting the same error on my site. It usually happens the first time a site is visited.

Notice: Undefined variable: debuggeron in google_analytics_counter_construct_content() (line 604 of /home/content/20/8959120/html/sites/all/modules/google_analytics_counter/google_analytics_counter.module).

You can see it yourself the 1st time you go to. www.serviidb.com

b.one’s picture

I had the same probleme.

I solved it by replacing this :
(on line 604)

 if (@$sumarray[0] == 0 AND $debuggeron <> 1) {
    // If $sumarray[2] is zero, it means nothing was fetched (cache expired but there was concurrency and new data could not be retrieved). We will return nothing -- until new value can be retrieved.
    //$result = '***'.$countdays.'***';
    $result = '';
  } else {
    $result .= $sum_of_pageviews;

    // If debugger is on, and if the user has admin rights for Google Analytics Counter.
    if (user_access('administer google analytics counter')) {
      if ($debuggeron == 1) {
        $result .= '<br/><font color="teal">' . $titlemsg . '</font>';
      }
    }
  }

by this

  $debuggeron = GOOGLE_ANALYTICS_COUNTER_DEBUG;
  if (@$sumarray[0] == 0 AND $debuggeron <> 1) {
    // If $sumarray[2] is zero, it means nothing was fetched (cache expired but there was concurrency and new data could not be retrieved). We will return nothing -- until new value can be retrieved.
    //$result = '***'.$countdays.'***';
    $result = '0';
  } else {
    $result .= $sum_of_pageviews;

    // If debugger is on, and if the user has admin rights for Google Analytics Counter.
    if (user_access('administer google analytics counter')) {
      if ($debuggeron == 1) {
        $result .= '<br/><font color="teal">' . $titlemsg . '</font>';
      }
    }
  }

to explain :
-I added the variable "$debuggeron" at the beginning
-I set the variable "$result" to "0" (at line 608) so that the counter displays "0" when there is still no counts (facultative)

nothinghere’s picture

Status: Active » Reviewed & tested by the community

Have same problem, installed 7.x-1.0 yesterday.

Solution #2 works fine ! Add it to stable release !

vacilando’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the comments! Fixed the notice and created 7.x-1.1.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.