Search code examples
google-analyticsgoogle-analytics-apigoogle-analytics-4

Google analytics reporting dimensions & metrics are incompatible


We have custom dimension define in Google Analytics Data API v1Beta for extracting data from Google Analytics GA4 account.

This worked fine till yesterday.

Error:

Please remove customEvent:institution_id to make the request compatible. The request's dimensions & metrics are incompatible. To learn more, see https://ga-dev-tools.web.app/ga4/dimensions-metrics-explorer/

POST - https://analyticsdata.googleapis.com/v1beta/properties/{propertyId}:runReport

Body

{
  "dateRanges": [
    {
      "startDate": "2022-08-29",
      "endDate": "2022-12-07"
    }
  ],
  "dimensions": [
    {
      "name": "customEvent:institution_id"
    },
    {
      "name": "pagePathPlusQueryString"
    }
  ],
  "dimensionFilter": {
    "andGroup": {
      "expressions": [
        {
          "filter": {
            "fieldName": "customEvent:institution_id",
            "inListFilter": {
              "values": [
                "47339486-a1e5-47be-abce-e4270af23rte"
              ]
            }
          }
        },
        {
          "filter": {
            "fieldName": "pagePathPlusQueryString",
            "stringFilter": {
              "matchType": "PARTIAL_REGEXP",
              "value": "/clip/.+",
              "caseSensitive": false
            }
          }
        }
      ]
    }
  },
  "metrics": [
    {
      "name": "screenPageViews"
    }
  ],
  "metricAggregations": [
    "TOTAL"
  ],
  "limit": "10000"
}

Solution

  • Dimensions that include the query string like pagePathPlusQueryString are only compatible with a limited set of dimensions & metrics.

    This changed was announced 2022-09-13 Schema compatibility changes announcement.

    It went live earlier this week. So the cause if the error is that the "customEvent:institution_id" dimension is not compatible with "pagePathPlusQueryString".