README.md

AppVeyor Build StatusTravis-CI Build StatusCoverage Status

Developped by Cheetah Mobile

fbAdsInsightsR

Current version: v3.1 (see "Developments" section below)

fbAdsInsightsR is an R package that allows fetching data from the facebook Ads Insights API. Now updated to Facebook Graph API v2.7!

Functions

Issues & Feature Requests

Please report bugs and request features on the issue page.

Documentation

Constantly being updated and improved. Currently the manual and examples are available in own repository (access NOT restricted) here Alternatively refer to the list below.

Install

devtools::install_github("JohnCoene/fbadsinsightsr")

Examples

# run authentication with your app details
TK <- fbAuthenticate(app.id = "1234567890123456", app.secret = "16xx79321xx0130x2x10a08x3e2x80xx", scope = c("ads_management", "ads_read"))

accounts <- listAccounts(id = "me", token = TK) # list facebook advertising accounts you have access to

ads <- grabAds(sample(accounts$id, 1), TK) # grab list of ads under random account

# get data on random ad
set.seed(19880525)
ad_data <- getAd(ad.id = sample(ads$id, 1), token = TK)

# get daily performance data for last month with a summary
my_preset <- findParams("date.preset")[grep("last_month", findParams("date.preset"))]
ad_data <- getAd(ad.id = sample(ads$id, 1), token = TK, n = 1000, date.preset = my_preset, time.increment = 1)

# get ad performance data by country 
ad_data <- getAd(ad.id = sample(ads$id, 1), token = TK, breakdowns = "country")

# get ad performance data by age and gender 
ad_data <- getAd(ad.id = sample(ads$id, 1), token = TK, breakdowns = c("age", "gender"))

creatives <- listCreatives(sample(accounts$id, 1), TK) # list creatives

# check targeting of adset
adsets <- grabAdsets(sample(accounts$id, 1), TK)
(target <- checkTargetSentence(sample(adsets$id, 1), TK))

targeting <- checkTargetTree(sample(accounts$id, 1), TK) # check targeting from account

labels <- listLabels(accounts$id[1], TK) # get labels

# get ads that match ANY label
ad_labels <- getLabAds(accounts$id[1], labels = labs, operator = "ANY", token = TK)

# get campaigns that match ALL labels                        
ad_labels <- getLabAds(accounts$id[1], labels = labs, operator = "ALL", token = TK)

(apps <- listApps(accounts$id[1], TK)) # list apps
(ad_apps <- listAdApps(accounts$id[1], TK)) # list advertiseable apps

Developments

Versions

See Git tags: 2.0, v3.0 and v3.1 (Rcpp branch)

Dev

See NEWS.md for entire changelog.

R CMD check

R CMD check results 0 errors | 0 warnings | 0 notes

Access & Contributors



JohnCoene/fbadsinsightsr documentation built on May 28, 2019, 12:55 p.m.