if (FALSE) {
token <- "YOURTOKEN"
which <- "act_20846447"
# Platforms' Insights: all ad-sets platforms of "which" account,
# aggregated, for the last 30 days
platforms <- fb_insights(
token, which,
start_date = Sys.Date() - 30,
time_increment = "all_days",
report_level = "adset",
fields = c(
"account_name",
"adset_id",
"adset_start",
"adset_end"
),
breakdowns = c(
"publisher_platform",
"platform_position",
"device_platform"
)
)
# Daily results for all campaigns of "which" account,
# with custom performance fields with no breakdowns.
insights_adset <- fb_insights(
token, which,
time_increment = "1",
report_level = "campaign",
fields = c(
"adset_id",
"reach",
"frequency",
"spend",
"cpm",
"objective",
"optimization_goal"
)
)
}
Run the code above in your browser using DataLab