Analyze web traffic data with Google Analytics and R

February 7, 2013
By

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

If you run an e-commerce site, blog or other web property there's a good chance you use Google Analytics to monitor traffic, look at visitor sources, and measure conversions. And while Google Analytics is quite powerful at looking at historic activity on your site, it lacks much in the way of predictive analytics. That's where R shines of course, and it's now quite easy to connect R to your Google Analytics account to make use of R's superior data visualization, forecasting, and other advanced analytics capabilities.

Digital analytics expert Randy Zwitch explains how to use the rga package for R to access your Google Analytics data and import it into R. There, you can use all of R's capabilities to analyze the data. For example, you can use boxplots to look at the proportion of visits to a site via a Google search where the search terms are actually provided:

Google-not-provided
To interface with Google Analytics you'll need an access token for the Google Analytics API console (the Tatvic Blog provides some tips for obtaining one). Once you're set up, you can run the code at the link below to create your own version of the chart above, or simply start using R to analyze your web traffic data.

randyzwitch.com: (not provided): Using R and the Google Analytics API

To leave a comment for the author, please follow the link and comment on his blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.