此物件代表單一即時文章的洞察報告衡量指標集合,依其標準網址而定。您可以查詢文章層級衡量指標,以及文章內各個影音素材資產的衡量指標。
如需即時文章的詳細資訊,請閱讀即時文章開發人員文件。
用於查詢文章層級洞察報告的端點是由這兩者所決定:查詢中文章的標準網址和查閱中的衡量指標。以下列出所有可用的衡量指標。
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
}];
名稱 | 說明 | 類型 | 必填 |
---|---|---|---|
| 即時文章的標準網址。 |
|
|
| 要求的衡量指標。 | 請參閱以下可用的衡量指標 |
|
| 整合衡量指標的時間區段。 |
|
|
| 要考慮的時間範圍下限。預設值: |
|
|
| 要考慮的時間範圍上限。預設值: |
|
|
| 依衡量指標發生的平台(iOS 或 Android)區隔結果。若未指定,結果會同時包括這兩個平台。 |
|
|
從此關係連線讀取將傳回 JSON 格式的結果:
{ "data": [] }
data
InsightsQueryResult 物件的清單。系統會將以下欄位新增至傳回的每個物件:
名稱 | 說明 | 類型 |
---|---|---|
time | 期間的開始,或存留期的結束時間。 | datetime |
value | 衡量指標在期間的計數、平均值、比率或百分比。 | numeric |
breakdowns | 該值所屬的貯體(即當使用 all_view_durations 衡量指標時,或是如果明確指定 breakdown(platform) 參數時)。 | map<string, string> |
以下是可用於不同衡量指標的整合期間。衡量指標是同時從 iOS 和 Android 裝置所收集。
名稱 | 說明 | 期間的值 |
---|---|---|
| 瀏覽次數 |
|
| 包含資料解析的瀏覽時間長度 |
|
| 瀏覽的平均時間長度 |
|
| 包含資料解析的捲動深度 |
|
| 平均捲動深度 |
|
若要查詢過去 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 天內某篇即時文章的每日瀏覽次數資料解析,並依瀏覽該文章的平台進一步細分,請發出下列 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 天內某篇即時文章的每週貯存瀏覽時間長度資料解析,請發出下列 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" }