Connector Improvement: Filtering for the Google Analytics 4 connector
AnsweredThe Google Analytics 4 Data API v1 supports different match types of filtering beyond just "exact" match but the existing connector does not.
Currently, in order to filter anything, the dimension must first be added to the report and then I can filter on it but it has be an exact match.
The API actually supports more filtering match types. Also it shouldn't be necessary to add the dimension to the report in order to filter on it.
https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/FilterExpression
Last the API supports grouping together multiple filters such as Filter 1 AND Filter 2.
https://developers.google.com/analytics/devguides/reporting/data/v1/basics
Here an example of basic a API request for multiple filters with different match types:
{
"dimensions": [
{
"name": "date"
}
],
"metrics": [
{
"name": "sessions"
}
],
"dimensionFilter": {
"andGroup": {
"expressions": [
{
"filter": {
"fieldName": "hostName",
"stringFilter": {
"caseSensitive": false,
"matchType": "CONTAINS",
"value": ".mycustomhost.com"
}
}
},
{
"filter": {
"fieldName": "customEvent:custom_dimension_one",
"stringFilter": {
"matchType": "EXACT",
"value": "CA"
}
}
}
]
}
},
"dateRanges": [
{
"startDate": "yesterday",
"endDate": "yesterday"
}
]
}-
Official comment
Hi there,
Luke from the Product team here. Thanks for submitting this feature request.
We've updated our connector to allow filtering on dimensions that aren't included in the report.
I'd like to understand more about your use cases for these other types of filters. Using the example you provided, why wouldn't you add hostName and custom_dimension_one as dimensions in your report and then apply filtering in your warehouse? Wouldn't this be preferred? If your needs change and you want to expand the filter to include another contains statement, you could make that change in your downstream queries rather than needing to modify the connector in Fivetran.
Luke -
Hello Lucas,
You bring a valid point, the issue is the limitation on the number of dimensions and metrics that can be pulled during the report generation. Adding the hostname as a dimensions means I would have to give up another dimension.
-
That makes sense, thanks for clarifying!
In case you didn't know, our connector allows you to filter a dimension not included in your report. You could filter customEvent:custom_dimension_one to include "CA" and add hostname as one of your nine dimensions within the report then filter it downstream.
However, I understand this doesn't work when there are more than ten dimensions you need to consider. I'm curious if that is a common use case though. -
Hi Lucas,
Valid point, our setup is a little more complicated. We have three domains in cross domain under the same property. Each of these root domains have different points of sale ("page_country") and the checkout funnels are on subdomains for each of these root domains. Given that the report is already aggregated it leads to a lot duplication unless it's filtered at the source. Example:
Date | Dimension hostname | Sessions
2024-01-01 | https://subdomainA.hostA.com | 10
2024-01-01 | https://www.hostA.com | 50
Total Sessions: 60
** Keep in mind to access SubdomainA people need to first visit www.HostA.www.
So the real session count is 50 for the "whole" of website A out of which 10 started the checkout
Date | Sessions
2024-01-01 | 50
Total Sessions : 50
Filter for host contains: ".hostA.com"
Best,
Please sign in to leave a comment.
Comments
4 comments