Skip to content

Commit

Permalink
Merge pull request #1256 from alphagov/add-ga4-gtm-tracking
Browse files Browse the repository at this point in the history
Implement Google Tag Manager
  • Loading branch information
AgaDufrat authored Apr 19, 2024
2 parents 42b33fd + ef6982c commit 6c73829
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
<!--[if gt IE 8]><!--><html lang="<%= content_for?(:html_lang) ? yield(:html_lang) : "en" %>"><!--<![endif]-->
<html class="govuk-template">
<head>

<% 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 %>
<script>
<% if Rails.application.config.analytics_tracking_id.present? %>
var analyticsInit = function() {
Expand Down

0 comments on commit 6c73829

Please sign in to comment.