trying out analytics

This commit is contained in:
Kyle Corbitt
2023-06-27 00:11:07 -07:00
parent 267a5381f3
commit f6f93a1161
8 changed files with 43 additions and 12 deletions

13
src/utils/analytics.ts Normal file
View File

@@ -0,0 +1,13 @@
// Make sure we're in the browser
import posthog from "posthog-js";
import { env } from "~/env.mjs";
const enableAnalytics = typeof window !== "undefined";
if (enableAnalytics) {
if (env.NEXT_PUBLIC_POSTHOG_KEY) {
posthog.init(env.NEXT_PUBLIC_POSTHOG_KEY, {
api_host: "https://app.posthog.com",
});
}
}