RGA-package: A Google Analytics API client for R

Description Key features Useage Bug reports Author(s) Examples

Description

A package for extracting data from Google Analytics API into R.

Key features

To report a bug please type: utils::bug.report(package = "RGA").

Useage

Once you have the package loaded, there are 3 steps you need to use to get data from Google Analytics:

  1. Authorize this package to access your Google Analytics data with the authorize function;

  2. Determine the profile ID which you want to get access to with the list_profiles function;

  3. Get the results from the API with one of these functions: get_ga, get_mcf or get_realtime.

For details about this steps please type into R: browseVignettes(package = "RGA")

Bug reports

Before posting a bug please try execute your code with the with_verbose wrapper. It will be useful if you attach verbose output to the bug report. For example: httr::with_verbose(list_profiles())

Post the traceback() output also may be helpful.

To report a bug please type into R: utils::bug.report(package = "RGA")

Author(s)

Artem Klevtsov [email protected]

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
# load package
library(RGA)
# get access token
authorize()
# get a GA profiles
ga_profiles <- list_profiles()
# choose the profile ID by site URL
id <- ga_profiles[grep("http://example.com", ga_profiles$website.url), "id"]
# get date when GA tracking began
first.date <- firstdate(id)
# get GA report data
ga_data <- get_ga(id, start.date = first.date, end.date = "today",
                  metrics = "ga:users,ga:sessions",
                  dimensions = "ga:userGender,ga:userAgeBracket")

## End(Not run)

RGA documentation built on May 2, 2019, 6:47 a.m.