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_ID = 2411683
NEXT_PUBLIC_HJ_SITE_V = 6 NEXT_PUBLIC_HJ_SITE_V = 6
NEXT_PUBLIC_GA_TRACKING_ID = 'G-3918VS75Y6'

18
beta/src/pages/_app.tsx

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

Loading…
Cancel
Save