Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Google Analytics Metrics #11

Merged
merged 9 commits into from
Nov 19, 2023
Merged

Conversation

cansavvy
Copy link
Collaborator

@cansavvy cansavvy commented Nov 15, 2023

Purpose/implementation Section

What changes are being implemented in this Pull Request?

Goals: We want any useful stats from Google Analytics about our many many websites and courses.

What was your approach?

Ideally we can just call one function that collects an entire GitHub organization's repos' metrics.

Usage

authorize("google") # Login with an account that actually has a Google Analytics account -- this is key
accounts <- get_ga_user()

# Pick an account
account_id <- accounts$id[5]
stats_list <- all_ga_metrics(account_id = account_id)

R/google-analytics.R Outdated Show resolved Hide resolved
"dateRanges" = list(
"startDate" = start_date,
"endDate" = end_date),
list(name = "activeUsers"),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a list of the stats I think are useful. I think it makes sense to functionalize this in such a way that allows folks to provide their own desired metrics they'd like to use. But that will probably be a future PR.

@cansavvy cansavvy marked this pull request as ready for review November 15, 2023 20:07
@howardbaik howardbaik self-requested a review November 16, 2023 00:56
@howardbaik
Copy link
Contributor

howardbaik commented Nov 17, 2023

What do you think of outputting tibbles instead of dataframes? The googlesheets4 package does this here https://github.com/tidyverse/googlesheets4#read , and it looks much nicer in the console.

The authors of googlesheets4 uses as_tibble() to coerce the final output into tibbles.

@howardbaik
Copy link
Contributor

The Usage functions work, but I think the trick now is to coerce those unpretty lists into readable tibbles.

@cansavvy
Copy link
Collaborator Author

Yes! That is what #16 and #17 are!

R/google-analytics.R Outdated Show resolved Hide resolved
R/google-analytics.R Outdated Show resolved Hide resolved
@cansavvy cansavvy merged commit 4ce5028 into main Nov 19, 2023
5 checks passed
@cansavvy cansavvy deleted the cansavvy/google-analytics branch November 19, 2023 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants