【问题标题】:How to further filter Facebook Graph API query on Graph API Explorer for my ad account?如何在 Graph API Explorer 上为我的广告帐户进一步过滤 Facebook Graph API 查询?
【发布时间】:2022-01-21 08:22:51
【问题描述】:

我正在尝试使用 Facebook Graph API v2.11 进行营销,以获取我的应用的广告支出和移动应用安装量。在 Graph API Explorer 中,当我尝试时

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

在输出中,在“见解”下,我得到了这种类型的对象:

    "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"
      }
    ]

如果我希望它仅获取操作类型为“mobile_app_install”的操作,我该如何进一步过滤我的查询?

【问题讨论】:

    标签: facebook facebook-graph-api facebook-ads-api facebook-insights facebook-marketing-api


    【解决方案1】:

    可以在 Facebook 端过滤它,就这样称呼它:

    /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
    

    【讨论】:

    • 有没有办法对嵌套查询中的值执行此操作?
    • @p0rter 当然,使用.filtering([{field: "action_type",operator:"IN", value: ['mobile_app_install']}])
    • 您能看看我最近提出的问题吗? stackoverflow.com/questions/57222780/…
    • @Vanley 感谢您的回答,效果很好 - 我还有一个问题,您为什么要设置 use_account_attribution_setting=true
    • @MadhaviMohoni 非常好的问题归因是有点棘手的事情,但对于“转化”洞察力来说非常重要,因为指定回顾窗口来计算被称为转化的操作的发生非常重要。默认情况下,这是由 facebook 设置为 ["1d_view","28d_click"] 但广告帐户可以有不同的设置,然后您在广告管理器和 api 中看到的数字不匹配。
    【解决方案2】:

    我已经浏览了 github 上的文档和 adsinsights.py 文件,但我找不到限制返回的 action_types 数量的方法。从 api 检索数据后,您只需进行过滤即可。

    https://developers.facebook.com/docs/marketing-api/insights/parameters

    https://github.com/facebook/facebook-python-ads-sdk/blob/master/facebookads/adobjects/adsinsights.py

    【讨论】:

    • 感谢您的意见。这就是我目前的做法——不幸的是。在某些时候,如果我们想增加我们想要获得的 KPI 的数量,我们将遇到每小时 200 个调用的限制:(
    猜你喜欢
    • 2017-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多