Skip to content

Commit 8074c61

Browse files
karissarjacobsenUbuntu
andauthored
fix GA tag for rails app (#7)
Co-authored-by: Ubuntu <[email protected]>
1 parent 66af136 commit 8074c61

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
document.addEventListener('turbolinks:load', function(event) {
2+
if (typeof ga === 'function') {
3+
ga('set', 'location', event.data.url);
4+
return ga('send', 'pageview');
5+
}
6+
});

app/views/layouts/application.html.erb

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,8 @@
77
<meta property="og:description" content="Discover how the DocuSign Connect webhook service can help you monitor and automate your business processes through real-time updates when specific events are triggered in your workflows." />
88
<meta property="og:image" content="/images/MyConnectWebhook_OG.png" />
99

10-
<!-- Google Tag Manager -->
11-
<script>
12-
(function(w,d,s,l,i){
13-
w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});
14-
var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:';
15-
j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;
16-
f.parentNode.insertBefore(j,f);
17-
})(window,document,'script','dataLayer','GTM-WPK6FN5');
18-
</script>
19-
<!-- End Google Tag Manager -->
10+
<div class=" "></div>
11+
<%= render '/partials/track_analytics' %>
2012

2113
<%= csrf_meta_tags %>
2214
<%= csp_meta_tag %>
@@ -29,6 +21,9 @@
2921
</head>
3022

3123
<body>
24+
<noscript>
25+
<iframe height="0" src="https://www.googletagmanager.com/ns.html?id=GTM-WPK6FN5" style="display:none;visibility:hidden" width="0"></iframe>
26+
</noscript>
3227
<%= yield %>
3328
</body>
3429
</html>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<script>
2+
3+
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
4+
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
5+
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
6+
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
7+
})(window,document,'script','dataLayer','GTM-WPK6FN5');
8+
9+
</script>
10+

0 commit comments

Comments
 (0)