Skip to content

Commit

Permalink
Merge pull request #1315 from alphagov/add-google-tag-manager
Browse files Browse the repository at this point in the history
Add Google Tag Manager snippet
  • Loading branch information
beccapearce authored Nov 7, 2023
2 parents a123e5d + 39434f0 commit 21c1210
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ gem "gds-sso"
gem "govspeak"
gem "govuk_admin_template"
gem "govuk_app_config"
gem "govuk_publishing_components"
gem "highline"
gem "kaminari"
gem "mail-notify"
Expand Down
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ DEPENDENCIES
govspeak
govuk_admin_template
govuk_app_config
govuk_publishing_components
govuk_schemas
govuk_test
highline
Expand Down
9 changes: 9 additions & 0 deletions app/views/layouts/_google_tag_manager.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<% if ENV["GOOGLE_TAG_MANAGER_ID"] %>
<% content_for :head do %>
<%= 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 %>
<% end %>
3 changes: 3 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<%= javascript_include_tag "application" %>
<%= csrf_meta_tag %>
<% end %>
<% render "layouts/google_tag_manager" %>
<% content_for :page_title, " | GOV.UK Service Manual Publisher" %>
<% content_for :app_title do %>GOV.UK Service Manual Publisher<% end %>
Expand Down

0 comments on commit 21c1210

Please sign in to comment.