Files
supabase/apps/docs/lib/telemetry.ts
Alaister Young 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
442 B
TypeScript

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