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

发布于 2024-11-29 09:11:46 字数 1855 浏览 0 评论 0原文

我正在尝试使用 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()
  )
)
[...]

任何建议或为什么我没有获得展示数据?

I'm trying to query FB for a Page Stream using FQL in PHP, and I get all the data except impressions. The FB_ACCESS_TOKEN used is the OAuth token for my FB App, where I have granted the following scope: offline_access,manage_pages,email,read_insights,sms,publish_stream

Code example:

$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
));

Here is the example output:

[...]
[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()
  )
)
[...]

Any suggestions or reasons why I don't get the impression data?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我不在是我 2024-12-06 09:11:46

您是否尝试过对几天前的帖子进行此查询?

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

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

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

Have you tried this query for a post that is several days old?

Facebook Insights seems to usually be 24 to 48 hours behind and I believe that is the source of the impressions value.

To validate, I ran your FQL query for a post created today on a page that I have read_insights permissions for. The result for "impressions" was null (like in your example).

I then ran the same query for a post three days ago and the number of impressions was present.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文