0

I am trying to connect to the Google Analytics api. My ultimate goal is to add a goal automatically, but I cannot even HelloAnalytics to work. I have followed the explicit tutorial here.

My require once did not work at first because the tutorial links to paths that cannot be found. So I had to make a guess at which files to link to. I tried the following:

require_once '/classes/google-api-php/src/Google/Client.php';
require_once '/classes/google-api-php/src/Google/Service/Analytics.php';

I then get the following error:

Fatal error: Class 'Google_Service' not found in C:\xampp\htdocs\google-api-test\classes\google-api-php\src\Google\Service\Analytics.php on line 32

I have a feeling the tutorial needs to be updated to match the library. At the moment I am stuck confused.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Developer1
  • 75
  • 1
  • 9
  • 1
    Hello Analytics php is out of date it uses the old version of the client library. try this http://www.daimto.com/google-oauth2-php/ – Linda Lawton - DaImTo May 11 '15 at 09:39
  • thank you for the suggestion. i will give it a go and get back to you – Developer1 May 11 '15 at 09:48
  • Hi. I am getting the same error :-( Fatal error: Class 'Google_Service' not found in C:\xampp\htdocs\google-api-test\classes\src\Google\Service\Analytics.php on line 32 – Developer1 May 11 '15 at 10:26
  • I have found this thread: http://stackoverflow.com/questions/28351680/implementing-oauth2-login-fatal-error-class-google-service-not-found It says to use this line: require_once 'google-api-php-client/autoload.php'; It works and allows me to connect and "Login". But no data is being displayed. – Developer1 May 11 '15 at 10:46
  • SOLVED: The author of the post: daimto.com/google-oauth2-php , has replied to a comment. She has updated the post. It now works. I receive data back. – Developer1 May 11 '15 at 14:40
  • Unlike forum sites, we don't use "Thanks", or "Any help appreciated", or signatures on [so]. See "[Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?](http://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be-removed-from-posts). BTW, it's "Thanks in advance", not "Thanks in advanced". – John Saunders May 11 '15 at 17:37

1 Answers1

0

SOLVED: The author of the post: daimto.com/google-oauth2-php , has replied to a comment. She has updated the post. It now works. I receive data back.

Developer1
  • 75
  • 1
  • 9