google analytics

How to add Google Analytics tracking that works with Turbolinks

Turbolinks is a really nice way to improve your Rails 4 application's speed. It uses AJAX to load the pages and just replace the body element of your page. The official Google Analytics tracking code does not play nice with this approach, but we can easily make it work. The following code snippet is a nice and clean solution for a couple of reasons: It works nicely with Turbolinks Degrades to work even without Turbolinks enabled Uses the new trac…

Keep Reading by Mirko Akov Mirko Akov