Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Code for start using Google Analytics data in R


  • Hello world example
  • Basic exploratory data analysis
  • Data visualizations
  • Users segmentation

Hello world example

Conect to Google Analytics from R and download basic data.

Basic exploratory data analysis

Learn about dataset:

  • Calculate basic statistics (min, max, mean, median, standard deviation)

  • Plot histogram to check distribution

google analytics r histogram

  • Plot line chart to check values in times

google analytics r histogram

  • Prepare subset with days with low and high traffic

Data visualizations

  • Basic line chart - sessions in time

google analytics r histogram

  • Basic scatter plot - sessions in time

google analytics r histogram

  • Scatter plot with point size and color (bubble chart) - sessions in time

google analytics r histogram

  • Scatter plot with trend line - sessions in time

google analytics r histogram

  • Box plot - sessions distribution by dayOfWeek

google analytics r histogram


Forecasting web traffic using Holt-Winters method. Inspired by Richard Fergie

google analytics r forecasting

Users segmentation

Clustering website users by interests using k-means method and visualization in 3D scatter plot using plotly.

google analytics r clustering

Web traffic heatmap

Create heatmap of web traffic. Inspired by Todd Moy

google analytics r clustering

Device comparsion

Compare behavior of different user segments (by deviceCategory).

google analytics r clustering

Sessions calendar

Plot sessions calendar.

google analytics r sessions calendar

Others resources

All cases using library googleAnalyticsR by Mark Edmonson


Scripts to start working with data from Google Analytics in R



No releases published


No packages published


You can’t perform that action at this time.