-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisqus_tracking.js
More file actions
26 lines (25 loc) · 1.15 KB
/
disqus_tracking.js
File metadata and controls
26 lines (25 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
* disqus_tracking.js v1.0.0 - 2013-11-16
* https://github.com/thyngster/forms_cross_domains.js
* (c) 2013 David Vallejo ( @thyng )
* license: www.opensource.org/licenses/mit-license.php
*
*
* If using ga.js, just change the ga() call to _gaq.push(['trackEvent','Disqus',{ACTION}, windows.location.href]);
* Disqus is loaded asynchronously and callbacks configuration needs to be set before Disqus si loaded so we basically
* what we're doing is reseting it with the new callback values on winwdow.load event ( cross-browser compatibility ).
* Modify Event category, action and label to fit your needs.
*
*/
window.onload = function(){
if(window.DISQUS){
DISQUS.reset({
reload: true,
config: function () {
this.callbacks.onNewComment = [function(){ ga('send', 'event', 'Disqus', 'New Comment', window.location.href); }];
this.callbacks.onPaginate = [function(e){ ga('send', 'event', 'Disqus', 'Pagination', window.location.href); }];
this.callbacks.onPaginate = [function(e){ ga('send', 'event', 'Disqus', 'User Logged', window.location.href); }];
}
});
}
};