Loading Google Adwords Data into R

Aims at loading Google Adwords data into R. Adwords is an online advertising service that enables advertisers to display advertising copy to web users (see < https://developers.google.com/adwords/> for more information). Therefore the package implements three main features. First, the package provides an authentication process for R with the Google Adwords API (see < https://developers.google.com/adwords/api/> for more information) 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 formats for further data processing and data analysis.


RAdwords Cran Release RAdwords Cran Downloads

RAdwords is a R package with the aim to load 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 formats for further data processing and data analysis.

Documentation

We provide a detailed documentation here: RAdwords Documentation

Quickstart Guide

The following section helps you to get started straight away.

Installation

The package can be installed from CRAN

install.packages("RAdwords")

or directly from this Github repository with:

require(devtools)
install_github('jburkhardt/RAdwords')

Usage

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 with an Adwords developer token.

Authentication:

The function 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.

Loading Data:

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

Example

Authentication

library(RAdwords)
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 get data as dataframe

# make sure to use the Adwords Account Id (MCC Id will not work)
data <- getData(clientCustomerId = 'xxx-xxx-xxxx',
                google_auth = google_auth,
                statement = body)

Get available report types

reports()

Get available metrics/attributes of specific report type

metrics(report = 'ACCOUNT_PERFORMANCE_REPORT')

News

RAdwords v0.1.18 (Release Date: 2019-01-28)

RAdwords v0.1.17 (Release Date: 2018-06-11)

  • Migration towards Adwords API version v201806

FEATURES

  • Support compression support in statement(compress = TRUE)

BUG FIXES

  • R/getAuth.R: Uses default SSL configuration in RCurl.
  • R/refreshToken.R: Converts raw data input from RCurl to character format.

RAdwords v0.1.16 (Release Date: 2018-04-16)

RAdwords v0.1.15 (Release Date: 2018-02-21)

RAdwords v0.1.14 (Release Date: 2017-10-02)

BUG FIXES

  • SSL certificate issues on Windows system resolved in getData().

RAdwords v0.1.13 (Release Date: 2017-08-16)

RAdwords v0.1.12 (Release Date: 2017-04-06)

RAdwords v0.1.11 (Release Date: 2016-11-17)

RAdwords v0.1.10 (Release Date: 2016-07-05)

  • Migration towards API version v201605. API versions v201605, v201603, v201601 and v201509 are selectable.

RAdwords v0.1.9 (Release Date: 2016-04-22)

  • Migration towards API version v201603. API versions v201603, v20161 and v201509 are selectable.
  • Sunset date of API version v201506 is deprecated and removed from the package.
  • New report available in v201603: top-content-performance-report.

BUG FIXES

  • Transformation of raw data conflicting with variable of type double which contain "<" or ">". transformData() adjusted accordingly.

RAdwords v0.1.8 (Release Date: 2016-02-19)

  • Migration towards API version v201601. API versions v201601, v201509 and v201506 are selectable.
  • Sunset date of API version v201506 is April 11th 2016.

Features:

  • statement(): both date formats are valid options: 20160101 or 2016-01-01
  • getData(): - checks is reportType is valid - new function parameters: verbose and includeZeroImpressions

RAdwords v0.1.7 (Release Date: 2015-11-13)

  • Migration towards API version v201509. API versions v201509 and v201506 are selectable.
  • API version v201502 is deprecated since November 12th 2015 by Google.

RAdwords v0.1.6 (Release Date: 2015-08-05)

  • Migration towards API version v201506. API versions v201506 and v201502 are selectable.
  • API version v201409 is deprecated since July 14th 2015 by Google.

RAdwords v0.1.5 (Release Date: 2015-04-22)

BUG FIXES

  • Transformation of raw data (previous bug fix v0.1.4) conflicting with variable of type double. transformData() adjusted accordingly.

RAdwords v0.1.4 (Release Date: 2015-04-13)

BUG FIXES

  • Transformation of raw data conflicting if Ad Text data contain "%". transformData() adjusted accordingly.

RAdwords v0.1.3 (Release Date: 2015-04-01)

BUG FIXES

  • SSL certificate issues on Windows system resolved.

RAdwords v0.1.2 (Release Date: 2015-03-23)

NEW FEATURES

  • Google Adwords API versions v201409 and v201502 become selectable. *getData(), metrics() and reports() gain new apiVersion attribute for controlling whether the old or new Google Adwords API version is queried. API version v201502 is set to default.
  • API version v201409 will be deprecated on July 14th 2015 by Google.
  • Version v201502 supports new Report Types and some variable names changed. Changes are listed here: https://developers.google.com/adwords/api/docs/guides/migration/v201502

RAdwords v0.1.1 (Release Date: 2011-11-11)

  • migration towards Google Adwords API version v201409

RAdwords v0.1.0 (Release Date: 2011-10-11)

  • initial cran release

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.