if (FALSE) {
# access data for individual users
uar <- ga_clientid_activity(c("1106980347.1461227730", "476443645.1541099566"),
viewId = 81416156,
date_range = c("2019-01-01","2019-02-01"))
# access clientIds for users who have transacted
viewId <- 106249469
date_range <- c("2019-01-01","2019-02-01")
cids <- google_analytics(viewId,
date_range = date_range,
metrics = "sessions",
dimensions = "clientId",
met_filters = filter_clause_ga4(
list(met_filter("transactions",
"GREATER_THAN",
0)
)))
transactors <- ga_clientid_activity(cids$clientId,
viewId = viewId,
date_range = date_range)
# access the data.frames returned:
# the session level data for the users passed in
uar$sessions
# the hit level activity for the users passed in
uar$hits
# filter the response to only include certain activity types, such as goals:
only_goals <- ga_clientid_activity(c("1106980347.1461227730",
"476443645.1541099566"),
viewId = 81416156,
date_range = c("2019-01-01","2019-02-01"),
activity_types = "GOAL")
}
Run the code above in your browser using DataLab