Question:

I know how can I intercept the event when a user clicks a Like button... now, I want to log also the user ID of the user. How can I do that?

 

 

 

Answer:

Appreciate if you can like this page if you find it useful! - Click "Like"

You can get the user ID from the Facebook session.

Sample code is listed below:

FB.Event.subscribe('edge.create', function(href) {
 session = FB.getSession();
 uid = session['uid'];
 // do whatever you want
 });

 

 

Find my FAQ on Facebook Development useful? Download the PDF for all the FAQs HERE!