Is there a Facebook Share button event for FB.Event.subscribe?

前提是你 提交于 2019-11-29 01:01:41

问题


I'm looking to split test clicks between the Facebook Like button and Facebook Share button. I know I can attach an event handler of FB.Event.subscribe('edge.create',...) to track clicks on the Facebook like button, but is there a corresponding event for the Facebook share button? There doesn't appear to be on in the FB.Event.subscribe documentation.


回答1:


There is no event for this - if you need to be notified when a user clicks shares from within your app, you should create your own share button and display the Feed/Share dialog when clicked:

$('#shareButton').click(function() {
    FB.ui({
        method: 'feed',
        link: 'https://developers.facebook.com/docs/dialogs/',
        caption: 'An example caption',
    }, function(response){
        if (response === null) {
            console.log('was not shared');
        } else {
            console.log('shared - post id is ' + response.post_id);
        }
    });
});


来源:https://stackoverflow.com/questions/20152828/is-there-a-facebook-share-button-event-for-fb-event-subscribe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!