JavaScript SDK를 사용하면 사용자가 공유하는 항목을 추적하고 성공적으로 공유 한 경우에만 추적 할 수 있습니다. 아래에서이를 달성하기위한 기본 코드. 어떤 이미지가 공유되었는지 알 수 있도록 각 이미지에 고유 한 식별자를 보낼 수 있습니다. 물론 이것은 사용자가 도박을 할 수 있습니다. 이미지를 공유 한 다음 타임 라인에서 이미지를 삭제할 수 있습니다.
function fb_share() {
FB.ui({
method: 'feed',
name: "Facebook API: Tracking Shares using the JavaScript SDK",
link: "https://www.webniraj.com/2013/05/11/facebook-api-tracking-shares-using-the-javascript-sdk/",
picture: "https://stackexchange.com/users/flair/557969.png",
caption: "Tracking Facebook Shares on your website or application is a useful way of seeing how popular your articles are with your readers. In order to tracking Shares, you must used the Facebook JavaScript SDK."
}, function(response) {
if (response !== null && typeof response.post_id !== 'undefined') {
// ajax call to track share
}
});
}
You can find the complete code and working example here.