Follow the online documentation here: http://code.markedmondson.me/googleAnalyticsR/
First Google Analytics Reporting v4 API library for R
v4 features include: dynamic calculated metrics, pivots, histograms, date comparisons, batching
Multi-user login in Shiny App
Integration with BigQuery Google Analytics Premium/360 exports
Single authentication flow with other 'googleAuthR' apps
Automatic batching
sampling avoidance with daily walk
multi-account fetching
multi-channel funnnels
Support for batch. For big data calls this could be 10x quicker than normal GA fetching
Meta data included in attributes of returned dataframe
You may wish to set the below environment arguments for easier authentication
GA_CLIENT_ID
GA_CLIENT_SECRET
GA_WEB_CLIENT_ID
GA_WEB_CLIENT_SECRET
GA_AUTH_FILE