Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Rename frontend automation telemetry events (#1943)

Rohit Malhotra7ff8989b6314
diff --git a/__tests__/components/automations/create-instructions.test.tsx b/__tests__/components/automations/create-instructions.test.tsx
index 415bbf916b..85ba36936b 100644
--- a/__tests__/components/automations/create-instructions.test.tsx
+++ b/__tests__/components/automations/create-instructions.test.tsx
@@ -95,14 +95,14 @@ describe("CreateInstructions", () => {
captureMock.mockRestore();
});
- it("captures automation_created with the active backend kind when Create Automation is clicked", async () => {
+ it("captures automation_created_button with the active backend kind when Create Automation is clicked", async () => {
const user = userEvent.setup();
renderCreateInstructions();
await user.click(screen.getByTestId("automations-create-automation"));
expect(captureMock).toHaveBeenCalledWith(
- "automation_created",
+ "automation_created_button",
expect.objectContaining({ backend_kind: "local" }),
);
});
diff --git a/__tests__/hooks/query/use-automations-backend-switch.test.tsx b/__tests__/hooks/query/use-automations-backend-switch.test.tsx
index d6dfc0e373..c2a711ec1e 100644
--- a/__tests__/hooks/query/use-automations-backend-switch.test.tsx
+++ b/__tests__/hooks/query/use-automations-backend-switch.test.tsx
@@ -307,7 +307,7 @@ describe("automation mutation hooks β€” analytics tracking", () => {
});
});
- it("captures automation_deactivated when an automation is disabled", async () => {
+ it("captures automation_disable_button when an automation is disabled", async () => {
const { result } = renderHook(() => useToggleAutomation(), {
wrapper: makeWrapper(),
});
@@ -318,13 +318,13 @@ describe("automation mutation hooks β€” analytics tracking", () => {
await waitFor(() => {
expect(captureMock).toHaveBeenCalledWith(
- "automation_deactivated",
+ "automation_disable_button",
expect.objectContaining({ backend_kind: "local" }),
);
});
});
- it("does not capture automation_deactivated when an automation is enabled", async () => {
+ it("does not capture automation_disable_button when an automation is enabled", async () => {
const { result } = renderHook(() => useToggleAutomation(), {
wrapper: makeWrapper(),
});
@@ -334,7 +334,7 @@ describe("automation mutation hooks β€” analytics tracking", () => {
});
expect(captureMock).not.toHaveBeenCalledWith(
- "automation_deactivated",
+ "automation_disable_button",
expect.anything(),
);
});
diff --git a/src/components/features/automations/create-instructions.tsx b/src/components/features/automations/create-instructions.tsx
index f6bfe9cc0e..3433dc0cbd 100644
--- a/src/components/features/automations/create-instructions.tsx
+++ b/src/components/features/automations/create-instructions.tsx
@@ -55,10 +55,10 @@ export function CreateInstructionsContent({
const { t } = useTranslation("openhands");
const launchInChat = useLaunchSkillInChat();
const active = useActiveBackend();
- const { trackAutomationCreated } = useTracking();
+ const { trackAutomationCreatedButton } = useTracking();
const handleCreateAutomation = () => {
- trackAutomationCreated({ backendKind: active.backend.kind });
+ trackAutomationCreatedButton({ backendKind: active.backend.kind });
launchInChat(t(I18nKey.AUTOMATIONS$CREATE_AUTOMATION_PROMPT), onLaunch);
};
diff --git a/src/hooks/query/use-automations.ts b/src/hooks/query/use-automations.ts
index 32cb4f7377..cd34aab39f 100644
--- a/src/hooks/query/use-automations.ts
+++ b/src/hooks/query/use-automations.ts
@@ -35,7 +35,7 @@ export function useAutomations(options: UseAutomationsOptions = {}) {
export function useToggleAutomation() {
const queryClient = useQueryClient();
const active = useActiveBackend();
- const { trackAutomationDeactivated } = useTracking();
+ const { trackAutomationDisableButton } = useTracking();
return useMutation({
mutationFn: ({ id, enabled }: { id: string; enabled: boolean }) =>
AutomationService.toggleAutomation(id, enabled),
@@ -43,7 +43,7 @@ export function useToggleAutomation() {
queryClient.invalidateQueries({ queryKey: AUTOMATIONS_QUERY_KEY });
queryClient.invalidateQueries({ queryKey: AUTOMATION_DETAIL_QUERY_KEY });
if (!variables.enabled) {
- trackAutomationDeactivated({ backendKind: active.backend.kind });
+ trackAutomationDisableButton({ backendKind: active.backend.kind });
}
},
});
diff --git a/src/hooks/use-tracking.ts b/src/hooks/use-tracking.ts
index 16e7fe6095..160e745825 100644
--- a/src/hooks/use-tracking.ts
+++ b/src/hooks/use-tracking.ts
@@ -202,12 +202,12 @@ export const useTracking = () => {
track("conversation_exported", { format });
};
- const trackAutomationCreated = ({
+ const trackAutomationCreatedButton = ({
backendKind,
}: {
backendKind: BackendKind;
}) => {
- track("automation_created", { backend_kind: backendKind });
+ track("automation_created_button", { backend_kind: backendKind });
};
const trackAutomationExecuted = ({
@@ -226,12 +226,12 @@ export const useTracking = () => {
track("automation_deleted", { backend_kind: backendKind });
};
- const trackAutomationDeactivated = ({
+ const trackAutomationDisableButton = ({
backendKind,
}: {
backendKind: BackendKind;
}) => {
- track("automation_deactivated", { backend_kind: backendKind });
+ track("automation_disable_button", { backend_kind: backendKind });
};
const trackAutomationEdited = ({
@@ -346,10 +346,10 @@ export const useTracking = () => {
trackMcpConfigUpdated,
trackDownloadTrajectoryButtonClicked,
trackConversationExported,
- trackAutomationCreated,
+ trackAutomationCreatedButton,
trackAutomationExecuted,
trackAutomationDeleted,
- trackAutomationDeactivated,
+ trackAutomationDisableButton,
trackAutomationEdited,
trackAutomationExported,
trackAutomationImported,