diff --git a/R/ga_v4_get.R b/R/ga_v4_get.R index d7f13e09..c5957c3d 100644 --- a/R/ga_v4_get.R +++ b/R/ga_v4_get.R @@ -245,7 +245,7 @@ google_analytics_4 <- function(viewId, if(max > 10000){ ## how many v4 batch requests can be made at one time (5-1) due to bad maths batchLimit <- 5 - meta_batch_start_index <- seq(from=1, to=max, by=10000*batchLimit) + meta_batch_start_index <- seq(from=0, to=max, by=10000*batchLimit) batches <- length(meta_batch_start_index) message("V4 Batching data into [", batches, "] calls.") @@ -311,7 +311,7 @@ google_analytics_4 <- function(viewId, segments=segments, pivots=pivots, cohorts=cohorts, - pageToken = 1, + pageToken = 0, pageSize = max, samplingLevel=samplingLevel, metricFormat=metricFormat, diff --git a/README.md b/README.md index a0267552..df97ade7 100644 --- a/README.md +++ b/README.md @@ -287,8 +287,8 @@ Details on [cohort reports and LTV can be found here](https://developers.google. ```r ## 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"))) +cohort4 <- make_cohort_group(list("Jan2016" = c("2016-01-01", "2016-01-31"), + "Feb2016" = c("2016-02-01","2016-02-28"))) ## then call cohort report. No date_range and must include metrics and dimensions ## from the cohort list @@ -298,9 +298,9 @@ cohort_example <- google_analytics_4(ga_id, metrics = c('cohortTotalUsers')) cohort_example -# cohort cohortTotalUsers -# 1 cohort 1 14 -# 2 cohort 2 20 +# cohort cohortTotalUsers +# 1 Feb2016 19040 +# 2 Jan2016 23378 ```