Browse Source

feat(posthog): Emit user activated event (#4886)

sp.wack 1 year ago
parent
commit
80fdb9a2f4
1 changed files with 6 additions and 0 deletions
  1. 6 0
      frontend/src/routes/_oh.app.tsx

+ 6 - 0
frontend/src/routes/_oh.app.tsx

@@ -11,6 +11,7 @@ import {
 import { useDispatch, useSelector } from "react-redux";
 import WebSocket from "ws";
 import toast from "react-hot-toast";
+import posthog from "posthog-js";
 import { getSettings } from "#/services/settings";
 import Security from "../components/modals/security/Security";
 import { Controls } from "#/components/controls";
@@ -159,6 +160,11 @@ function App() {
   const sendInitialQuery = (query: string, base64Files: string[]) => {
     const timestamp = new Date().toISOString();
     send(createChatMessage(query, base64Files, timestamp));
+
+    const userSettings = getSettings();
+    if (userSettings.LLM_API_KEY) {
+      posthog.capture("user_activated");
+    }
   };
 
   const handleOpen = React.useCallback(() => {