Make capturing according to serverless

This commit is contained in:
2025-07-06 20:23:54 +03:00
parent 1e099d88ae
commit 963ac7111f
6 changed files with 31 additions and 19 deletions

View File

@@ -54,15 +54,7 @@ export default defineEventHandler(async (event) => {
});
});
posthog.identify({
distinctId: String(user.id),
properties: {
name: user.name,
country: user.country,
},
});
posthog.capture({
posthog.captureImmediate({
distinctId: String(user.id),
event: "content generated",
properties: {

View File

@@ -20,7 +20,7 @@ export default defineEventHandler(async (event) => {
},
});
posthog.identify({
posthog.identifyImmediate({
distinctId: String(user!.id),
properties: {
name: user!.name,
@@ -32,7 +32,7 @@ export default defineEventHandler(async (event) => {
.delete(tables.users)
.where(eq(tables.users.id, get(body, "object_id")));
posthog.capture({
posthog.captureImmediate({
distinctId: get(body, "object_id"),
event: "user deleted",
});