Filter Google Analytics report
29 Nov 2022 in TIL
I'm trying out Radar to keep track of analytics at a glance. It's Google Analytics collection works great, but the way that we've set up Google Analytics the data for multiple sites ends up in the same property.
I wanted to filter the report to only traffic to a specific subdomain. It took me too long to work out that I needed a dimensionFilterClauses entry with the ga:pagePath (via the schema).
Here's how to filter your reports in case you (or I) need to do it in the future:
json
Other things that may be useful:
Endpoint: https://analyticsreporting.googleapis.com/v4/reports:batchGet
Method: POST
Auth: Bearer [token]
Then transform the results using the following JS snippet:
javascript