Reputation: 849
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.
Upvotes: 13
Views: 19674
Reputation: 3079
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
Upvotes: 27
Reputation: 38135
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");
Upvotes: 2
Reputation: 12138
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.
Upvotes: -2