📈 (posthog) Send user last login event
This commit is contained in:
@@ -52,6 +52,12 @@ export const trackEvents = async (events: TelemetryEvent[]) => {
|
||||
properties:
|
||||
event.name === 'User updated'
|
||||
? { $set: event.data }
|
||||
: event.name === 'User logged in'
|
||||
? {
|
||||
$set: {
|
||||
lastActivityAt: new Date().toISOString(),
|
||||
},
|
||||
}
|
||||
: 'data' in event
|
||||
? event.data
|
||||
: undefined,
|
||||
|
||||
@@ -37,6 +37,12 @@ const userCreatedEventSchema = userEvent.merge(
|
||||
})
|
||||
)
|
||||
|
||||
const userLoggedInEventSchema = userEvent.merge(
|
||||
z.object({
|
||||
name: z.literal('User logged in'),
|
||||
})
|
||||
)
|
||||
|
||||
const userUpdatedEventSchema = userEvent.merge(
|
||||
z.object({
|
||||
name: z.literal('User updated'),
|
||||
@@ -173,6 +179,7 @@ export const clientSideEvents = [removedBrandingEventSchema] as const
|
||||
export const eventSchema = z.discriminatedUnion('name', [
|
||||
workspaceCreatedEventSchema,
|
||||
userCreatedEventSchema,
|
||||
userLoggedInEventSchema,
|
||||
typebotCreatedEventSchema,
|
||||
publishedTypebotEventSchema,
|
||||
subscriptionUpdatedEventSchema,
|
||||
|
||||
Reference in New Issue
Block a user