R Wrapper for the Google Analytics API

Provides functions for accessing and retrieving data from the Google Analytics API

This repo is the new home for the RGoogleAnalytics library migrated from Google Code SVN

RGoogleAnalytics is a R Wrapper around the Google Analytics API. It allows fast and easy data extraction in R so that further statistical analysis can be run on the data

Key Features

  • Provides Access to v3 of the Google Analytics Core Reporting API

  • Supports authorization via OAuth 2.0

  • QueryBuilder Class to simplify creation of API Queries

  • Ability to pull more than 10,000 rows of data in batches via pagination of queries

  • Ability to mitigate the effect of Query Sampling by decreasing the date-range of queries and hence extract (nearly) unsampled data

  • In cases where queries are sampled, the output also returns the percentage of sessions that were used for the query


To get the current released version from CRAN:


To get the current development version from github:

# install.packages("devtools")


  • RCurl handles all the API Requests and Responses

  • rjson is used to convert the JSON Responses delivered by the Google Analytics API into R Objects

  • lubridate handles the date manipulation logic underlying Query Partitioning


Work on RGoogleAnalytics was started by Michael Pearmain at Google. He was supported by Nick Mihailowski (Google) and Vignesh Prajapati(Tatvic).

Important Links

  • List of Valid Dimension/Metric Combinations from the Google Analytics API Reference Guide

  • Query Feed Explorer allows you to test your queries for syntatical correctness. Once verified, the query parameters can then be copied to your R Script


Reference manual

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


0.1.1 by Kushan Shah, 4 years ago

Report a bug at https://github.com/Tatvic/RGoogleAnalytics/issues

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

Authors: Michael Pearmain. Contributions from Nick Mihailowski, Vignesh Prajapati, Kushan Shah and Nicolas Remy

Documentation:   PDF Manual  

Task views: Web Technologies and Services

Apache License 2.0 license

Depends on lubridate, httr

Suggests testthat

See at CRAN