Learn R Programming

shinyga (version 0.1.2.9001)

rollupGA: rollupGA - get GA data from multiple Views

Description

If you have multiple GA views in GAProfileTable (from getAndMergeGAAccounts() ) will walk through results for all of them.

Usage

rollupGA(GAProfileTable, sort = "", max_results = -1, dimensions = "ga:date", start_date = "2013-02-01", start_index = 1, metrics = "ga:visits,ga:transactionRevenue", filters = "", segment = "", end_date = "2013-02-01", walk = FALSE, ga = someGAtoken)

Arguments

GAProfileTable
Table of property Ids, generated from
sort
Sort the results before returning data
dimensions
Dimensions called, in GA API format (e.g. ga:date, ga:source)
metrics
Metrics called, in GA API format (e.g. ga:visits,ga:pageviews)
filters
Filters of data
segment
Any segments
walk
If results are sampled, whether to do daily fetches to avoid sampling
ga
The token needed to fetch the data
start.date
Start date of data fetch
end.date
End date of data fetch
fields
What fields from the API should be returned
start
What start index of the data, used for walking through big results
max
Maximum number of results to fetch
date.format
Date format of results
messages
Feedback messages
batch
If results over 10000 limit, whether to batch them
output.raw
Whether the results should be outputed not parsed into data.frame
output.formats
Formats of data output
return.url
Whether to return a URL
rbr
Row by Row setting, will return NAs for empty rows
envir
Which environment the data will be

Value

A dataframe of GA data with the GA View specified in a column.

See Also

Refer to the dimensions and metric Google help file for more details. https://developers.google.com/analytics/devguides/reporting/core/dimsmets

Other fetch data functions: MEgetData; getAndMergeGAAccounts; processManagementData; shinygaGetAccounts; shinygaGetAdWords; shinygaGetCustomDataSources; shinygaGetCustomDimensions; shinygaGetCustomMetrics; shinygaGetFilters; shinygaGetGoals; shinygaGetProfiles; shinygaGetSegments; shinygaGetUsers; shinygaGetWebProperties

Examples

Run this code
## Not run: 
#  chartData <- reactive({
#      validate(
#        need(ShinyMakeGAProfileTable(), "Need Profiles"),
#        need(input$menuSeg != "", "Need Segment"),
#        need(input$metric_choice != "", "Need Metric"),
#        need(datePeriod(), "Need Dates")
#      )
# 
#    data <- ShinyMakeGAProfileTable()
# 
#    token <- AccessToken()
#    start <- input$range_date[1]
#    end   <- input$range_date[2]
#    segment_choice <- as.character(input$menuSeg)
#    gaid <- as.character(input$view)
#    metric_choice <- as.character(input$metric_choice)
# 
#    profileRow <- df[df$id == gaid,]
#    d_dates <- as.character(datePeriod())
# 
#  data <- rollupGA(GAProfileTable = profileRow,
#                   sort = d_dates,
#                   max_results = -1,
#                   dimensions = d_dates,
#                   start_date = start,
#                   start_index = 1,
#                   metrics = paste0('ga:',metric_choice),
#                   filters = '',
#                   segment = segment_choice,
#                   end_date = end,
#                   walk = FALSE,
#                   ga = token)
# 
#  data
# 
#  })
#  ## End(Not run)

Run the code above in your browser using DataLab