mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Externalize Hotjar tracking code to an environment variable
This commit is contained in:
parent
f6e6fb2b2d
commit
f81874d082
5 changed files with 12 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
|||
class HomeController < ActionController::Base
|
||||
before_action :set_google_analytics_id
|
||||
before_action :set_hotjar_id
|
||||
|
||||
def index
|
||||
@districts = District.all.order(:name)
|
||||
|
|
@ -13,4 +14,8 @@ class HomeController < ActionController::Base
|
|||
def set_google_analytics_id
|
||||
@google_analytics_id = ENV['GOOGLE_ANALYTICS_ID']
|
||||
end
|
||||
|
||||
def set_hotjar_id
|
||||
@hotjar_id = ENV['HOTJAR_ID']
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ class SqmApplicationController < ActionController::Base
|
|||
before_action :set_schools_and_districts
|
||||
before_action :authenticate_district
|
||||
before_action :set_google_analytics_id
|
||||
before_action :set_hotjar_id
|
||||
|
||||
private
|
||||
|
||||
|
|
@ -39,4 +40,7 @@ class SqmApplicationController < ActionController::Base
|
|||
@google_analytics_id = ENV['GOOGLE_ANALYTICS_ID']
|
||||
end
|
||||
|
||||
def set_hotjar_id
|
||||
@hotjar_id = ENV['HOTJAR_ID']
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<script>
|
||||
(function(h,o,t,j,a,r){
|
||||
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
|
||||
h._hjSettings={hjid:2693082,hjsv:6};
|
||||
h._hjSettings={hjid:<%= hotjar_id.to_json.html_safe %>,hjsv:6};
|
||||
a=o.getElementsByTagName('head')[0];
|
||||
r=o.createElement('script');r.async=1;
|
||||
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<%= stylesheet_link_tag 'welcome', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
<%= render partial: 'layouts/google_analytics', locals: { google_analytics_id: @google_analytics_id } %>
|
||||
<%= render 'layouts/hotjar' %>
|
||||
<%= render partial: 'layouts/hotjar', locals: { hotjar_id: @hotjar_id } %>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<%= stylesheet_link_tag 'sqm_application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
<%= render partial: 'layouts/google_analytics', locals: { google_analytics_id: @google_analytics_id } %>
|
||||
<%= render 'layouts/hotjar' %>
|
||||
<%= render partial: 'layouts/hotjar', locals: { hotjar_id: @hotjar_id } %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue