Learn business growth with Google Analytics 4 Forums Google Analytics 4 Google Analytics API: Request Error – Incompatible Dimensions and Metrics

  • Google Analytics API: Request Error – Incompatible Dimensions and Metrics

    Posted by John on 23 July 2022 at 10:51 pm

    Hey there, I was using this custom dimension in Google Analytics Data API v1Beta to pull data from our GA4 account, and until yesterday things were working fine. But now I’m seeing this error saying I need to remove ‘customEvent:institution_id’ to make the request compatible. Any clue why this is happening? It seems like there’s some issue with the request’s dimensions & metrics. There’s more info about this at this link: https://ga-dev-tools.web.app/ga4/dimensions-metrics-explorer/.

    Just to give you an idea, here’s the POST I’m using: https://analyticsdata.googleapis.com/v1beta/properties/{propertyId}:runReport and the following body:

    `json
    {
    “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”
    }
    `
    What do you think? Can you help me out on this?

    Anthony replied 11 months, 1 week ago 3 Members · 2 Replies
  • 2 Replies
  • Aiden

    Member
    23 October 2022 at 6:26 pm

    Sure, I think I know why you’re seeing this error. Google Analytics recently announced new compatibility rules for dimensions and metrics, particularly for dimensions that include a query string like ‘pagePathPlusQueryString’. It turns out that it’s only compatible with a limited set of dimensions and metrics now. You can find more details in their change log announcement from September 13, 2022 [here](https://developers.google.com/analytics/devguides/reporting/data/v1/changelog#2022-09-13_schema_compatibility_changes_announcement).

    The error is basically saying that your ‘customEvent:institution_id’ dimension isn’t compatible with ‘pagePathPlusQueryString’. These changes took effect earlier this week, which probably explains why you only started seeing the error recently. Hopefully, this helps clear up the confusion!

  • Anthony

    Member
    10 June 2023 at 2:16 am

    Sure, I can help! It’s likely that the issue is with the “customEvent:institution_id” line. Google may have changed how they handle custom dimensions and metrics. A good place to start would be check if this custom dimension still exists and is correctly set in Google Analytics 4, then adjust your POST request accordingly.

Log in to reply.