javascript - How to get comment count on livefyre? - Stack Overflow

I would like to get the livefyrement count in my own database so that I can then sort my articles by m

I would like to get the livefyre ment count in my own database so that I can then sort my articles by ment count.

Every time a page is read on my site, I'd like to ask Livefyre how many ments that certain page has, then update the database with that count.

I tried to get the source of the page but it doesn't seem to be helpful.

Any suggestions?

I would like to get the livefyre ment count in my own database so that I can then sort my articles by ment count.

Every time a page is read on my site, I'd like to ask Livefyre how many ments that certain page has, then update the database with that count.

I tried to get the source of the page but it doesn't seem to be helpful.

Any suggestions?

Share Improve this question edited Aug 10, 2015 at 21:55 Gibron 1,3551 gold badge10 silver badges28 bronze badges asked Feb 6, 2013 at 11:05 Surabhil SergySurabhil Sergy 2,0061 gold badge24 silver badges40 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

Atish's answer is correct as the best way for the JavaScript on the page to be notified of the Comment Count so that you can track via client-side analytics or update another place on the page where the count is rendered.

From the server side, you can use the 'init' request for any Conversation to retrieve the public ment count.

  • Docs: http://answers.livefyre./developers/api-reference/#link-collection-info-plus
  • Example: http://bootstrap.livefyre./bs3/livefyre./4/NTg0/init (look for numVisible)

Finally, you can use the Livefyre Activity Stream API to get a real-time firehose of your munity activity, which you can use to keep a count up to date on your end.

  • Docs: http://answers.livefyre./developers/advanced-topics/activity-stream/

Check custom implementation of Livefyre ment here

https://github./Livefyre/livefyre-docs/wiki

When you call

 fyre.conv.load({"network": selfwork,
                                 authDelegate: self.authDelegate
                               }, [ self.config ], self.lfready)

you need to pass call back event in self.lfready i.e.

 app.on('mentCountUpdated', self.onCommentCountUpdated);

This 'mentCountUpdated' is livefyre call back event which returns you the number of ment counts.

 self.lfready = function(app) {
            //Wrap in try catch because Livefyre catches errors in the callback (seemingly)
            //And we want to catch and log ourselves.
            try{
                $.log("Livefyre is ready, attaching custom handlers");
                //Attach events
                app.on('mentCountUpdated', self.onCommentCountUpdated);
                //Only update to zero if the onCommentCount hasn't fired already
                self.$mentContainer.find("#lf_ment_stream").show();
            }catch(err){
                $.error("Livefyre failed to load", err);
                self.$mentContainer.hide();
            }
        };


self.onCommentCountUpdated = function(number){
            console.log("Latest count from LF stream event:" + number)

        };

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745567561a4633488.html

相关推荐

  • javascript - How to get comment count on livefyre? - Stack Overflow

    I would like to get the livefyrement count in my own database so that I can then sort my articles by m

    6小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信