On line 39 on mostpopular_ga.module file the script calls for the google_analytics_api module but that module has been moved to google_analytics_reports module causing a fatal error in the script? I don't know if we are supposed to change the file to call the new Reports module or how to proceed. Please advise.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fran seva’s picture

I'm using mostpopular 6.x-1 and Google analytics report instead Google Analytics API.
I see two problems

  1. The dependencies in mostpopular_ga, that define that the module googleanalytics must be installed and should be google_analytics_report. It's necesary change the dependence, adding dependencies[] = google_analytics_reports and hiding dependencies[] = googleanalytics
  2. In the module mostpopular_ga there is a reference to google_analytics_api that not cause a problem because is use in a drupal_get_path and get a valid path (ie. sites/all/modules/google_analytics_reports). The problem is that the file gapi.class.php doesn't exist hence the module can't include the file and method that is supposed to be used.
markie’s picture

google_analytics_api was changed to google_analytics_reports so we need to make that change in the module. Thanks for bringing it up.

markie’s picture

All,
I have pushed changes to reflect the new google_analytics_reports changes to the dev snapshot (should be available in 24hours) Please test this out and let me know if this resolves your issues and I'll make it a release. Thank you for your patience.

markie

fran seva’s picture

Thanks markie!!
I will test it tomorrow.

Fran

markie’s picture

Status: Active » Fixed
ajayg’s picture

I tried the latest dev version and I still can't enable the most popular module. The issue is not with google analytics report. It is working as expected and verified. Most popular complains it depends on google_analytics as disabled. Even though it is enabled and working fine.

the dependency need to be changed to "googleanalytics" (remove underscore). Once I changed the dependency, I was able to enable module

bernman’s picture

Version: 6.x-1.0 » 7.x-1.x-dev
Status: Fixed » Active

Looks like these changes never made it into the 7.x branch? I can try to roll a patch but if the work you did for patching the 6.x branch can be applied here as well that would probably be better.

Many thanks in advance!

ajayg’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev

Actually The module itself is still not working in 6.x. I can only enable it once I changed to "googleanalytics" (remove underscore). The module still give WSD

fran seva’s picture

Hello ajayg,
I've changed the dependencies to googleanalytics and it's working. I don't see a WSD and I have configured the one service for GA.
What I see is a problem in the url "admin/settings/mostpopular/services/" because the link to configure a site to monitor with GA don't work. Instead of that, I use the configurations options that Google Analytics Report providees to configure the authentication with your GA account.
ajayg, Do you still see a WSD?

I attach a patch to change the dependencie...

fran seva’s picture

Attach a patch that includes the change of depencie and the link to configure the authentication to Google to set a site to monitoring, using the Google Analytics Reports configuration.

ajayg’s picture

Status: Active » Needs work

../admin/settings/mostpopular/refresh still gives WSD. Already tried both patch #10

If you try to run cron manually you still get WSD. So the issue is with refresh.

Here is the error in apache error log
PHP Fatal error: Call to undefined method stdClass::getMetrics() in ../sites/all/modules/mostpopular/modules/mostpopular_ga/mostpopular_ga.module on line 114, referer: http://mydomain.com/admin/settings/mostpopular

The patch #10 is incomplete. There are several references to google Analytics API inside module code that still need to be updated.

fran seva’s picture

I have a new patch that resolve the problem with:

* use of undefined functions as getMetrics (for the time being, it's the only undefined function)
* change the object $data, with the configuration to make a request to GA

I'm going to test it today, I suppose tomorrow will be ready (I need a site to be tracked from GA...).

If you want test it, I can attach the patch.....

fran seva’s picture

Hello,
Attach the patch to resolve the following problems:

* Undefined function getMetrics and getDimensions undefined functions.
* Change the request objetc use in function google_analytics_api_report_data

The request object changes:

$request = array(
-            '#dimensions' => array('pagePath'),
-            '#metrics' => 'pageviews',
-            '#sort_metric' => '-pageviews',
-            '#filter' => 'pagePath != / && pagePath !@ 404.html && pagePath !@ /user && pagePath !@ /admin',
-            '#start_date' => $start_ts,
-            '#end_date' => $end_ts,
+            'dimensions' => array('ga:pagePath'),
+            'metrics' => array('ga:pageviews'),
+            'sort_metric' => array('-ga:pageviews'),
+            'filter' => 'pagePath != / && pagePath !@ 404.html && pagePath !@ /user && pagePath !@ /admin',
+            'start_date' => $start_ts,
+            'end_date' => $end_ts,
           );

The workaround to avoid the undefined functions:

           $status = '';
-          foreach ($data as $v) {
-            $metrics = $v->getMetrics();
-            $dimensions = $v->getDimensions();
+          foreach ($data->results as $v) {
 
-            $count = $metrics['pageviews'];
-            $url = $dimensions['pagePath'];
+            $count = $v['pageviews'];
+            $url = $v['pagePath'];
             $status .= "$url ($count)"; 
fran seva’s picture

Status: Needs work » Needs review

The problem with WSD is being work in #1563870: refresh gives white screen of death

Sutharsan’s picture

Status: Needs review » Reviewed & tested by the community
dreamet’s picture

Do you have any patch for google
Analytics report 7.x-3.x-dev? Please please please. dreamet2013@gmail.com

dreamet’s picture

Issue summary: View changes

Bernman, how did you fix for 7.x-1.x-dev? I am still getting error.