make_cohort_group: Create a cohort group

Description Usage Arguments Details Value See Also Examples

View source: R/cohorts.R

Description

Create a cohort group

Usage

1
make_cohort_group(cohorts, lifetimeValue = FALSE, cohort_types = NULL)

Arguments

cohorts

A named list of start/end date pairs

lifetimeValue

lifetimeValue TRUE or FALSE. Only works for webapps.

cohort_types

placeholder, does nothing as only FIRST_VISIT_DATE supported.

Details

Example: list("cohort 1" = c("2015-08-01", "2015-08-01"), "cohort 2" = c("2015-07-01","2015-07-01"))

Value

A cohortGroup object

See Also

https://developers.google.com/analytics/devguides/reporting/core/v4/advanced#cohort_and_lifetime_value_ltv_dimensions_and_metrics

Other v4 cohort functions: cohortGroup, cohort_dimension_check, cohort_metric_check, cohort

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## 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_4(ga_id, 
                                     dimensions=c('cohort'), 
                                     cohort = cohort4, 
                                     metrics = c('cohortTotalUsers'))
                                     

## End(Not run)

GeeHLee/GoogleR documentation built on May 6, 2019, 5:34 p.m.