Giter VIP home page Giter VIP logo

radwords's Introduction

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="2017-01-01",
end="2017-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')

radwords's People

Contributors

jburkhardt avatar mbannert avatar djuery avatar refik avatar

Watchers

James Cloos avatar Gio Gio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.