Facebook喜欢并分享用户跟踪

时间:2018-03-05 10:01:26

标签: javascript php facebook facebook-like tracking

我在我的网站上使用FB共享和插件。链接如下:

https://developers.facebook.com/docs/plugins/like-button

我想跟踪登录我网站的用户(我有用户ID)并喜欢并通过FB共享帖子和分享插件,当用户这样做时我会做一些php在用户喜欢并分享我的帖子之后立即编码并奖励用户。我如何跟踪用户喜欢和分享? 谢谢,

2 个答案:

答案 0 :(得分:0)

阅读本文 -  https://developers.facebook.com/docs/javascript/reference/FB.ui

这个例子很清楚,你有一个回调,你可以根据响应的状态(他们实际共享,他们取消等)做任何事情,你可以在回调中调用你的PHP驱动的服务器做任何事。

答案 1 :(得分:0)

您无法使用此like按钮获取共享回调。您可以改为创建自己的share按钮,并在其单击时调用Feed对话框

FB.ui(
{
  method: 'feed',
  name: 'Facebook Dialogs',
  link: 'https://developers.facebook.com/docs/dialogs/',
  picture: 'http://fbrell.com/f8.jpg',
  caption: 'Reference Documentation',
  description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'
},
function(response) {
  if (response && response.post_id) {
    alert('Post was published.');
  } else {
    alert('Post was not published.');
  }
}
);

另请参阅此链接:https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSocial