Skip to content

Commit

Permalink
Merge pull request #2950 from alphagov/add-google-tag-manager
Browse files Browse the repository at this point in the history
Move google tag manager snippet
  • Loading branch information
ryanb-gds authored Nov 7, 2023
2 parents 254a06f + 41080fe commit 08049b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 7 additions & 0 deletions app/views/layouts/_google_tag_manager.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<% 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"]
} %>
<% end %>
8 changes: 1 addition & 7 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@
dataLayer.push({ 'gtm.blacklist': ['html', 'customScripts', 'nonGoogleScripts', 'customPixels'] });
</script>

<% 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"]
} %>
<% end %>
<% render "layouts/google_tag_manager" %>

<meta name="app-environment" content="<%= Rails.env %>">
<% end %>
Expand Down

0 comments on commit 08049b0

Please sign in to comment.