From 3dbae2d278b122908c351aa9f961ef90a9f82d7e Mon Sep 17 00:00:00 2001 From: Eric Lammertsma Date: Fri, 20 Feb 2026 09:37:49 -0500 Subject: [PATCH 1/2] feat: add PostHog last_seen_at property --- surfsense_web/instrumentation-client.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/surfsense_web/instrumentation-client.ts b/surfsense_web/instrumentation-client.ts index e6b346073..0193b2754 100644 --- a/surfsense_web/instrumentation-client.ts +++ b/surfsense_web/instrumentation-client.ts @@ -12,6 +12,15 @@ if (process.env.NEXT_PUBLIC_POSTHOG_KEY) { capture_pageview: "history_change", // Enable session recording capture_pageleave: true, + before_send: (event) => { + if (event.properties) { + event.properties.$set = { + ...event.properties.$set, + last_seen_at: new Date().toISOString(), + }; + } + return event; + }, loaded: (posthog) => { // Expose PostHog to window for console access and toolbar if (typeof window !== "undefined") { From cdd9b4b4b515e64aa0cd64189f7e2d536e552a13 Mon Sep 17 00:00:00 2001 From: Eric Lammertsma Date: Fri, 20 Feb 2026 10:19:28 -0500 Subject: [PATCH 2/2] feat: include user display name in PostHog identification --- .../components/providers/PostHogIdentify.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/surfsense_web/components/providers/PostHogIdentify.tsx b/surfsense_web/components/providers/PostHogIdentify.tsx index 51fae8747..cb11d6fe7 100644 --- a/surfsense_web/components/providers/PostHogIdentify.tsx +++ b/surfsense_web/components/providers/PostHogIdentify.tsx @@ -26,12 +26,12 @@ export function PostHogIdentify() { // Only identify if this is a new user or different from previous if (previousUserIdRef.current !== userId) { - identifyUser(userId, { - email: user.email, - // Add any other user properties you want to track - is_superuser: user.is_superuser, - is_verified: user.is_verified, - }); + identifyUser(userId, { + email: user.email, + name: user.display_name, + is_superuser: user.is_superuser, + is_verified: user.is_verified, + }); previousUserIdRef.current = userId; } }