Facebook link_stat Incorrect Unique URL Stat - facebook

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.

Related

facebook api - get likes and number of comments made for a specific period

I am pretty new to Facebook api's and would like to know if it's possible to fetch the number of likes and also the number of comments for any specific page for a given period of time via the api?
Thanks in advance.
you can use FQL:
e.g.
select comment_count, share_count, like_count from link_stat where url = "http://techcrunch.com/2011/04/12/facebook-comments-now-on-over-50k-sites-get-more-social-with-latest-upgrade/"
you can use this api explorer as your reference:
https://developers.facebook.com/tools/explorer/?fql=select+comment_count%2C+share_count%2C+like_count+from+link_stat+where+url+%3D+%22http%3A%2F%2Ftechcrunch.com%2F2011%2F04%2F12%2Ffacebook-comments-now-on-over-50k-sites-get-more-social-with-latest-upgrade%2F%22

How to get top 30 most liked urls on my website (FQL)

I'm upgrading my webshop and it involves doing some changes in my product url's (because of SEO optimizing). Since there doesn't seem to be anyway of migrating likes from one url to another and "tricking" the likes to the old url with 301 redirecting is out of the question, i was trying to get a list of the top 20-30 liked urls so i could then loop the result to find the amount of likes, shares etc.
I have already built a small script that finds the like, share etc count for a certain url, but i am unable to find out what the most liked url's are!
Thanks a bunch!
It's possible, but not easy. You'll need to build an FQL query like this:
SELECT url, normalized_url, share_count, like_count, comment_count, total_count
FROM link_stat
WHERE url IN ("example.com/url1", "example.com/url2", ... "example.com/urln")
ORDER BY like_count DESC

Facebook sharing data for url

I am working on a project to get shares for different articles of the client. I searched whole internet but did not find any info so as a last resort putting the question here:
Is there a way to check how many shares an article has on facebook by giving just the url of the article? I have seen code on facebook where you can get number of likes for your own article you paste but is there a way to tell lets say if some techcruch article has how many facebook shares?
Here is the reference:
https://developers.facebook.com/docs/reference/fql/link_stat/
Sample query to get number of shares for a Techcrunch article:
SELECT url, normalized_url, share_count, like_count, comment_count,
total_count, commentsbox_count, comments_fbid, click_count FROM
link_stat WHERE
url="http://techcrunch.com/2012/07/25/zipongo-seed-round/"
You can play around with different queries here:
https://developers.facebook.com/tools/explorer
(choose FQL from the menu)

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