Add logs for posthog in frontend

This commit is contained in:
Maidul Islam
2023-01-05 23:15:30 -05:00
parent 37c66c2499
commit 37998b84a9
+7
View File
@@ -5,14 +5,21 @@ import posthog from 'posthog-js';
import { ENV, POSTHOG_API_KEY, POSTHOG_HOST } from '../utilities/config'; import { ENV, POSTHOG_API_KEY, POSTHOG_HOST } from '../utilities/config';
export const initPostHog = () => { export const initPostHog = () => {
try {
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
// @ts-ignore // @ts-ignore
if (ENV == 'production' && TELEMETRY_CAPTURING_ENABLED) { if (ENV == 'production' && TELEMETRY_CAPTURING_ENABLED) {
console.log("Outside of posthog", "POSTHOG_API_KEY", POSTHOG_API_KEY, "POSTHOG_HOST", POSTHOG_HOST)
posthog.init(POSTHOG_API_KEY, { posthog.init(POSTHOG_API_KEY, {
api_host: POSTHOG_HOST api_host: POSTHOG_HOST
}); });
} }
console.log("Outside of posthog")
} }
return posthog; return posthog;
} catch (e) {
console.log("posthog err", e)
}
}; };