googleAnalyticsR (version 0.8.0)

fetch_google_analytics_4: Fetch multiple GAv4 requests

Description

Fetch the GAv4 requests as created by make_ga_4_req

Usage

fetch_google_analytics_4(request_list, merge = FALSE, useResourceQuotas = NULL)

Arguments

request_list

A list of requests created by make_ga_4_req

merge

If TRUE then will rbind that list of data.frames

useResourceQuotas

If using GA360, access increased sampling limits. Default NULL, set to TRUE or FALSE if you have access to this feature.

Value

A dataframe if one request, or a list of data.frames if multiple.

Details

For same viewId, daterange, segments, samplingLevel and cohortGroup, v4 batches can be made

See Also

Other GAv4 fetch functions: fetch_google_analytics_4_slow(), google_analytics(), make_ga_4_req()

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
library(googleAnalyticsR)

## authenticate, 
## or use the RStudio Addin "Google API Auth" with analytics scopes set
ga_auth()

## get your accounts
account_list <- ga_account_list()

## pick a profile with data to query

ga_id <- account_list[23,'viewId']

ga_req1 <- make_ga_4_req(ga_id, 
                         date_range = c("2015-07-30","2015-10-01"),
                         dimensions=c('source','medium'), 
                         metrics = c('sessions'))

ga_req2 <- make_ga_4_req(ga_id, 
                         date_range = c("2015-07-30","2015-10-01"),
                         dimensions=c('source','medium'), 
                         metrics = c('users'))
                         
fetch_google_analytics_4(list(ga_req1, ga_req2))

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab