API for getting total number of likes of a facebook page

I am looking for a way to keep track of my facebook page's number of likes every day. Is there an API for it? or any other way?

Thanks.

Answers


You can do it in an even easier way with the Facebook Graph API - it just returns JSON data, like so : http://graph.facebook.com/225397695229/

Where 225397695229 is the page or user ID you're referring to on FB. Just scroll to the bottom of the array and look for "likes".

Edit - 9/4/2015 - Looks like an access token is required now in Facebook Graph 2.4 - so, appended to the URL would be &access_token={token_id}. Details on obtaining a Page token are here: https://developers.facebook.com/docs/facebook-login/access-tokens#pagetokens


If you are the admin of the page, you should already have access to the Facebook Insights which would provide you that information and even more!

If you want to programmatically access these data, you need to create an application, grant a read_insights and maybe offline_access permissions and then it's an easy api call:

$facebook->api("/$page_id/insights");

I'm not sure you can access the Like button on an actual Facebook page; most of the API stuff is for the facebook platform (i.e. adding a Like button to a non-facebook page.)

That said, although I've not done this you might be able to use the Graph API and get the number of likes via JSON.

EDITED TO ADD: you can use FQL (Facebook's query language) to access those properties.


Need Your Help

How to Convert an int to a String?

java string

I have an int variable and when I am setting this variable as an Android TextView's text it's throwing an error, maybe because it's an Int. I have checked but couldn't find a toString function for ...