Skip to content

Commit 73e0229

Browse files
committed
feat(vercel): send Loops event when install starts
Add a fire-and-forget call to loopsClient.vercelIntegrationStarted from the Vercel installation route so we emit a "vercel-integration" event when a user begins the Vercel integration flow. Implement vercelIntegrationStarted in services/loops.server to log and dispatch the event payload (email, userId, firstName, eventName). This provides visibility into integration adoption without blocking the redirect flow. Error handling is intentionally silent to avoid affecting user experience.
1 parent c292f81 commit 73e0229

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

apps/webapp/app/routes/vercel.install.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { z } from "zod";
44
import { $replica } from "~/db.server";
55
import { requireUser } from "~/services/session.server";
66
import { logger } from "~/services/logger.server";
7+
import { loopsClient } from "~/services/loops.server";
78
import { OrgIntegrationRepository } from "~/models/orgIntegration.server";
89
import { generateVercelOAuthState } from "~/v3/vercel/vercelOAuthState.server";
910
import { findProjectBySlug } from "~/models/project.server";
@@ -65,6 +66,15 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
6566
projectSlug: project_slug,
6667
});
6768

69+
// Send Loops.so event (fire-and-forget, don't block the redirect)
70+
loopsClient
71+
?.vercelIntegrationStarted({
72+
userId: user.id,
73+
email: user.email,
74+
name: user.name,
75+
})
76+
.catch(() => {});
77+
6878
// Generate Vercel install URL
6979
const vercelInstallUrl = OrgIntegrationRepository.vercelInstallUrl(stateToken);
7080

apps/webapp/app/services/loops.server.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,24 @@ class LoopsClient {
2222
});
2323
}
2424

25+
async vercelIntegrationStarted({
26+
userId,
27+
email,
28+
name,
29+
}: {
30+
userId: string;
31+
email: string;
32+
name: string | null;
33+
}) {
34+
logger.info(`Loops send "vercel-integration" event`, { userId, email, name });
35+
return this.#sendEvent({
36+
email,
37+
userId,
38+
firstName: name?.split(" ").at(0),
39+
eventName: "vercel-integration",
40+
});
41+
}
42+
2543
async #sendEvent({
2644
email,
2745
userId,

0 commit comments

Comments
 (0)