Skip to content

Instantly share code, notes, and snippets.

@bretterer
Last active December 17, 2015 03:09
Show Gist options
  • Save bretterer/5541558 to your computer and use it in GitHub Desktop.
Save bretterer/5541558 to your computer and use it in GitHub Desktop.
Disqus Wordpress callbacks
// In a js file
disqus_config = function() {
this.callbacks.afterRender.push(function() { /* your code */ });
this.callbacks.onNewComment.push(function() { /* your code */ });
/* Available callbacks are afterRender, onInit, onNewComment, onPaginate, onReady, preData, preInit, preReset */
}
example
Place the following right before the disqus element javascript
function disqus_config() {
this.callbacks.onNewComment = [function() { trackComment(); }];
}
function trackComment() {
s.events="event7" // Blog Comments Submitted (Success Event)
s.eVar25= s.pageName // Blog Page Name Counter
s.eVar26= s.prop20// Blog Post Category Counter
s.eVar27= s.prop25// Blog Post Author Counter
/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
s.t();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment