Graph API 版本

彙總即時文章洞察報告衡量數據

此物件表示從某個 Facebook 專頁的所有已發佈即時文章彙總而成的一系列洞察報告衡量數據。如需更多關於即時文章的資訊,請參閱即時文章開發人員文件

這些洞察報告包括 Facebook 內即時文章的所有分享情況,且不僅限於來自其專頁的帖子。

這些洞察報告的資料僅在 2015 年 11 月 30 日後可用。

讀取

此端點由專頁編號和正被搜尋的衡量數據組成。所有可用的衡量數據均列於下方

Graph API 測試工具
GET /v19.0/{page-id}?fields=instant_articles_insights.metric(metric-name) HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get(
    '/{page-id}?fields=instant_articles_insights.metric(metric-name)',
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "/{page-id}?fields=instant_articles_insights.metric(metric-name)",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{page-id}?fields=instant_articles_insights.metric(metric-name)",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{page-id}?fields=instant_articles_insights.metric(metric-name)"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

權限

  • 帶有 read_insights權限的專頁存取憑證可以檢索該專頁的衡量數據。如需更多關於專頁存取憑證的資訊,請參閱專頁存取憑證文件。

參數

名稱 說明 類型 必要項目

id

專頁編號。

string

yes

metric

被要求的衡量數據。

請見下方的可用的衡量數據

yes

period

彙總衡量數據的時段。

enum{day, week, days_28, month, lifetime}

yes

since

要考慮的時間範圍下限。預設值:2 weeks ago

datetime

no

until

要考慮的時間範圍上限。預設值:Current time

datetime

no

breakdown

特定平台(iOS 或 Android)衡量數據的獨立結果。如未指定,則結果將包括兩個平台。

enum{platform}

no

欄位

讀取此關係連線將會傳回 JSON 格式的結果:

{
  "data": []
}

data

InsightsQueryResult 物件清單。以下欄位將被加入已傳回的每個物件:

名稱 說明 類型

time

時段的開始時間,或總時段的結束時間。

datetime

value

衡量數據在該時段的計數、平均值、比率或百分比。

numeric

breakdowns

值所屬的族群(例如,當

all_view_durations

衡量數據被使用,或當

breakdown(platform)

參數被明確指定時)。

map<string, string>

可用的衡量數據

以下是適用於不同衡量數據的彙整時段。衡量數據收集自 iOS 和 Android 裝置。

名稱 說明 時段的值

all_views

觀看次數

day

all_view_durations

觀看時長(附資料細節)

week

all_view_durations_average

平均觀看時長

week

all_scrolls

捲動深度(附資料細節)

week

all_scrolls_average

平均捲動深度

week

範例

過去 7 天的每日文章瀏覽次數

如要查詢過去 7 天內您專頁中所有即時文章的每日瀏覽次數資料細節,請發出以下 GET 要求:

GET /v19.0/{page-id}?fields=instant_articles_insights.metric(all_views).period(day).since(7 day ago).until(now)&access_token={your-page-access-token} HTTP/1.1
Host: graph.facebook.com

此要求將傳回以下回應:

{
   "instant_articles_insights": {
      "data": [
        {
          "time": "2015-11-30T08:00:00+0000",
          "value": "224067"
        },
        {
          "time": "2015-12-01T08:00:00+0000",
          "value": "467846"
        },
        {
          "time": "2015-12-02T08:00:00+0000",
          "value": "849467"
        },
        {
          "time": "2015-12-03T08:00:00+0000",
          "value": "188502"
        },
        {
          "time": "2015-12-04T08:00:00+0000",
          "value": "321942"
        },
        {
          "time": "2015-12-05T08:00:00+0000",
          "value": "622841"
        },
        {
          "time": "2015-12-06T08:00:00+0000",
          "value": "198124"
        }
      ]
   },
   "id": "<page-id>"
}


過去 7 天的每日文章瀏覽次數及平台資料細節

如要查詢過去 7 天內您專頁中所有即時文章的每日瀏覽次數資料細節,並以所用平台進一步區分資料內容,請發出以下 GET 要求:

GET /v19.0/{page-id}?fields=instant_articles_insights.metric(all_views).breakdown(platform).period(day).since(7 day ago).until(now)&access_token={your-page-access-token} HTTP/1.1
Host: graph.facebook.com

此要求將傳回以下回應:

{
   "instant_articles_insights": {
      "data": [
        {
          "time": "2015-11-30T08:00:00+0000",
          "value": "112033",
          "breakdowns": {
            "platform": "ANDROID"
          }
        },
        {
          "time": "2015-11-30T08:00:00+0000",
          "value": "112034",
          "breakdowns": {
            "platform": "IOS"
          }
        },
        {
          "time": "2015-12-01T08:00:00+0000",
          "value": "233923",
          "breakdowns": {
            "platform": "ANDROID"
          }
        },
        {
          "time": "2015-12-01T08:00:00+0000",
          "value": "233923",
          "breakdowns": {
            "platform": "IOS"
          }
        },
        {
          "time": "2015-12-02T08:00:00+0000",
          "value": "424733",
          "breakdowns": {
            "platform": "ANDROID"
          }
        },
        {
          "time": "2015-12-02T08:00:00+0000",
          "value": "424734",
          "breakdowns": {
            "platform": "IOS"
          }
        }
      ]
   },
   "id": "<page-id>"
}


過去 7 天的每週文章捲動深度

如要查詢過去 7 天內您專頁中所有即時文章的每週按族群區分的捲動深度資料細節,請發出以下 GET 要求:

GET /v19.0/{page-id}?fields=instant_articles_insights.metric(all_scrolls).period(week).since(7 day ago).until(now)&access_token={your-page-access-token} HTTP/1.1
Host: graph.facebook.com

此要求將傳回以下回應。請注意,此回應所傳回的資料為已按族群區分的資料。要求期間內的訪客數量以值的方式傳回,捲動深度百分比則以族群的方式傳回:

{
   "instant_articles_insights": {
    "data": [
      {
        "time": "2015-11-26T08:00:00+0000",
        "value": "334606",
        "breakdowns": {
          "bucket": "100"
        }
      },
      {
        "time": "2015-11-26T08:00:00+0000",
        "value": "27339",
        "breakdowns": {
          "bucket": "94"
        }
      },
      {
        "time": "2015-11-26T08:00:00+0000",
        "value": "26746",
        "breakdowns": {
          "bucket": "95"
        }
      },
      {
        "time": "2015-11-26T08:00:00+0000",
        "value": "26727",
        "breakdowns": {
          "bucket": "93"
        }
      },
      {
        "time": "2015-11-26T08:00:00+0000",
        "value": "26512",
        "breakdowns": {
          "bucket": "96"
        }
      }
     ]
   }, 
   "id": "<page-id>"
}