Create a cohort group
make_cohort_group(cohorts, lifetimeValue = FALSE, cohort_types = NULL)
A named list of start/end date pairs
lifetimeValue TRUE or FALSE. Only works for webapps.
placeholder, does nothing as only FIRST_VISIT_DATE supported.
A cohortGroup object
Example: list("cohort 1" = c("2015-08-01", "2015-08-01"),
"cohort 2" = c("2015-07-01","2015-07-01"))
Other v4 cohort functions: cohortGroup
,
cohort_dimension_check
,
cohort_metric_check
, cohort
# NOT RUN {
# }
# NOT RUN {
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']
## first make a cohort group
cohort4 <- make_cohort_group(list("cohort 1" = c("2015-08-01", "2015-08-01"),
"cohort 2" = c("2015-07-01","2015-07-01")))
## then call cohort report. No date_range and must include metrics and dimensions
## from the cohort list
cohort_example <- google_analytics(ga_id,
dimensions=c('cohort'),
cohort = cohort4,
metrics = c('cohortTotalUsers'))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab