圖形 API 版本

即時文章的洞察報告衡量指標

此物件代表單一即時文章的洞察報告衡量指標集合,依其標準網址而定。您可以查詢文章層級衡量指標,以及文章內各個影音素材資產的衡量指標。

如需即時文章的詳細資訊,請閱讀即時文章開發人員文件

文章洞察報告

用於查詢文章層級洞察報告的端點是由這兩者所決定:查詢中文章的標準網址和查閱中的衡量指標。以下列出所有可用的衡量指標

圖形 API 測試工具
GET /v21.0/?fields=instant_article{insights.metric(metric-name)}&id={canonical-url} 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(
    '/?fields=instant_article{insights.metric(metric-name)}&id={canonical-url}',
    '{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(
    "/?fields=instant_article{insights.metric(metric-name)}&id={canonical-url}",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/?fields=instant_article{insights.metric(metric-name)}&id={canonical-url}",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/?fields=instant_article{insights.metric(metric-name)}&id={canonical-url}"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

權限

  • 具備 read_insights 權限的粉絲專頁存取權杖可以擷取該粉絲專頁的衡量指標。如需有關粉絲專頁存取權杖的詳細資訊,請參閱粉絲專頁存取權杖文件。

參數

名稱 說明 類型 必填

id

即時文章的標準網址。

url

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 /v21.0/?fields=instant_article{insights.metric(all_views).period(day).since(7 day ago).until(now)}&id=http://www.example.com/my-test-page.html&access_token={your-page-access-token} HTTP/1.1
Host: graph.facebook.com

此查詢將傳回下列回應:

{
   "instant_article": {
      "insights": {
         "data": [
            {
               "time": "2015-10-28T08:00:00+0000",
               "value": "3"
            },
            {
               "time": "2015-10-29T08:00:00+0000",
               "value": "3"
            },
            {
               "time": "2015-10-30T08:00:00+0000",
               "value": "3"
            },
            {
               "time": "2015-10-31T08:00:00+0000",
               "value": "3"
            },
            {
               "time": "2015-11-01T08:00:00+0000",
               "value": "2"
            },
            {
               "time": "2015-11-02T08:00:00+0000",
               "value": "6"
            },
            {
               "time": "2015-11-03T08:00:00+0000",
               "value": "4"
            }
         ]
      },
      "id": "<article-id>"
   },
   "id": "http://www.example.com/my-test-page.com"
}


過去 7 天內的每日文章瀏覽次數(包含平台資料解析)

若要查詢過去 7 天內某篇即時文章的每日瀏覽次數資料解析,並依瀏覽該文章的平台進一步細分,請發出下列 GET 要求:

GET /v21.0/?fields=instant_article{insights.metric(all_views).breakdown(platform).period(day).since(7 day ago).until(now)}&id=http://www.example.com/my-test-page.html&access_token={your-page-access-token} HTTP/1.1
Host: graph.facebook.com

此查詢將傳回下列回應:

{
   "instant_article": {
      "insights": {
         "data": [
            {
              "time": "2015-10-28T08:00:00+0000",
              "value": "1",
              "breakdowns": {
                "platform": "ANDROID"
              }
            },
            {
              "time": "2015-10-28T08:00:00+0000",
              "value": "2",
              "breakdowns": {
                "platform": "IOS"
              }
            },
            {
              "time": "2015-10-29T08:00:00+0000",
              "value": "1",
              "breakdowns": {
                "platform": "ANDROID"
              }
            },
            {
              "time": "2015-10-29T08:00:00+0000",
              "value": "2",
              "breakdowns": {
                "platform": "IOS"
              }
            },
            {
              "time": "2015-10-30T08:00:00+0000",
              "value": "1",
              "breakdowns": {
                "platform": "ANDROID"
              }
            },
            {
              "time": "2015-10-30T08:00:00+0000",
              "value": "2",
              "breakdowns": {
                "platform": "IOS"
              }
            }
         ]
      },
      "id": "<article-id>"
   },
   "id": "http://www.example.com/my-test-page.com"
}


過去 7 天內的每週文章瀏覽時間長度

若要查詢過去 7 天內某篇即時文章的每週貯存瀏覽時間長度資料解析,請發出下列 GET 要求:

GET /v21.0/?fields=instant_article{insights.metric(all_view_durations).period(week).since(7 day ago).until(now)}&id=http://www.example.com/my-test-page.html&access_token={your-page-access-token} HTTP/1.1
Host: graph.facebook.com

此查詢將傳回下列回應。請注意,此回應傳回的資料是貯體的:

{
   "instant_article": {
      "insights": {
         "data": [
            {
               "time": "2015-10-29T08:00:00+0000",
               "value": "8",
               "breakdowns": {
                  "bucket": "15"
               }
            },
            {
               "time": "2015-10-29T08:00:00+0000",
               "value": "2",
               "breakdowns": {
                  "bucket": "225"
               }
            },
            {
               "time": "2015-10-29T08:00:00+0000",
               "value": "2",
               "breakdowns": {
                  "bucket": "90"
               }
            },
            {
               "time": "2015-10-29T08:00:00+0000",
               "value": "1",
               "breakdowns": {
                  "bucket": "360"
               }
            },
            {
               "time": "2015-10-29T08:00:00+0000",
               "value": "1",
               "breakdowns": {
                  "bucket": "240"
               }
            },
            {
               "time": "2015-10-29T08:00:00+0000",
               "value": "1",
               "breakdowns": {
                  "bucket": "165"
               }
            },
            {
               "time": "2015-10-29T08:00:00+0000",
               "value": "1",
               "breakdowns": {
                  "bucket": "120"
               }
            },
            {
               "time": "2015-10-29T08:00:00+0000",
               "value": "1",
               "breakdowns": {
                  "bucket": "75"
               }
            },
            {
               "time": "2015-10-29T08:00:00+0000",
               "value": "1",
               "breakdowns": {
                  "bucket": "60"
               }
            },
            {
               "time": "2015-10-29T08:00:00+0000",
               "value": "1",
               "breakdowns": {
                  "bucket": "45"
               }
            },
            {
               "time": "2015-10-29T08:00:00+0000",
               "value": "1",
               "breakdowns": {
                  "bucket": "30"
               }
            }
         ]
      },
      "id": "<article-id>"
   },
   "id": "http://www.example.com/my-test-page.com"
}