mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed analytics events for own documentation
This commit is contained in:
parent
e7efdade80
commit
a8534f7a48
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -35,5 +35,5 @@
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
{{ super() }}
|
||||
<script src="{{ 'overrides/assets/javascripts/bundle.f989075e.min.js' | url }}"></script>
|
||||
<script src="{{ 'overrides/assets/javascripts/bundle.52d656d3.min.js' | url }}"></script>
|
||||
{% endblock %}
|
||||
|
@ -30,11 +30,12 @@ import { fromEvent } from "rxjs"
|
||||
* Set up extra analytics events
|
||||
*/
|
||||
export function setupAnalytics(): void {
|
||||
const { origin } = new URL(location.href)
|
||||
fromEvent(document.body, "click")
|
||||
.subscribe(ev => {
|
||||
if (ev.target instanceof HTMLElement) {
|
||||
const el = ev.target.closest("a[href^=http]")
|
||||
if (el instanceof HTMLLinkElement)
|
||||
const el = ev.target.closest("a")
|
||||
if (el && el.origin !== origin)
|
||||
ga("send", "event", "outbound", "click", el.href)
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user