Skip to content

Commit

Permalink
docs: use GA4 instead of UA
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenbreddels committed Oct 17, 2023
1 parent bcbee9c commit 988ecd6
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions solara/website/templates/index.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,15 @@
<link rel="stylesheet" href="/_solara/cdn/@docsearch/css@3/dist/style.css" />
<script src="/_solara/cdn/@docsearch/js@3"></script>

<!-- Google Analytics -->
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-G985FTLWGQ"></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');
_solara_skip_use_ga = (window.location.hostname == 'localhost') || (window.location.hostname == '0.0.0.0');
if(!_solara_skip_use_ga) {
ga('create', 'UA-240047566-1', 'auto');
ga('send', 'pageview');
}
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-G985FTLWGQ');
</script>
<!-- End Google Analytics -->
{{ super() }}
<script>
if(!_solara_skip_use_ga) {
// for client side routing
window.addEventListener('solara.router', function(event) {
ga('send', 'pageview', window.location.pathname);
});
}
</script>
{% endblock %}

0 comments on commit 988ecd6

Please sign in to comment.