How can I retrieve the number of fans my Facebook page had on a given day?
How can I retrieve the number of fans my Facebook page had on a given day? I am trying to find a way to display a plot of date vs number of fans, but I can't find a way to get the number of fans by date.
I have tried this:
select active_users from metrics where end_time = 1263812045 and period = 2592000
in the Facebook developers tools page for my Page ( http://developers.facebook.com/tools.php ), but it retrieves an empty set.
Firstly: you can retrieve statistics such as active users for apps, but it won't tell you how many fans your page has. To retrieve fans you need to query the fan_count column of the page_fan FQL table, but you can't get historical data, only a total count. So you'll need to query it every day and build up your own database.
If, from the original query, you really wanted active users for an app, it's not particularly straightforward as the FQL query barfs at a lot of timestamps. The metrics FQL table documentation claims that you need to enter midnight PST timestamps, but I've found that it accepts 2am GMT and nothing else. E.g. select active_users from metrics where end_time = 1263715200 and period = 2592000 works for me on both apps and pages, but note as above: this retrieves an active user count and not the number of fans.
For people finding this question now: It's possible if you have read_insights permission. Then you can use FQL to query fan count, adds, removes and many other things:
You can execute FQL queries using https://graph.facebook.com/fql?q=THE%20Query