From 1dfafd5c6b0ad39ed221a519b653d4b35bf0964b Mon Sep 17 00:00:00 2001 From: yafeilee Date: Mon, 25 Apr 2016 11:16:51 +0800 Subject: [PATCH] Support turoblinks5 --- app/assets/javascripts/google_anlytics.js.coffee.erb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/assets/javascripts/google_anlytics.js.coffee.erb b/app/assets/javascripts/google_anlytics.js.coffee.erb index a029068..d4f7069 100644 --- a/app/assets/javascripts/google_anlytics.js.coffee.erb +++ b/app/assets/javascripts/google_anlytics.js.coffee.erb @@ -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