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

后端 未结 1 1236
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-28 22:31

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\',...)

1条回答
  •  别那么骄傲
    2020-12-28 22:45

    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);
            }
        });
    });
    

    0 讨论(0)
提交回复
热议问题