diff --git a/app/helpers/analytics_helper.rb b/app/helpers/analytics_helper.rb new file mode 100644 index 000000000..e15849405 --- /dev/null +++ b/app/helpers/analytics_helper.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module AnalyticsHelper + def get_gtm_container + # Additional environments tbc + "GTM-M6GS7FF" + end + + def get_gtm_id + # Additional environments tbc + "G-1RH26G5KVP" + end +end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index f6111fce5..2e5f66da1 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -21,6 +21,34 @@ <%= javascript_include_tag "vendor/polyfill-output-value.js" %> <%= javascript_include_tag "vendor/outerHTML.js" %> + + <% gtm_container = get_gtm_container %> + <% gtm_id = get_gtm_id %> + + + + + + <% if cookies[:accept_analytics_cookies] == "on" %> + + <% else %> + + <% end %> + + <%= javascript_include_tag "application", defer: true %> <% if content_for?(:head) %> @@ -44,6 +72,13 @@ document.body.className = ((document.body.className) ? document.body.className + " js-enabled" : "js-enabled"); + + <% if cookies[:accept_analytics_cookies] %> + + <% end %> + <%= govuk_skip_link %> <%= govuk_header(