What is it?
RGoogleAnalytics is a R package that provides an interface to the Google Analytics API. It enables you to query and extract your Google Analytics data within R itself.
It aims to provide the much need data extraction functionality since Google Analytics does not have a native R Client. It is designed for analysts and data scientists who wish to apply R’s analytics capabilities to their Google Analytics data.
Here are a few things RGoogleAnalytics does well out of the box
Provides Access to v3 of the Google Analytics Core Reporting API
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 splitting 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
Supports authorization via OAuth 2.0
At its core, RGoogleAnalytics handles the low level API routines (Authorization, JSON Data Parsing). Moreover, its bells and whistles ensure that you can extract your data without you having to worry about the plumbing. It is therefore well suited for both ad-hoc and batch extraction jobs. But if your use-case requires batch data extraction it is advisable to build your own data extraction module that satisfies your application’s latency requirements.
How to Install?
To get the current released version from CRAN:
To get the current development version from github:
If you are using the RStudio IDE then you can simply select RGoogleAnalytics from the dropdown in the Install Packages option
Below are a few blog posts that go over various web analytics use-cases in R. The posts assume general familiarity with R. If you haven’t used R much or at all, do invest some time in learning about R first.
This post gives a quick walkthrough of RGoogleAnalytics and getting your Google Analytics Data into R
Post your issues and feature requests to Github