Deprecated DOMContentSwitch event

This commit is contained in:
squidfunk 2021-02-13 17:20:55 +01:00
parent aacb5ca5a7
commit a8b5cafa73
2 changed files with 6 additions and 5 deletions

View File

@ -2,5 +2,5 @@
This file was automatically generated - do not edit
-#}
{% set analytics = config.google_analytics %}
<script>window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create","{{ analytics[0] }}","{{ analytics[1] }}"),ga("set","anonymizeIp",!0),ga("send","pageview"),document.addEventListener("DOMContentLoaded",function(){document.forms.search&&document.forms.search.query.addEventListener("blur",function(){if(this.value){var e=document.location.pathname;ga("send","pageview",e+"?q="+this.value)}})}),document.addEventListener("DOMContentSwitch",function(){ga("send","pageview",document.location.pathname)})</script>
<script>window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create","{{ analytics[0] }}","{{ analytics[1] }}"),ga("set","anonymizeIp",!0),ga("send","pageview"),document.addEventListener("DOMContentLoaded",function(){document.forms.search&&document.forms.search.query.addEventListener("blur",function(){if(this.value){var e=document.location.pathname;ga("send","pageview",e+"?q="+this.value)}});"undefined"!=typeof location$&&location$.subscribe(function(e){ga("send","pageview",e.pathname)})})</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>

View File

@ -44,11 +44,12 @@
}
})
}
})
/* Send page view on document switch (instant loading, custom event) */
document.addEventListener("DOMContentSwitch", function() {
ga("send", "pageview", document.location.pathname)
/* Send page view on location change */
if (typeof location$ !== "undefined")
location$.subscribe(function(url) {
ga("send", "pageview", url.pathname)
})
})
</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>