查询文章级成效分析所用端点由要查询文章的权威网址和要查询的指标决定。所有可用指标已列于下方。
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 | value 所属的桶(即使用 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" }