Skip to content

Instantly share code, notes, and snippets.

@tonyhue
Created April 5, 2018 18:24
Show Gist options
  • Save tonyhue/148a6dc2aad5c832296728c44f4277b6 to your computer and use it in GitHub Desktop.
Save tonyhue/148a6dc2aad5c832296728c44f4277b6 to your computer and use it in GitHub Desktop.
Capture Disqus new comments in Google Analytics
// Adds the onNewComment callback to the disqus_config of the embed code
// that sends 'New Comment' events over to Google Analytics.
// The callback can also be used for any other analytics service like Parse.ly, Chartbeat, Mixpanel
var disqus_config = function() {
this.callbacks.onNewComment = [function(comment) {
ga('send', {
'hitType': 'event', // Required.
'eventCategory': 'Comments', // Required.
'eventAction': 'New Comment', // Required.
'eventLabel': 'New Comment'
});
}];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment