fix(posthog): set email and name on person profile at signup (#4152)

This commit is contained in:
Waleed
2026-04-13 22:19:09 -07:00
committed by GitHub
parent 48d5101151
commit 8a8bc1b0e6
+17 -1
View File
@@ -80,7 +80,7 @@ import { sendEmail } from '@/lib/messaging/email/mailer'
import { getFromEmailAddress, getPersonalEmailFrom } from '@/lib/messaging/email/utils'
import { quickValidateEmail } from '@/lib/messaging/email/validation'
import { scheduleLifecycleEmail } from '@/lib/messaging/lifecycle'
import { captureServerEvent } from '@/lib/posthog/server'
import { captureServerEvent, getPostHogClient } from '@/lib/posthog/server'
import { syncAllWebhooksForCredentialSet } from '@/lib/webhooks/utils.server'
import { disableUserResources } from '@/lib/workflows/lifecycle'
import { SSO_TRUSTED_PROVIDERS } from '@/ee/sso/constants'
@@ -196,6 +196,21 @@ export const auth = betterAuth({
// Telemetry should not fail the operation
}
try {
const client = getPostHogClient()
if (client) {
client.identify({
distinctId: user.id,
properties: {
...(user.email ? { email: user.email } : {}),
...(user.name ? { name: user.name } : {}),
},
})
}
} catch {
// Telemetry should not fail the operation
}
try {
await handleNewUser(user.id)
} catch (error) {
@@ -396,6 +411,7 @@ export const auth = betterAuth({
: SSO_TRUSTED_PROVIDERS.includes(providerId)
? 'sso'
: 'oauth'
captureServerEvent(
account.userId,
'user_created',