How to determine if Facebook users Unlike a URL?
Asked Answered
P

2

13

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!

Pedicab answered 22/2, 2011 at 18:31 Comment(1)
This thread has some good info but still doesn't resolve my problem: #4876922Pedicab
J
4

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

Janssen answered 23/2, 2011 at 13:18 Comment(4)
Is there enough detail to support tracking individual users? The question mentions that a user Un-Likes and then Likes something again, and must receive credit accordingly. I'd like to see a code sample posted that can be run to determine if this info constitutes an answer for the author's requirements.Headless
A couple problems with this approach: (1) It doesn't work ;) Example: api.facebook.com/method/… and (2) It says "Insights are available for pages, applications, and domains with 30 or more connections." which won't work because our system has many domains with less than 30 connections.Pedicab
query on insights need to have a time range, hence you received the error on the above query. Please try something like this api.facebook.com/method/… The oauth access token provided should be on the user with the privilege "read_insights".Janssen
Doesn't this solution mean we'll have to get the users to authorize our app with Facebook? Or am I missing something?Pedicab
J
2

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/

Journeywork answered 29/3, 2012 at 5:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.