skip to Main Content

I am trying to filter adsets insights by adset status, but when I add a status filter, I get an empty dataset back:

curl "https://graph.facebook.com/v2.7/act_<redacted>/insights?fields=clicks,impressions,cpc,ctr,account_id&time_range%5Bsince%5D=2016-01-12&time_range%5Buntil%5D=2016-09-12&access_token=<redacted>&format=json&filtering=%5B%7B%22field%22:%22status%22,%22operator%22:%22EQUAL%22,%22value%22:%22ACTIVE%22%7D%5D&level=adset"

here is what filtering param looks like before it gets url-encoded:
[{"field":"status","operator":"EQUAL","value":"ACTIVE"}]

I have tried all valid values for status ACTIVE, PAUSED, DELETED, ARCHIVED to no avail.
When I remove filtering param – I see my data.

The question is:
Does anyone know if it is possible to filter by status, and if it is, what I am doing wrong?

3

Answers


  1. Chosen as BEST ANSWER

    Filtering by insights isn't possible. At least in v2.7. To get insights for let's say ads I've decided to do the following: 1. Fetch ads that I need via /ads call. This allows me to filter by status. 2. Fetch insights for the same collection of ads and make sure that I ad id is included in the response. 3. Filter the second collection using the first one.


  2. i m using this to filter campaigns with insights , working for me , start playing with it

    'filtering'=>
                      array(
                            array(
                            "field"=>"campaign.effective_status",
                            "operator"=>"IN",
                            "value"=>$campaigncheckstatus,
                          ),
                      ), 
    $campaigncheckstatus =  array("ACTIVE","PAUSED");
    

    dont forget to json_encode $campaigncheckstatus if passed through url

    Login or Signup to reply.
  3. It is possible. Using latest version as of March 2018.

    You need to actually request all the ads that are ACTIVE and then provide insights as a ‘nested’ list of fields.

    Replace 123456 with your ad account (but leave the 'act_' which is needed)

    act_123456/ads?fields=effective_status,name,insights{total_action_value,total_actions,actions},adset_id,campaign_id&filtering=[{‘field’:’effective_status’,’operator’:’IN’,’value’:[‘ACTIVE’]}]

    This also works for /campaigns and /adsets


    You can also do this (be sure to include &level=ad):

    act_123456/insights?fields=ad_id,adset_id,campaign_name,action_values,campaign_id,total_action_value&level=ad&filtering=[{“field”:”campaign.delivery_info”,”operator”:”IN”,”value”:[“active”]}]

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search