diff --git a/src/lib/actions/analytics.ts b/src/lib/actions/analytics.ts index 9b09297af..1f77d0cc3 100644 --- a/src/lib/actions/analytics.ts +++ b/src/lib/actions/analytics.ts @@ -34,9 +34,10 @@ export function trackPageView(path: string) { function sendEventToGrowth(event: string, path: string, data: object = null): void { let email: string, name: string; - if (get(user)) { - email = get(user).email; - name = get(user).name; + const userStore = get(user); + if (userStore) { + email = userStore.email; + name = userStore.name; } fetch('https://growth.appwrite.io/v1/analytics', { method: 'POST',