The problem is that the
RAdwords package is used to work
with Google AdWords API v201809. This API has not been updated for a
long time and will stop working on 27 April 2022.
In this vignette, I want to share some information on a new package, rgoogleads, which I started working on in June 2021. The package currently has all the functions needed to request the function data. Next, we will go through the details of how to switch from RAdwords to rgoogleads, so that from April 2022, your scripts will still correctly collect the necessary data from your Google Ads accounts.
The rgoogleads package currently includes all the functions needed to fetch data from the Google Ads API:
Now let’s look at the benefits of switching to the new rgoogleads package:
rgoogleadsis used to work with Google Ads API v8 (released on 09.06.2021);
RAdwordsis used to work with Google AdWords API v201809. Google AdWords API will sunset on 27.04.2022;
rgoogleadsuses the gargle package for authorization, which gives much more flexibility than the
rgoogleadshas an embedded Google Ads developer token and an OAuth client for authorization. This will save most users from having to request basic access to the Google Ads API from Google support and wasting time creating a project and OAuth client in the Google Cloud Console;
rgoogleadsfunctions have a cl argument, which allows for multi-threaded data import;
rgoogleadshas a list and account hierarchy import function;
rgoogleadshas separate functions to import the main objects of the advertising accounts, such as advertising campaigns, ad groups, keywords, and ads;
rgoogleadsis more straightforward and concise. In
RAdwords, you had to initially create
statement()function and then use it to request the data in the
rgoogleadshas no problem importing names containing Cyrillic characters;
rgoogleadspackage will automatically pause for 100 seconds and try to request data again. This makes this package more stable and resilient to Google Ads API server failures;
rgoogleadsdisplays a detailed error message. In comparison,
RAdwordswill not display a message if the user has made a request error;
rgoogleadsallows you to request data from the Keyword Planner.
Fortunately, there are few key differences between the old and new APIs, and the migration process isn’t that difficult. Let me enumerate the key points of the migration below.
The former report types in Google AdWords have become resources in Google Ads. See the comparison table from the official help guide:
#> #> Attaching package: 'dplyr' #> The following objects are masked from 'package:stats': #> #> filter, lag #> The following objects are masked from 'package:base': #> #> intersect, setdiff, setequal, union
See the official help guide for the correspondence between the “Report” and the resource fields. The table is large, so there’s no need to duplicate it here.
See the example of requesting a campaign performance report with the
same set of fields, using the
RAdwords package and
library(RAdwords) # auth adwords_auth <- doAuth() # create request query <- statement( select = c('CampaignName', 'Date', 'Clicks'), report = 'CAMPAIGN_PERFORMANCE_REPORT', start = '2021-06-01', end = '2021-06-30' ) # data import data1 <- getData( clientCustomerId = 'xxx-xxx-xxxx', statement = query, google_auth = adwords_auth )
library(rgoogleads) # auth gads_auth_configure(path = 'D:/ga_auth/app.json') gads_auth(email = 'firstname.lastname@example.org') # data import data2 <- gads_get_report( resource = 'campaign', fields = c('campaign.name', 'segments.date', 'metrics.clicks'), date_from = '2021-06-01', date_to = '2021-06-30', customer_id = 'xxx-xxx-xxxx', login_customer_id = 'xxx-xxx-xxxx' )