Facebook Graph API Insights值差异

时间:2015-06-04 11:04:16

标签: facebook facebook-graph-api facebook-insights

我正在使用Graph API从facebook获取数据,但我发现奇怪的是,根据选择的时间段,这些值对我来说没有意义。

请求

 /insights/page_impressions_unique?since=1432191600&until=1433401200

返回以下值:

  "name": "page_impressions_unique", 
      "period": "day", 
      "values": [
        {
          "value": 2, 
          "end_time": "2015-05-22T07:00:00+0000"
        }, 
        {
          "value": 8, 
          "end_time": "2015-05-23T07:00:00+0000"
        }, 
        {
          "value": 4, 
          "end_time": "2015-05-24T07:00:00+0000"
        }, 
        {
          "value": 2, 
          "end_time": "2015-05-25T07:00:00+0000"
        }, 
        {
          "value": 0, 
          "end_time": "2015-05-26T07:00:00+0000"
        }, 
        {
          "value": 2, 
          "end_time": "2015-05-27T07:00:00+0000"
        }, 
        {
          "value": 10, 
          "end_time": "2015-05-28T07:00:00+0000"
        }, 
        {
          "value": 14, 
          "end_time": "2015-05-29T07:00:00+0000"
        }, 
        {
          "value": 4, 
          "end_time": "2015-05-30T07:00:00+0000"
        }, 
        {
          "value": 1, 
          "end_time": "2015-05-31T07:00:00+0000"
        }, 
        {
          "value": 1, 
          "end_time": "2015-06-01T07:00:00+0000"
        }, 
        {
          "value": 3, 
          "end_time": "2015-06-02T07:00:00+0000"
        }, 
        {
          "value": 108, 
          "end_time": "2015-06-03T07:00:00+0000"
        }, 
        {
          "value": 17, 
          "end_time": "2015-06-04T07:00:00+0000"
        }
      ], 
      "title": "Daily Total Reach", 
      "description": "Daily: The number of people who have seen any content associated with your Page. (Unique Users)"
    }, 
    {
      "name": "page_impressions_unique", 
      "period": "week", 
      "values": [
        {
          "value": 110, 
          "end_time": "2015-05-22T07:00:00+0000"
        }, 
        {
          "value": 114, 
          "end_time": "2015-05-23T07:00:00+0000"
        }, 
        {
          "value": 116, 
          "end_time": "2015-05-24T07:00:00+0000"
        }, 
        {
          "value": 116, 
          "end_time": "2015-05-25T07:00:00+0000"
        }, 
        {
          "value": 69, 
          "end_time": "2015-05-26T07:00:00+0000"
        }, 
        {
          "value": 16, 
          "end_time": "2015-05-27T07:00:00+0000"
        }, 
        {
          "value": 20, 
          "end_time": "2015-05-28T07:00:00+0000"
        }, 
        {
          "value": 29, 
          "end_time": "2015-05-29T07:00:00+0000"
        }, 
        {
          "value": 27, 
          "end_time": "2015-05-30T07:00:00+0000"
        }, 
        {
          "value": 24, 
          "end_time": "2015-05-31T07:00:00+0000"
        }, 
        {
          "value": 23, 
          "end_time": "2015-06-01T07:00:00+0000"
        }, 
        {
          "value": 23, 
          "end_time": "2015-06-02T07:00:00+0000"
        }, 
        {
          "value": 125, 
          "end_time": "2015-06-03T07:00:00+0000"
        }, 
        {
          "value": 131, 
          "end_time": "2015-06-04T07:00:00+0000"
        }
      ], 

我知道“期间”:“周”值是end_time之前7天的总和,但我无法通过添加“期间”:“日”。

TL; DR:有没有人知道如何通过添加日期值获得周值?

1 个答案:

答案 0 :(得分:-1)

这是因为当您要求一周时它会为您提供每周数据的平均值,对于"end_time": "2015-05-22T07:00:00+0000"数据是过去7天,即它包含"2015-05-16T07:00:00+0000""2015-05-22T07:00:00+0000"和{"end_time": "2015-05-23T07:00:00+0000"的数据{1}}数据是最近7天,即它包含"2015-05-17T07:00:00+0000" to "2015-05-23T07:00:00+0000"的数据。

如果您汇总此范围之间的所有值,那么您可以获得大于或等于每周数据返回值的值,因为在过去7天内是唯一的。

您也可以尝试使用

 /insights/page_impressions_unique?since=1432191600&until=1432364400

然后您将获得每周数据,但自"2015-05-21T07:00:00+0000" & until is "2015-05-23T07:00:00+0000"起,日期范围为2天数据,但我们也会获得每周数据。

以上信息作为Facebook团队有效,我从Facebook开发者那里得到了这个答案。我们与Facebook团队讨论了我们在申请中遇到的同样问题。