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);
    }];
}
Contact us

We welcome all questions, feedback and bug reports. If you're having an issue, we usually need the following information:

  • A brief description of the issue
  • Link to any page where you saw the issue
  • Screenshots that illustrate the problem - How do I take a screenshot?