开发者

get email when someone hits facebook likebutton on website

is it possible for me to receive an email when someone hits a likebutton on my website?

I have been looking into this and I can only assume it has to be possible wit开发者_Python百科h the edge.create option but for the life of me, I have no idea how to set this up to trigger an email being sent.

any ideas??


You need to subscribe to the click event of the like button.

You can do this via the FB.Event.subscribe function.

Here is some code for a working sample:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
    <script src="http://connect.facebook.net/en_US/all.js"></script>
    <script>
      FB.init({status:true,cookie:true,xfbml:true});
      FB.Event.subscribe('edge.create', function(href, widget)
      {
         //insert your code to send email here
         alert('someone just clicked the like button');
      });
    </script>
</head>
<body>
    <div id="fb-root"></div>
    <fb:like href="http://www.example.com/" show_faces="false" width="450" font="verdana"></fb:like> 
</body>

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜