With four commands in a script, we're going to pull daily data from 01.01.2016 through 08.11.2016.
## Load the package we need to pull Google Analytics library(googleAnalyticsR)
## Authenticate (gotta' have access to the data!) ga_auth()
## Specify the view we're going to use data from view_id <- 81054104
## Get the data!
web_data <- google_analytics_4(view_id,
date_range = c("2016-01-01", as.character(Sys.Date()-1)),
metrics = c("sessions","pageviews",
"entrances","bounces","hits","totalEvents"),
dimensions = c("date","deviceCategory",
"channelGrouping"),
anti_sample = TRUE)