Skip to content
Snippets Groups Projects
Commit e4300da2 authored by Nick Poulden's avatar Nick Poulden
Browse files

Analytics tracking on classes and guides

parent b37dffee
No related branches found
No related tags found
No related merge requests found
......@@ -85,6 +85,18 @@ task :export do
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
Docs.afterLaunch = function() {
Docs.App.getController('Classes').addListener('showClass', function(cls, member) {
_gaq.push(['_trackEvent', 'Classes', 'Show', cls]);
if (member) {
_gaq.push(['_trackEvent', 'Classes', 'Member', cls + ' - ' + member]);
}
});
Docs.App.getController('Classes').addListener('showGuide', function(guide) {
_gaq.push(['_trackEvent', 'Guides', 'Show', cls]);
});
}
</script>
EOHTML
......
......@@ -10,6 +10,6 @@ Ext.Loader.setConfig({
Ext.require('Docs.Application');
Ext.onReady(function() {
Ext.onReady(function() {
Ext.create('Docs.Application');
});
......@@ -26,5 +26,9 @@ Ext.define('Docs.Application', {
Docs.Favorites.init();
Docs.History.init();
Docs.Settings.init();
if (Docs.afterLaunch) {
Docs.afterLaunch();
}
}
});
......@@ -3,6 +3,7 @@
*/
Ext.define('Docs.controller.Classes', {
extend: 'Ext.app.Controller',
requires: [
'Docs.History',
'Docs.Syntax'
......@@ -36,6 +37,12 @@ Ext.define('Docs.controller.Classes', {
],
init: function() {
this.addEvents({
"showClass" : true,
"showGuide" : true
});
Ext.getBody().addListener('click', function(cmp, el) {
this.loadClass(el.rel);
}, this, {
......@@ -134,6 +141,9 @@ Ext.define('Docs.controller.Classes', {
},
showClass: function(cls, anchor) {
this.fireEvent('showClass', cls.name, anchor);
if (this.currentCls != cls) {
var container = Ext.getCmp('container'),
showClass = container.down('showclass'),
......@@ -162,6 +172,8 @@ Ext.define('Docs.controller.Classes', {
showGuide: function(name, noHistory) {
noHistory || Docs.History.push("/guide/" + name);
this.fireEvent('showGuide', name);
Ext.data.JsonP.request({
url: this.getBaseUrl() + "/guides/" + name + "/README.js",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment