Skip to content Skip to sidebar Skip to footer

Fb Comments Plugin - Detect Comment On Page

How can I detect when a comment is made on my page with the Comments Plugin? I'm currently using the Facebook PHP SDK, reading the Facebook documentation it says I need the JS SDK,

Solution 1:

I guess it's straight forward:

<divid="fb-root"></div><script>window.fbAsyncInit = function() {
    FB.init({
      appId      : 'YOUR_APP_ID', // App ID
      channelURL : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      oauth      : true, // enable OAuth 2.0
      xfbml      : true// parse XFBML
    });

    FB.Event.subscribe('comment.create',
        function(response) {
            alert('A new comment has been added!');
        }
    );

  };

  // Load the SDK Asynchronously
  (function(d){
     var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/en_US/all.js";
     d.getElementsByTagName('head')[0].appendChild(js);
   }(document));
</script>

Documents: 1 - 2

Post a Comment for "Fb Comments Plugin - Detect Comment On Page"