1
votes

I plan to use Disqus on my website. It has a "blog"-style layout. On the front page I want to display the comment-count for every blog-entry. I know I can connect to Disqus to get the counts but I would prefer to just save the comment - count into my database directly for the blog-entry when someone enters a comment.

So getting the count would not affect performance/load time of the main page. Is there any event that is fired if someone entered a comment on my page that I can listen to?

AngularJS would be a bonus but a simple javascript or jQuery solution would be helpful, too.

1
A comment for the downvote would be nice.Ole Albers
Not a bad question really, but, it'd be nice to know what you've tried so far (I wasn't the downvoter).Seer

1 Answers

2
votes
function disqus_config() {
    this.callbacks.onNewComment = this.callbacks.onNewComment || [];
    this.callbacks.onNewComment.push(function(comment) { 
      // Code to store the comment count here.
    });
}

You can use this to add callbacks to certain events and hook into custom analytics systems. (The same would work for sending events to Google Analytics for instance. Here you'd just need to make an requests to your counter endpoint.

More info here: https://help.disqus.com/customer/portal/articles/466258-capturing-disqus-commenting-activity-via-callbacks