mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Tie legacy analytics ID to environment
This commit is contained in:
parent
48f2d64c71
commit
3e15194eff
3 changed files with 9 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
protect_from_forgery with: :exception, prepend: true
|
protect_from_forgery with: :exception, prepend: true
|
||||||
|
before_action :set_google_analytics_id
|
||||||
|
|
||||||
|
|
||||||
def verify_admin
|
def verify_admin
|
||||||
|
|
@ -16,4 +17,9 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def set_google_analytics_id
|
||||||
|
@google_analytics_id = ENV['GOOGLE_ANALYTICS_ID']
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,13 @@
|
||||||
= javascript_include_tag 'application', 'data-turbolinks-track': 'reload'
|
= javascript_include_tag 'application', 'data-turbolinks-track': 'reload'
|
||||||
|
|
||||||
/ Global site tag (gtag.js) - Google Analytics
|
/ Global site tag (gtag.js) - Google Analytics
|
||||||
%script{:async => "", :src => "https://www.googletagmanager.com/gtag/js?id=UA-132936999-1"}
|
%script{:async => "", :src => "https://www.googletagmanager.com/gtag/js?id=#{@google_analytics_id}"}
|
||||||
:javascript
|
:javascript
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
function gtag(){dataLayer.push(arguments);}
|
function gtag(){dataLayer.push(arguments);}
|
||||||
gtag('js', new Date());
|
gtag('js', new Date());
|
||||||
|
|
||||||
gtag('config', 'UA-132936999-1');
|
gtag('config', #{@google_analytics_id.to_json.html_safe});
|
||||||
|
|
||||||
%body
|
%body
|
||||||
.container
|
.container
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
<%= stylesheet_link_tag 'welcome', media: 'all', 'data-turbolinks-track': 'reload' %>
|
<%= stylesheet_link_tag 'welcome', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||||
<script src="https://www.googletagmanager.com/gtag/js?id=<%= @google_analytics_id %>" type="javascript"></script>
|
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= @google_analytics_id %>" type="javascript"></script>
|
||||||
<script type="javascript">
|
<script type="javascript">
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue