Trouble with Google Analytics v4 Resource Configuration in Retool

I’m running into an issue configuring a Google Analytics resource in Retool, and I suspect it might be a misconfiguration or a bug with the v4 API setup. I’ve been trying to pull GA4 data into my app, but I keep hitting errors, and I’d really appreciate some guidance.

Details:

  • Resource Setup: I’ve set up a Google Analytics resource using the Reporting v4 API (POST /v4/reports:batchGet) and authenticated it with a Google account that has access to my GA4 property.

  • Request Body: I’ve tried various structures, including:

{
  "reportRequests": [
    {
      "property": "properties/G-XXX",
      "dateRanges": [
        {
          "startDate": "7daysAgo",
          "endDate": "today"
        }
      ],
      "metrics": [
        {
          "name": "activeUsers"
        }
      ]
    }
  ]
}

and simpler versions like:

{
  "property": "properties/XXX",
  "dateRanges": [
    {
      "startDate": "7daysAgo",
      "endDate": "today"
    }
  ],
  "metrics": [
    "activeUsers"
  ]
}
  • Errors: I’ve encountered multiple 400 errors, including:

  • "Parameter viewId must be set" (despite using v4, which should use property).

  • "Invalid JSON payload received. Unknown name 'property' at 'report_requests'" and "Unknown name 'name' at 'report_requests.metrics[0]'".

  • What I’ve Tried:

  • Verified my GA4 Property ID in Google Analytics Admin > Property Settings.

  • Re-authenticated the resource multiple times.

  • Tested with minimal requests and different metric formats (e.g., name vs. expression).

  • Checked that the account has read access to the GA4 property.

Suspected Issue: It feels like the v4 resource might be misconfigured or expecting a v3 structure (e.g., viewId instead of property), even though it’s set to v4. The Retool docs example I found uses viewId and ga: prefixes, which aligns with v3, but that doesn’t seem to fit my v4 setup.

Question: Has anyone else experienced this with the GA4 v4 API in Retool? Could this be a resource misconfiguration, or am I missing something in the request body? Any suggestions on how to troubleshoot further or fix this would be hugely appreciated!

Thanks in advance for your help!

Hi @chuck,

Apologies for the issue. I am not very familiar with v3 verses v4 but I spun up a v4 query and also got the error Required parameter ids is not provided which from your account is incorrect as it should not be a required argument.

I can definitely report this to our engineering team to dig into. If possible, could you share a screenshot of your query in Retool?

I am going to need to try and seed my GA account with some dummy data to test this out fully, if you have a screenshot of some simple dummy data that should appear from the query that would be incredibly helpful as well!