Skip to content

Commit

Permalink
Move Google Tag Manager ID to the Settings (#328)
Browse files Browse the repository at this point in the history
* Move Google Tag Manager ID to Settings
* Remove backslashes from the analytics snippet
  • Loading branch information
leoapost authored Jul 20, 2018
2 parents fb00da2 + a1e5ca1 commit ac2cf5a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

- content_for :after_header
noscript
iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MBQ9L9X" height="0" width="0" style="display:none;visibility:hidden"
iframe src="https://www.googletagmanager.com/ns.html?id=#{Settings.analytics.id}" height="0" width="0" style="display:none;visibility:hidden"

- content_for :content_override
#wrapper.group
Expand Down
6 changes: 3 additions & 3 deletions app/views/shared/_analytics.html.slim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
javascript:
(function(w, d, s, l, i)\ {
(function(w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push(\{
w[l].push({
'gtm.start': new Date().getTime(),
event: 'gtm.js'
});
Expand All @@ -12,4 +12,4 @@ javascript:
j.src =
'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-MBQ9L9X');
})(window, document, 'script', 'dataLayer', "#{Settings.analytics.id}");
5 changes: 2 additions & 3 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ submission:
url: <%= ENV['SUBMISSION_URL'] %>
token: <%= ENV['SUBMISSION_TOKEN'] %>
analytics:
id: <%= ENV['GA_ID'] || 'UA-37377084-52' %>
domain: <%= ENV['GA_DOMAIN'] || 'auto' %>
id: <%= ENV['GTM_ID'] || 'GTM-MBQ9L9X' %>
health_status:
deployment:
version_number: <%= ENV['APPVERSION'] || 'unknown' %>
Expand All @@ -30,4 +29,4 @@ income:
max_threshold_base: 5085
per_child_increment: 245
married_supplement: 160

0 comments on commit ac2cf5a

Please sign in to comment.