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.
With the Facebook Graph API, you can access a wide range of user data, including user information such as name, email address, birthday, and friends list in JSON. You can also access information about pages that a user has liked or engaged with on Facebook, as well as events and photos that they have posted or shared.
You can access Page Insights by typing /insights after the name of your page in the URL field. This command will retrieve all of the Insights associated with your Page. Type "/insights" after your company name. Click the Submit button.
Call the Graph API - https://graph.facebook.com/me/accounts. You can test this procedure in the graph explorer -> Just click on 'Get Access Token' button-> under 'Extended permission' check 'manage_pages' & submit it. It will give you the admin-page-details JSON.
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");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With