mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Adjusted analytics implementation
This commit is contained in:
parent
98d1c354df
commit
6295251c24
@ -51,3 +51,17 @@
|
||||
</a>
|
||||
</aside>
|
||||
{% endblock %}
|
||||
{% block analytics %}
|
||||
{{ super() }}
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
document.body.addEventListener("click", ev => {
|
||||
if (ev.target instanceof HTMLElement) {
|
||||
var el = ev.target.closest("a[href^=http]")
|
||||
if (el)
|
||||
ga('send', 'event', 'outbound', 'click', el.href)
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
@ -60,9 +60,9 @@ theme:
|
||||
font:
|
||||
text: Roboto
|
||||
code: Roboto Mono
|
||||
favicon: assets/favicon.png
|
||||
icon:
|
||||
logo: logo
|
||||
favicon: assets/favicon.png
|
||||
|
||||
# Plugins
|
||||
plugins:
|
||||
|
@ -91,3 +91,21 @@
|
||||
</a>
|
||||
</aside>
|
||||
{% endblock %}
|
||||
|
||||
<!-- Analytics -->
|
||||
{% block analytics %}
|
||||
{{ super() }}
|
||||
|
||||
<!-- Track external links -->
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
document.body.addEventListener("click", ev => {
|
||||
if (ev.target instanceof HTMLElement) {
|
||||
var el = ev.target.closest("a[href^=http]")
|
||||
if (el)
|
||||
ga('send', 'event', 'outbound', 'click', el.href)
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user