Alex Rivera | Logout

Get Facebook "Like" count for every page on my domain

Asked 2011-02-02T17:49:28.877
44

I have integrated the Facebook "Like" button into a lot of pages in my site. I want to display the most "Liked" pages on my site in a list, but I can't figure out how to get that data from Facebook in one request. So far, I have been able to get the "Like" count for individual pages using the following FQL query:

SELECT share_count, like_count, comment_count, total_count
FROM link_stat
WHERE url="http://www.mysite.com/some-page"

However, getting the count for each page on my site one at a time is not really feasible. Aside from having a large number of pages, new pages are being created constantly (new user profiles, new blogs and blog articles, etc), which would make getting complete statistics for my site a complicated process and would involve calling Facebook's API thousands of times.

Is there a way to get a count of how many times each page on my domain has been "Liked" in one request? Or just the top 10 most "Liked" pages, or something similar?

Edit
Report

3 Answers

7

In continuation to Salil's answer, here are the some of the major APIs sharedcount.com are using (full list here: http://sharedcount.com/documentation.php)

You can use sharedcount's API to get a general summary, or write something yourself using the APIs:

answered 2012-05-16T09:36:21.463
1

Maybe you can just query the number of likes for each page each time the page is viewed. This won't be precise, but keeping in mind that the most popular pages will be viewed more often it might be good enough.

Additionally, you can use a batch process to query the number of likes of all the page or at least the top N last created ones every couple of hours. Most of the time you won't get the correct result, but in most cases your users don't need the correct result but a good enough approximation.

answered 2011-02-11T17:35:01.073
-1

After some looking around, we may be better off using FQL with graph API:

http://graph.facebook.com/fql?q=select%20comment_count%2C%20share_count%2C%20like_count%20from%20link_stat%20where%20url%20%3D%20%22http%3A%2F%2Fmashable.com%2F2013%2F01%2F30%2Ffacebook-twitter-blackberry-10%2F%22

Results are

{
   "data": [
      {
         "comment_count": 3,
         "share_count": 91,
         "like_count": 5
      }
   ]
}
answered 2013-02-08T06:40:42.243

Your Answer