18F / analytics-reporter

Lightweight analytics reporting and publishing tool for Digital Analytics Program's Google Analytics 360 data.

Home Page:https://analytics.usa.gov/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expand reports to include more agencies

geramirez opened this issue · comments

Allow analytics reporter to work with views for multiple agencies.

+1 just looking at this at the moment to work out how to use .env to config GA IDs for multiple properties and perhaps generate subfolders of json output for each set of data.

How is this tool being run for each agencies set of data that is being displayed on analytics.usa.gov? Is there an individual instance per agency or something?

Thanks in advance.

@camfindlay Last I checked, the DAP uses a single reporting Property in GA, with a separate filtered View for each participating agency (it's a paid Google Analytics 360 account, allowing more than 20 views per Property).

Each View # is defined in /deploy/envs/*.env, then the reports configured in /reports/usa.json are run for each View per the crontab & intervals set forth in /deploy/*.sh files. The shell scripts also define paths for each agency in the AWS S3 bucket where the data is stored (and the front end is configured to look).

TL;DR it's one instance of analytics-reporter running the same reports at scheduled intervals for each agency View from a single GA Property, then saving the data to a separate directory for each agency. To use the same configuration, your GA reporting would also need to be configured this way, with separate Views filtering traffic for each agency.

Disclaimer: I am an external contributor and don't directly access the DAP GA account, but hopefully this might be helpful. Happy to expound if you've other questions.

Correct me if wrong @geramirez @konklone, but might this issue be closed, since this feature exists since ~ 3882b08?

Correct me if wrong @geramirez @konklone, but might this issue be closed, since this feature exists since ~ 3882b08?

Yep, that's right. And yeah, the production site uses one analytics-reporter instance, but it runs it repeatedly with different env vars each time, to produce reports scoped per-view (which internally to GA, is structured so that each agency has their own view).

"but it runs it repeatedly with different env vars each time" @konklone this is what I'm interested in. I see in the sh script in deploy folder it's just a matter of loading in each .env file and then running the command again with a different output path 👍

It would work for multiple Properties too as long as the service account email is granted permissions on that property and you use a view id from each property.

Just expressing my thoughts here in case someone else is looking for the same info :) (Could perhaps even start a wiki or /docs/ folder in the codebase to capture reuse knowledge?)