This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/routes/google_analytics.js

27 lines
546 B
JavaScript

/*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);