Derryl Thomas
Derryl Thomas

Reputation: 1568

Number of dimensions allowed in GA4 data API

While going through the new GA4 data API documentation, I didn't come across any specification for the number of dimensions allowed in a single request. It seemed like there was no upper limit. This document doesn’t mention an upper limit and states the following: “In a report request, you can specify zero or more dimensions.”

However when I try executing the v1alpha:runReport API via postman I get this response if I give more than 8 dimensions:

{
    "error": {
        "code": 400,
        "message": "Requests are limited to 8 dimensions within a nested request.\n  This request is for 9 dimensions.",
        "status": "INVALID_ARGUMENT"
    }
}

Has the number of dimensions allowed in a request been reduced to 8? If yes, can you point me to some document that states this? The earlier UA batchGet API used to allow max 9 dimensions and I was expecting the same limit with the new GA4 data API.

Steps to Reproduce: Post a request to v1alpha:runReport with more than 8 dimensions:

Request URL: https://analyticsdata.googleapis.com/v1alpha:runReport

Request Auth: A valid bearer token

Request Body:

{
"entity":{
    "propertyId":"123456789"
},
"dateRanges":[
    {
        "startDate":"2021-03-29",
        "endDate":"2021-03-29"
    }
],
"dimensions":[
    {
        "name":"eventName"
    },
    {
        "name":"source"
    },
    {
        "name":"medium"
    },
    {
        "name":"hostname"
    },
    {
        "name":"dateHour"
    },
    {
        "name":"deviceCategory"
    },
    {
        "name":"browser"
    },
    {
        "name":"city"
    },
    {
        "name":"country"
    }
],
"metrics":[
    {
        "name":"screenPageViews"
    },
    {
        "name":"userEngagementDuration"
    },
    {
        "name":"eventCount"
    }
]

}

Upvotes: 1

Views: 4376

Answers (3)

Nikeel Sathoo
Nikeel Sathoo

Reputation: 11

Looks like its updated to 10: google.api_core.exceptions.InvalidArgument: 400 Requests are limited to 10 metrics within a nested request.

Upvotes: 1

Christine Treacy
Christine Treacy

Reputation: 212

Updated docs state up to 9 dimensions are now allowed.

https://developers.google.com/analytics/devguides/reporting/data/v1/basics#dimensions

Upvotes: 1

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 117016

The Google analytics GA4 data api is a brand new api, released as part of GA4. As such it has not been reduced to 8 dimensions this is the current limit as it stands

Requests are limited to 8 dimensions within a nested request.

The Google analytics reporting api may allow for additional dimensions and metrics but they are it's a completely different system. You can't compare universal analytics and GA4

Note: i have submitted a note about the lack of documentation to the team

Upvotes: 2

Related Questions