Merge pull request #4579 from rbideau/4576-google-analytics

Add google analytics scripts in template for standalone app
This commit is contained in:
Fredrik Adelöw
2021-02-22 16:17:30 +01:00
committed by GitHub
7 changed files with 79 additions and 12 deletions
@@ -48,6 +48,22 @@
}
</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>