Skip to content

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

fix: window.gtag is not a function

phamhieu4d572cbeda9a
diff --git a/studio/hooks/misc/useStore.tsx b/studio/hooks/misc/useStore.tsx
index 4b5b42297d5..a998f78d3d1 100644
--- a/studio/hooks/misc/useStore.tsx
+++ b/studio/hooks/misc/useStore.tsx
@@ -88,15 +88,18 @@ export const StoreProvider: FC<StoreProvider> = ({ children, rootStore }) => {
* get Ga4 client_id when it's available
* */
// @ts-ignore
- window?.gtag(
- 'get',
- `${process.env.NEXT_PUBLIC_GA4_MEASUREMENT_ID}`,
- 'client_id',
+ if (!!window?.gtag) {
// @ts-ignore
- (client_id) => {
- ui.setGaClientId(client_id)
- }
- )
+ window?.gtag(
+ 'get',
+ `${process.env.NEXT_PUBLIC_GA4_MEASUREMENT_ID}`,
+ 'client_id',
+ // @ts-ignore
+ (client_id) => {
+ ui.setGaClientId(client_id)
+ }
+ )
+ }
return () =>
window