Facebook like button should display like_count and not total_count - facebook

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

Related

get facebook like counts for a given url

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

How to get the total number of likes & comments about particular post?

I want to get the total number of like & comments for a particular post on my website, for eg. if my website has 100 pages, I integrate facebook like button on every page, how can i get the number of likes related to that page or post? I have take a look a GRAPH API, but i did n't find any thing relating to my issue.
Check this
Facebook documentation
simply use this javascript code. (change the url)
FB.api({
method: 'fql.query',
query: 'SELECT url, normalized_url, share_count, like_count, comment_count, total_count, commentsbox_count, comments_fbid, click_count FROM link_stat WHERE url="http://www.facebook.com"'
}, function(response){});

Retrieve Facebook users who like a URL/web page

How can I retrieve the list of Facebook users that have clicked the like button on an external site?
Say I have a like button:
<fb:like href="http://example.com/xyz"></fb:like>
I'd like a list of FB user IDs of people who have liked it.
I've tried OpenGraph:
https://graph.facebook.com/OBJECTID/likes/
(where OBJECTID is the id of the like example.com/xyz)
and FQL
select user_id from like where object_id in (
select id from object_url where url = 'http://example.com/xyz'))
but both return empty results.
I can see from other calls that the likes are counted alright, but I can't get the actual users.
Anyone know what permissions etc. I'd need to retrieve these?
Also see this question for sample code.
The simple answer is 'Its not possible to get individual user ids who liked a page'.
https://graph.facebook.com/cocacola/likes?access_token='xxxxxxxxxxxxxxxxxxxxxxx'
will surely return the data about the likes from the user/page but not the list of users who liked the specific object(in this case coca-cola). But make sure you send a proper access_token with proper permissions.
The FQL like is used to get the likes of any objects like video, note, link, photo, or album. To get liked users count of a page please use either link_stat or page from FQL.
the sample query will be like
SELECT url, normalized_url, share_count, like_count, comment_count, total_count,
commentsbox_count, comments_fbid, click_count FROM link_stat WHERE url="facebook.com"
SELECT name, fan_count FROM page WHERE page_id = 19292868552
For more clear answers on this, please read the answer by Jonathan Dean in How to list facebook users who like a page or interest
or ifaour answer in Querying Users who 'like' my Facebook Page

facebook like button

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

Query number of users that like a page in facebook?

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.