File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ import { sendEmail } from '@/lib/messaging/email/mailer'
8080import { getFromEmailAddress , getPersonalEmailFrom } from '@/lib/messaging/email/utils'
8181import { quickValidateEmail } from '@/lib/messaging/email/validation'
8282import { scheduleLifecycleEmail } from '@/lib/messaging/lifecycle'
83- import { captureServerEvent } from '@/lib/posthog/server'
83+ import { captureServerEvent , getPostHogClient } from '@/lib/posthog/server'
8484import { syncAllWebhooksForCredentialSet } from '@/lib/webhooks/utils.server'
8585import { disableUserResources } from '@/lib/workflows/lifecycle'
8686import { SSO_TRUSTED_PROVIDERS } from '@/ee/sso/constants'
@@ -196,6 +196,21 @@ export const auth = betterAuth({
196196 // Telemetry should not fail the operation
197197 }
198198
199+ try {
200+ const client = getPostHogClient ( )
201+ if ( client ) {
202+ client . identify ( {
203+ distinctId : user . id ,
204+ properties : {
205+ ...( user . email ? { email : user . email } : { } ) ,
206+ ...( user . name ? { name : user . name } : { } ) ,
207+ } ,
208+ } )
209+ }
210+ } catch {
211+ // Telemetry should not fail the operation
212+ }
213+
199214 try {
200215 await handleNewUser ( user . id )
201216 } catch ( error ) {
@@ -396,6 +411,7 @@ export const auth = betterAuth({
396411 : SSO_TRUSTED_PROVIDERS . includes ( providerId )
397412 ? 'sso'
398413 : 'oauth'
414+
399415 captureServerEvent (
400416 account . userId ,
401417 'user_created' ,
You can’t perform that action at this time.
0 commit comments