简体   繁体   中英

Facebook social plugin share button

I am using a Facebook social plugin share button, I want to capture the event whether the user shares the event or not.

Is there a way to check whether the user shared it or not using plugin only?

Using the FB.ui method provided by the Facebook JavaScript SDK , you can pass a callback as the second argument and check for the post_id on the response object.

FB.ui({
    method: 'feed',
    link: 'http://www.example.org/',
    picture: 'http://placehold.it/400x400',
    caption: 'Title',
    description: 'Some description...'
}, function (response) {
    if (response.post_id) {
        // This post was shared
    } else {
        // This post was not shared
    }
});

More information can be found in the Facebook share documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM