UPDATE:
基于新的促销指南 https://www.facebook.com/promotions_guidelines.php, you cannot使用 Like 插件作为投票机制:
您不得使用 Facebook 的特性或功能,例如“点赞”
按钮,作为促销的投票机制。
实际上,使用 Facebook 作为投票系统根本不是一个坏主意,我正在考虑自己实现一个测试投票系统(基于 Facebook Like PLugin 等)。
该方法类似于answer https://stackoverflow.com/questions/5220877/tracking-facebook-like-referrals/5221538#5221538 here.
您捕获“喜欢”和“不喜欢”:
FB.Event.subscribe('edge.create', function(response) {
$.ajax({
type: 'POST',
url:'/voting.php',
data: {vote: 'up'}
});
});
FB.Event.subscribe('edge.remove', function(response) {
$.ajax({
type: 'POST',
url:'/voting.php',
data: {vote: 'down'}
});
});
您设置了正确的开放图元标签:
<meta property="og:title" content="Picture Title" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://domain.com/path/to/picture/page/" />
<meta property="og:image" content="http://domain.com/path/to/picture.jpg" />
<meta property="og:site_name" content="Site Name" />
<meta property="fb:admins" content="XXXXXXX" />
<meta property="fb:app_id" content="XXXXXXX" />
所以现在你可以做以下两件事之一:
- 在您的数据库中有一条记录,您根据 JS 事件增加喜欢(或当用户改变主意和不喜欢时减少)
- You may使用 FQL (link_stat http://developers.facebook.com/docs/reference/fql/link_stat/ 表格更具体)来收集
total_count
查找某个 URL(对象)并检查最喜欢的。
因此,根据您的需求,如果您只想从页面内收集投票(喜欢),请使用FB.events
上述或 FQL 否则。