图谱 API 版

汇总即阅文成效分析指标

此对象表示一个 Facebook 公共主页已发布的所有即阅文汇总后的一组成效分析指标。有关即阅文详情,请阅读我们的即阅文开发者文档

这些成效分析包括在 Facebook 上的任何即阅文分享,而非仅限于此公共主页中的帖子。

仅 2015 年 11 月 30 日及以后的数据可用于这些成效分析。

读取

此端点由公共主页编号和要查找的指标组成。所有可用指标已列于下方

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

权限

  • 具备 read_insights 权限的公共主页访问口令可检索相关公共主页的指标。有关公共主页访问口令的详情,请参阅我们的公共主页访问口令文档。

参数

名称 描述 类型 是否必要

id

公共主页编号。

string

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 /v19.0/{page-id}?fields=instant_articles_insights.metric(all_views).period(day).since(7 day ago).until(now)&access_token={your-page-access-token} HTTP/1.1
Host: graph.facebook.com

此请求将返回以下响应:

{
   "instant_articles_insights": {
      "data": [
        {
          "time": "2015-11-30T08:00:00+0000",
          "value": "224067"
        },
        {
          "time": "2015-12-01T08:00:00+0000",
          "value": "467846"
        },
        {
          "time": "2015-12-02T08:00:00+0000",
          "value": "849467"
        },
        {
          "time": "2015-12-03T08:00:00+0000",
          "value": "188502"
        },
        {
          "time": "2015-12-04T08:00:00+0000",
          "value": "321942"
        },
        {
          "time": "2015-12-05T08:00:00+0000",
          "value": "622841"
        },
        {
          "time": "2015-12-06T08:00:00+0000",
          "value": "198124"
        }
      ]
   },
   "id": "<page-id>"
}


过去 7 天的每日文章浏览量(含平台细分条件)

如要查询过去 7 天内您公共主页中所有即阅文的每日浏览量细分数据(按平台进一步细分),请发出以下 GET 请求:

GET /v19.0/{page-id}?fields=instant_articles_insights.metric(all_views).breakdown(platform).period(day).since(7 day ago).until(now)&access_token={your-page-access-token} HTTP/1.1
Host: graph.facebook.com

此请求将返回以下响应:

{
   "instant_articles_insights": {
      "data": [
        {
          "time": "2015-11-30T08:00:00+0000",
          "value": "112033",
          "breakdowns": {
            "platform": "ANDROID"
          }
        },
        {
          "time": "2015-11-30T08:00:00+0000",
          "value": "112034",
          "breakdowns": {
            "platform": "IOS"
          }
        },
        {
          "time": "2015-12-01T08:00:00+0000",
          "value": "233923",
          "breakdowns": {
            "platform": "ANDROID"
          }
        },
        {
          "time": "2015-12-01T08:00:00+0000",
          "value": "233923",
          "breakdowns": {
            "platform": "IOS"
          }
        },
        {
          "time": "2015-12-02T08:00:00+0000",
          "value": "424733",
          "breakdowns": {
            "platform": "ANDROID"
          }
        },
        {
          "time": "2015-12-02T08:00:00+0000",
          "value": "424734",
          "breakdowns": {
            "platform": "IOS"
          }
        }
      ]
   },
   "id": "<page-id>"
}


过去 7 天的每周文章滚动深度

如要查询过去 7 天内经分组的公共主页中所有即阅文的每周滚动深度细分数据,请发出以下 GET 请求:

GET /v19.0/{page-id}?fields=instant_articles_insights.metric(all_scrolls).period(week).since(7 day ago).until(now)&access_token={your-page-access-token} HTTP/1.1
Host: graph.facebook.com

此请求将返回以下响应。请注意,此响应中返回的数据已经过分组。请求时间段内的访客和滚动深度百分比分别通过 value 和 bucket 返回:

{
   "instant_articles_insights": {
    "data": [
      {
        "time": "2015-11-26T08:00:00+0000",
        "value": "334606",
        "breakdowns": {
          "bucket": "100"
        }
      },
      {
        "time": "2015-11-26T08:00:00+0000",
        "value": "27339",
        "breakdowns": {
          "bucket": "94"
        }
      },
      {
        "time": "2015-11-26T08:00:00+0000",
        "value": "26746",
        "breakdowns": {
          "bucket": "95"
        }
      },
      {
        "time": "2015-11-26T08:00:00+0000",
        "value": "26727",
        "breakdowns": {
          "bucket": "93"
        }
      },
      {
        "time": "2015-11-26T08:00:00+0000",
        "value": "26512",
        "breakdowns": {
          "bucket": "96"
        }
      }
     ]
   }, 
   "id": "<page-id>"
}