1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-10-28 00:35:48 -04:00

don't load fathom script unless on production

This commit is contained in:
2022-05-16 09:40:36 -04:00
parent cf4f2fe442
commit 2f695be18f
12 changed files with 40 additions and 46 deletions

View File

@@ -28,10 +28,14 @@ const App = ({ Component, pageProps }: AppProps) => {
const canonical = urlJoin(config.baseUrl, router.pathname === "/" ? "" : router.pathname, "/");
useEffect(() => {
// don't track pageviews on branch/deploy previews and localhost
if (process.env.NEXT_PUBLIC_VERCEL_ENV !== "production") {
return;
}
// https://usefathom.com/docs/integrations/next
// https://vercel.com/guides/deploying-nextjs-using-fathom-analytics-with-vercel
Fathom.load(config.fathomSiteId, {
// don't track branch/deploy previews and localhost
includedDomains: [config.siteDomain],
// we trigger pageview sending manually below, don't also do it on script load
auto: false,