Skip to content

Commit

Permalink
Update Google analytics code to use new GA4 trackers (#118)
Browse files Browse the repository at this point in the history
The old scripts stopped accepting user data as of July 2023.
  • Loading branch information
abought authored Sep 28, 2023
1 parent a7c2a6d commit c3c26fa
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/main/html/webapp/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,17 @@
<script src="./dist/bundles/cloudgene/index.js"></script>

<#if google_analytics??>
<!-- Google Analytics -->
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=${google_analytics}"></script>
<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','//www.google-analytics.com/analytics.js','ga');

ga('create', ' ${google_analytics}', 'auto');
ga('send', 'pageview');
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

// Automatically sends a pageview with specified Tag ID
gtag('config', '${google_analytics}');
</script>
<!-- End Google Analytics -->
<!-- End Google Analytics -->
</#if>

</body>
Expand Down

0 comments on commit c3c26fa

Please sign in to comment.