Description Functions Examples
Set of functions to collect data from Facebook Insights API.
OAuth
fbAuthenticate
Get-family
getAccount
getCampaign
getAdset
getAd
getAny
getActivity
getCreative
getLabCampaigns
getLabCreatives
getLabAdsets
getLabAds
getEstReach
List-family
listBusinesses
listAccounts
listVideos
listImages
listCreatives
listApps
listAdApps
listLabels
Grab-family
grabCampaigns
grabAdsets
grabAds
grabCreatives
(.deprecated, use listCreatives
)
Check-family
checkTarget
(.deprecated, use checkTargetSentence
)
checkStatus
checkTargetTree
checkTargetSentence
checkUsers
Update-family
updateCampaign
updateAdset
updateAd
Create-family
createLabels
Helpers
findFields
findParams
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | ## Not run:
# run authentication with your app details
TK <- fbAuthenticate(app.id = "1234567890123456",
app.secret = "16xx79321xx0130x2x10a08x3e2x80xx",
scope = "ads_management")
# list facebook advertising accounts you have access to
accounts <- listAccounts(id = "me", token = TK)
# grab list of ads under random account
ads <- grabAds(sample(accounts$id, 1), TK)
# 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"))
# list creatives
creatives <- listCreatives(sample(accounts$id, 1), TK)
# check targeting of adset
adsets <- grabAdsets(sample(accounts$id, 1), TK)
(target <- checkTargetSentence(sample(adsets$id, 1), TK))
# check targeting from account
targeting <- checkTargetTree(sample(accounts$id, 1), TK)
# get labels
labels <- listLabels(accounts$id[1], TK)
# 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
(apps <- listAdApps(accounts$id[1], TK)) # list advertiseable apps
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.