0

I am trying to develop an application that does server side requests nightly to my Google analytics profile. I have seen some outdated posts that the API library for PHP does not support service accounts for Google analytics.

I followed these instructions(the edited answer):

Service Applications and Google Analytics API V3: Server-to-server OAuth2 authentication?

When I run the code I'm getting a connection reset error and on my test server I get a 500 internal.

The error occurs at this part in the answer above.

    $service->data_ga->get($ids, $startDate, $endDate, $metrics, $optParams); 

The path to the private key is correct and I'm running on 5.3.8

Community
  • 1
  • 1
Tom
  • 602
  • 5
  • 20

2 Answers2

0

Connection reset and 500 internal errors sounds like it doesn't have anything to do with the code you post above. Sounds more like the connection to Google Analytics is broken somehow.

Emil Stenström
  • 13,329
  • 8
  • 53
  • 75
0

Im guessing there is something wrong with the credentials or the way the service account was setup. First Make sure you have enabled error reporting:

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

Post the full error message you get with the above settings and we'll take it from there.

sboss
  • 957
  • 1
  • 7
  • 21