fb_insights {fbRads} | R Documentation |
Insights
Description
Insights
Usage
fb_insights(
fbacc,
target = fbacc$acct_path,
job_type = c("sync", "async"),
retries = 0,
simplify = TRUE,
...
)
Arguments
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. |
Value
list
of data.frame
or list
objects depending on the simplify
argument
References
https://developers.facebook.com/docs/marketing-api/insights
Examples
## Not run:
fb_insights(fbacc)
## get default fields and filter for a few metrics
l <- fb_insights(date_preset = 'today', level = 'ad')
## merge pages into tabular data
data.table::rbindlist(l)
## sometimes more advanced list selections are needed
l <- fb_insights(date_preset = 'today', level = 'ad', fields = 'unique_actions', simplify = FALSE)
## filter for ACTIVE Ads
l <- fb_insights(date_preset = 'today', level = 'ad',
filtering = "[{'field':'adset.effective_status','operator':'IN','value':['ACTIVE']}]")
## End(Not run)
[Package fbRads version 17.0.0 Index]