Skip to content

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

fix: remove ga4 client

phamhieufba1c14a20d9
diff --git a/studio/hooks/misc/useStore.tsx b/studio/hooks/misc/useStore.tsx
index a998f78d3d1..4e5cb1d9943 100644
--- a/studio/hooks/misc/useStore.tsx
+++ b/studio/hooks/misc/useStore.tsx
@@ -84,23 +84,6 @@ export const StoreProvider: FC<StoreProvider> = ({ children, rootStore }) => {
}
})
- /**
- * get Ga4 client_id when it's available
- * */
- // @ts-ignore
- if (!!window?.gtag) {
- // @ts-ignore
- window?.gtag(
- 'get',
- `${process.env.NEXT_PUBLIC_GA4_MEASUREMENT_ID}`,
- 'client_id',
- // @ts-ignore
- (client_id) => {
- ui.setGaClientId(client_id)
- }
- )
- }
-
return () =>
window
.matchMedia('(prefers-color-scheme: dark)')
diff --git a/studio/lib/common/fetch/base.ts b/studio/lib/common/fetch/base.ts
index 45597dc3588..bc6b87c49f4 100644
--- a/studio/lib/common/fetch/base.ts
+++ b/studio/lib/common/fetch/base.ts
@@ -108,10 +108,5 @@ export async function constructHeaders(requestId: string, optionHeaders?: { [pro
if (accessToken) headers.Authorization = `Bearer ${accessToken}`
}
- if (typeof window !== 'undefined') {
- const gaClientId = window?.localStorage?.getItem('ga_client_id')
- if (gaClientId && gaClientId !== 'undefined') headers['X-GA-Client-Id'] = gaClientId
- }
-
return headers
}
diff --git a/studio/pages/_app.tsx b/studio/pages/_app.tsx
index d97675d69ef..a32e1806458 100644
--- a/studio/pages/_app.tsx
+++ b/studio/pages/_app.tsx
@@ -21,7 +21,6 @@ import utc from 'dayjs/plugin/utc'
import Prism from 'prism-react-renderer/prism'
import Head from 'next/head'
-import Script from 'next/script'
import { AppPropsWithLayout } from 'types'
@@ -112,20 +111,6 @@ function MyApp({ Component, pageProps }: AppPropsWithLayout) {
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
</Head>
- <Script
- src={`https://www.googletagmanager.com/gtag/js?id=${process.env.NEXT_PUBLIC_GA4_MEASUREMENT_ID}`}
- strategy="afterInteractive"
- />
- <Script id="google-analytics" strategy="afterInteractive">
- {`
- window.dataLayer = window.dataLayer || [];
- function gtag(){window.dataLayer.push(arguments);}
- gtag('js', new Date());
-
- gtag('config', '${process.env.NEXT_PUBLIC_GA4_MEASUREMENT_ID}', { 'send_page_view': false });
- `}
- </Script>
-
<PageTelemetry>
<RouteValidationWrapper>
<AppBannerWrapper>{getLayout(<Component {...pageProps} />)}</AppBannerWrapper>
diff --git a/studio/stores/UiStore.ts b/studio/stores/UiStore.ts
index 411eecbdd74..a70031c6c80 100644
--- a/studio/stores/UiStore.ts
+++ b/studio/stores/UiStore.ts
@@ -28,7 +28,6 @@ export interface IUiStore {
setNotification: (notification: Notification) => string
setProfile: (value?: User) => void
setPermissions: (permissions?: Permission[]) => void
- setGaClientId: (clientId?: string) => void
}
export default class UiStore implements IUiStore {
rootStore: IRootStore
@@ -169,13 +168,4 @@ export default class UiStore implements IUiStore {
setPermissions(permissions?: any) {
this.permissions = permissions
}
-
- setGaClientId(clientId?: string) {
- /**
- * We need to access ga client_id from base.constructHeaders method
- * in order to set custom header('ga_client_id).
- * TODO: Do we have a better way than storing in local storage?
- */
- window.localStorage.setItem('ga_client_id', String(clientId))
- }
}