authorize() function uses
oauth2.0_token to obtain the OAuth tokens. Expired tokens will be refreshed automamaticly. If you have no
client.secret the package provides predefined values.
1 2 3 4
character. Google username email address hint. If not set you will need choose an account for the authorization.
character. OAuth client ID. If you set the environment variable RGA_CLIENT_ID it is used.
character. OAuth client secret. If you set the environment variable RGA_CLIENT_SECRET it is used.
logical or character.
After calling this function first time, a web browser will be opened. First, log in with a Google Account, confirm the authorization to access the Google Analytics data. Note that the package requests access for read-only data.
authorize() function is used the
Token variable is created in the separate
.RGAEnv environment which is not visible for user. So, there is no need to pass the token argument to any function which requires authorization every time. Also there is a possibility to store token in separate variable and to pass it to the functions. It can be useful when you are working with several accounts at the same time.
client.secret params can be specified by an appropriate options (with “RGA” prefix): RGA_USERNAME, RGA_CLIENT_ID, RGA_CLIENT_SECRET.
Token2.0 object containing all the data required for OAuth access.
Google Analytics is used by millions of sites. To protect the system from receiving more data than it can handle, and to ensure an equitable distribution of system resources, certain limits have been put in place.
The following quota limits are shared between all RGA users which use the predefined credentials (daily quotas refresh at midnight PST):
50,000 requests per day
10 queries per second per IP
To get full quota, you must register your application in the Google Developers Console. When you register a new application, you are given a unique client ID to identify each application under that project. To find your project's client ID and client secret, do the following:
Open the Credentials page.
Select a project (create if needed).
create your project's OAuth 2.0 credentials by clicking Add credentials > OAuth 2.0 client ID and select Other application type.
Look for the Client ID in the OAuth 2.0 client IDs section. You can click the application name for details.
To enable Analytics API for your project, do the following:
Open the Analytics API Overview page.
CLick on the Enable API button to activate Analytics API.
There 3 ways to use custom Client ID and Client secret:
client.secret arguments directly in the
authorize() function call
Set the RGA_CLIENT_ID and RGA_CLIENT_SECRET environment variables
rga.client.secret options into the R session
To revoke access the RGA package do the following:
Go to the Apps connected to your account page
Find RGA package entry. Then click on it
Click on the Revoke access button in the sidebar on the right
To revoke all tokens:
Setup environment variables:
1 2 3 4 5 6 7 8
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.