Facebook sharing data for url - facebook

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)

Related

Facebook API - does it keep track of shares via link pasting?

If a link is shared by pasting the link on a facebook post instead of the share button, will it be counted as a share?
I tried pasting this link (https://kabayanabroad.antdomus.com/as-a-parent-will-you-bring-your-kids-to-ksa/) and posted in my facebook timeline.
Then I checked the url statistic using FQL, and still got the same share count. It didn't seem to increment.
FQL:
SELECT url, normalized_url, share_count, like_count, comment_count,
total_count, commentsbox_count, comments_fbid, click_count FROM
link_stat WHERE url = 'https://kabayanabroad.antdomus.com/as-a-parent-will-you-bring-your-kids-to-ksa/'
RESULT:
FB share
*****************************************************
UPDATE: 3/10/2015
When I comment on the posted link inside facebook, it increments the comment_count
When I 'like' the posted link inside facebook, it increments the like_count
When I share the posted link inside facebook using the share dialog, it increments the share_count
Does this mean it has to go through the SHARE DIALOG? And does this mean that if a link is shared only by copy-pasting the link it will not count as a share_count?
Yes, if you paste the link on the Facebook post it is getting counted as a share, together with each like, comment and share of your post.
The reason why you don't see the share number increasing is probably that you have already liked this specific page before.

How to get most commented pages on your website?

I am having a problem getting the most commented pages on my site. I wanted to return list of pages sorted by their comment count.
I have tried this one. But this is not efficient for me I have a lot of pages.
SELECT url, normalized_url, share_count, like_count, comment_count, total_count,
commentsbox_count, comments_fbid, click_count FROM link_stat WHERE url IN ( "url",
"url2") LIMIT 10
Are there other ways to get this?
There are no ways via the API to query the most commented pages on your website. If you have Insights integrated into your website you can make a close approximation.

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 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

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){});