Skip to content

Commit

Permalink
Add google tag manager
Browse files Browse the repository at this point in the history
  • Loading branch information
mlandauer committed Oct 17, 2024
1 parent e694f7f commit 69f0010
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/views/application/_analytics.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@
cookie_flags: 'max-age=7200;secure;samesite=none'
});
</script>
<%# TODO: Remove Analytics above once tag manager is working %>
<%# TODO: Extract GTM code into configuration %>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-TQK6F2JF');</script>
<!-- End Google Tag Manager -->
6 changes: 6 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
<%= render "html_head" %>
</head>
<body x-data="{ bodyScrolling: true }" x-bind:class="{ 'overflow-hidden': !bodyScrolling}">
<%# TODO: Extract the tag manager into partial %>
<%# TODO: Extract GTM config %>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-TQK6F2JF"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<%= render "header" %>
<main>
<%= render ContainerComponent.new do %>
Expand Down

0 comments on commit 69f0010

Please sign in to comment.