Monday, March 31, 2014

Using Google Analytics in your Single Page Application

Google Analytics is a great tool to figure out what’s going inside your web application. It gives you real-time monitoring on the pages they visit, the time they spend on your site and much, much more…

Recently we switched from a standard ASP.NET MVC application to a Single Page Application. The problem is that Google Analytics has no idea when you switch pages, so you loose a lot of interesting reporting.

To fix this you can use the fact that most SPA’s use hashes for their URL routing (e.g. Everything the hash changes, the hashchange event is raised.

No comments: