To pull data from Google Analytics into R we will use googleAnalyticsR package by Mark Edmonson. This add-on enables you to use all of the features of Google Analytics, including the latest, like Google Analytics 360 or integration with Big Query.
Short list of googleAnalyticsR's features:
- First Google Analytics Reporting v4 API library for R
- v4 features include: dynamic calculated metrics, pivots, histograms, date comparisons, batching.
- v4 API explorer
- API metadata of possible metrics and dimensions
- Multi-user login in Shiny App
- Integration with BigQuery Google Analytics Premium\/360 exports.
- Single authentication flow can be used with other googleAuthR apps like searchConsoleR
- Automatic batching, sampling avoidance with daily walk, multi-account fetching, multi-channel funnnel
- Support for googleAuthR batch. For big data calls this could be 10x quicker than normal GA fetching.
- Meta data in attributes of returned dataframe including date ranges, totals, min and max
You can read the docs of this package visiting Mark's website:
or check the docs on CRAN repository: https://cran.r-project.org/web/packages/googleAnalyticsR/vignettes/googleAnalyticsR.html