图谱 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

value 所属的桶(即使用

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