The googleAnalyticsR package

The googleAnalyticsR R package makes it easy and fun to query our Google Analytics data using the GA API. There are numerous functions available in this package that enable us to control the data we want to retrieve. Before diving into the code, let’s spend some time learning about Google Analytics dimensions and metrics.

Dimensions and metrics

In order to analyze our Google Analytics data, we need to gain a basic understanding of dimensions and metrics.

Dimensions are attributes of our data and metrics are quantitative measurements. For example, to analyze the count of users on our website in the last 60 days, the dimension is date and the metric is users.

Google Analytics supports hundreds of dimension-metric combinations that we can explore later. In this lesson, we will focus on some of the most used combinations.

Install googleAnalyticsR

To install the googleAnalyticsR package, we can use the following command in the R console:

Get hands-on with 1200+ tech skills courses.