Description Usage Arguments Value References Examples
Insights
1 2 | fb_insights(fbacc, target = fbacc$acct_path, job_type = c("sync", "async"),
retries = 0, simplify = TRUE, ...)
|
fbacc |
(optional) |
target |
ad account id(s) (default), campaign id(s), adset id(s) or ad id(s) |
job_type |
synchronous or asynchronous request. If the prior fails with "please reduce the amount of data", it will fall back to async request. Async query is possible with only one target. |
retries |
number of times this query has been sent to Facebook previously and failed – to be used internally for error handling |
simplify |
return a list of |
... |
named arguments passed to the API, like time range, fields, filtering etc. |
list
of data.frame
or list
objects depending on the simplify
argument
https://developers.facebook.com/docs/marketing-api/insights
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
fb_insights(fbacc)
## get default fields and filter for a few metrics afterwards
l <- fb_insights(date_preset = 'today', level = 'ad')
library(rlist)
list.stack(list.select(l, date_start, date_stop, ad_id, adset_id, impressions))
## get given list of fields and transform to tabular data
l <- fb_insights(date_preset = 'today', level = 'ad', fields = toJSON(c('impressions', 'total_actions')))
data.table::rbindlist(l)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.