正确获取每月活跃用户的问题(通过 Facebook Graph API)
嘿! 我无法获取我的应用程序的可靠的每月活跃用户数量。我用 FQL 尝试过:
[...] $end_time = date('Y-m-d', time()-(60*60*24*2)); // Dont' know what is correct. Sometimes it's *2 sometimes it's working with *3 $fql = $facebook->api(array( "method" => "fql.query", "query" => "SELECT metric, value FROM insights WHERE object_id='000000000' AND metric='application_active_users' AND end_time=end_time_date('".$end_time."') AND period=period('month')" )); [...]
看起来不可能获得最新的值。我想要获得与我的申请页面上所述相同的值。但有了这段代码,每天的情况都会有所不同。
我也尝试了这个解决方案:
$fql = $facebook->api('/000000000/insights/application_active_users/month');
但作为回应,我只得到几天前的过时值:
Array ( [data] => Array ( [0] => Array ( [id] => 000000000/insights/application_active_users/month [name] => application_active_users [period] => month [values] => Array ( [0] => Array ( [value] => 166345 [end_time] => 2010-12-09T08:00:00+0000 ) [1] => Array ( [value] => 167679 [end_time] => 2010-12-10T08:00:00+0000 ) [2] => Array ( [value] => 168983 [end_time] => 2010-12-11T08:00:00+0000 ) ) [description] => Monthly Users who have engaged with your application or viewed your application (Unique Users) ) ) [paging] => Array ( [previous] => https://graph.facebook.com/000000000/insights/application_active_users/month?since=1291556506&until=1291815706 [next] => https://graph.facebook.com/000000000/insights/application_active_users/month?since=1292074906&until=1292334106 ) )
我做错了什么?
Hey there!
I'm not able to fetch a reliable monthly active users number of my application. I tried it with FQL:
[...] $end_time = date('Y-m-d', time()-(60*60*24*2)); // Dont' know what is correct. Sometimes it's *2 sometimes it's working with *3 $fql = $facebook->api(array( "method" => "fql.query", "query" => "SELECT metric, value FROM insights WHERE object_id='000000000' AND metric='application_active_users' AND end_time=end_time_date('".$end_time."') AND period=period('month')" )); [...]
Looks like it's not possible to get a value up-to-the-minute. I want to get the same value as stated on my application page. But with this code it's different every day.
I also tried this solution:
$fql = $facebook->api('/000000000/insights/application_active_users/month');
but as response I only get out dated values which are a few days old:
Array ( [data] => Array ( [0] => Array ( [id] => 000000000/insights/application_active_users/month [name] => application_active_users [period] => month [values] => Array ( [0] => Array ( [value] => 166345 [end_time] => 2010-12-09T08:00:00+0000 ) [1] => Array ( [value] => 167679 [end_time] => 2010-12-10T08:00:00+0000 ) [2] => Array ( [value] => 168983 [end_time] => 2010-12-11T08:00:00+0000 ) ) [description] => Monthly Users who have engaged with your application or viewed your application (Unique Users) ) ) [paging] => Array ( [previous] => https://graph.facebook.com/000000000/insights/application_active_users/month?since=1291556506&until=1291815706 [next] => https://graph.facebook.com/000000000/insights/application_active_users/month?since=1292074906&until=1292334106 ) )
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Facebook 洞察数据无法及时获得。见解图表将始终仅显示历史数据。
如果您对当前的
monthly_active_users
数量感兴趣,请使用 fql 查看applications
表。Facebook insights data is not available just-in-time. The insights graph will always display historic data only.
If you are interested for current
monthly_active_users
number look into theapplications
table with fql.