Google analytics with rails 4

后端 未结 6 1279
后悔当初
后悔当初 2020-12-07 11:39

I am having a bit of difficulty implementing google analytics to my rails 4 project. I included the tracking code to the bottom of my layouts file and have even tried to rem

6条回答
  •  伪装坚强ぢ
    2020-12-07 12:07

    Here is code without using coffeescript:

    app/assets/javascripts/analytics.js
    
    $(document).on('page:change', function() {
     if (window._gaq != null) {
      return _gaq.push(['_trackPageview']);
     } else if (window.pageTracker != null) {
      return pageTracker._trackPageview();
     }
    });
    

提交回复
热议问题