How to get Google Analytics to work for your Single Page Application
May 7, 2015
One of the things that gets increasingly fascinating the older I get is the new stuff you pick up as you “do things for real”. Right now we have been building a site for my current organisation.
We built a little CMS to drive content and the whole page is a Single Page Application (SPA). As we approached being finished we of course wanted to add Google Analytics to the site. Dead simple.
Or not maybe … in this post I’ll describe how we got it to work for our Single Page Application. Google Analytics default was is not built for that. And many descriptions you will find out there is written based with a client-side framework in mind, like Backbone.js.
What I write about below only requires jQuery, and that’s mostly for convience. As with most things I learn it’s based on others...