facebookfacebook-fqlfacebook-authentication

How to check if someone is liked my fanpage from my website?


I want to check if a user liked my fan-page from my website and if he did i skip the step and if he didnt i want to suggest him to like my fan-page,its all on my website i dont want to put a landing page or something else on my fan-page.all of it is on my website,i don't want to put a landing page or anything else on my fan-page. Thanks


Solution

  • there are only 2 ways for this:

    -) use the edge.create event: https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/

    downside: this can only check right after clicking a like button on your website. so, if the user comes back, you can´t be sure if the like button is still clicked. also, you never get the id of the user, of course (deprecated)

    -) authorization with facebook login > you can check for the user likes > user_likes permission needed. but i doubt that you really want to authorize the user just for this...

    the graph api call you could use:

    me/likes?target_id=[page-id]
    

    subscription: permission user_subscriptions needed. graph api call would be the following:

    me/subscribedto?user=[user-id]