无法使用Facebook FQL检索帖子展示次数

时间:2011-08-15 12:41:10

标签: php facebook facebook-fql impressions

我正在尝试在PHP中使用FQL查询FB页面流,并获得除展示之外的所有数据。使用的FB_ACCESS_TOKEN是我的FB应用程序的OAuth令牌,我已授予以下范围: offline_access,manage_pages,email,read_insights,sms,publish_stream

代码示例:

$this->fb->api(array(
  "method" => "fql.multiquery",
  "queries" => json_encode(array(
    "post" => "SELECT post_id, source_id, updated_time, created_time, actor_id, 
                      message, attachment, impressions, likes, privacy, 
                      permalink, comments 
               FROM stream WHERE source_id='".$source_id."' 
                           AND created_time > '".$date_updated."'",
    "comment" => "SELECT post_id, fromid, time, text, id, likes, object_id 
                  FROM comment WHERE post_id IN (SELECT post_id FROM #post) 
                               AND time> '".$date_updated."'"
  )), access_token" => FB_ACCESS_TOKEN
));

以下是示例输出:

[...]
[0] => Array(
  [post_id] => 107112482661088_236459409726394
  [source_id] => 107112482661088
  [updated_time] => 1312884237
  [created_time] => 1312884237
  [actor_id] => 608795063
  [message] => funker jo ikke detta nå da :( får ikke spilt i det hele tatt :@
  [attachment] => Array(
    [description] => 
  )
  [impressions] => 
  [likes] => Array(
    [href] => http://www.facebook.com/browse/?type=likes&id=236459409726394
    [count] => 0
    [sample] => Array()
    [friends] => Array()
    [user_likes] => 
    [can_like] => 
  )
  [privacy] => Array(
    [value] => 
  )
  [permalink] => http://www.facebook.com/hacktheplanet.no/posts/236459409726394
  [comments] => Array(
    [can_remove] => 
    [can_post] => 
    [count] => 0
    [comment_list] => Array()
  )
)
[...]

我没有获得展示数据的任何建议或原因?

1 个答案:

答案 0 :(得分:0)

您是否尝试过几天的帖子?

Facebook Insights似乎通常落后24至48小时,我相信这是展示价值的来源。

为了验证,我在今天创建的帖子上运行了您的FQL查询,该页面具有read_insights权限。 “展示次数”的结果为空(如您的示例中所示)。

然后我在三天前为一个帖子运行了相同的查询,并且显示了展示次数。