fix: add posthog error monitor

This commit is contained in:
David Nguyen
2025-02-25 15:14:45 +11:00
parent cedd5e87b1
commit 7e8955b89c
17 changed files with 175 additions and 148 deletions

View File

@ -20,6 +20,20 @@ export function useAnalytics() {
posthog.capture(event, properties);
};
/**
* Capture an analytic event.
*
* @param error The error to capture.
* @param properties Properties to attach to the event.
*/
const captureException = (error: Error, properties?: Record<string, unknown>) => {
if (!isPostHogEnabled) {
return;
}
posthog.captureException(error, properties);
};
/**
* Start the session recording.
*
@ -53,6 +67,7 @@ export function useAnalytics() {
return {
capture,
captureException,
startSessionRecording,
stopSessionRecording,
};