views:

544

answers:

4

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.

+1  A: 

That's not possible, I'm sorry. You have to manually pull the data on a daily basis and write it to a database. That's the only way to create such a graph.

There's already a service called PageData.

Henrik P. Hessel
Are you sure, not even from Metrics like above? I'm not doing something wrong, it just isn't possible to make it work like I want?
Doug Treadwell
+3  A: 

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.

Karl B
A: 

SELECT fan_count, page_url FROM page WHERE page_id=1234567890",

McLaughlin
A: 

Hello,

Thanks for this response but for my ID, the fan_count field is not visible. Why ?

{ "id": "100000674356088", "name": "Guillaume Reynaud", "first_name": "Guillaume", "last_name": "Reynaud", "link": "http://www.facebook.com/people/Guillaume-Reynaud/100000674356088", "gender": "homme", "locale": "fr_FR" }

Guillaume

related questions