Facebook - Detect previously liked
FB.Event.subscribe('edge.create', function(response) {
$.ajax({
url: $(location).attr("href") + "?facebook=true",
success开发者_C百科: function()
{
alert("You now get the promotion.");
}
});
});
This will set a cookie for me, through an ajax redirect IF they clicked like.
So the question is, how can you figure out if someone has previously liked your page? I swear I've spent half the day in the API. Is this possible?
If the user has authenticated with your Facebook application, you can all the /me/likes graph api function with a url of https://graph.facebook.com/me/likes?access_token=.... If not, you will need to keep track of likes in your own database, but this won't work for people that have liked your page directly on facebook.
精彩评论