pythonfacebook-graph-apifacebook-ads-apifetching-strategyfacebook-ads

Facebook Marketing API, Get Insights Fields and Campaign Object Fields


I was wondering if anyone found a way to get insight fields like reach, spend, etc with the combination of campaign object fields like daily_budget, lifetime_budget, etc + date_preset=this_month&time_increment=1?

Graph API Explorer INSIGHT:

act_NUMBER/insights?fields=account_id,account_name,campaign_id,campaign_name,buying_type,account_currency,spend,reach&date_preset=this_month&time_increment=1&level=campaign

I found a way to start from campaign object extraction with the combination of insights but there was no access to get daily outcome. This is why I am making start from Insights.

GRAPH API Explorer OBJECT:

CAMPAIGN_ID?fields=account_id,status,configured_status,daily_budget,lifetime_budget,budget_remaining,spend_cap,objective,buying_type,insights{account_name,campaign_id,campaign_name,buying_type,account_currency,reach,spend}&date_preset=this_month&time_increment=1&level=campaign

Solution

  • Found an answer to my question

    CAMPAIGN_ID?fields=account_id,status,configured_status,daily_budget,lifetime_budget,budget_remaining,spend_cap,objective,buying_type,insights.date_preset(this_month).time_increment(1).fields(account_name,campaign_id,campaign_name,buying_type,account_currency,reach,spend)
    

    Whats changed:

    insights.date_preset(this_month).time_increment(1).fields(account_name,campaign_id,campaign_name,buying_type,account_currency,reach,spend)