Skip to content

Instantly share code, notes, and snippets.

@ghempton
Created October 3, 2012 16:00
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghempton/3827798 to your computer and use it in GitHub Desktop.
Save ghempton/3827798 to your computer and use it in GitHub Desktop.
Drop in addition of analytics to Ember.js applications
Ember.Route.reopen({
enter: function(router) {
this._super(router);
if(this.get('isLeafRoute')) {
var path = this.absoluteRoute(router);
mixpanel.track('page viewed', {'page name' : document.title, 'url' : path});
_gaq.push(['_trackPageview', path]);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment