Skip to content

Commit

Permalink
Fixed analytics events for own documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed Jun 6, 2021
1 parent e7efdad commit a8534f7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion material/overrides/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
Expand Down

0 comments on commit a8534f7

Please sign in to comment.