MyNixOS website logo
Description

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

RAdwords Cran Release RAdwords Cran Downloads

Loading Google Adwords data into R

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')
Metadata

Version

0.1.18

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows