I was wondering how I would go about detecting if when a person likes a post on my blog that they are first person to like it.
I tried this but it does not seem to work.
Any help/ideas?
<script type='text/javascript'>
function FB.Event.subscribe('edge.create', function(response) {
// user clicked like
alert('Thank you for liking this post');
var query = FB.Data.query('SELECT like_count FROM link_stat WHERE url="' + window.location + '"');
query.wait(function(rows) {
if ( ! rows[0].like_count ) {
alert('Congrats - You are the first person to like this');
}
});
});
</script>
functionin front ofFB.Event.subscribe().The following should work, assuming you’ve called
FB.init()before this, and your Like Button URL is the same aswindow.location.