Browse Source

Removed google analytics for dev (#4233)

main
Strek 3 years ago
committed by GitHub
parent
commit
51105970b7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      beta/.env.development
  2. 18
      beta/src/pages/_app.tsx

3
beta/.env.development

@ -1,3 +1,2 @@
NEXT_PUBLIC_HJ_SITE_ID = 2411683
NEXT_PUBLIC_HJ_SITE_V = 6
NEXT_PUBLIC_GA_TRACKING_ID = 'G-3918VS75Y6'
NEXT_PUBLIC_HJ_SITE_V = 6

18
beta/src/pages/_app.tsx

@ -30,12 +30,14 @@ export default function MyApp({Component, pageProps}: AppProps) {
return (
<AppShell>
<Component {...pageProps} />
<Script
strategy="lazyOnload"
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.NEXT_PUBLIC_GA_TRACKING_ID}`}
/>
<Script id="google-analytics" strategy="lazyOnload">
{`
{process.env.NODE_ENV === 'production' && (
<>
<Script
strategy="lazyOnload"
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.NEXT_PUBLIC_GA_TRACKING_ID}`}
/>
<Script id="google-analytics" strategy="lazyOnload">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
@ -43,7 +45,9 @@ export default function MyApp({Component, pageProps}: AppProps) {
page_path: window.location.pathname,
});
`}
</Script>
</Script>
</>
)}
</AppShell>
);
}

Loading…
Cancel
Save