MCPcopy Create free account
hub / github.com/winfunc/opcode / usePageView

Function usePageView

src/hooks/useAnalytics.ts:356–368  ·  view source on GitHub ↗
(pageName: string, properties?: Record<string, any>)

Source from the content-addressed store, hash-verified

354}
355
356export function usePageView(pageName: string, properties?: Record<string, any>) {
357 const hasTracked = useRef(false);
358
359 useEffect(() => {
360 if (!hasTracked.current && analytics.isEnabled()) {
361 analytics.track('$pageview', {
362 page_name: pageName,
363 ...properties,
364 });
365 hasTracked.current = true;
366 }
367 }, [pageName, properties]);
368}
369
370export function useAppLifecycle() {
371 useEffect(() => {

Callers

nothing calls this directly

Calls 2

trackMethod · 0.80
isEnabledMethod · 0.45

Tested by

no test coverage detected