使用 Facebook 影片 API 從 Meta 取得洞察報告

本指南會展示如何就 Facebook 專頁上已發佈的影片取得洞察報告。

進一步了解 Reels 洞察報告

準備工作

您需要準備以下項目:

限制

  • 無法就在 Facebook 群組或用戶發佈的影片提供洞察報告。
  • 多重發佈影片在已發佈此影片的每個專頁上,都有各自的不重複 <VIDEO_ID>

獲取整體洞察報告

傳送 GET 要求至 /<VIDEO_ID>/video_insights 端點,以就與此影片相關的所有影片帖子獲取整體洞察報告。

GET <API_VERSION>/<VIDEO_ID>/video_insights?access_token=<PAGE_ACCESS_TOKEN>"

要求範例

curl -X GET \
 "https://graph.facebook.com/v20.0/323790578640877/video_insights?access_token=EAABkW..."

回應範例

{
  "data": [
    {
      "name": "total_video_views",
      "period": "lifetime",
      "values": [
        {
          "value": 89
        }
      ],
      "title": "Lifetime Total Video Views",
      "description": "Lifetime: Total number of times your video was viewed for 3 seconds or viewed to the end, whichever came first. (Total Count)",
      "id": "323790578640877/video_insights/total_video_views/lifetime"
    },
    {
      "name": "total_video_views_unique",
      "period": "lifetime",
      "values": [
        {
          "value": 56
        }
      ],
      "title": "Lifetime Unique Video Views",
      "description": "Lifetime: Number of unique people who viewed your video for 3 seconds or viewed to the end, whichever came first. (Unique Users)",
      "id": "323790578640877/video_insights/total_video_views_unique/lifetime"
    },
    {
      "name": "total_video_views_autoplayed",
      "period": "lifetime",
      "values": [
        {
          "value": 23
        }
      ],
      "title": "Lifetime Auto-Played Video Views",
      "description": "Lifetime: Number of times your video started automatically playing and people viewed it for 3 seconds or viewed it to the end, whichever came first. (Total Count)",
      "id": "323790578640877/video_insights/total_video_views_autoplayed/lifetime"
    },
    {
      "name": "total_video_views_clicked_to_play",
      "period": "lifetime",
      "values": [
        {
          "value": 12
        }
      ],
    }
    ...
  ]
}   

獲取特定的洞察報告衡量數據

傳送 GET 要求至 VideoVideoInsights 端點,並附上您要獲取的 metric 參數和特定衡量數據

GET /&lt;API_VERSION>/&lt;VIDEO_ID>/video_insights
  ?metric=total_video_views,total_video_views_unique
  &access_token=&lt;PAGE_ACCESS_TOKEN>"

要求範例

curl -X GET \
  "https://graph.facebook.com/v20.0/323790578640877/video_insights?metric=total_video_views,total_video_views_unique&access_token=EAABkW..."

回應範例

{
  "data": [
    {
      "name": "total_video_views",
      "period": "lifetime",
      "values": [
        {
          "value": 2206
        }
      ],
      "title": "Lifetime Total Video Views",
      "description": "Lifetime: Total number of times your video was viewed for 3 seconds or viewed to the end, whichever came first. (Total Count)",
      "id": "323790578640877/video_insights/total_video_views/lifetime"
    },
    {
      "name": "total_video_views_unique",
      "period": "lifetime",
      "values": [
        {
          "value": 6
        }
      ],
      "title": "Lifetime Unique Video Views",
      "description": "Lifetime: Number of unique people who viewed your video for 3 seconds or viewed to the end, whichever came first. (Unique Users)",
      "id": "323790578640877/video_insights/total_video_views_unique/lifetime"
    }
  ]
}