MyNixOS website logo
Description

'Google Ads API' Interface.

Interface for the 'Google Ads API'. 'Google Ads' is an online advertising service that enables advertisers to display advertising to web users (see <https://developers.google.com/google-ads/> for more information).

r4googleads -
R Client Library for Google's Ads Interface

CRAN status CRAN monthly downloads Lifecycle: stable R-CMD-check

Buy Me A Coffee

Welcome to the source code repository of the {r4googleads} package. {r4googleads} helps you to implement your advertising performance analytics in R and increase your efficiency, make your reports reproducible and flexible enough to managing even large, complex Google Ads accounts and campaigns.

If you came for the user documentation and howto, please visit {r4googleads}' our pkgdowndocumentation site.

The {r4googleads} package uses Google Ads' application programming interface to conveniently load data from Google Ads into an R environment. The Google Ads API suceeds Google's Adwords API and consequently, {r4googleads} suceeds its popular predecessor R package {RAdwords}.

Installation

To install the latest stable version of {r4googleads} from R's official Comprehensive R Archive Network (CRAN) run

install.packages("r4googleads")

or install the latest development release from GitHub using the {remotes} R package. (the below example code assumes the {remotes} package has been installed previously.)

remotes::install_github("banboo-data/r4googleads")

Basic Example - Load Data

library(r4googleads)

To specify which data you want to load into your R session you can use Google's own SQL reminiscant query language. The above link helps you to find out about available reports and to validate your queries online.

g_query <- "SELECT
                campaign.name, 
                campaign.status,
                segments.device, 
                metrics.impressions,
                metrics.clicks, 
                metrics.ctr,
                metrics.average_cpc, 
                metrics.cost_micros
              FROM campaign
              WHERE segments.date DURING LAST_30_DAYS
              AND metrics.impressions > 0
              PARAMETERS include_drafts=true"

The next step is to create a service object that contains the query string, your Google Ads Account ID and the API version you want to use. The example goes on to use one of our 3 constructors to create different service objects: googleAdsSearch, googleAdsFields, listAccessibleCustomers.

query_service <- googleAdsSearch(
  aid = '***-****-***', # Google Ads Account ID
  query = g_query,
  api_version = 'v9'
  )

the resulting service query object can be passed on to the query_google_ads functions which sends the service object to Google's actual API service. Note, that a MCC ID is needed here. The handler inside query_google_ads processes the service object depending on its class and starts the corresponding request.

d <- query_google_ads(
  mcc_id = '***-***-****', # Google Ads My Client Center ID
  google_auth = google_auth,
  service = query_service,
  raw_data = F
)

To learn more about creating and using our service objects visit the {r4googleads} pkgdown documentation site.

Metadata

Version

0.1.1

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