attempt at fixing google analytics
This commit is contained in:
parent
430a397cde
commit
997b436210
|
@ -1,11 +1,22 @@
|
|||
(function() {
|
||||
/*global _gaq:true */
|
||||
|
||||
window.Discourse.ApplicationController = Ember.Controller.extend({
|
||||
needs: ['modal'],
|
||||
showLogin: function() {
|
||||
var _ref;
|
||||
return (_ref = this.get('controllers.modal')) ? _ref.show(Discourse.LoginView.create()) : void 0;
|
||||
window.Discourse.ApplicationController = Ember.Controller.extend({
|
||||
needs: ['modal'],
|
||||
showLogin: function() {
|
||||
var _ref;
|
||||
return (_ref = this.get('controllers.modal')) ? _ref.show(Discourse.LoginView.create()) : void 0;
|
||||
},
|
||||
|
||||
routeChanged: function(){
|
||||
if (window._gaq === undefined) { return; }
|
||||
|
||||
if(this.afterFirstHit) {
|
||||
Em.run.next(function(){
|
||||
_gaq.push(['_trackPageview']);
|
||||
});
|
||||
} else {
|
||||
this.afterFirstHit = true;
|
||||
}
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
}.observes('currentPath')
|
||||
|
||||
});
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
/*global _gaq:true */
|
||||
|
||||
(function() {
|
||||
|
||||
Ember.Route.reopen({
|
||||
setup: function(router, context) {
|
||||
var path;
|
||||
this._super(router, context);
|
||||
if (window._gaq) {
|
||||
if (this.get("isLeafRoute")) {
|
||||
/* first hit is tracked inline
|
||||
*/
|
||||
|
||||
if (router.afterFirstHit) {
|
||||
path = this.absoluteRoute(router);
|
||||
_gaq.push(['_trackPageview', path]);
|
||||
} else {
|
||||
router.afterFirstHit = true;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}).call(this);
|
Loading…
Reference in New Issue