Cemo Acar
Cemo Acar

Reputation: 13

how to check if visitor liked my facebook fanpage. private website not facebook iframe tabs

Is it possible to check if the visitor of my private Website liked my Facebook Fanpage? I found many posts for Facebook Iframe-Tabs but not for private Website owner.

Upvotes: 0

Views: 914

Answers (1)

Fabio Antunes
Fabio Antunes

Reputation: 22882

You must have the user_likes permission, so you can query the likes the user already has.

And then using the javascript sdk you can achieve it by doing this:

function isPageLiked(YOUR_VALID_TOKEN) {
    token = YOUR_VALID_TOKEN;
    FB.api('/me/likes/YOUR_PAGE_ID', function(response) {
        if(response.data.length){
            //the user likes your page do something here
        }
    }, {access_token: token});

}

Upvotes: 1

Related Questions