chore: remove google analytics (#7293)

This commit is contained in:
Laurin Quast 2025-11-20 15:29:52 +01:00 committed by GitHub
parent 02a1f71a13
commit 2a18499342
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 1 additions and 46 deletions

View file

@ -26,7 +26,6 @@ The following environment variables configure the application.
| `SENTRY_ENABLED` | No | Whether Sentry error reporting should be enabled. | `1` (enabled) or `0` (disabled) |
| `DOCS_URL` | No | The URL of the Hive Docs | `https://the-guild.dev/graphql/hive/docs` |
| `NODE_ENV` | No | The `NODE_ENV` value. | `production` |
| `GA_TRACKING_ID` | No | The token for Google Analytics in order to track user actions. | `g6aff8102efda5e1d12e` |
| `GRAPHQL_PERSISTED_OPERATIONS` | No | Send persisted operation hashes instead of documents to the server. | `1` (enabled) or `0` (disabled) |
## Hive Hosted Configuration

View file

@ -8,7 +8,6 @@ export const ALLOWED_ENVIRONMENT_VARIABLES = [
'GRAPHQL_PUBLIC_ENDPOINT',
'GRAPHQL_PUBLIC_SUBSCRIPTION_ENDPOINT',
'GRAPHQL_PUBLIC_ORIGIN',
'GA_TRACKING_ID',
'DOCS_URL',
'STRIPE_PUBLIC_KEY',
'RELEASE',

View file

@ -43,7 +43,6 @@ const BaseSchema = protectedObject({
GRAPHQL_PUBLIC_ENDPOINT: zod.string().url(),
GRAPHQL_PUBLIC_SUBSCRIPTION_ENDPOINT: zod.string().url(),
GRAPHQL_PUBLIC_ORIGIN: zod.string().url(),
GA_TRACKING_ID: emptyString(zod.string().optional()),
DOCS_URL: emptyString(zod.string().url().optional()),
STRIPE_PUBLIC_KEY: emptyString(zod.string().optional()),
RELEASE: emptyString(zod.string().optional()),
@ -155,9 +154,6 @@ function buildConfig() {
requireEmailVerification: base.AUTH_REQUIRE_EMAIL_VERIFICATION === '1',
oidc: authOktaMultiTenant.AUTH_ORGANIZATION_OIDC === '1',
},
analytics: {
googleAnalyticsTrackingId: base.GA_TRACKING_ID,
},
integrations: {
slack: integrationSlack.INTEGRATION_SLACK === '1',
},

View file

@ -1,16 +0,0 @@
import { env } from '@/env/frontend';
export const pageview = (url: string): void => {
if (!env.analytics.googleAnalyticsTrackingId) {
return;
}
const gtag = (window as any).gtag;
if (typeof gtag === 'function') {
gtag('config', env.analytics.googleAnalyticsTrackingId, {
page_path: url,
});
} else {
console.error('window.gtag function not found');
}
};

View file

@ -1,6 +1,6 @@
import { lazy, useCallback, useEffect, useMemo } from 'react';
import { parse as jsUrlParse, stringify as jsUrlStringify } from 'jsurl2';
import { Helmet, HelmetProvider } from 'react-helmet-async';
import { HelmetProvider } from 'react-helmet-async';
import { ToastContainer } from 'react-toastify';
import SuperTokens, { SuperTokensWrapper } from 'supertokens-auth-react';
import Session from 'supertokens-auth-react/recipe/session';
@ -10,7 +10,6 @@ import { LoadingAPIIndicator } from '@/components/common/LoadingAPI';
import { Toaster } from '@/components/ui/toaster';
import { frontendConfig } from '@/config/supertokens/frontend';
import { env } from '@/env/frontend';
import * as gtag from '@/lib/gtag';
import { urqlClient } from '@/lib/urql';
import { configureScope, init } from '@sentry/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
@ -121,24 +120,6 @@ function RootComponent() {
return (
<HelmetProvider>
{env.analytics.googleAnalyticsTrackingId && (
<Helmet>
<script id="gtag-init" key="gtag-init" type="text/javascript">{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${env.analytics.googleAnalyticsTrackingId}', {
page_path: window.location.pathname,
});
`}</script>
<script
key="gtag-script"
async
src={`https://www.googletagmanager.com/gtag/js?id=${env.analytics.googleAnalyticsTrackingId}`}
type="text/javascript"
/>
</Helmet>
)}
<Toaster />
<SuperTokensWrapper>
<QueryClientProvider client={queryClient}>
@ -985,7 +966,3 @@ export const router = createRouter({
return JSON.stringify(search);
}),
});
router.history.subscribe(() => {
gtag.pageview(router.history.location.href);
});