I get tired of wasting time searching for this in old files… I typically use BigQuery, but when it is handy, it is handy.
#install.packages("googleAnalyticsR")
library(googleAnalyticsR)
library(googleAuthR)
ga_auth() #authorize googleAnalyticsR to access your data
my_accounts <- ga_account_list()
class(my_accounts)
is.data.frame(my_accounts)
dim(my_accounts)
my_accounts$accountName
arguments <- ga_meta()
my_id <- "362…." #my_id <- my_accounts$viewId[3]
dates <- c("2020-10-26","2020-10-26")
prodMetrics <- c("productListViews","productDetailViews","productAddsToCart", "productRemovesFromCart","cartToDetailRate","buyToDetailRate", "uniquePurchases","itemQuantity")
prodData <- google_analytics(my_id,
date_range = dates,
metrics = prodMetrics,
dimensions = c("date","productName"))
Leave a Reply