diff --git a/Gemfile b/Gemfile index 965b55f1..db5e5504 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ gem "elasticsearch-rails", "~> 7.2.1" gem "faraday" gem "faraday_middleware" gem "govuk_elements_rails" -gem "govuk_publishing_components", "~> 28.7.1" +gem "govuk_publishing_components", "~> 28.7.1" # TODO: Revert https://github.com/alphagov/datagovuk_find/pull/1286 once 39.2.3+ gem "htmlentities" gem "jbuilder" gem "jquery-rails" diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 1efef26d..bccbddf8 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,12 +5,24 @@ <% if ENV["GOOGLE_TAG_MANAGER_ID"] %> - <%= render "govuk_publishing_components/components/google_tag_manager_script", { - gtm_id: ENV["GOOGLE_TAG_MANAGER_ID"], - gtm_auth: ENV["GOOGLE_TAG_MANAGER_AUTH"], - gtm_preview: ENV["GOOGLE_TAG_MANAGER_PREVIEW"] - } %> + <% + gtm_auth = ENV["GOOGLE_TAG_MANAGER_AUTH"] + gtm_preview = ENV["GOOGLE_TAG_MANAGER_PREVIEW"] + + gtm_attributes = [] + gtm_attributes << "gtm_auth=" + gtm_auth if gtm_auth + gtm_attributes << "gtm_preview=#{gtm_preview}>m_cookies_win=x" if gtm_preview + gtm_attributes = gtm_attributes.join('&') + %> + <% end %> +