Skip to content

Commit 366f042

Browse files
authored
Merge pull request #1726 from alphagov/add-google-tag-manager
Add Google Tag Manager snippet
2 parents fd639eb + 130ada2 commit 366f042

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<% if ENV["GOOGLE_TAG_MANAGER_ID"] %>
2+
<% content_for :head do %>
3+
<%= render "govuk_publishing_components/components/google_tag_manager_script", {
4+
gtm_id: ENV["GOOGLE_TAG_MANAGER_ID"],
5+
gtm_auth: ENV["GOOGLE_TAG_MANAGER_AUTH"],
6+
gtm_preview: ENV["GOOGLE_TAG_MANAGER_PREVIEW"],
7+
} %>
8+
<% end %>
9+
<% end %>

app/views/layouts/application.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<% render "layouts/google_tag_manager" %>
12
<%= render 'govuk_publishing_components/components/layout_for_admin',
23
product_name: "Travel Advice Publisher",
34
environment: GovukPublishingComponents::AppHelpers::Environment.current_acceptance_environment,

app/views/layouts/historical_edition.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<% render "layouts/google_tag_manager" %>
12
<!DOCTYPE html>
23
<html lang="en">
34
<head>
@@ -8,6 +9,7 @@
89
<% end %>
910
<%= stylesheet_link_tag "historical-edition", media: "all" %>
1011
<%= yield :extra_headers %>
12+
<%= yield :head %>
1113
</head>
1214
<body>
1315
<div id="wrapper" class="travel-advice-guide">

0 commit comments

Comments
 (0)