2

I am have some difficulty extending my API query to only include specific actions. I can run the following query just fine:

https://graph.facebook.com/v2.10/act_11111111111111111/ads?fields=name,insights{actions.filtering("action_type":comment)}&limit=1

...but the results contain more action types than desired.

  "data": [
{
  "name": "Test Name",
  "insights": {
    "data": [
      {
        "actions": [
          {
            "action_type": "comment",
            "value": "2"
          },
          {
            "action_type": "link_click",
            "value": "142"
          },
          {
            "action_type": "post_reaction",
            "value": "16"
          },
          {
            "action_type": "video_view",
            "value": "630"
          },
          {
            "action_type": "page_engagement",
            "value": "790"
          },
          {
            "action_type": "post_engagement",
            "value": "790"
          }
        ],
        "date_start": "2017-08-26",
        "date_stop": "2017-09-24"
      }
    ],

I'm looking to only return 'comment' and 'link_click', something along the lines of...

https://graph.facebook.com/v2.10/act_11111111111111111/ads?fields=name,insights{actions?action_type=comment,link_click}&limit=1

Thank you!

C Fisher
  • 21
  • 3

2 Answers2

1

Try This

This Graph URI is only for single ads not an ad accounts level but you can set your logic similar like below

https://graph.facebook.com/v3.0/<ad_id>/insights?fields=actions&filtering=[{field: "action_type",operator:"IN", value: ['like', 'comment','landing_page_view','link_click','offsite_conversion','cost_per_lead']}]&access_token=<Your Access Token>
1

You can ask for all ads in ad account:

/act_<yourAdAccount>/insights
  ?level=ad
  &fields=actions,ad_name,ad_id
  &filtering=[{field: "action_type",operator:"IN", value: ['comment']}]
Vanley
  • 121
  • 1
  • 2