Update GA4 for public

This commit is contained in:
Paulo Gustavo Veiga 2022-05-29 21:47:44 -07:00
parent 1290261966
commit b44ace6992
2 changed files with 14 additions and 17 deletions

View File

@ -1,16 +0,0 @@
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:if test="${requestScope['google.analytics.enabled']}">
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '${requestScope['google.analytics.account']}', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
</c:if>

View File

@ -19,7 +19,20 @@
var locale = '${locale}';
var isAuth = ${principal != null};
</script>
<%@ include file="/jsp/googleAnalytics.jsf" %>
<c:if test="${requestScope['google.analytics.enabled']}">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id='${requestScope['google.analytics.account']}'"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${requestScope['google.analytics.account']}',
{
'page_title' : 'Public - ${mindmap.id}'
});
</script>
</c:if>
</head>
<body>