Search code examples
facebookfacebook-graph-apiklipfolio

How to filter facebook API Campaign data by veiculation date


As of now, my query is:

https://graph.facebook.com/v3.1/my_adact/campaigns?fields=name,insights{spend,reach,impressions,clicks},start_time,end_time&date_preset=this_month&limit=100

How should I make it so I can filter by campaigns that ran this month?}

Thanks!


Solution

  • To see campaign stats for every campaign that was active this month you can use the following query and the insights endpoint:

    https://graph.facebook.com/v3.1/act_xxxxxx/insights?date_preset=this_month&level=campaign&fields=campaign_name,campaign_id,spend,impressions,reach,actions,clicks
    

    This will return the insights as defined in the field parameter rolled up to the campaign level as defined by the level parameter and for this_month.