You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

App Insights API已废弃停止服务,如何迁移至Graph API v3.0?

迁移Facebook Graph API v2.12 App Insights代码到v3.0+

I see you're hitting that frustrating version mismatch error:

The app tried to call version v2.12. This app can only call versions v3.0 and higher, so the request defaulted to version v3.0.

The root issue is that the app_insights/app_event endpoint was deprecated starting in Graph API v3.0. Let's get your revenue-tracking code updated to use the replacement endpoint—here's how:

Key Changes to Know

  • Retired Endpoint: /{app-id}/app_insights/app_event/
  • Replacement Endpoint: /{app-id}/events
  • Parameter Updates: Old parameters like aggregateBy and breakdowns have been simplified to aggregation and breakdown

Migrated Code Example

import requests

# Replace these with your actual values
app_id = "YOUR_APP_ID"
app_access_token = "YOUR_APP_ACCESS_TOKEN"
d1 = # Your start datetime object
d2 = # Your end datetime object

response = requests.request(
    "GET",
    f"https://graph.facebook.com/v3.0/{app_id}/events",
    params={
        "since": d1.strftime("%s"),
        "until": d2.strftime("%s"),
        "summary": "true",
        "event_name": "fb_ad_network_revenue",
        "aggregation": "SUM",
        "breakdown": "placement",
        "access_token": app_access_token
    }
)

Parameter Adjustment Details

  • aggregateBy → aggregation: Same core function (defines how to calculate metrics, e.g., SUM), just a streamlined parameter name.
  • breakdowns[0] → breakdown: For a single dimension like placement, use this parameter directly. If you need multiple breakdowns later, separate them with commas (e.g., breakdown=placement,platform).
  • API Version: Stick to v3.0 or newer (I recommend using the latest stable version, like v18.0, for the best feature support and bug fixes).

Extra Notes

  • Ensure your app has the required permissions: app_events_read or ads_read depending on your specific use case.
  • If you ever need more advanced revenue analytics, the Facebook Marketing API's Ads Insights endpoint is an option, but for tracking app-level ad network revenue, the /{app-id}/events endpoint will work perfectly for your needs.

内容的提问来源于stack exchange,提问作者Pascal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 06:31:14