-
Notifications
You must be signed in to change notification settings - Fork 176
Integrating Google Analytics
mtrpcic edited this page Jul 19, 2011
·
2 revisions
By default, Google Analytics will use your current URI, and will only be triggered upon page load. This isn't ideal for applications that provide client-side routing with libraries like PathJS. To update your Google Analytics when different actions are hit via PathJS, you can use the following code:
// Define our update method.
function updateAnalytics(){
_gaq.push(['_trackPageview', document.location.href]);
}
Path.map("#/users/:id").enter(updateAnalytics).to(function(){
// Code here
});