rollupGA: rollupGA - get GA data from multiple Views

Description Usage Arguments Value See Also Examples

Description

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

Usage

1
2
3
4
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
## 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)

MarkEdmondson1234/shinyga documentation built on May 7, 2019, 3:34 p.m.