Guides / SaaS
Account deletions are the clearest churn signal you have. Unlike subscription cancellations (which might be pauses), a deletion is deliberate. Logging it gives you:
export async function logAccountDeletion(userId: string, email: string, plan: string, reason?: string) {
await logit.now("deletions", {
event: "Account deleted",
description: `${email} deleted their account${reason ? ` — "${reason}"` : ""}`,
icon: "🗑️",
notify: true,
tags: {
plan,
reason: reason ?? "not_provided",
hadPaidPlan: plan !== "free" ? "true" : "false",
},
metadata: {
userId,
email,
plan,
reason: reason ?? null,
deletedAt: new Date().toISOString(),
},
});
}
// app/api/account/delete/route.ts
export async function DELETE(req: Request) {
const { reason } = await req.json() as { reason?: string };
const user = await getAuthUser(req);
// Log before deleting — you need the user data
await logAccountDeletion(user.id, user.email, user.plan, reason);
await db.user.delete({ where: { id: user.id } });
return new Response(null, { status: 204 });
}
| Field | Value |
|---|---|
| Name | Deletion spike |
| Channel | deletions |
| Event name | Account deleted |
| Threshold | 3 |
| Window | 2 hours |
| Cooldown | 6 hours |
| Action | Push notification |
notify: true on every deletion — paid plan deletions especially deserve immediate attention.hadPaidPlan: "true" as a tag to quickly filter for high-value departures in the dashboard.Try LogIt free
7-day trial. No credit card required.