mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-07-30 01:32:39 -04:00
Added logging of icon searches
This commit is contained in:
@@ -24,8 +24,10 @@ import { Observable, combineLatest, fromEvent, merge } from "rxjs"
|
||||
import {
|
||||
delay,
|
||||
distinctUntilChanged,
|
||||
filter,
|
||||
map,
|
||||
startWith
|
||||
startWith,
|
||||
withLatestFrom
|
||||
} from "rxjs/operators"
|
||||
|
||||
import { watchElementFocus } from "~/browser"
|
||||
@@ -71,6 +73,17 @@ export function mountIconSearchQuery(
|
||||
distinctUntilChanged()
|
||||
)
|
||||
|
||||
/* Log search on blur */
|
||||
focus$
|
||||
.pipe(
|
||||
filter(active => !active),
|
||||
withLatestFrom(value$)
|
||||
)
|
||||
.subscribe(([, value]) => {
|
||||
const path = document.location.pathname
|
||||
ga("send", "pageview", `${path}?q=[icon]+${value}`)
|
||||
})
|
||||
|
||||
/* Combine into single observable */
|
||||
return combineLatest([value$, focus$])
|
||||
.pipe(
|
||||
|
||||
Reference in New Issue
Block a user