google_analytics_4(viewId, date_range = NULL, metrics = NULL,
dimensions = NULL, dim_filters = NULL, met_filters = NULL,
filtersExpression = NULL, order = NULL, segments = NULL,
pivots = NULL, cohorts = NULL, max = 1000,
samplingLevel = c("DEFAULT", "SMALL", "LARGE"), metricFormat = NULL,
histogramBuckets = NULL)
c(start, end)
or
for two date ranges: c(start1,end1,start2,end2)
fetch_google_analytics_4
,
make_ga_4_req
library(googleAnalyticsR)
## authenticate,
## or use the RStudio Addin "Google API Auth" with analytics scopes set
ga_auth()
## get your accounts
account_list <- google_analytics_account_list()
## pick a profile with data to query
ga_id <- account_list[23,'viewId']
ga_data <- google_analytics_4(ga_id,
date_range = c("2015-07-30","2015-10-01"),
dimensions=c('source','medium'),
metrics = c('sessions','bounces'))
Run the code above in your browser using DataLab