Description Usage Arguments Details Value Auto-authentication
A wrapper for gar_auth and gar_auth_service
1 |
new_user |
If TRUE, reauthenticate via Google login screen |
no_auto |
Skip auto authentication |
Run this function first time to authenticate with Google in your browser.
After initial authentication, a .httr-oauth
will be saved to your working directory, where your authentication details are kept. Keep this file safe.
If you want to reauthenticate, delete this file from your directory or run ga_auth(new_user = TRUE)
Invisibly, the token that has been saved to the session
You can choose to auto-authenticate by moving your .httr-oauth
or by
creating a Google OAuth service account JSON file.
Specify an environment variable in R via a .Renviron
file or using Sys.setenv which point to the file location of your chosen authentication file.
Once you have set the environment variable GA_AUTH_FILE
to a valid file location,
the function will look there for authentication details upon loading the library meaning
you will not need to call ga_auth()
yourself as you would normally.
An example .Renviron
file is below:
GA_AUTH_FILE = "/Users/bob/auth/googleAnalyticsR.httr-oauth"
GA_AUTH_FILE
can be either a token generated by gar_auth or
service account JSON ending with file extension .json
If you use the service account JSON, you will need to add the service account email
to your Google Analytics users to see data e.g. xxxx@yyyyyy.iam.gserviceaccount.com
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.