Tag

turbolinks

How to add Facebook like button that works with Turbolinks

After finding a solution to add Google Analytics tracking code, once again I had to face a problem that came with Turbolinks. I was not able to load the facebook script in the head of the page, to prevent it from being loaded with every single request. That's why, I decided to combine my research into a helpful CoffeeScript class. To be able to use it, you need to require the file in your application script and load them in the head section of th…

Keep Reading by Mirko Akov Mirko Akov

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