📈 Improvements to posthog analytics data (#1189)

This commit is contained in:
Luke Vella 2024-07-03 12:09:58 +01:00 committed by GitHub
parent 278713d57f
commit 587e11de17
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 93 additions and 80 deletions

View file

@ -77,7 +77,7 @@ export const auth = router({
locale: z.string().optional(),
}),
)
.mutation(async ({ input }) => {
.mutation(async ({ input, ctx }) => {
const payload = await decryptToken<RegistrationTokenPayload>(input.token);
if (!payload) {
@ -99,6 +99,19 @@ export const auth = router({
},
});
ctx.posthogClient?.capture({
event: "register",
distinctId: user.id,
properties: {
$set: {
email: user.email,
name: user.name,
timeZone: input.timeZone,
locale: input.locale,
},
},
});
return { ok: true, user };
}),
getUserPermission: publicProcedure

View file

@ -923,13 +923,7 @@ export const polls = router({
},
});
waitUntil(
Promise.all([
emailToHost,
...emailsToParticipants,
ctx.posthogClient?.flushAsync(),
]),
);
waitUntil(Promise.all([emailToHost, ...emailsToParticipants]));
}
}),
reopen: possiblyPublicProcedure