开发者

How do I sort my products by most liked on Facebook?

开发者 https://www.devze.com 2023-02-04 20:29 出处:网络
I开发者_如何学Cf I have an e-commerce site, for instance, where I have a selection of products that each gets a \'Like\' button, how would I go about ranking these products in order of their popularit

I开发者_如何学Cf I have an e-commerce site, for instance, where I have a selection of products that each gets a 'Like' button, how would I go about ranking these products in order of their popularity?


What I do is, I store the number of likes locally on my own Database.

You can grab the number of likes for a URL from link_stats table:

http://developers.facebook.com/docs/reference/fql/link_stat/

I looked around a lot for a simpler solution, but it's best if you store the number of likes locally. You can update your local value when a user clicks on the like button or you can do it every so often for all URLs if you don't have that many. I personally update the number of counts for all my URLs once every 24 hours.

-Roozbeh


You may be able to do it if you have all your products on one page using this tool: http://www.pagesort.com


I suggest you keeping local reference count (in database) and set up facebook realtime update on those objects. So every time somebody likes your url (object), facebook service will post update to your api. https://developers.facebook.com/docs/reference/api/realtime/

0

精彩评论

暂无评论...
验证码 换一张
取 消