It is necessary to check if the user has chosen only me to share [facebook api]

I'm trying to figure out how I can tell if a user is using a link to their channel by only selecting me as an option. I want to know this because if a user shares my link to himself, then my website will not be promoted.

<div id="fb-share">Share</div>
<div class="social-share-wrap"></div>
jQuery('#fb-share').on('click', function() {
        checkLoginState();
    });

    function statusChangeCallback(response) {
        console.log(response);
        if (response.status === 'connected') {
            shareUrl();
        } else if (response.status === 'not_authorized') {
            checkLoginState();
        } else {
            checkLoginState();
        }
    };

    function checkLoginState() {
        FB.login(function (response) {
            console.log(response);
            statusChangeCallback(response);
        }, {scope: 'email'});
    };

function shareUrl() {
        FB.ui({
            method: 'feed',
            link: 'http://www.example.com',
        }, function(response) {
            if (response && response.post_id) {
                FB.api('/me', function (response) {
                    jQuery.post('test.php',{name: response.name, email: response.email}).done(function(data) {
                        jQuery('.social-share-wrap').html(data);
                        jQuery.fancybox({
                            href: '#social-share',
                            centerOnScroll: true,
                            hideOnOverlayClick: false
                        });
                        return false;
                    });
                });
            } else {
                console.log('cancelled by user');
            }
        });
    };

      

In the code above, what I do, when the user clicks on the share div, the user gets a login popup, and then the user gets a permission popup, and then the share iframe appears if the user successfully shares their information to test.php, and if the user cancels it, it logs into the console. I didn't find anything in the api where I can find out if the user selects custom and installs it just for me.

+3


source to share


1 answer


You cannot check the permission setting, it is completely up to the user and there is no way to determine which one he chose. After all, you are not allowed to encourage sharing as per platform policy, so it is not important to know.



+1


source







All Articles