If you’re using Google’s AngularJS or thinking about using AngularJS, you might want to consider these analytics checkpoints. This is purely a view of how to check analytics implementation, not a debate on the pros and cons of Angular, or why you should / shouldn’t use it.
Finally, this post assumes the reader knows what AngularJS is. This also assumes the reader is using Universal Analytics.
A live example of analytics only firing once despite having navigated to “other pages” can be found in, ironically, a website called Made With Angular, a website made in Angular about other websites made using Angular. This was observed during the time of writing.
On loading the homepage: https://www.madewithangular.com this is the pageview, which is expected:
Then, when navigating to https://www.madewithangular.com/#/categories/business, the first pageview still persists:
From there navigation to https://www.madewithangular.com/#/sites/google-insights but the first pageview remains:
The above shouldn’t be an issue if that is the intended reporting preference, however for those who intend to report on these urls seperately the solution is below:
will just report as:
For single page websites that are built to look like it has separate pages, what this means is that analytics is ever only going to report the url without the #.
A fallback for browsers still on HTML4 may need to be considered. There is a wonderful resource on Github called history.js which gracefully provides support for HTML4 browsers (like, IE 9 and below).
What if we don’t want to clean urls and insist on sending hash urls into analytics?
remember, analytics ignores anything after the #.
Want to find out more about what Analytics & CRO can do for your business? Contact us here.