Closed Cassandra-Clark closed 3 months ago
Cassandra Clark reports a new STANDUP for today (2024-02-06):
Progress: run_analytics_report design, book club, table.running design It should be finished by 2024-02-15.
Next Day: review run_analytics_report and table.running, publish book club
For Dimensions and Metrics, the following should be used to start:
Dimensions:
Metrics:
Are we supporting UA or GA4? Those are all UA options, but think we want to be on GA4 right?
The Google Analytics APIs offer a robust and varied set of options for querying data. The current
run_analytics_report
method only supports modification to which property is being queried and the date range, but there is room for a much more robust set of options.A rough outline of the proposed API follows:
run_analytics_report File -> Text -> Date -> Date -> Metrics -> Dimensions -> Table run_analytics_report authentication_file=Nothing start_date:Date=(Date.new 2020 3 31) end_date:Date=date.today metrics:[see notes] dimensions:[see notes]
authentication_file
Default is Nothing, if default then uses the GOOGLE_APPLICATION_CREDENTIALS environment variable. If a secrets file is provided, uses that file instead. There are two different options that can be used for this,
options.credentials
which is a JSON object andoptions.keyFilename
which is a path. Ideally both of these would be supported, but the credentials option is probably more Enso-y if we have to pick one. See this documentation from Google for more detailsNOTE: As the secrets file can allow access to powerful modifications within the user's google_analytics space, it should probably be treated similarly to a password. This could leverage enso's support of secrets instead as a more robust design.
Metrics a helper with a list of supported metrics from the reporting api, IE
activeUsers
Supports a vector of a sequence of metrics and iterates through.addMetrics
to add each one.Dimensions a helper with a list of supported dimensions from the reporting api, IE
city
Supports a vector of a sequence of metrics and iterates through.addDimensions
to add each one.reference document for all dimensions and metrics. We can discuss which ones are high priority as I don't think we have to support all of them, and there are some metric+dimension pairs that do not work