mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 02:15:05 +03:00
Merge pull request #13800 from supabase/hi/remove-ga4-client
fix: remove ga4 client
This commit is contained in:
4 files changed
-47
No files matched your search
@@ -73,23 +73,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 <StoreContext.Provider value={rootStore}>{children}</StoreContext.Provider>
|
||||
|
||||
@@ -111,10 +111,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
|
||||
}
|
||||
@@ -22,7 +22,6 @@ import relativeTime from 'dayjs/plugin/relativeTime'
|
||||
import Prism from 'prism-react-renderer/prism'
|
||||
|
||||
import Head from 'next/head'
|
||||
import Script from 'next/script'
|
||||
|
||||
import { AppPropsWithLayout } from 'types'
|
||||
import { ThemeProvider } from 'common'
|
||||
@@ -133,20 +132,6 @@ function CustomApp({ Component, pageProps }: AppPropsWithLayout) {
|
||||
</Head>
|
||||
<Favicons />
|
||||
|
||||
<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>
|
||||
<TooltipProvider>
|
||||
<RouteValidationWrapper>
|
||||
|
||||
@@ -19,7 +19,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
|
||||
@@ -117,13 +116,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))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user