PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, November 3, 2022

[FIXED] How to further filter Facebook Graph API query on Graph API Explorer for my ad account?

 November 03, 2022     facebook, facebook-ads-api, facebook-graph-api, facebook-insights, facebook-marketing-api     No comments   

Issue

I'm trying to get the ad spend and mobile app installs for my app using the Facebook Graph API v2.11 for marketing. In the Graph API Explorer, when I try

/act_<my account>/campaigns?fields=insights{actions,spend}&time_range={'since':'2017-07-07','until':'2017-12-12'}

In the output, under "insights", I get an object of this type:

    "data": [
      {
        "actions": [             
          {
            "action_type": "comment",
            "value": "3"
          },
          {
            "action_type": "like",
            "value": "33"
          },
          {
            "action_type": "link_click",
            "value": "1531"
          },
          {
            "action_type": "mobile_app_install",
            "value": "1049"
          }
        ],
        "spend": "8621.03",
        "date_start": "2017-10-28",
        "date_stop": "2017-11-26"
      }
    ]

If I want it to fetch only the actions where action type is "mobile_app_install", how can I further filter my query?


Solution

There is possible to filter that on Facebook side just call it like that:

/act_<yourAdAccount>/insights
  ?level=campaign
  &fields=actions,spend
  &time_increment=all_days
  &time_range={'since':'2017-07-07','until':'2017-12-12'}
  &filtering=[{field: "action_type",operator:"IN", value: ['mobile_app_install']}]
  &use_account_attribution_setting=true


Answered By - Vanley
Answer Checked By - Marilyn (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing