Main goal and capabilities of rgoogleads
rgoogleads is R client for work with Google Ads API v8. Main goal of
rgoogleads - load report data from Google Ads client account into R for analisys and visualizations.
- Authorization in the Google Ads API
- Loading a list of top-level accounts
- Loading the entire hierarchy of accounts from manager accounts
- Loading list of Google Ads client account objects: campaigns, ad groups, ads, etc.
- Loading statistics from Google Ads client account
- Loading resource metadata, resource fields, segments and metrics
- Loading forecast and historical metrics from Keyword Planning.
rgoogleads package for authorization uses the gargle package, the credentials obtained during authorization are stored exclusively on your local PC, you can find out the folder into which the credentials are cached using the
For loading data from Google Ads Account
https://www.googleapis.com/auth/adwords scope (Manage Your Google AdWords Campaigns), see official Google Ads API documentation.
The package does not transfer your credentials or data obtained from your advertising accounts to third parties, however, the responsibility for information leakage remains on the side of the package user. The author does not bear any responsibility for their safety, be careful when transferring cached credentials to third parties.
For more details, I recommend that you read the following articles from the official documentation of the gargle package:
- By default, gargle caches user tokens centrally, at the user level, and their keys or labels also convey which Google identity is associated with each token.
- Token storage relies on serialized R objects. That is, tokens are stored locally on your PC in the form of RDS files.
Use own OAuth client
You can use own OAuth app:
Example of use rgoogleads
# set own oauth app
gads_auth_configure(path = 'C:/auth/app.json')
# set your developer token if needed, or use default developer token
gads_auth(email = 'email@example.com', developer_token = "own developer token")
# get list of accessible accounts
my_accounts <- gads_get_accessible_customers()
# set manager account id (options)
# set client account id
# load report data
ad_group_report <- gads_get_report(
resource = "ad_group",
fields = c("ad_group.campaign",
date_from = "2021-06-10",
date_to = "2021-06-17",
where = "ad_group.status = 'ENABLED'",
order_by = c("metrics.clicks DESC", "metrics.cost_micros")
Bug report and support
If you encounter an error in the package, or you have suggestions for improving its functionality, you can create a issue using the link.