Support turoblinks5

This commit is contained in:
yafeilee 2016-04-25 11:16:51 +08:00
parent 179a79675c
commit 1dfafd5c6b
1 changed files with 1 additions and 3 deletions

View File

@ -13,10 +13,8 @@ class @GoogleAnalytics
firstScript = document.getElementsByTagName("script")[0]
firstScript.parentNode.insertBefore ga, firstScript
# If Turbolinks is supported, set up a callback to track pageviews on page:change.
# If it isn't supported, just track the pageview now.
if typeof Turbolinks isnt 'undefined' and Turbolinks.supported
document.addEventListener "page:change", (->
document.addEventListener "turbolinks:load", (->
GoogleAnalytics.trackPageview()
), true
else