Joined December 2013
·

Jonathon Wolfe

San Francisco, CA
·
·

Posted to Faster page loads with Turbolinks over 1 year ago

Following up here with my own solution. I wanted to find a way to support old browsers, but not have to put script tags in the body.

https://gist.github.com/jonwolfe/7897610

Posted to Faster page loads with Turbolinks over 1 year ago

Thank you for being the only person with a sane solution to using Google Analytics with Turbolinks! The only thing I had to add was a callback on the page:restore event to track the pageview, since the inline script tag isn't re-evaluated when the page is restored from the Turbolinks cache.

See the issue I opened with the Turbolinks-compatibility project for an example of the callback: https://github.com/reed/turbolinks-compatibility/issues/19#issuecomment-29759877

Thanks again!

Achievements
8 Karma
0 Total ProTip Views
Interests & Skills