Skip to content

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

chore: add cmd_k_menu:opened event for main menu "go to..." button (#5351)

Marc Klingen334d34ac159e
diff --git a/web/src/components/layouts/routes.tsx b/web/src/components/layouts/routes.tsx
index 1c494815ee..b0325c30b3 100644
--- a/web/src/components/layouts/routes.tsx
+++ b/web/src/components/layouts/routes.tsx
@@ -23,6 +23,7 @@ import { type OrganizationScope } from "@/src/features/rbac/constants/organizati
import { SupportMenuDropdown } from "@/src/components/nav/support-menu-dropdown";
import { SidebarMenuButton } from "@/src/components/ui/sidebar";
import { useCommandMenu } from "@/src/features/command-k-menu/CommandMenuProvider";
+import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
export type Route = {
title: string;
@@ -173,10 +174,16 @@ export const ROUTES: Route[] = [
function CommandMenuTrigger() {
const { setOpen } = useCommandMenu();
+ const capture = usePostHogClientCapture();
return (
<SidebarMenuButton
- onClick={() => setOpen(true)}
+ onClick={() => {
+ capture("cmd_k_menu:opened", {
+ source: "main_navigation",
+ });
+ setOpen(true);
+ }}
className="whitespace-nowrap"
>
<Search className="h-4 w-4" />
diff --git a/web/src/features/command-k-menu/CommandMenu.tsx b/web/src/features/command-k-menu/CommandMenu.tsx
index 907afdb83f..3d7d579cfa 100644
--- a/web/src/features/command-k-menu/CommandMenu.tsx
+++ b/web/src/features/command-k-menu/CommandMenu.tsx
@@ -63,7 +63,9 @@ export function CommandMenu({
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
e.preventDefault();
if (!open) {
- capture("cmd_k_menu:opened");
+ capture("cmd_k_menu:opened", {
+ source: "cmd_k",
+ });
}
setOpen(!open);
}