Add telemetry to frontend

This commit is contained in:
Vladyslav Matsiiako
2022-11-25 16:08:56 -05:00
parent d70d1f23d8
commit 22e7137e74
7 changed files with 35 additions and 14 deletions
+2 -1
View File
@@ -7,6 +7,7 @@ import { publicPaths } from "../const.js";
import { useEffect } from "react";
import { useRouter } from "next/router";
import { initPostHog } from "../components/analytics/posthog";
import { ENV } from "../components/utilities/config";
config.autoAddCss = false;
@@ -20,7 +21,7 @@ const App = ({ Component, pageProps, ...appProps }) => {
const handleRouteChange = () => {
if (typeof window !== "undefined") {
if (process.env.NEXT_PUBLIC_ENV == "production") {
if (ENV == "production") {
posthog.capture("$pageview");
}
}