mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 13:01:09 +02:00
Projects included: - maerchenzauber (NestJS backend + Expo mobile + SvelteKit web + Astro landing) - manacore (Expo mobile + SvelteKit web + Astro landing) - manadeck (NestJS backend + Expo mobile + SvelteKit web) - memoro (Expo mobile + SvelteKit web + Astro landing) This commit preserves the current state before monorepo restructuring. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
35 lines
984 B
TypeScript
35 lines
984 B
TypeScript
import { useEffect } from 'react';
|
|
import { usePathname } from 'expo-router';
|
|
import { useAnalytics } from '../hooks/useAnalytics';
|
|
|
|
export const AnalyticsNavigationTracker = () => {
|
|
const pathname = usePathname();
|
|
const { screen } = useAnalytics();
|
|
|
|
useEffect(() => {
|
|
if (pathname) {
|
|
// Convert path to screen name: /memo/123 -> memo_detail
|
|
const segments = pathname.split('/').filter(Boolean);
|
|
let screenName = 'home';
|
|
|
|
if (segments.length > 0) {
|
|
// Handle dynamic routes
|
|
if (segments[0] === 'memo' && segments[1]) {
|
|
screenName = 'memo_detail';
|
|
} else if (segments[0] === 'space' && segments[1]) {
|
|
screenName = 'space_detail';
|
|
} else {
|
|
// Convert path to screen name
|
|
screenName = segments.join('_');
|
|
}
|
|
}
|
|
|
|
screen(screenName, {
|
|
path: pathname,
|
|
timestamp: new Date().toISOString(),
|
|
});
|
|
}
|
|
}, [pathname, screen]);
|
|
|
|
return null;
|
|
};
|