Skip to content

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

chore(web): Track error notification clicks (#13386)

Ben Bachemb92e60618c71
diff --git a/web/src/features/notifications/ErrorNotification.tsx b/web/src/features/notifications/ErrorNotification.tsx
index 54fb192dc1..bcce0a029d 100644
--- a/web/src/features/notifications/ErrorNotification.tsx
+++ b/web/src/features/notifications/ErrorNotification.tsx
@@ -1,4 +1,5 @@
import { Button } from "@/src/components/ui/button";
+import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
import { useSupportDrawer } from "@/src/features/support-chat/SupportDrawerProvider";
import { AlertTriangle, X } from "lucide-react";
@@ -20,6 +21,7 @@ export const ErrorNotification: React.FC<ErrorNotificationProps> = ({
path,
}) => {
const { setOpen } = useSupportDrawer();
+ const capture = usePostHogClientCapture();
const isError = type === "ERROR";
const textColor = isError
? "text-destructive-foreground"
@@ -61,6 +63,10 @@ export const ErrorNotification: React.FC<ErrorNotificationProps> = ({
variant="errorNotification"
size={"sm"}
onClick={() => {
+ capture("toast:report_issue", {
+ toast_type: type,
+ path,
+ });
setOpen(true);
}}
>
@@ -70,7 +76,13 @@ export const ErrorNotification: React.FC<ErrorNotificationProps> = ({
</div>
<button
className={`flex h-6 w-6 cursor-pointer items-start justify-end border-none bg-transparent p-0 ${textColor} transition-colors duration-200`}
- onClick={() => dismissToast(toast)}
+ onClick={() => {
+ capture("toast:dismiss", {
+ toast_type: type,
+ path,
+ });
+ dismissToast(toast);
+ }}
onPointerDown={(e) => {
e.stopPropagation();
e.preventDefault();
diff --git a/web/src/features/posthog-analytics/usePostHogClientCapture.ts b/web/src/features/posthog-analytics/usePostHogClientCapture.ts
index 01d3e11f08..862f49c8ca 100644
--- a/web/src/features/posthog-analytics/usePostHogClientCapture.ts
+++ b/web/src/features/posthog-analytics/usePostHogClientCapture.ts
@@ -166,6 +166,7 @@ export const events = {
"compare_run_removed",
],
notification: ["click_link", "dismiss_notification"],
+ toast: ["report_issue", "dismiss"],
tag: [
"add_existing_tag",
"remove_tag",