Skip to content

Commit

Permalink
Add logs for posthog in frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
maidul98 committed Jan 6, 2023
1 parent 37c66c2 commit 37998b8
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions frontend/components/analytics/posthog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@ import posthog from 'posthog-js';
import { ENV, POSTHOG_API_KEY, POSTHOG_HOST } from '../utilities/config';

export const initPostHog = () => {
if (typeof window !== 'undefined') {
// @ts-ignore
if (ENV == 'production' && TELEMETRY_CAPTURING_ENABLED) {
posthog.init(POSTHOG_API_KEY, {
api_host: POSTHOG_HOST
});
try {
if (typeof window !== 'undefined') {
// @ts-ignore
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, {
api_host: POSTHOG_HOST
});
}

console.log("Outside of posthog")
}
}

return posthog;
return posthog;
} catch (e) {
console.log("posthog err", e)
}
};

0 comments on commit 37998b8

Please sign in to comment.