fbRads icon indicating copy to clipboard operation
fbRads copied to clipboard

fb_insights only fetches last breakdown value

Open hhissami opened this issue 5 years ago • 1 comments

Hi,

When multiple breakdown values get passed into fb_insights(), it only returns the last breakdown as a column in the resulting dataframe.

For example:

insights_list <- fb_insights(target=campaign_id, level="ad", date_preset = "lifetime", fields=c("ad_name"), breakdowns = c("gender", "age"))

returns a dataframe with the following columns:

$ ad_name  <chr>
$ date_start <chr>
$ date_stop  <chr>
$ age  <chr>

Note there is an age column but no gender column.

I tested this with other breakdown values, and the same pattern always holds where only the last breakdown value ends up as a column.

hhissami avatar Nov 12 '20 17:11 hhissami

Don't use "c(", note that your command is just converted into a URL which should be formatted according to Facebook guidelines, see here for examples: https://developers.facebook.com/docs/marketing-api/insights/breakdowns#combiningbreakdowns

In your case, simply use "breakdowns="gender, age"", without "c(".

sayac007 avatar Mar 22 '21 12:03 sayac007