Capturing Disqus commenting activity via callbacks

If you would like to track new comments and replies via your own analytics service, such as Omniture or Google Analytics, you can do so via the following callback function.

The following callback can be added to the disqus_config function before the main Disqus Javascript include:

function disqus_config() {
    this.callbacks.onNewComment = [function() { trackComment(); }];
}

Make sure to replace trackComment(); with the script you wish to track via your analytics service.

NOTE: If you're using the Wordpress plugin, this variable is already set. To avoid overriding it, you'll need to edit the plugin and add your tracker to the existing disqus_config function.

Getting comment information

This callback function accepts one parameter comment which is a JavaScript object with comment ID and text. For example you can find the unique comment ID for further analysis the following way:

function disqus_config() {
    this.callbacks.onNewComment = [function(comment) { 
      alert(comment.id);
    }];
}
Ask the Community Contact us

Post a public question in one of our community channels to get help from other Disqus users. Also, be sure to search our Knowledge Base first, your answer might be just a click away!

Discuss Disqus –– Great for getting quick help, sharing feedback, and discussing issues with the community and Disqus help team.

Q&A –– Great for asking very specific questions about how Disqus works