Merge pull request #2934 from RoadieHQ/google-analytics

Add Google Analytics support
This commit is contained in:
Patrik Oldsberg
2020-10-17 10:38:00 +02:00
committed by GitHub
6 changed files with 24 additions and 0 deletions
+17
View File
@@ -48,6 +48,23 @@
}
</style>
<title><%= app.title %></title>
<% if (app.googleAnalyticsTrackingId && typeof app.googleAnalyticsTrackingId
=== 'string') { %>
<script
async
src="https://www.googletagmanager.com/gtag/js?id=<%= app.googleAnalyticsTrackingId %>"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', '<%= app.googleAnalyticsTrackingId %>');
</script>
<% } %>
</head>
<body style="margin: 0;">
<noscript>You need to enable JavaScript to run this app.</noscript>