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 pkgdown documentation 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}.
InstallationTo 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
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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4