Tutorial :FaceBook fan count on website


I'd like to include a within the footer of my website a "facebook fan count". I believe this will add an incentive to users considering clicking our facebook icon. "join XXXX fans on our facebook page" for example. I want the XXXX to be automatically populated with our facebook fan count. I want to do the same with twitter. Any insight you can provide would be helpful.

Note, I dont want to include the whole FB widget, just need the fan count for this purpose.



You can get the fan count of a page via their API using Pages.getInfo found here.

Or using FQL:

select fan_count from page where page_id = [ID of Fan Page]  

For Twitter you can get the followers_count from this call of users/lookup found here.


Do the following FQL query to the facebook api:

select fan_count from page where page_id = <FAN_PAGE_ID>  

For twitter you need to extract it from a user query.



"fan_count" property. replace "cocacola" with your page ID.


FaceBook Graph API


the new Graph api should work for you..

Replace the "devilsworkshop.org" with your page name and then try opening page

https ://graph.facebook.com/devilsworkshop.org

It will return a object with fan_count as its member.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »