if (FALSE) {
# 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)
# unnest ecommerce activity hits from users
ga_clientid_activity_unnest(transactors$hits, "ecommerce")
# unnest goal activity hits from users
ga_clientid_activity_unnest(transactors$hits, "goals")
# unnest custom dimension activity hits from users
ga_clientid_activity_unnest(transactors$hits, "customDimension")
}
Run the code above in your browser using DataLab