Zac Herman
Zac Herman

Reputation: 71

Google Analytics API Quota Error Timeout

I'm currently creating a project that uses the Google-Analytics-API and have just received the following error:

Quota Error: Number of recent failed reporting API requests is too high, please implement exponential back off.

My questions is, how long do I need to wait before trying again? Does this 'reset' so to speak? Right now, the endpoint times out instantly and gives me the above message.. It's been working fine this whole time however.

Any suggestions are greatly appreciated.

Thanks.

Upvotes: 2

Views: 2666

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 116868

This depends a little on which quota error you are getting. there is a list here errors and they also add new ones.

its most liekly one of the flood protecion ones. In which case you should implement exponential backoff.

  1. Make a request to the API
  2. Receive an error response that has a retry-able error code
  3. Wait 1s + random_number_milliseconds seconds
  4. Retry request
  5. Receive an error response that has a retry-able error code
  6. Wait 2s + random_number_milliseconds seconds
  7. Retry request
  8. Receive an error response that has a retry-able error code
  9. Wait 4s + random_number_milliseconds seconds
  10. Retry request
  11. Receive an error response that has a retry-able error code
  12. Wait 8s + random_number_milliseconds seconds
  13. Retry request
  14. Receive an error response that has a retry-able error code
  15. Wait 16s + random_number_milliseconds seconds
  16. Retry request
  17. If you still get an error, stop and log the error.

You can read the full list of errors here errors

There is another quota if you send a request that returns an error for example requesting dimensions and metrics that cant be mixed. If you keep doing it then you can be blocked normally for a few hours. Check Google developer console under Enabled APIs and services you can see how many errors are you are getting. try and stay under 4%

Upvotes: 3

Related Questions