So lately, I’ve been learning to use R with Google Analytics using R Studio. I’m just a couple of weeks in, but so far it has proven just amazing. By combining R with the Google Analytics Core Reporting API, it’s possible to do analysis, calculations and statistics much faster and deeper than using the Google Analytics interface or even add-ons to import Google Analytics data into Excel. Since R is script based, all analyses are automatically documented – and they’re easily reusable. Throw in the built-in plot functions (or the ggplot2 package) to build a wide range of visual representations of data, and you got an extremely powerful data analysis tool. However, what I’ve found is that – compared to Google Analytics – it’s more difficult to find good information, tips and learning material online. So I thought I’d share some of the articles I have come across.
This post from Analytics Demystified is *the* best resource I found for getting to know R with Google Analytics. Tim Wilson takes you through a step by step guide to setup your R environment (on Windows), set up API keys for Google Analytics, introduce you to the R Studio workspace and how to perform the first basic data grabs from Google Analytics. If you’re just getting started with R for Google Analytics, this is a must read.
This LunaMetrics post is not as detailed, and is not meant as tutorial as such for setting up R. Instead, it focuses more on how to use R to export data from Google Analytics to different formats. Becky West details how to link R with your Google Analytics account and then proceeds with examples on how to export your data to CSV files, to Excel files, to charts/graphics (using ggplot2) or to a database. These export features are great when you just need that raw data, need charts for presentations or need to performer larger scale analysis with SQL.
This one hour webinar by Indian analytics agency Tatvic takes you through some of the benefits of using R with Google Analytics altogether. It’s not as much a tutorial as it’s an “explainer”. Why should you use R, and what is R’s role in the world of web analytics? It does proceed to give three real world examples and use cases, that demonstrate some of the power R to do analysis in a manner that would be fairly time consuming using the Google Analytics interface or Excel.
I found this post when I specifically searched for way to do traffic heatmaps with R Studio. Heatmaps are many things – but I often use them as graphical representations of traffic, ecommerce sales and other metrics over time (e.g. to visualise ecommerce sales for an entire year with a heatmap). Building these types of heatmaps with Google Analytics and Excel involves a series of steps – and if you do them often enough, it’ll take up a lot of time. Using R, however, the entire process is scripted, and it’s literally possible to create a heatmap in seconds. This post by Todd May is a great tutorial for getting started with those heatmaps in R.
Well, I guess this is a must have on this list. I accidently found this entire R for Dummies book online when checking out the suggested reading material for a course I’m thinking of taking with the Danish Technological Institute. The course is held by one of the writers, so I’m assuming it’s legal to link to this book. I’m not done reading it yet, but the first many pages are really promising and talks about R in plain english. It doesn’t include any use cases or examples for using R with Google Analytics specifically, but it will teach you (and me!) a lot of the basics of R calculations and tools.