useFirstTouchStore.ts17 lines · main
| 1 | import { useEffect } from 'react' |
| 2 | |
| 3 | import { setFirstTouchData } from '../telemetry-first-touch-store' |
| 4 | import { getSharedTelemetryData } from '../telemetry-utils' |
| 5 | |
| 6 | interface UseFirstTouchStoreProps { |
| 7 | enabled: boolean |
| 8 | } |
| 9 | |
| 10 | export function useFirstTouchStore({ enabled }: UseFirstTouchStoreProps) { |
| 11 | useEffect(() => { |
| 12 | if (!enabled) return |
| 13 | |
| 14 | const telemetryData = getSharedTelemetryData(window.location.pathname) |
| 15 | setFirstTouchData(telemetryData) |
| 16 | }, [enabled]) |
| 17 | } |