-
-
Save tracend/3044124 to your computer and use it in GitHub Desktop.
[DEPRECATED]: Super simple Google Analytics page tracking with backbone.js
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
Router = Backbone.Router.extend({ | |
initialize: function() { | |
this.bind('all', this._trackPageview); | |
}, | |
_trackPageview: function(){ | |
var url = Backbone.history.getFragment(); | |
_gaq.push(['_trackPageview', "/#"+url]); | |
} | |
}); |
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
<script type="text/javascript"> | |
var _gaq=[["_setAccount","{ANALYTICS_ID}"],["_trackPageview"]]; | |
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1; | |
g.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js"; | |
s.parentNode.insertBefore(g,s)}(document,"script")); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This tipbit has now become a feature for Backbone APP() at:
http://github.com/makesites/backbone-app