A Google Analytics API Client

Provides functions for accessing and retrieving data from the Google Analytics APIs ( https://developers.google.com/analytics/). Supports OAuth 2.0 authorization. Package provides access to the Management, Core Reporting, Multi-Channel Funnels Reporting, Real Time Reporting and Metadata APIs. Access to all the Google Analytics accounts which the user has access to. Auto-pagination to return more than 10,000 rows of the results by combining multiple data requests. Also package provides shiny app to explore the core reporting API dimensions and metrics.

Travis-CI Build Status CRAN_Status_Badge

This package is designed to work with the API Google Analytics in R.

Key features:

  • OAuth 2.0 authorization;
  • Auto refresh an expired OAuth access token;
  • Access to all the accounts which the user has access to;
  • API responses is converted directly into R objects;
  • Access to the following Google Analytics APIs:
  • Auto-pagination to return more than 10,000 rows of the results by combining multiple data requests;
  • Split the query by date ranges to avoid a sampling data;
  • Shiny app to explore all the dimensions and metrics available through the Core Reporting API.


To install the latest release version from CRAN with:


To install the development version the install_github() function from devtools package can be used:


Another method to install the package RGA (using the command line):

git clone https://github.com/artemklevtsov/RGA.git
R CMD build RGA


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 anaytics data from the API with one of these functions:
    • get_ga() for the Core Reporting API
    • get_mcf() for the Multi-Channel Funnels Reporting API
    • get_realtime() for the Real Time Reporting API

For details about this steps please type into R:

library(help = "RGA")
browseVignettes(package = "RGA")

Bug reports

First check the changes in the latest version of the package. Type type into R:

news(package = "RGA", Version == packageVersion("RGA"))

Try reproduce a bug with the latest development version from Git.

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


Post the traceback() and sessionInfo() output also may be helpful.

To report a bug please type into R:

utils::bug.report(package = "RGA")


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.4.2 by Artem Klevtsov, 5 years ago


Report a bug at https://github.com/artemklevtsov/RGA/issues

Browse source code at https://github.com/cran/RGA

Authors: Artem Klevtsov [aut, cre] , Philipp Upravitelev [ctb] , Olga Shramko [ctb]

Documentation:   PDF Manual  

Task views: Web Technologies and Services

GPL (>= 2) license

Imports jsonlite, httr, plyr, lubridate

Suggests knitr, rmarkdown, testthat, shiny

See at CRAN