Tjoosten / gapi-google-analytics-php-interface

Automatically exported from code.google.com/p/gapi-google-analytics-php-interface
0 stars 0 forks source link

call to getTotalResults results in an error #79

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call $gapi->requestReportData(...); to retrieve data from GA
2. Call $gapi->getTotalResults(); to get the total results so that you know 
whether to call requestReportData again with a higher starting index.

What is the expected output? What do you see instead?
The expected output I would like to see is the total amount of results that GA 
has returned. Instead, I get the following error:
No valid root parameter or aggregate metric called "TotalResults"

What version of the product are you using? On what operating system?
I'm using GAPI version 1.3

Please provide any additional information below.
I searched through the actual results GAPI retrieves from GA and the total 
results were in the XML-results. So there was no problem there. However, I 
discovered that they are using a different OpenSearch namespace. Previously 
they were using "http://a9.com/-/spec/opensearchrss/1.0/", and they are now 
using "http://a9.com/-/spec/opensearch/1.1/". Replacing the old namespace 
definition with the new one solves the problem.

Original issue reported on code.google.com by blizz...@gmail.com on 9 Aug 2012 at 7:32

GoogleCodeExporter commented 9 years ago
Hi,

I tried this modification in the gapi class and it fixes the issue for me:

http://wordpress.org/support/topic/plugin-google-analytics-visits-no-valid-root-
parameter-or-aggregate-metric-called-totalresults

So the only thing you have to do in the gapi.class.php file is update this line 
twice to the correct namespace:

//$open_search_results = 
$xml->children('http://a9.com/-/spec/opensearchrss/1.0/');
$open_search_results = $xml->children('http://a9.com/-/spec/opensearch/1.1/');

Good luck!

Chris

Original comment by chris.de...@gmail.com on 14 Aug 2012 at 9:43

Attachments:

GoogleCodeExporter commented 9 years ago
Awesome Chris - you made my day :-)

Regards

Morten Ross
http://www.ross.no/communicate

Original comment by mor...@ross.no on 15 Aug 2012 at 11:56

GoogleCodeExporter commented 9 years ago
This is exactly what the fault is.  Is this likely to get patched?

Original comment by nozze...@gmail.com on 17 Aug 2012 at 7:20

GoogleCodeExporter commented 9 years ago
Thianks a lot. Very useful to me.

Original comment by wangyp...@gmail.com on 11 Sep 2012 at 8:27

GoogleCodeExporter commented 9 years ago
I'm still having this problem after making the above changes.  Any suggestions?

Original comment by richards...@gmail.com on 6 Feb 2013 at 5:20

GoogleCodeExporter commented 9 years ago
me too still getting it. now change after above line replacing.

Original comment by shezee...@gmail.com on 24 Feb 2013 at 7:55

GoogleCodeExporter commented 9 years ago
Changes don't have any effect for me too. Anybody got any other solution to the 
probem?

Original comment by ivan999i...@gmail.com on 26 Feb 2013 at 12:46

GoogleCodeExporter commented 9 years ago
For whom they still have problem, try to download attached gapi.class.php file 
and replace with your old one.

Original comment by suncod...@gmail.com on 28 Feb 2013 at 10:07

GoogleCodeExporter commented 9 years ago
It stopped working yesterday I think, and replacing with attached file found 
here does not resolve the problem.

Original comment by mor...@ross.no on 28 Feb 2013 at 1:03

GoogleCodeExporter commented 9 years ago
Also if I made this changes to 1.3 version, the examples are working:

@@ -29,7 +29,7 @@
   const http_interface = 'auto'; //'auto': autodetect, 'curl' or 'fopen'

   const client_login_url = 'https://www.google.com/accounts/ClientLogin';
-  const account_data_url = 
'https://www.google.com/analytics/feeds/accounts/default';
+  const account_data_url = 
'https://www.googleapis.com/analytics/v2.4/management/accounts/~all/webpropertie
s/~all/profiles';
   const report_data_url = 'https://www.google.com/analytics/feeds/data';
   const interface_name = 'GAPI-1.3';
   const dev_mode = false;
@@ -267,7 +267,7 @@
     $account_root_parameters['generator'] = strval($xml->generator);
     $account_root_parameters['generatorVersion'] = strval($xml->generator->attributes());

-    $open_search_results = 
$xml->children('http://a9.com/-/spec/opensearchrss/1.0/');
+    $open_search_results = 
$xml->children('http://a9.com/-/spec/opensearch/1.1/');

     foreach($open_search_results as $key => $open_search_result)
     {
@@ -322,7 +322,7 @@
     $report_root_parameters['generator'] = strval($xml->generator);
     $report_root_parameters['generatorVersion'] = strval($xml->generator->attributes());

-    $open_search_results = 
$xml->children('http://a9.com/-/spec/opensearchrss/1.0/');
+    $open_search_results = 
$xml->children('http://a9.com/-/spec/opensearch/1.1/');

     foreach($open_search_results as $key => $open_search_result)
     {

Original comment by dan.ohne...@gmail.com on 21 Mar 2013 at 5:21

GoogleCodeExporter commented 9 years ago
It works for me. Comment #10

Original comment by AndroidM...@gmail.com on 26 Apr 2013 at 2:27

GoogleCodeExporter commented 9 years ago
#10 comment worked for me too. thanks.

Original comment by bueno.te...@gmail.com on 4 Jun 2013 at 1:09

GoogleCodeExporter commented 9 years ago
#10 comment worked for me also!!

Original comment by countvi...@gmail.com on 26 Jun 2013 at 5:53

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
worked for me aswell

Original comment by kalaipri...@gmail.com on 29 Aug 2013 at 5:21

GoogleCodeExporter commented 9 years ago
Comment #10! :)

Original comment by hrvoje.g...@gmail.com on 29 Aug 2013 at 9:39

GoogleCodeExporter commented 9 years ago
worked for me also!!

Original comment by gruposi...@gmail.com on 4 Oct 2013 at 8:58

GoogleCodeExporter commented 9 years ago
Word me as well! Thanks for that #10

Original comment by kandiweb...@gmail.com on 7 Jul 2014 at 12:42

GoogleCodeExporter commented 9 years ago
Awesome! thanks a lot.

Original comment by sezertu...@gmail.com on 1 Aug 2014 at 11:33

GoogleCodeExporter commented 9 years ago
Thanks! XD 

Original comment by cleopatr...@gmail.com on 27 Aug 2014 at 1:09