Created
October 3, 2012 16:00
-
-
Save ghempton/3827798 to your computer and use it in GitHub Desktop.
Drop in addition of analytics to Ember.js applications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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