Resource Based Quota

This document describes the Resource Based Quota system for the Google Analytics Reporting API v4, which is only available to Analytics 360 customers. See the API Limits and Quotas for the full set of limits applied to the APIs.

Introduction

To ensure the availability and reliability of shared resources, every project that accesses the Analytics Reporting API is subject to limits and quotas. When querying large datasets, sampling may be employed by the Analytics Reporting API, which can affect the results of your data.

The resource based quota system is a new quota system which will enable Analytics 360 accounts to have higher sampling thresholds while using the Analytics Reporting API. This system is optional and independent of the existing limits placed on views and projects, such as those reported in the quotas page of the Google API Console.

Resource based quota

Not all requests are created equal; some requests are computationally much more expensive than others. The resource based quota system is designed to support a higher threshold of sampling while still protecting the Analytics Reporting infrastructure.

Each property will be allocated a set amount of query resource tokens. The API client can add an optional field to the API request to get a higher threshold of sampling in exchange for the relative query resource tokens. A computationally more expensive request will require more tokens.

Sampling threshold

Requests for data using the Google Analytics API v4 are subject to the following general sampling thresholds based on the number of sessions for the requested date range (at the property level):

  • Analytics Standard: 500k sessions
  • Analytics 360: 1M sessions
  • Analytics 360 using resource based quota: 100M sessions

Enable Resource Based Quota

To enable resource based quotas for a given request, the API call must include the optional field useResourceQuotas in the batchGet method.

{
  "reportRequests": [{object(ReportRequest)}],
  "useResourceQuotas": boolean,
}

For example:

{
  "reportRequests":[
  {
    "viewId":"XXXX",
    "dateRanges":[
      {
        "startDate":"2017-06-15",
        "endDate":"2017-06-30"
      }],
    "metrics":[
      {
        "expression":"ga:sessions"
      }],
    "dimensions": [
      {
        "name":"ga:browser"
      }]
    }],
  "useResourceQuotas": true
}

Query resource cost response field

For each call to the batchGet method, the response will have a queryCost field.

{
  "reports": [{ object(Report) }],
  "queryCost": number
}

The queryCost field is an integer representing the total resource cost of all ReportRequests in the batchGet request. For example:

{
  "reports": [
    {
      "columnHeader": {...},
      "data": {
        "rows": [...]
      }
    }
  ],
  "queryCost": 1337
}

Quota allocation

Analytics 360 property quota

  • 100,000 query cost units per day per property.
  • 25,000 query cost units per hour per property.

If you exceed your quota limit you will receive a RESOURCE_EXHAUSTED error. See Error Responses for details.

Cost calculation

The cost of a request is proportional to:

  • The size of the date range.
  • The number of hits within the view.
  • The cardinality of the requested dimensions.
  • The number of requested dimensions and metrics.
  • The complexity of segment and filter definitions.
  • The processing status of the requested information (requesting today's data is more costly than requesting yesterday's data).
  • The presence of Query Time import dimensions and metrics.

API limits and usage

In addition to the resource based quota system, the APIs are also governed by the limits and quotas on the Analytics API v4.

Notes

  • The queryCost response field represents the computational cost of a request. It is not a monetary cost, and the API is free to use.
  • Intraday and certain historical data (1+ years old) reports may still be subject to sampling, regardless of the useResourceQuotas setting.
  • If a higher sampling threshold could not be satisfied for a request, the resource quota tokens will not be deducted (sampled responses always have zero resource quota cost).
  • A report contains sampled data if fields samplesReadCounts, samplingSpaceSizes are present in the response.

To view or change usage limits for your project, or to request an increase to your quota, do the following:

  1. If you don't already have a billing account for your project, then create one.
  2. Visit the Enabled APIs page of the API library in the API Console, and select an API from the list.
  3. To view and change quota-related settings, select Quotas. To view usage statistics, select Usage.