get facebook like counts for a given url - facebook

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

Related

Facebook link_stat Incorrect Unique URL Stat

I'm using this FQL to get the number of likes of every article in my app.
SELECT share_count, like_count, comment_count, total_count FROM link_stat WHERE url="http://www.example.com/some/dir/slug"
However, I've been noticing that the number and the like button doesn't seem to take the slug into factor. So when I'm debugging it in Graph API Explorer, the stat for http://www.example.com/some/dir/slug and http://www.example.com/some/dir is the same.
Is this FB bug?
Thanks
The og:url meta tag has to contain the individual URL for each article - otherwise, if it is the same URL value for all articles, Facebook will count all likes for that very 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){});

Facebook like button should display like_count and not total_count

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

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

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.