Files
supabase/apps/www/lib/telemetry.ts
T
30c390c19c chore: unify telemetry event sending (#32861)
* chore: unify telemetry event sending

* organize some imports

* remove final useTelemetryProps

* add www telemetry actions typing and docs

* remove gaevents

* fix build

* move telemetry identify into PageTelemetry

* fix telemetry constants import

---------

Co-authored-by: Pamela Chia <pamelachiamayyee@gmail.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-01-22 23:52:32 +08:00

17 lines
448 B
TypeScript

import { sendTelemetryEvent } from 'common'
import { TelemetryEvent } from 'common/telemetry-constants'
import { API_URL } from 'lib/constants'
import { useRouter } from 'next/router'
import { useCallback } from 'react'
export function useSendTelemetryEvent() {
const router = useRouter()
return useCallback(
(event: TelemetryEvent) => {
return sendTelemetryEvent(API_URL, event, router.pathname)
},
[router.pathname]
)
}