Google Analytics Node Filtering the custom report

Describe the issue/error/question

Hello community,
I’m having a problem with the google analytics node. I want to automate one GA custom report in n8n. As far as I understand the only way to do this is to generate the same custom report by selecting all the fields in n8n node. I managed to add date range, one dimension and one metric but I can’t use the filter dimention functionality for some reason.

Any idea why this might be?

Here is the report I’m trying to creare


What is the error message (if any)?

ERROR: Bad request - please check your parameters

Unknown dimension(s): submitFreebie|RAF For details see https://developers.google.com/analytics/devguides/reporting/core/dimsmets.

Details


Google Analytics

Execute node

Parameters


Docs

Credential for Google Analytics OAuth2 API

Resource

Operation

View Name or ID

Fixed

Expression

Return All

Fixed

Expression

Simplify

Fixed

Expression

Additional Fields

Date Ranges

Start Date

Fixed

Expression

End Date

Fixed

Expression

Dimensions

Name or ID

Fixed

Expression

Name or ID

Fixed

Expression

Name or ID

Fixed

Expression

Add Dimension

Dimension Filters

Dimension Name or ID

Fixed

Expression

Operator

Fixed

Expression

Value

Fixed

Expression

Add Dimension Filter

Metrics

Alias

Fixed

Expression

Expression

Fixed

Expression

Formatting Type

Fixed

Expression

Add Metrics

I wish this node would…

Problem in node ‘Google Analytics‘

Bad request - please check your parameters

Please share the workflow

(Select the nodes and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow respectively)

{
“meta”: {
“instanceId”: “bd3424651820da96219b3bf8bf1cdfabcd2b0cc2dbde58159a106ccfa63cca09”
},
“nodes”: [
{
“parameters”: {},
“id”: “49e62e75-b5f6-4a6d-ada6-10bb0513c74e”,
“name”: “When clicking "Execute Workflow"”,
“type”: “n8n-nodes-base.manualTrigger”,
“typeVersion”: 1,
“position”: [
1140,
580
]
},
{
“parameters”: {
“viewId”: “54789410”,
“returnAll”: true,
“additionalFields”: {
“dateRangesUi”: {
“dateRanges”: {
“startDate”: “2023-01-21T23:00:00.000Z”,
“endDate”: “2023-01-27T23:00:00.000Z”
}
},
“dimensionUi”: {
“dimensionValues”: [
{
“name”: “ga:sourceMedium”
},
{
“name”: “ga:campaign”
},
{
“name”: “ga:eventAction”
}
]
},
“dimensionFiltersUi”: {
“filterValues”: [
{
“dimensionName”: “submitFreebie|RAF”,
“operator”: “REGEXP”,
“expressions”: “ga:eventAction”
}
]
},
“metricsUi”: {
“metricValues”: [
{
“alias”: “Total Events”,
“expression”: “ga:totalEvents”
}
]
}
}
},
“id”: “3be3c3ee-6447-4159-a636-b41e35a6ce6c”,
“name”: “Google Analytics”,
“type”: “n8n-nodes-base.googleAnalytics”,
“typeVersion”: 1,
“position”: [
1340,
580
],
“credentials”: {
“googleAnalyticsOAuth2”: {
“id”: “46”,
“name”: “Google Analytics account”
}
}
}
],
“connections”: {
“When clicking "Execute Workflow"”: {
“main”: [
[
{
“node”: “Google Analytics”,
“type”: “main”,
“index”: 0
}
]
]
}
}
}

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]:
1 Like

Hey @Irem_Odemis,

What version of n8n are you using?

Looking at the screenshot the red icons tend to mean the option is not valid unless an expression is used. Are those options typed in or selected from a list?

The actual error you are getting is Google saying that “submitFreebie|RAF” doesn’t exist as a dimension.

I’m using Version 0.209.0
I don’t see any list in the drop down unfortunately.

I used the expressions I found in https://ga-dev-tools.web.app/dimensions-metrics-explorer/ and I get some data with these expressions so it’s working actually.

The actual error you are getting is Google saying that “submitFreebie|RAF” doesn’t exist as a dimension. - Yes I thought this is because of the regex but even when I try the exact name of one event this time I get this error

ERROR: Bad request - please check your parameters

Unknown dimension(s): submitFreebie For details see https://developers.google.com/analytics/devguides/reporting/core/dimsmets

Hey @Irem_Odemis,

If you click on the 3 dots above the field there should be an option to refresh the list. While the expression works in the UI it is still not happy with what you are sending it from the node so it might want the full ID rather than the name. The name is the friendly value that is loaded and the ID could be a random string of numbers and letters.

Thank you for your reply Jon,
Can you tell me how I can get the id of the dimensions and metrics?

Unfortunatelly the three dots and refresh doesn’t do anything in my case. I get this message Issues:

  • There was a problem loading the parameter options from server: “Forbidden - perhaps check your credentials?” But I’m able to get the report when I add manually the metric name (ga:sourceMedium) so I shouldn’t have any credential issue.

Hey @Irem_Odemis,

Normally I would say use the dropdown and swap it to an expression and that should sort it out, A forbidden could be that there is a permission missing that is stopping that from working so the manual approach would be to work out where in the Google UI they hide the internal ID that you can work with.

Sadly I don’t do anything with Google Analytics so I am not sure where it would be hiding, It could also be worth updating to 0.212.0 which includes an updated Google Analytics node which might solve the issue as well.

Thank you for your suggestions Jon,
One question is there another way to access only to a specific report in GA? instead of creaiting that report again in n8n? Like ideally I would like to have these kind of filters and settings in the report itself and pull that specific report to n8n with a report id.

It doesn’t look like it, Sounds like a good feature request though.

1 Like

Thanks Jon,
I will submit a feature request for that.

Same problem here, it was working and after a n8n update the workflow begins to fail with the same message: “ERROR: Bad request - please check you parameters”.

Hey @lpadula
I tried adding the dimension name and value like this (see screenshot) and it worked. Hope this helps
Screenshot 2023-02-08 at 11.05.32

I take the dimension names from https://ga-dev-tools.web.app/dimensions-metrics-explorer/

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.