输入评论时的Disqus事件?

时间:2021-11-17 21:11:42

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.

我打算在我的网站上使用Disqus。它有一个“博客”式的布局。在首页我想显示每个博客条目的评论计数。我知道我可以连接到Disqus以获取计数,但我更愿意只保存评论 - 当有人输入评论时,直接计入我的数据库中的博客条目。

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.

AngularJS将是一个奖励,但简单的javascript或jQuery解决方案也会有所帮助。

1 个解决方案

#1


1  

function disqus_config() {
    this.callbacks.onNewComment = this.callback.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.

您可以使用它来为某些事件添加回调并挂钩到自定义分析系统。 (例如,将事件发送到Google Analytics也是如此。在这里,您只需向计数器端点发出请求即可。

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

更多信息:https://help.disqus.com/customer/portal/articles/466258-capturing-disqus-commenting-activity-via-callbacks

#1


1  

function disqus_config() {
    this.callbacks.onNewComment = this.callback.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.

您可以使用它来为某些事件添加回调并挂钩到自定义分析系统。 (例如,将事件发送到Google Analytics也是如此。在这里,您只需向计数器端点发出请求即可。

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

更多信息:https://help.disqus.com/customer/portal/articles/466258-capturing-disqus-commenting-activity-via-callbacks