From cbf3e42b5020401d3636709a22eb41d41164e0df Mon Sep 17 00:00:00 2001 From: Sahaj Jain Date: Sun, 1 Jun 2025 00:19:09 +0530 Subject: [PATCH] fix: Add back analytics for ai gen theme --- hooks/use-ai-theme-generation.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hooks/use-ai-theme-generation.ts b/hooks/use-ai-theme-generation.ts index 31d62a8c..dfc91249 100644 --- a/hooks/use-ai-theme-generation.ts +++ b/hooks/use-ai-theme-generation.ts @@ -1,10 +1,12 @@ import { toast } from "@/components/ui/use-toast"; import { useAIThemeGenerationStore } from "@/store/ai-theme-generation-store"; +import { usePostHog } from "posthog-js/react"; export function useAIThemeGeneration() { const generateTheme = useAIThemeGenerationStore((state) => state.generateTheme); const loading = useAIThemeGenerationStore((state) => state.loading); const cancelThemeGeneration = useAIThemeGenerationStore((state) => state.cancelThemeGeneration); + const posthog = usePostHog(); const handleGenerateTheme = async (prompt: string) => { try { @@ -15,6 +17,10 @@ export function useAIThemeGeneration() { description: "Your AI-generated theme has been applied", }); + posthog.capture("AI_GENERATE_THEME", { + prompt, + }); + return result; // Return the result from the store } catch (error) { if (error instanceof Error && error.name === "AbortError") {