fb_insights: Insights

Description Usage Arguments Value References Examples

View source: R/fb_insights.R

Description

Insights

Usage

1
2
fb_insights(fbacc, target = fbacc$acct_path, job_type = c("sync", "async"),
  retries = 0, ...)

Arguments

fbacc

(optional) FB_Ad_account object, which defaults to the last returned object of fbad_init.

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

...

named arguments passed to the API, like time range, fields, filtering etc.

Value

list

References

https://developers.facebook.com/docs/marketing-api/insights

Examples

 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)

daroczig/fbRads-transition documentation built on May 20, 2019, 4:08 p.m.