正确获取每月活跃用户的问题(通过 Facebook Graph API)

发布于 2024-10-07 05:34:52 字数 2352 浏览 0 评论 0原文

嘿! 我无法获取我的应用程序的可靠的每月活跃用户数量。我用 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 技术交流群。

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

发布评论

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

评论(1

舟遥客 2024-10-14 05:34:52

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 the applications table with fql.

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