我在扩展 API 查询以仅包含特定操作时遇到一些困难。我可以很好地运行以下查询:
https://graph.facebook.com/v2.10/act_11111111111111111/ads?fields=name,insights{actions.filtering("action_type":comment)}&limit=1
...但结果包含的操作类型多于预期。
"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"
}
],
我希望只返回“comment”和“link_click”,类似于...
https://graph.facebook.com/v2.10/act_11111111111111111/ads?fields=name,insights{actions?action_type=comment,link_click}&limit=1
谢谢!
最佳答案
试试这个
此图形 URI 仅适用于单个广告,而不是广告帐户级别,但您可以设置类似于下面的逻辑
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>
关于facebook-graph-api - 为 Facebook Graph Ad API 查询指定 action_type,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46411326/