mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed Google Analytics not tracking URLs with instant loading
This commit is contained in:
parent
dd40970865
commit
4e72d31043
@ -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)}})}),document.addEventListener("DOMContentSwitch",function(){ga("send","pageview",{title:document.title,location:document.location})})</script>
|
||||
<script async src="https://www.google-analytics.com/analytics.js"></script>
|
||||
|
@ -48,7 +48,10 @@
|
||||
|
||||
/* Send page view on document switch (instant loading, custom event) */
|
||||
document.addEventListener("DOMContentSwitch", function() {
|
||||
ga("send", "pageview", document.location.pathname)
|
||||
ga("send", "pageview", {
|
||||
title: document.title,
|
||||
location: document.location
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<script async src="https://www.google-analytics.com/analytics.js"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user