SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict Corobori's Avatar
    Join Date
    Jun 2003
    Location
    Concepcion, Chile
    Posts
    395
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How to read comments posted by users on a website using FB Social Plugin ?

    On one of my customer's website we added the Social Plugins "Comments" to allow visitors to post comments about the products on sale in this website. My client would like a way to check out what people are saying about his products.
    So far the only way he has is to go thru all products one by one, which is obviously not handy at all. Is there a way to do this ?
    Jean-Luc
    Corobori WebDesign
    Working in the Concepcion area, Chile, since 1999
    Follow us on Twitter

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Aug 2003
    Location
    Southern California
    Posts
    4,686
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Corobori View Post
    On one of my customer's website we added the Social Plugins "Comments" to allow visitors to post comments about the products on sale in this website. My client would like a way to check out what people are saying about his products.
    So far the only way he has is to go thru all products one by one, which is obviously not handy at all. Is there a way to do this ?
    There's a few ways to address this...

    First you should be tying all of your comment blocks back to a single Facebook App ID with assigned admins [it's also possible to just add admins without an app but that makes user management a real pain as you want to add / remove people]. This will let you get notifications and aggregate analytics around what's happening versus just having the comment widget without anywhere for it to associate too.

    Second you can use a social media management platform or build your own tool to access the Facebook API and report on new comments off of it. Obviously this requires some investment but with everything tied into an App it's very easy to pull up the most recent comments and display links to them without anything too fancy.

    Third if you want to get more sophisticated, you can update a database or do anything else you like by triggered a javascript event when a comment is left. This allows for both system updates and analytics.

    http://developers.facebook.com/docs/...ent.subscribe/

    http://developers.facebook.com/docs/...gins/comments/
    - Ted S

  3. #3
    SitePoint Addict Corobori's Avatar
    Join Date
    Jun 2003
    Location
    Concepcion, Chile
    Posts
    395
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Ted, I am looking into it
    Jean-Luc
    Corobori WebDesign
    Working in the Concepcion area, Chile, since 1999
    Follow us on Twitter

  4. #4
    SitePoint Addict Corobori's Avatar
    Join Date
    Jun 2003
    Location
    Concepcion, Chile
    Posts
    395
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have defined a Facebook Application Id and comments are showing up in the Comment Moderation Tool. Still we have to go there to see if a comment was posted or not because I haven't found the way to automate the notification yet.

    The comment box is set up that way

    In the header

    HTML Code:
    <meta property="fb:app_id" content="my_app_idd"/>
    <meta property="fb:admins" content="101xxxxxx"/>
    Before the fb comment

    Code:
    <script>
     window.fbAsyncInit = function() {
         FB.init({ appId: '338850122832287',
            status: true,
            cookie: true,
            xfbml: true});
     
        FB.Event.subscribe('comment.create',
            function(response) {
            
            }
        );
     
     };
     </script>
    And the box

    HTML Code:
    <fb:comments notify="true" href="http://www.xxxxx111.cl/xxxxxxx-50.aspx" num_posts="5" width="730">
    Jean-Luc
    Corobori WebDesign
    Working in the Concepcion area, Chile, since 1999
    Follow us on Twitter

  5. #5
    SitePoint Wizard silver trophy
    Join Date
    Aug 2003
    Location
    Southern California
    Posts
    4,686
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)
    You can add a handler to function(response) {} to send a notification or query the API to access recent comments.

    Facebook has expanded notifications to on-page items and the timeline dashboard brings more information to the surface but honestly I'm not sure if this extends out to off-page comments. http://www.insidefacebook.com/2011/0...ookmarks-home/
    - Ted S

  6. #6
    SitePoint Addict Corobori's Avatar
    Join Date
    Jun 2003
    Location
    Concepcion, Chile
    Posts
    395
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just spend a few hours diviing into the Grap API and no luck so far. At least the alert message comes up fine. See http://www.8va.cl/fb.htm
    Jean-Luc
    Corobori WebDesign
    Working in the Concepcion area, Chile, since 1999
    Follow us on Twitter

  7. #7
    SitePoint Addict Corobori's Avatar
    Join Date
    Jun 2003
    Location
    Concepcion, Chile
    Posts
    395
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Got it working eventually. Not the way I really wanted (that is posting a message on the wall) but sending an email

    Code:
     window.fbAsyncInit = function() {
         FB.init({ appId: 'YOU_APP_ID',
            status: true,
            cookie: true,
            xfbml: true});
    
        FB.Event.subscribe('comment.create',
            function (response) {
                console.log("comment created");
                var commentQuery = FB.Data.query("SELECT text, fromid FROM comment WHERE post_fbid='" + response.commentID +
                    "' AND object_id IN (SELECT comments_fbid FROM link_stat WHERE url='" + response.href + "')");
                var userQuery = FB.Data.query("SELECT name FROM user WHERE uid in (select fromid from {0})", commentQuery);
                FB.Data.waitOn([commentQuery, userQuery], function () {
                    var commentRow = commentQuery.value[0];
                    var userRow = userQuery.value[0];
                    /* console.log(userRow.name + " (id: " + commentRow.fromid + ") posted the comment: " + commentRow.text); */
                    trackcomments(response['commentID'], response['href'], 'create', commentRow.text, userRow.name, commentRow.fromid);
                   
                });
            });
    
    };
    
    function trackcomments(_commentid, _address, _action,
     _commentMessage, _userName, _userId) {
        /* Replace FBComment.aspx by any server script sending the email*/
        $.ajax({
            type: 'POST',
            url: '/FBComment.aspx', 
            data:
                 {
                     commentId: _commentid,
                     pageUrl: _address,
                     actionTaken: _action,
                     userName: _userName,
                     userId: _userId,
                     commentMessage: _commentMessage
                 },
            error: function (jqXHR, textStatus, errorThrown) {
                console.log(errorThrown);
            },
            success: function (result) {
                console.log("successfully received callback");
            }
        });
    }
    Jean-Luc
    Corobori WebDesign
    Working in the Concepcion area, Chile, since 1999
    Follow us on Twitter


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •