RAdwords: Loading Google Adwords Data into R

Description Details Author(s) Examples

Description

The aim of RAdwords is loading Google Adwords data into R. Therefore the package implements three main features.
First, the package provides an authentication process for R with the Adwords API via OAUTH2.
Second, the package offers an interface to apply the Adwords query language in R and query the Adwords API with ad-hoc reports.
Third, the received data are transformed into suitable data format for further data processing and data analysis.

Details

Requirements:
In order to access the Adwords API you have to set up a Google API project for native apps. The Google API project provides a Client Id and Client Secret which is necessary for the authentication. Moreover you need to have a Adwords MCC (My Client Center) with an Adwords developer token.

Authentication:
doAuth manages the complete authentication process. Meaning doAuth authenticates the R app for the first time, loads the access token or refreshes the access token if expired. Hence, you only run doAuth() to authenticate whether it is your initial R Session or a later instance.

What's happening in details?
Once the API projects for native application is set up, getAuth is able to authenticate the R app with the credentials (Client Id, Client Secret) from the Google API project. The Google authentication server returns a client token, which later is used by loadToken to receive the access token. If the access token is expired after one hour, it can be updated with refreshToken. The access token in combination with the Adwords developer token enables a connection with the Adwords API.

Create Statement:
statement creates the Adwords Query Language Statement.

Receiving Data:
getData queries the data from the Adwords API and transforms the data into an R dataframe.

Author(s)

Johannes Burkhardt <johannes.burkhardt@gmail.com>
Matthias Bannert <matthias.bannert@gmail.com>
https://github.com/jburkhardt/RAdwords

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
Authentication:
google_auth <- doAuth()
Create Statement:
body <- statement(select = c('Clicks','AveragePosition','Cost','Ctr'),
                  report = "ACCOUNT_PERFORMANCE_REPORT",
                  start = "2018-01-01",
                  end = "2018-01-10")
Query Adwords API and load data as dataframe:
data <- getData(clientCustomerId = 'xxx-xxx-xxxx', #use Adwords Account Id (MCC Id will not work)
                google_auth = google_auth,
                statement = body)
Get available report types:
reports()
Get available metrics/attributes of specific report type:
metrics(report = 'ACCOUNT_PERFORMANCE_REPORT')

## End(Not run)

RAdwords documentation built on May 2, 2019, 6:12 a.m.