Open source CapCut alternative.
TypeScript
feat(site): track cloud mode enables from the connect wall and settings
David Le23d2ccda6a5d
diff --git a/site/src/app/cut/app/(home)/settings/flags/page.tsx b/site/src/app/cut/app/(home)/settings/flags/page.tsxindex 67a03603..e5eff227 100644--- a/site/src/app/cut/app/(home)/settings/flags/page.tsx+++ b/site/src/app/cut/app/(home)/settings/flags/page.tsx@@ -2,6 +2,7 @@import { useEffect, useState } from "react";+import { track } from "@/lib/analytics";import { Switch } from "@/components/ui/switch";import { applyWebModeLocal } from "@/cut/lib/flags";@@ -32,7 +33,10 @@ export default function CutFeatureFlagsPage() {const toggle = (id: string, enabled: boolean) => {setFlags((cur) => cur?.map((f) => (f.id === id ? { ...f, enabled } : f)) ?? cur);- if (id === "cut-web-mode") applyWebModeLocal(enabled);+ if (id === "cut-web-mode") {+ applyWebModeLocal(enabled);+ if (enabled) track("cut_cloud_enable_clicked", { source: "settings_flags" });+ }void fetch("/api/account/feature-flags", {method: "PUT",headers: { "Content-Type": "application/json" },diff --git a/site/src/cut/components/ConnectGate.tsx b/site/src/cut/components/ConnectGate.tsxindex a16d6630..e46d3146 100644--- a/site/src/cut/components/ConnectGate.tsx+++ b/site/src/cut/components/ConnectGate.tsx@@ -159,6 +159,14 @@ export function ConnectGate({ children }: { children: ReactNode }) {const [cloudTrying, setCloudTrying] = useState(false);const [cloudError, setCloudError] = useState(false);const tryCloud = async () => {+ track("cut_cloud_enable_clicked", {+ source:+ gate === "blocked"+ ? "connect_gate_blocked"+ : needsAsk+ ? "connect_gate_ask"+ : "connect_gate_install",+ });setCloudTrying(true);setCloudError(false);const ok = await enableWebMode();diff --git a/site/src/lib/analytics.ts b/site/src/lib/analytics.tsindex a4d4600b..5581ca34 100644--- a/site/src/lib/analytics.ts+++ b/site/src/lib/analytics.ts@@ -11,6 +11,14 @@ export type AnalyticsEvents = {home_download_clicked: { location: "hero" | "final_cta" };// Install prompts on the Cut app home's connect gate.app_install_clicked: { source: "connect_gate_button" | "connect_gate_link" };+ // Cut cloud mode turned on (the cut-web-mode account flag).+ cut_cloud_enable_clicked: {+ source:+ | "connect_gate_install"+ | "connect_gate_ask"+ | "connect_gate_blocked"+ | "settings_flags";+ };// Cut projects home.project_created: { source: "projects_home" | "sidebar" | "file_import" };folder_created: void;