skip to Main Content

I’m trying to return campaign insights in the Facebook Marketing API and show the results aggregated for each day and broken down by country.

I’m trying

act_xxxx/?fields=campaigns{name,insights}&time_increment=1&breakdowns=country 

but the country and time_increment paramaters don’t seem to affect the results.

I’ve had success with EITHER time_increment of breakdowns if I don’t use the ?fields paramater but then I’m not aggregating at the level I want and can still only use one paramater.

Can anyone suggest anything?

Thanks

James

2

Answers


  1. Chosen as BEST ANSWER

    Managed to figure this one out:

    act_xxx/insights?fields=account_name,campaign_name,date_start,date_stop,spend,reach,impressions,cpc,inline_link_clicks,frequency,ctr,cost_per_inline_link_click,inline_link_click_ctr&breakdowns=country&time_increment=1&level=campaign
    

    The key things I was missing were:

    • define the level of aggregation in the ?level paramater return the

    • Return insights edge before the ?fields paramater rather than through field extension as I did in my example.


  2. all you have to do is

    act_xxxx?fields=campaigns{name,insights.time_range({"since":"2019-03-03","until":"2019-03-03"}).time_increment(1).breakdowns(country)}
    

    This one fetches all campaigns name and insights between the date interval in day by day manner breaking down according to countries

    you can use {} for subfields like

    campaigns{ads{name,insights,adcreatives{image_url}}}
    

    you can use . and () for parameters like; always make sure you use you use fields only after parameters like this order .(){}

    campaigns.limit(1).time_range({"since":"2019-03-03","until":"2019-03-03"}).time_increment(1).breakdowns(country){ads{name,insights.time_range({"since":"2019-03-03","until":"2019-03-03"}).time_increment(1).breakdowns(country),adcreatives{image_url}}}
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search