Skip to content

Instantly share code, notes, and snippets.

@tonyhue
tonyhue / disqus-embed.html
Last active September 9, 2017 01:57
Disqus Universal Embed Code
<div id="disqus_thread"></div>
<script>
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables
*/
/*
var disqus_config = function () {
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
@tonyhue
tonyhue / ga-disqus.js
Created April 5, 2018 18:24
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'