Facebook Like Button Callback

I'm interested in the implementation of the facebook โ€œLikeโ€ button, but I would like to know that the user clicks on this button so that I can get useful information from this. From what I read, facebook leaves us in the dark who clicks on what. Does anyone have an idea on how I could track which user clicked on a similar button for a particular product?

UPDATE: a similar button is displayed on facebook either through iFrame or through xFBML. That's why it's hard to keep track of who clicks on what, or implement an onclick event, etc.

+55
javascript callback facebook button facebook-like
May 09 '10 at 18:15
source share
5 answers
<script> FB.Event.subscribe('edge.create', function(href, widget) { alert('You just liked the page!'); }); </script> 
+62
Aug 30 2018-11-11T00:
source share

so I just made a unique button for each registered user with the URL www.somewebsite.com/thisIsThePageIlike/facebookUID.

wouldn't it defeat the goal of having a similar button and ruining your facebook search ranking? Each user will like a different URL, and so facebook will think that you have a ton of pages, each of which has the same account.

I also have a problem with XFBML buttons in which the edge.create event does not fire

+9
Jun 28 2018-11-11T00:
source share

OK, so I can tell you how I implemented it. What I wanted to get was the UID of the facebook user by clicking the Like button inside my facebook connect application. I noticed that when the user clicks the how button, facebook retrieves the URL passed to it using the button, so I just made a unique button for each registered user with the URL www.somewebsite.com/thisIsThePageIlike/facebookUID, When the request arrives at the web server with this url, it works like a callback, and I process and write the UID if the user first clicked โ€œhowโ€ (ie, the recording of this โ€œhowโ€ does not exist in db). works for me.

+6
May 13 '10 at 2:08 a.m.
source share
 window.fbAsyncInit = function () { FB.Event.subscribe('edge.create', function (response) { alert('Liked'); }); } ); FB.Event.subscribe('edge.remove', function (response) { alert('DisLiked') }); }; (function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.7"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); 

HTML: -

 <div id="fb-root"></div><div class="fb-like" data-href="https://www.facebook.com/testpage" data-layout="standard" data-action="like" data-size="small" data-show-faces="true"></div> 
+1
Sep 09 '16 at 11:52
source share

It will be something like what I have for my client site, for example

 <iframe src="http://www.facebook.com/plugins/like.php?href=www.jesterkaraoke.com&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe> 
0
Dec 19 '10 at 4:25
source share



All Articles