Created
April 5, 2018 18:24
-
-
Save tonyhue/148a6dc2aad5c832296728c44f4277b6 to your computer and use it in GitHub Desktop.
Capture Disqus new comments in Google Analytics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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