The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
send sign_in telemetry event
Alaister Youngb49968d977d4
diff --git a/studio/hooks/misc/useProfile.tsx b/studio/hooks/misc/useProfile.tsxindex 08f4dbaca4c..93901e82cd3 100644--- a/studio/hooks/misc/useProfile.tsx+++ b/studio/hooks/misc/useProfile.tsx@@ -3,7 +3,7 @@ import { useRouter } from 'next/router'import { useTelemetryProps } from 'common'import { useProfileCreateMutation } from 'data/profile/profile-create-mutation'import { useProfileQuery } from 'data/profile/profile-query'-import telemetry from 'lib/telemetry'+import Telemetry from 'lib/telemetry'/*** Fetches the user's profile, creating one if it does not exist@@ -14,7 +14,7 @@ function useProfile() {const { mutate: createProfile, isLoading: isCreating } = useProfileCreateMutation({onSuccess() {- telemetry.sendEvent(+ Telemetry.sendEvent({ category: 'conversion', action: 'sign_up', label: '' },telemetryProps,routerdiff --git a/studio/lib/auth.tsx b/studio/lib/auth.tsxindex 973530e3afd..815387f5c08 100644--- a/studio/lib/auth.tsx+++ b/studio/lib/auth.tsx@@ -1,4 +1,5 @@import { useQueryClient } from '@tanstack/react-query'+import { useRouter } from 'next/router'import { PropsWithChildren, useCallback, useEffect } from 'react'import {@@ -17,6 +18,7 @@ export const AuthContext = AuthContextInternalexport const AuthProvider = ({ children }: PropsWithChildren<{}>) => {const { ui, app } = useStore()+ const router = useRouter()const telemetryProps = useTelemetryProps()// Check for unverified GitHub users after a GitHub sign in@@ -36,6 +38,22 @@ export const AuthProvider = ({ children }: PropsWithChildren<{}>) => {handleEmailVerificationError()}, [])+ useEffect(() => {+ const {+ data: { subscription },+ } = gotrueClient.onAuthStateChange((event) => {+ if (event === 'SIGNED_IN') {+ Telemetry.sendEvent(+ { category: 'conversion', action: 'sign_in', label: '' },+ telemetryProps,+ router+ )+ }+ })++ return subscription.unsubscribe+ }, [])+// Track telemetry for the current useruseProfileQuery({onSuccess(profile) {