Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: rename telemetryProps

Francesco Sansalvadore0edff93e46c4
diff --git a/apps/docs/pages/_app.tsx b/apps/docs/pages/_app.tsx
index e0ad82b5602..7234e438f59 100644
--- a/apps/docs/pages/_app.tsx
+++ b/apps/docs/pages/_app.tsx
@@ -1,6 +1,6 @@
import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs'
import { SessionContextProvider } from '@supabase/auth-helpers-react'
-import { AuthProvider, ThemeProvider, useGoogleAnalyticsProps } from 'common'
+import { AuthProvider, ThemeProvider, useTelemetryProps } from 'common'
import { useRouter } from 'next/router'
import { useEffect, useState } from 'react'
import ReactMarkdown from 'react-markdown'
@@ -21,7 +21,7 @@ import '../styles/prism-okaidia.scss'
function MyApp({ Component, pageProps }: AppPropsWithLayout) {
const router = useRouter()
- const googleAnalyticsProps = useGoogleAnalyticsProps()
+ const telemetryProps = useTelemetryProps()
const [supabase] = useState(() =>
IS_PLATFORM || LOCAL_SUPABASE ? createBrowserSupabaseClient() : undefined
@@ -33,8 +33,8 @@ function MyApp({ Component, pageProps }: AppPropsWithLayout) {
title: document.title,
route,
ga: {
- screen_resolution: googleAnalyticsProps?.screenResolution,
- language: googleAnalyticsProps?.language,
+ screen_resolution: telemetryProps?.screenResolution,
+ language: telemetryProps?.language,
session_id: BrowserTabTracker.sessionId,
},
})
diff --git a/apps/www/components/Features/index.tsx b/apps/www/components/Features/index.tsx
index 4b291e78767..ab6510718e5 100644
--- a/apps/www/components/Features/index.tsx
+++ b/apps/www/components/Features/index.tsx
@@ -5,43 +5,43 @@ import gaEvents from '~/lib/gaEvents'
import SectionContainer from '../Layouts/SectionContainer'
import ProductIcon from '../ProductIcon'
import TextLink from '../TextLink'
-import { useGoogleAnalyticsProps } from 'common/hooks/useGoogleAnalyticsProps'
+import { useTelemetryProps } from 'common/hooks/useTelemetryProps'
import { useRouter } from 'next/router'
const Features = () => {
const router = useRouter()
- const googleAnalyticsProps = useGoogleAnalyticsProps()
+ const telemetryProps = useTelemetryProps()
const sendTelemetryEvent = async (product: any) => {
switch (product) {
case 'Database':
return await Telemetry.sendEvent(
gaEvents['www_hp_subhero_products_database'],
- googleAnalyticsProps,
+ telemetryProps,
router
)
case 'Authentication':
return await Telemetry.sendEvent(
gaEvents['www_hp_subhero_products_auth'],
- googleAnalyticsProps,
+ telemetryProps,
router
)
case 'Storage':
return await Telemetry.sendEvent(
gaEvents['www_hp_subhero_products_storage'],
- googleAnalyticsProps,
+ telemetryProps,
router
)
case 'Edge Functions':
return await Telemetry.sendEvent(
gaEvents['www_hp_subhero_products_edgeFunctions'],
- googleAnalyticsProps,
+ telemetryProps,
router
)
case 'Realtime':
return await Telemetry.sendEvent(
gaEvents['www_hp_subhero_products_realtime'],
- googleAnalyticsProps,
+ telemetryProps,
router
)
}
diff --git a/apps/www/components/Hero.tsx b/apps/www/components/Hero.tsx
index 33a1e3deec6..d2decb0ab08 100644
--- a/apps/www/components/Hero.tsx
+++ b/apps/www/components/Hero.tsx
@@ -2,17 +2,17 @@ import { Button, IconBookOpen } from 'ui'
import { useRouter } from 'next/router'
import Link from 'next/link'
import SectionContainer from './Layouts/SectionContainer'
-import Telemetry, { GoogleAnalyticsEvent } from '~/lib/telemetry'
+import Telemetry, { TelemetryEvent } from '~/lib/telemetry'
import gaEvents from '~/lib/gaEvents'
-import { useGoogleAnalyticsProps } from 'common/hooks/useGoogleAnalyticsProps'
+import { useTelemetryProps } from 'common/hooks/useTelemetryProps'
const Hero = () => {
const router = useRouter()
const { basePath } = router
- const googleAnalyticsProps = useGoogleAnalyticsProps()
+ const telemetryProps = useTelemetryProps()
- const sendTelemetryEvent = async (event: GoogleAnalyticsEvent) => {
- await Telemetry.sendEvent(event, googleAnalyticsProps, router)
+ const sendTelemetryEvent = async (event: TelemetryEvent) => {
+ await Telemetry.sendEvent(event, telemetryProps, router)
}
return (
diff --git a/apps/www/lib/gaEvents.ts b/apps/www/lib/gaEvents.ts
index 73599720f86..a9db7dead20 100644
--- a/apps/www/lib/gaEvents.ts
+++ b/apps/www/lib/gaEvents.ts
@@ -1,10 +1,10 @@
-import { GoogleAnalyticsEvent } from './telemetry'
+import { TelemetryEvent } from './telemetry'
-interface GoogleAnalyticsEventType {
- [key: string]: GoogleAnalyticsEvent
+interface TelemetryEventType {
+ [key: string]: TelemetryEvent
}
-const GoogleAnalyticsEvents: GoogleAnalyticsEventType = {
+const TelemetryEvents: TelemetryEventType = {
www_hp_hero_startProject: {
action: 'www_hp_hero_startProject',
category: 'link',
@@ -42,4 +42,4 @@ const GoogleAnalyticsEvents: GoogleAnalyticsEventType = {
},
}
-export default GoogleAnalyticsEvents
+export default TelemetryEvents
diff --git a/apps/www/lib/telemetry.ts b/apps/www/lib/telemetry.ts
index e64f0992b68..579e3a14f5b 100644
--- a/apps/www/lib/telemetry.ts
+++ b/apps/www/lib/telemetry.ts
@@ -3,14 +3,14 @@ import { API_URL, IS_PROD, IS_PREVIEW } from 'lib/constants'
import { BrowserTabTracker } from 'browser-session-tabs'
import { NextRouter } from 'next/router'
-export interface GoogleAnalyticsEvent {
+export interface TelemetryEvent {
category: string
action: string
label: string
value?: string
}
-export interface GoogleAnalyticsProps {
+export interface TelemetryProps {
screenResolution?: string
language: string
}
@@ -18,11 +18,7 @@ export interface GoogleAnalyticsProps {
// This event is the same as in studio/lib/telemetry.tx
// but uses different ENV variables for www
-const sendEvent = (
- event: GoogleAnalyticsEvent,
- gaProps: GoogleAnalyticsProps,
- router: NextRouter
-) => {
+const sendEvent = (event: TelemetryEvent, gaProps: TelemetryProps, router: NextRouter) => {
if (!IS_PROD && !IS_PREVIEW) return
const { category, action, label, value } = event
diff --git a/apps/www/pages/_app.tsx b/apps/www/pages/_app.tsx
index ab0dbf807d2..1b5db4d340b 100644
--- a/apps/www/pages/_app.tsx
+++ b/apps/www/pages/_app.tsx
@@ -6,14 +6,14 @@ import { useEffect } from 'react'
import Meta from '~/components/Favicons'
import '../styles/index.css'
import { post } from '~/lib/fetchWrapper'
-import { AuthProvider, ThemeProvider, useGoogleAnalyticsProps } from 'common'
+import { AuthProvider, ThemeProvider, useTelemetryProps } from 'common'
import { BrowserTabTracker } from 'browser-session-tabs'
import { v4 as uuidv4 } from 'uuid'
import Head from 'next/head'
export default function MyApp({ Component, pageProps }: AppProps) {
const router = useRouter()
- const googleAnalyticsProps = useGoogleAnalyticsProps()
+ const telemetryProps = useTelemetryProps()
function handlePageTelemetry(route: string) {
return post(`${API_URL}/telemetry/page`, {
@@ -21,8 +21,8 @@ export default function MyApp({ Component, pageProps }: AppProps) {
title: document.title,
route,
ga: {
- screen_resolution: googleAnalyticsProps?.screenResolution,
- language: googleAnalyticsProps?.language,
+ screen_resolution: telemetryProps?.screenResolution,
+ language: telemetryProps?.language,
session_id: BrowserTabTracker.sessionId,
},
})
diff --git a/packages/common/hooks/useGoogleAnalyticsProps.ts b/packages/common/hooks/useTelemetryProps.ts
similarity index 85%
rename from packages/common/hooks/useGoogleAnalyticsProps.ts
rename to packages/common/hooks/useTelemetryProps.ts
index 3b247008f9f..73e63cd5e4f 100644
--- a/packages/common/hooks/useGoogleAnalyticsProps.ts
+++ b/packages/common/hooks/useTelemetryProps.ts
@@ -2,7 +2,7 @@ import { useRouter } from 'next/router'
const isBrowser = typeof window !== 'undefined'
-export function useGoogleAnalyticsProps() {
+export function useTelemetryProps() {
const { locale } = useRouter()
return {
diff --git a/studio/components/interfaces/SQLEditor/SQLTemplates/SQLTemplates.tsx b/studio/components/interfaces/SQLEditor/SQLTemplates/SQLTemplates.tsx
index f400dbd6a13..86f850fbce4 100644
--- a/studio/components/interfaces/SQLEditor/SQLTemplates/SQLTemplates.tsx
+++ b/studio/components/interfaces/SQLEditor/SQLTemplates/SQLTemplates.tsx
@@ -8,7 +8,7 @@ import { useProfileQuery } from 'data/profile/profile-query'
import { SQL_TEMPLATES } from 'components/interfaces/SQLEditor/SQLEditor.constants'
import SQLCard from './SQLCard'
import { createSqlSnippetSkeleton } from '../SQLEditor.utils'
-import { useGoogleAnalyticsProps, useParams } from 'common'
+import { useTelemetryProps, useParams } from 'common'
import { useRouter } from 'next/router'
import { SqlSnippet } from 'data/content/sql-snippets-query'
import { useSqlEditorStateSnapshot } from 'state/sql-editor'
@@ -21,7 +21,7 @@ const SQLTemplates = observer(() => {
const { data: profile } = useProfileQuery()
const [sql, quickStart] = partition(SQL_TEMPLATES, { type: 'template' })
- const googleAnalyticsProps = useGoogleAnalyticsProps()
+ const telemetryProps = useTelemetryProps()
const snap = useSqlEditorStateSnapshot()
const canCreateSQLSnippet = checkPermissions(PermissionAction.CREATE, 'user_content', {
resource: { type: 'sql', owner_id: profile?.id },
@@ -78,7 +78,7 @@ const SQLTemplates = observer(() => {
action: 'script_clicked',
label: x.title,
},
- googleAnalyticsProps,
+ telemetryProps,
router
)
}}
@@ -113,7 +113,7 @@ const SQLTemplates = observer(() => {
action: 'quickstart_clicked',
label: x.title,
},
- googleAnalyticsProps,
+ telemetryProps,
router
)
}}
diff --git a/studio/components/interfaces/SQLEditor/UtilityPanel/ResultsDropdown.tsx b/studio/components/interfaces/SQLEditor/UtilityPanel/ResultsDropdown.tsx
index 4d47dcedb13..50565d6c697 100644
--- a/studio/components/interfaces/SQLEditor/UtilityPanel/ResultsDropdown.tsx
+++ b/studio/components/interfaces/SQLEditor/UtilityPanel/ResultsDropdown.tsx
@@ -9,7 +9,7 @@ import { CSVLink } from 'react-csv'
import { useSqlEditorStateSnapshot } from 'state/sql-editor'
// @ts-ignore
import MarkdownTable from 'markdown-table'
-import { useGoogleAnalyticsProps } from 'common'
+import { useTelemetryProps } from 'common'
import { useRouter } from 'next/router'
export type ResultsDropdownProps = {
@@ -19,7 +19,7 @@ export type ResultsDropdownProps = {
const ResultsDropdown = ({ id }: ResultsDropdownProps) => {
const { project } = useProjectContext()
const snap = useSqlEditorStateSnapshot()
- const googleAnalyticsProps = useGoogleAnalyticsProps()
+ const telemetryProps = useTelemetryProps()
const result = snap.results?.[id]?.[0] ?? undefined
const { ui } = useStore()
const csvRef = useRef<CSVLink & HTMLAnchorElement & { link: HTMLAnchorElement }>(null)
@@ -34,7 +34,7 @@ const ResultsDropdown = ({ id }: ResultsDropdownProps) => {
csvRef.current?.link.click()
Telemetry.sendEvent(
{ category: 'sql_editor', action: 'sql_download_csv', label: '' },
- googleAnalyticsProps,
+ telemetryProps,
router
)
}
@@ -58,7 +58,7 @@ const ResultsDropdown = ({ id }: ResultsDropdownProps) => {
ui.setNotification({ category: 'success', message: 'Copied results to clipboard' })
Telemetry.sendEvent(
{ category: 'sql_editor', action: 'sql_copy_as_markdown', label: '' },
- googleAnalyticsProps,
+ telemetryProps,
router
)
})
diff --git a/studio/components/ui/PageTelemetry.tsx b/studio/components/ui/PageTelemetry.tsx
index 54b9155cec1..eeda65b6071 100644
--- a/studio/components/ui/PageTelemetry.tsx
+++ b/studio/components/ui/PageTelemetry.tsx
@@ -1,5 +1,5 @@
import { BrowserTabTracker } from 'browser-session-tabs'
-import { useGoogleAnalyticsProps } from 'common'
+import { useTelemetryProps } from 'common'
import { post } from 'lib/common/fetch'
import { API_URL, IS_PLATFORM } from 'lib/constants'
import { observer } from 'mobx-react-lite'
@@ -26,7 +26,7 @@ function sanitizePageViewRoute(_route?: string) {
const PageTelemetry: FC = ({ children }) => {
const router = useRouter()
- const googleAnalyticsProps = useGoogleAnalyticsProps()
+ const telemetryProps = useTelemetryProps()
useEffect(() => {
function handleRouteChange(url: string) {
@@ -72,8 +72,8 @@ const PageTelemetry: FC = ({ children }) => {
title: document.title,
route,
ga: {
- screen_resolution: googleAnalyticsProps?.screenResolution,
- language: googleAnalyticsProps?.language,
+ screen_resolution: telemetryProps?.screenResolution,
+ language: telemetryProps?.language,
session_id: BrowserTabTracker.sessionId,
},
})
diff --git a/studio/lib/auth.tsx b/studio/lib/auth.tsx
index f02f3688130..55b17f74866 100644
--- a/studio/lib/auth.tsx
+++ b/studio/lib/auth.tsx
@@ -2,7 +2,7 @@ import {
AuthContext as AuthContextInternal,
AuthProvider as AuthProviderInternal,
gotrueClient,
- useGoogleAnalyticsProps,
+ useTelemetryProps,
} from 'common'
import { useProfileQuery } from 'data/profile/profile-query'
import { useStore } from 'hooks'
@@ -14,7 +14,7 @@ export const AuthContext = AuthContextInternal
export const AuthProvider = ({ children }: PropsWithChildren<{}>) => {
const { ui, app } = useStore()
- const googleAnalyticsProps = useGoogleAnalyticsProps()
+ const telemetryProps = useTelemetryProps()
// Check for unverified GitHub users after a GitHub sign in
useEffect(() => {
@@ -36,7 +36,7 @@ export const AuthProvider = ({ children }: PropsWithChildren<{}>) => {
// Track telemetry for the current user
useProfileQuery({
onSuccess(profile) {
- Telemetry.sendIdentify(profile, googleAnalyticsProps)
+ Telemetry.sendIdentify(profile, telemetryProps)
// [Joshen] Temp fix: For new users, the GET profile call also creates a default org
// But because the dashboard's logged in state is using gotrue as the source of truth
diff --git a/studio/lib/telemetry.ts b/studio/lib/telemetry.ts
index f3a75970c6a..8b75269c02a 100644
--- a/studio/lib/telemetry.ts
+++ b/studio/lib/telemetry.ts
@@ -4,7 +4,7 @@ import { User } from 'types'
import { BrowserTabTracker } from 'browser-session-tabs'
import { NextRouter } from 'next/router'
-export interface GoogleAnalyticsProps {
+export interface TelemetryProps {
screenResolution?: string
language: string
}
@@ -16,7 +16,7 @@ const sendEvent = (
label: string
value?: string
},
- gaProps: GoogleAnalyticsProps,
+ gaProps: TelemetryProps,
router: NextRouter
) => {
if (!IS_PLATFORM) return
@@ -43,7 +43,7 @@ const sendEvent = (
* TODO: GA4 doesn't have identify method.
* We may or may not need gaClientId here. Confirm later
*/
-const sendIdentify = (user: User, gaProps?: GoogleAnalyticsProps) => {
+const sendIdentify = (user: User, gaProps?: TelemetryProps) => {
if (!IS_PLATFORM) return
return post(`${API_URL}/telemetry/identify`, {