Facebook 营销 API:获取活动的结果和每个结果的成本

Facebook Marketing API : Get results and cost per result of a Campaign

我正在创建一个应用程序(使用 Facebook Business Java SDK),它可以获取广告帐户拥有的所有广告系列信息。我的几乎所有广告系列都具有相同的 objective 和 APP_INSTALLS。我想知道我的应用程序安装了多少次,所以我尝试在 Adsmanager board 中请求 "Results" 列和 "Cost per Result" 列之类的信息:

Adsmanager colums

但是当我将 "results" 和 "cost_per_result" 添加到 APIRequestGetInsights 的请求字段时,我得到了一个 FailRequestException :

"{"error":{"message":"(#100) 结果,cost_per_result 对字段参数无效。请检查 https://developers.facebook.com/docs/marketing-api/reference/ads-insights/ 以获取所有有效值","type":"OAuthException","code":100,"fbtrace_id": "DnPCKyIGIqs"}}"

我使用了具有以下权限的用户访问令牌: - read_insights - manage_pages - pages_show_list - publish_pages - ads_management - ads_read - business_management

我在 google 上搜索了很多次,但没有任何用处。所以这里有人请告诉我如何通过 Facebook api?

获取活动的 "Results" 和 "Cost per Result" 信息

如评论中所述,此信息过去在字段 cost_per_action_type 中可用,您可以在 ad['action_type'] == 'mobile_app_install'.

的项目中检索值

很遗憾,这个在3.2中不再可用,但是你可以自己计算这个值:

进行包含 actionsspend 字段的查询。
您会找到安装总数(在带有 action_type == 'mobile_app_install') 的项目中,然后您可以使用 cost_per_install = spend / install_count 来计算每次安装的成本。