How to get the number of Likes in facebook like button?
Here is my scenario, I have five like buttons, I want to sort the buttons based on the number of likes. Is it possible?
You can get number of likes for any URL by running FQL on link_stat table:
SELECT like_count, url FROM link_stat WHERE url IN("FIRST_SHARE_URL","SECOND_SHARE_URL") ORDER BY like_count
then display buttons in corresponding order.
There is a button_count settings which once specified, will display the counts to the right of the button.
More Info:
Like Button
Related
When I use https://developers.facebook.com/docs/reference/fql/link_stat
i got this informations like_count, commentsbox_count , share_count , comments_fbid
like_count is the number of times Facebook users have "Liked" the page, or liked any comments or re-shares of this page. can I only get the count of users who clicked on my like button page ?
You are already getting the like count, just make your fql as below
SELECT like_count FROM link_stat WHERE url=your_url
I want to display a Top 10 page in my Facebook App. Basically it's an App where you can vote for DJ Mixes. I select the top 10 urls form the link_stat table over fql and there is the problem: the values of the total_count column in the link_stat table are not equal to the values which are displayed besides the like button.
Check for example:
Like Button: http://www.beatpatrol.at/mix/1020
FQL Request: http://api.facebook.com/method/fql.query?query=SELECT%20share_count,%20like_count,%20comment_count,%20total_count%20FROM%20link_stat%20WHERE%20url%20=%20%22www.beatpatrol.at/mix/1020%22
At the time i wrote this, the like button shows 779likes and the total_count is 752.
Is there a way to get exactly the value from the like button, so that I can order on this value?
Note that:
What makes up the number shown on my Like button?
The number shown is the sum of:
The number of likes of this URL
The number of shares of this URL (this includes copy/pasting a link back to Facebook)
The number of likes and comments on stories on Facebook about this URL
https://developers.facebook.com/docs/reference/plugins/like/
To answer your question, neither the formula of likes nor the Like Button look like being configurable. In my opinion, there is definitely no way to get the exact value from the like button.
A user can turn off all platform apps and hide himself from all applications. It looks like 5 of your friends chose to turn that off.
The setting is under:
Privacy Settings > Apps and Websites > Apps you use > "Turn off all apps"
May be this can be the reason why the exact no of likes are not coming.
The like count displayed next to the facebook like button represents the totat_count which is the sum of share_count and like_count. Is it possible to display only the like_count instead of total_count?
No, It's not possible to show just the like_count on facebook like button.
But it's possible to fetch like_count using their API, Here's the FQL link which outputs
share_count, like_count, comment_count and total_count
Link:
https://api.facebook.com/method/fql.query?query=SELECT%20share_count,%20like_count,%20comment_count,%20total_count%20FROM%20link_stat%20WHERE%20url=%27facebook.com%27
If I put a facebook like button on a webpage, can I use FQL to query the number of users that 'liked' the page?
Yep. Try the following FQL:
SELECT like_count FROM link_stat WHERE url="http://your-web-page-url";
There's more stats available from the link_stat table as well. The table reference is here.
I can get the page's share (click) number in the link-stat table using FQL.
What I want to know is the unique share number, in other words can I get
the number of users who share (group by Uid) the page.
Thanks in advance,
Onder
This is not possible as the link_stat table is user independent. The closest approximation would be to use the regular count
SELECT share_count FROM link_stat WHERE url = A