View on GitHub

ga-and-r-examples

Examples using Google Analytics with R for a range of specific use cases

Google Analytics (and a little bit of Twitter) and R

This repository has ~5 examples of using R with Google Analytics (plus one example of using R with Twitter). These examples are designed to work with the free version of Google Analytics with just the base tag (implemented). This makes the examples less impactful, but the idea is that it makes them a safe and easy jumping off point for anyone who wants to use them.

There have been various presentations that, ultimately, point to this page for follow-up information. Depending on if/when you saw one of those presentations, you may be looking for different slides:

The presentations themselves cover different territory, but they all reference this page for examples.

There are Two Versions of Each Example

There are two versions of each example here:

Links to “executed code showing output” (RPubs) as well as links to Shiny apps (Shiny) that can be tried out with no coding are included in the table below.

Example Folder Name Examples
Time-Normalized Pageviews time-normalized-pageviews RPubs / Shiny
Page-Level Analysis/Comparison with Two Metrics page-analysis-two-metrics RPubs / Shiny
(Light) Text Mining of On-Site Search Data site-search-analysis RPubs / Shiny
(Light) Text Mining of Twitter Followers twitter-followers RPubs
Regression Analysis with a Nominal / Categorical Value (Day of Week) regression RPubs / Shiny
Time-Series Decomposition / Holt-Winters Forecasting / Anomaly Detection forecasting RPubs / Shiny

A Few Notes on the Shiny Apps

The Shiny apps listed above should work fairly well, although they have extremely limited error handling. So, if you’re using them and run into an error, please do log an issue in this repository.

If you are interested in using the Shiny code itself and modifying the code for your own purposes, there are a few things to be aware of:

Resources to Learn More

For a list of sites, blogs, books, podcasts, and other educational resources related to this topic, check out this resource.