Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

feat(analytics): add user id to backend activity events (#16318)

Max Deichmann978188d8b4bd
diff --git a/web/src/__tests__/server/unit/backendActivity.servertest.ts b/web/src/__tests__/server/unit/backendActivity.servertest.ts
index 66ab9ec267..05ace9e208 100644
--- a/web/src/__tests__/server/unit/backendActivity.servertest.ts
+++ b/web/src/__tests__/server/unit/backendActivity.servertest.ts
@@ -73,6 +73,7 @@ describe("backend activity tracking", () => {
cloudRegion: "US",
organizationId: "org-1",
projectId: "project-1",
+ userId: "user-1",
},
timestamp: new Date("2026-08-10T12:00:00.000Z"),
disableGeoip: true,
@@ -97,6 +98,7 @@ describe("backend activity tracking", () => {
activityScope: "organization",
cloudRegion: "US",
organizationId: "org-1",
+ userId: "user-1",
},
}),
);
@@ -108,6 +110,7 @@ describe("backend activity tracking", () => {
cloudRegion: "US",
organizationId: "org-1",
projectId: "project-1",
+ userId: "user-1",
},
}),
);
diff --git a/web/src/features/posthog-analytics/server/backendActivity.ts b/web/src/features/posthog-analytics/server/backendActivity.ts
index 3f67d6ded6..2bbf9e96dc 100644
--- a/web/src/features/posthog-analytics/server/backendActivity.ts
+++ b/web/src/features/posthog-analytics/server/backendActivity.ts
@@ -77,6 +77,7 @@ export const createBackendActivityTracker = ({
cloudRegion,
organizationId,
...(projectId ? { projectId } : {}),
+ userId,
},
timestamp,
disableGeoip: true,