0
votes

I'm trying to pull data from google anlytics using googleapis npm.

let res= await analyticsreporting.reports.batchGet({
        requestBody: {
            reportRequests: [
                {
                    viewId: defaultProfileId,
                    dateRanges: dateRanges,
                    metrics: [
                        {
                            expression: 'ga:users',
                        },
                        {
                            expression: 'ga:sessions',
                        },
                        {
                            expression: 'ga:bounces',

                    ],
                    dimensions: [
                        {
                            name: 'ga:source'
                        },
                        {
                            name: 'ga:medium'
                        },
                        {
                            name: 'ga:channelGrouping'
                        }
                    ]
                },
            ],
        },
    });

where dateRanges contains the date

        {
            startDate: "2017-01-01",
            endDate: "2017-01-01",
        }

to

            {
            startDate: "2020-05-13",
            endDate: "2020-05-13",
        }

When calling this, error says Error: Quota exceeded for quota group 'AnalyticsDefaultGroup' and limit 'Requests per user per 100 seconds' of service 'analyticsreporting.googleapis.com'.

How can I increase quota?

Documentation says By default, it is set to 100 requests per 100 seconds per user and can be adjusted to a maximum value of 1,000. From where it can be increase the limit quota?

1

1 Answers

2
votes

There are two types of Google quotas.

  • project based
  • user based.

Project based quotas effect your full project. You can by default make 50000 request per day over your full project. This quota can be extended.

User based quotas are mostly for flood protection to ensure that your application doesnt run to fast and spam the server.

Error: Quota exceeded for quota group 'AnalyticsDefaultGroup' and limit 'Requests per user per 100 seconds' of service 'analyticsreporting.googleapis.com'.

The quota you are hitting is a user based quota you can max make 100 request per 1000 seconds. This quota can not be extended byond that point you need to slow your application down. Using exponential backoff

To increase it go to the google developer console under library -> google analytics -> manage -> quota menu and there is a penile icon near the quota in question.

enter image description here