Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine if Facebook users Unlike a URL?

We have a web app where we need to track users "Likes" of URLs (not Facebook pages, external ones), because they earn credits for doing so.

To do this we're using JQuery and the subscribe (edge.create) event and it's working great. http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/

Unfortunately we can't seem to figure out a way handle the case where a user "Likes" a URL through our site, earns a credit, then goes to their Facebook Wall and "Unlikes" it, essentially cheating the system.

I played around with these two FQL queries. The 1st is supposed to return an object ID of a URL, and the 2nd should return the list of user_ids who "Like" the URL. But they seem inconsistent and don't always return data for every case I tested.

https://api.facebook.com/method/fql.query?query=select%20id%20from%20object_url%20where%20url=%22http://www.saschakimmel.com/2010/05/how-to-capture-clicks-on-the-facebook-like-button/%22

https://api.facebook.com/method/fql.query?query=SELECT%20user_id%20FROM%20like%20WHERE%20object_id=%22393958018726%22

We'd rather not have to get the users to authorize our app with Facebook, and give us permission to access their data, in order to make this work either.

Any ideas? Thanks in advance!

like image 476
Kane Avatar asked Feb 22 '11 18:02

Kane


2 Answers

In in insights table of FQL you have metrics "domain_fan_removes" , "page_fan_removes" , "application_like_removes" and "domain_like_removes" http://developers.facebook.com/docs/reference/fql/insights/ This might help.

https://api.facebook.com/method/fql.query?query=SELECT%20metric,value%20FROM%20insights%20WHERE%20object_id=118584441503782%20AND%20metric='page_fan_removes'%20AND%20end_time=end_time_date('2011-02-01')%20AND%20period=period('lifetime')&access_token=xxxxx

like image 133
Balakrishnan Avatar answered Nov 15 '22 18:11

Balakrishnan


With the JS Api you can use the FB.Event.subscribe,

FB.Event.subscribe('edge.create',
    function(response) {
        alert('You liked the URL: ' + response);
    }
);

or you can use edge.remove if user unlike a url:

FB.Event.subscribe('edge.remove',
    function(response) {
        alert('You unliked the URL: ' + response);
    }
);

https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/

like image 20
Philip Avatar answered Nov 15 '22 18:11

Philip