diff --git a/Rakefile b/Rakefile index 3488dda661bfeb5585d28651e7f7f46059182f7a..7eb0bc2e4b362cfd8d35c7c67134e9462387c056 100644 --- a/Rakefile +++ b/Rakefile @@ -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]); + }); + } EOHTML diff --git a/template/app.js b/template/app.js index 575aa54a7030968257bd5315e8c7316de274c890..5bf8169e7573c24be140f5810e345055d9e07bbb 100644 --- a/template/app.js +++ b/template/app.js @@ -10,6 +10,6 @@ Ext.Loader.setConfig({ Ext.require('Docs.Application'); -Ext.onReady(function() { +Ext.onReady(function() { Ext.create('Docs.Application'); }); diff --git a/template/app/Application.js b/template/app/Application.js index e979ce3cda577ce9caad4296808394048aeab0af..f39ba3baf8d3a3e77fe1fd009ce141be9eb3bba9 100644 --- a/template/app/Application.js +++ b/template/app/Application.js @@ -26,5 +26,9 @@ Ext.define('Docs.Application', { Docs.Favorites.init(); Docs.History.init(); Docs.Settings.init(); + + if (Docs.afterLaunch) { + Docs.afterLaunch(); + } } }); diff --git a/template/app/controller/Classes.js b/template/app/controller/Classes.js index d9e2d2775823f7cdeab2cbe475ad262438e5449e..1eeb8e56d7a30f3084b28ba1827cdd8ecb9ac9b1 100644 --- a/template/app/controller/Classes.js +++ b/template/app/controller/Classes.js @@ -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",