MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / analyticsMiddleware

Function analyticsMiddleware

apps/web/utilities/typesenseClient.ts:40–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38}
39
40export function analyticsMiddleware() {
41 const sendEventDebounced = debounce(() => {
42 const url = new URL(window.location.toString());
43 (window as any).posthog?.capture('search', {
44 url: url.toJSON(),
45 });
46 }, 3000);
47
48 return {
49 onStateChange() {
50 sendEventDebounced();
51 },
52 subscribe() {},
53 unsubscribe() {},
54 };
55}

Callers

nothing calls this directly

Calls 1

debounceFunction · 0.85

Tested by

no test coverage detected