trying out analytics
This commit is contained in:
13
src/utils/analytics.ts
Normal file
13
src/utils/analytics.ts
Normal 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",
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user