AI-generated Key Takeaways
-
Looker Studio can apply filters to data from community connectors, but applying filters within the connector itself can significantly enhance performance.
-
Community connectors should apply all filters provided in the
getData()request or none at all, and structure them withANDandORlogic as specified. -
If a connector cannot apply all filters, it should return all data and indicate
filtersApplied: falsein the response, ensuring backward compatibility. -
When filters are successfully applied within the connector, the response should exclude
forFilterOnlyfields and includefiltersApplied: true.
If a report contains filters and a community connector returns unfiltered data for all fields requested then Looker Studio will apply filters to the connector response. However, filters can be applied at the community connector level which can significantly improve performance in some cases. Filter information is passed in the getData() request object, and the connector can use this information to filter data before sending it back to Looker Studio.
For example, if you're connecting to a SQL database, applying the filters
directly in the WHERE clause (B3 in diagram below) can drastically decrease
the number of rows returned to Looker Studio. This, in turn, limits the amount
of data that has to be processed and sent to Looker Studio (B5).

Rules of applying filters
- Apply all filters, or none of them. See Unsupported filters
- Do not include
forFilterOnlyfields in the response. ANDtogether each entry in therequest.dimensionsFiltersarray.For example, for the following filter, the connector should only include values that have a
countryofUSAAND asourceofSocial.{ "dimensionsFilters": [ [{ "fieldName": "country", "values": ["USA"], "type": "INCLUDE", "operator": "EQUALS" }], [{ "fieldName": "source", "values": ["Social"], "type": "INCLUDE", "operator": "EQUALS" }] ] }ORtogether each sub-array in therequest.dimensionsFiltersarray.For example, for the following filter, the connector should only include values that have a
countryofUSAOR acountryofCanada.{ "dimensionsFilters": [ [{ "fieldName": "country", "values": ["Canada"], "type": "INCLUDE", "operator": "EQUALS" }, { "fieldName": "country", "values": ["USA"], "type": "INCLUDE", "operator": "EQUALS" }] ] }
Example
The following example illustrates an end-to-end flow from the report user defining filters to the community connector returning filtered data.

The report user has configured two filters:
countryisIN_LISTofCanada, USAsourceisIN_LISTofSocial, Organic
The report user has configured a chart component with the
sourcedimension andsessionsmetricgetData()is executed by Looker Studio with the following request object:{ "fields": [ {"name": "source"}, {"name": "sessions"}, {"name": "country", "forFilterOnly": true} ], "dimensionsFilters": [ [{ "fieldName": "country", "values": ["Canada", "USA"], "type": "INCLUDE", "operator": "IN_LIST" }], [{ "fieldName": "source", "values": ["Social", "Organic"], "type": "INCLUDE", "operator": "IN_LIST" }] ] }Connector responds with filtered data.
For the example request, return the
sourceandsessionswherecountryis"Canada"or"USA"AND thesourceis"Social"or"Organic". SetfiltersAppliedtotruesince all filters were able to be successfully applied.
Original data
| source | sessions | country |
|---|---|---|
| Social | 60 | USA |
| Social | 50 | Canada |
| Social | 40 | UK |
| Organic | 90 | USA |
| Organic | 80 | Canada |
| Organic | 70 | UK |
| Newspaper | 30 | USA |
| Newspaper | 20 | Canada |
| Newspaper | 10 | UK |
Filtered data
| source | sessions |
|---|---|
| Social | 60 |
| Social | 50 |
| Organic | 90 |
| Organic | 80 |
getData() response
{
"schema": [
{"name": "source", "dataType": "STRING"},
{"name": "sessions", "dataType": "NUMBER"},
],
"rows": [
{"values": ["Social", 60]},
{"values": ["Social", 50]},
{"values": ["Organic", 90]},
{"values": ["Organic", 80]}
],
"filtersApplied": true
}
Unsupported filters
If the connector cannot apply all filters in the request, no filtering should be
performed. Return all of the requested fields (including the forFilterOnly
fields) and set the filtersApplied key in your response to false.
Example:
{
"schema": [
{"name": "source", "dataType": "STRING"},
{"name": "sessions", "dataType": "NUMBER"},
{"name": "country", "dataType": "STRING"}
],
"rows": [
{"values": ["Social", 60, "USA"]},
{"values": ["Social", 50, "Canada"]},
{"values": ["Social", 40, "UK"]},
{"values": ["Organic", 90, "USA"]},
{"values": ["Organic", 80, "Canada"]},
{"values": ["Organic", 70, "UK"]},
{"values": ["Newspaper", 30, "USA"]},
{"values": ["Newspaper", 20, "Canada"]},
{"values": ["Newspaper", 10, "UK"]},
],
"filtersApplied": false
}