0
votes

I'm writing an application for processing large amounts of google analytics data at once, and I keep bumping on the

(403) Quota Error: User Rate Limit Exceeded

error.

I have done some research and I've found out that while the limit is 10queries/second/user, it defaults to 1. So I adjusted it to 10 in the Google console, but without any luck.

I've also added sleep(0.5) between every other call I make, which would make it impossible for 10 requests to be done in 1 second, but also without any luck.

This seems very weird to me, and that's why I'm wondering if it might be possible that 1 call with multiple dimensions/metrics/sort filters, might be treated as multiple requests?

Edit: I've also looked into the UserIp and the quotaUser standard query parameters, but I'm unsure how I can add those to my request (I'm using the API to make the calls:

$analytics->data_ga->get($query);

). If I understand correctly, these parameters can be used to split your quota over the users you're querying data for. In my case that won't be helpful at all (Correct me if I'm wrong), because the problem is I'm hitting the per second-cap, and I'm not querying for more than one user in the same second.

Any help would be greatly appreciated

1

1 Answers

-1
votes

You are correct that userid won't affect the 10 per second quota. In my earlier work, I tried the approach of adding a sleep between calls but learned the hard way that that isn't the correct solution. The correct solution is to look for the quota error and when found then add the sleep call. And if you still get a quota error then add a larger sleep call. I try three times in my code. There are other protocol errors - "backend error" I think - where Google's advice is to just try again.