Skip to content

An open-source, faster Devin alternative

TypeScript

Track the link card's funnel: link_shown, linked

Igor Zalutski via Computera25542f27fe0
diff --git a/web/src/managed-agents/AgentStep.test.tsx b/web/src/managed-agents/AgentStep.test.tsx
index 70119286..3d0f1bda 100644
--- a/web/src/managed-agents/AgentStep.test.tsx
+++ b/web/src/managed-agents/AgentStep.test.tsx
@@ -920,6 +920,8 @@ describe('choosing the coding agent', () => {
'Linked to your Slack account.',
)
expect(computerApi.createConnectCode).toHaveBeenCalledTimes(1)
+ expect(capture).toHaveBeenCalledWith('computer.agent.link_shown')
+ expect(capture).toHaveBeenCalledWith('computer.agent.linked')
// A used code is never offered again.
expect(Object.keys(window.localStorage)).toEqual([])
})
diff --git a/web/src/managed-agents/AgentStep.tsx b/web/src/managed-agents/AgentStep.tsx
index b6925335..42e86c20 100644
--- a/web/src/managed-agents/AgentStep.tsx
+++ b/web/src/managed-agents/AgentStep.tsx
@@ -35,6 +35,8 @@ import {
trackAgentConnected,
trackAgentFailed,
trackAgentStepShown,
+ trackLinked,
+ trackLinkShown,
} from './computer-analytics'
import {
computerConnectCodeQueryKey,
@@ -713,6 +715,9 @@ function LinkSlack() {
// Set with the link, before this unmounts: the forgotten code's query is
// still observed until then, and must not mint again.
const [linked, setLinked] = useState(false)
+ useEffect(() => {
+ trackLinkShown()
+ }, [])
const {
query: code,
renew: renewCode,
@@ -741,6 +746,7 @@ function LinkSlack() {
announced.current = true
setLinked(true)
forget()
+ trackLinked()
notifySuccess('Linked to your Slack account.')
}
check(queryClient.getQueryData<ComputerStatus>(computerQueryKey))
diff --git a/web/src/managed-agents/computer-analytics.ts b/web/src/managed-agents/computer-analytics.ts
index ff275d36..e4fc2a4e 100644
--- a/web/src/managed-agents/computer-analytics.ts
+++ b/web/src/managed-agents/computer-analytics.ts
@@ -22,6 +22,18 @@ export function trackAgentStepShown(): void {
posthog.capture('computer.setup.agent_shown')
}
+/**
+ * The link card (work 083): shown to someone not linked to Slack, and the
+ * link landing while it is open. Linked over shown is the card's funnel.
+ */
+export function trackLinkShown(): void {
+ posthog.capture('computer.agent.link_shown')
+}
+
+export function trackLinked(): void {
+ posthog.capture('computer.agent.linked')
+}
+
/** Fired once the server has recorded the choice, never on the click. */
export function trackAgentChosen(choice: AgentChoice): void {
posthog.capture('computer.setup.agent_chosen', { choice })