

I installed the RStudio server for Ubuntu 18 as suggested here: I am running the following version of Ubuntu. I currently have version R-3.4.4 on RStudio, but would like to upgrade. The function we will create will use three parameters "id" for the Google Analytics View ID and dates for the period to collect data within.I am trying to set up Rstudio on an Ubuntu cloud server (gcloud). What you need is IDs for users (client) and visits. Simo Ahava wrote an excellent guide for how to implement it.

You can of course skip it if you don't feel like you need them but I sincerely advice you to implement them. To do this though, you will have to use some custom dimensions in your GA property. What I'm gonna show you is how you can access a lot of valuable data and structuring it in a way that looks a little bit like the Google Analytics 360 integration with BigQuery. Writing the import functions - Google AnalyticsĬreate a new R script file (Ctrl+Shift+Alt+N). If you're living in the EU you HAVE TO pick a data location within the EU area. Just head to, click on your project name (marked in green below) and then click on "Create dataset" (marked in red below). If you haven't worked with BigQuery previously then you'll have to create a dataset before you can set the global variables. Let's set our global project and dataset for BigQuery as well. Here we pick our scopes, set the environment variables to check the JSON file and then authorize the connections with gar_auth_service(). GoogleAuthR::gar_auth_service(json_file = "my_auth_file.json", Sys.setenv(SC_AUTH_FILE = "my_auth_file.json") Sys.setenv(GA_AUTH_FILE = "my_auth_file.json") Sys.setenv(BQ_AUTH_FILE = "my_auth_file.json") Sys.setenv(GAR_AUTH_FILE = "my_auth_file.json") You do this by authorizing with your JSON file. Now make sure you set the correct scopes and authorize the connection from your machine to your applications.

All of them are pre installed on the machine. Then call for the libraries we need to use. Now add a new R script file to work with by clicking on the icon in the navigation bar or by pressing Ctrl+Shift+Alt+N.
