facebook java ads sdk how to retrieve "delivery, results,result_rate,cost_per_result", and breakdown by day -
i'm trying use facebook's java sdk generate ads report. followed sample code, using new adaccount(ad_account_id, context).getinsights() retrieve data. java sdk retrieve partially data. i'm not sure i'm using correct api.
import com.facebook.ads.sdk.*; import java.util.arraylist; import java.util.list; import config.fbreporting.gettyimages.com.config; public class sample_code { public static void main(string args[]) throws apiexception { string access_token = config.access_token; string ad_account_id = config.ad_account_id; string app_secret = config.app_secret; apicontext context = new apicontext(access_token).enabledebug(true); list<adsinsights.enumbreakdowns> breakdowns = new arraylist<>(); list<adsinsights.enumsummary> summaries = new arraylist<>(); apinodelist<adsinsights> adsinsights = new adaccount(ad_account_id, context) .getinsights() .setlevel(adsinsights.enumlevel.value_ad) .setfiltering("[{\"field\":\"impressions\",\"operator\":\"greater_than\",\"value\":\"0\"}]") // .setbreakdowns(list<adsinsights.enumbreakdowns.value_>) .setbreakdowns(breakdowns) .settimerange("{\"since\":\"2017-08-13\",\"until\":\"2017-09-12\"}") .requestfield("account_id") .requestfield("account_name") .requestfield("ad_name") .requestfield("adset_id") .requestfield("adset_name") .requestfield("ad_id") .requestfield("actions") .requestfield("unique_clicks") .requestfield("unique_inline_link_clicks") .requestfield("impressions") .requestfield("reach") .requestfield("relevance_score") .requestfield("campaign_id") .requestfield("campaign_name") .requestfield("total_action_value") .requestfield("social_impressions") .requestfield("spend") .requestfield("total_actions") .requestfield("total_conversion_value") .requestfield("clicks") .requestfield("date_start") .requestfield("date_stop") // .requestfield("delivery") // .requestfield("result_rate") // .requestfield("results") // .requestfield("cost_per_result") .execute(); } }
if used way, return:
{ "error": { "message": "(#100) result not valid fields param. please check https://developers.facebook.com/docs/marketing-api/reference/ads-insights/ valid values", "type": "oauthexception", "code": 100, "fbtrace_id": "alsfezwk4yp" } }
delivery result_rate results cost_per_result
is there know these fields?
another problem cannot set breakdown day. there no value in adsinsights.enumsummary.
Comments
Post a Comment