Search code examples
phpgoogle-analyticsgoogle-api-php-clientquota

Google PHP API Analytics gives strange userRateLimitExceeded


Since GAPI stopped working two days ago I had to rewrite some code for my Google Analytics dashboard. I decided to use the Google API PHP Client (https://github.com/google/google-api-php-client) I got it all working pretty nice at my local Vagrant Ubuntu server but when I deploy the code to my remote webserver I get a 500 PHP error. When checking the logs I discover that the error message it creates is

(403) Quota Error: User Rate Limit Exceeded.

How can this code be working on my Vagrant but not on my remote webserver? The domains are both added correctly to the developers console. I tried setting the query/user/second-setting to 10 or more but that does not change anything.


Solution

  • Allright, so I fixed it:

    I added a sleep(1); into the PHP foreach loop that was querying the Google Analytics profiles I have in my account. Apparently my VPS is querying Google's API faster than my local development environment does and therefore I was not getting any errors local.