From 4d24959e93ebcd528535c2d8c54baccec16955ab Mon Sep 17 00:00:00 2001 From: Jeff Escalante Date: Thu, 19 Apr 2018 18:02:40 -0400 Subject: [PATCH] adjust analytics and scripts for turbolinks --- .../source/assets/javascripts/analytics.js | 5 ++- website/source/layouts/layout.erb | 44 ++++--------------- 2 files changed, 12 insertions(+), 37 deletions(-) diff --git a/website/source/assets/javascripts/analytics.js b/website/source/assets/javascripts/analytics.js index 4cfbb8e92..9482db4aa 100644 --- a/website/source/assets/javascripts/analytics.js +++ b/website/source/assets/javascripts/analytics.js @@ -1,5 +1,6 @@ -document.addEventListener('DOMContentLoaded', function() { - track('.downloads .download .details li a', function(el) { +document.addEventListener('turbolinks:load', function() { + analytics.page() + var m = el.href.match(/nomad_(.*?)_(.*?)_(.*?)\.zip/) return { event: 'Download', diff --git a/website/source/layouts/layout.erb b/website/source/layouts/layout.erb index cc4b9a7c6..456202699 100644 --- a/website/source/layouts/layout.erb +++ b/website/source/layouts/layout.erb @@ -35,25 +35,18 @@ <%= title_for(current_page) %> + + <%= stylesheet_link_tag "application" %> - - <%= javascript_include_tag "application" %> + + + <%= javascript_include_tag "application", defer: true %> - <% if config[:environment] == :build %> - - - <% end %> - - - - + + <%= yield_content :head %> @@ -134,25 +127,6 @@ - <% if config[:environment] == :build %> - - <% end %> -