Skip to contents

logo Interface for loading data from 'Google Ads API', see https://developers.google.com/google-ads/api/docs/start. Package provide function for authorization and loading reports.

Capabilities of rgoogleads:

  • 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.

Author

Alexey Seleznev

Examples

if (FALSE) {
library(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 = 'me@gmail.com', developer_token = "own developer token")

# get list of accessible accounts
my_accounts <- gads_get_accessible_customers()

# set manager account id
gads_set_login_customer_id('xxx-xxx-xxxx')

# set client account id
gads_set_customer_id('xxx-xxx-xxxx')

# load report data
ad_group_report <- gads_get_report(
  resource    = "ad_group",
  fields = c("ad_group.campaign",
             "ad_group.id",
             "ad_group.name",
             "ad_group.status",
             "metrics.clicks",
             "metrics.cost_micros"),
  date_from   = "2021-06-10",
  date_to     = "2021-06-17",
  where       = "ad_group.status = 'ENABLED'",
  order_by    = c("metrics.clicks DESC", "metrics.cost_micros")
)
}