Implement posthog

This commit is contained in:
2025-07-06 14:02:22 +03:00
parent f7d994d02e
commit 1e099d88ae
13 changed files with 209 additions and 41 deletions

View File

@@ -24,6 +24,8 @@ export default defineOAuthStravaEventHandler({
});
}
const posthog = event.context.posthog;
const userPayload = {
id: auth.user.id,
name: `${auth.user.firstname} ${auth.user.lastname}`,
@@ -80,6 +82,19 @@ export default defineOAuthStravaEventHandler({
user: userPayload,
});
posthog.identify({
distinctId: String(user!.id),
properties: {
name: user!.name,
country: user!.country,
},
});
posthog.capture({
distinctId: String(user!.id),
event: "user logged in",
});
sendRedirect(event, "/");
},
});