Graph API 版本

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

此物件根據單一即時文章的標準網址,代表其洞察報告衡量數據的組合。文章級別衡量數據和文章內關於個人影音素材的衡量數據均可查詢。

若要進一步了解即時文章,請參閱我們的即時文章開發人員文件

文章洞察報告

用於查詢文章級別洞察報告的端點,取決於所查詢文章的標準網址和查詢的衡量數據。所有可用衡量數據均在下方列出

Graph 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"
}