From 14b12459c94e2ddc8a4f46c398da973485d40a9d Mon Sep 17 00:00:00 2001 From: Kyrylo Shmidt Date: Mon, 3 Apr 2023 12:20:47 +0200 Subject: [PATCH 1/3] Add action to track user activity events in Installation Wizard --- src/components/InstallationWizard/index.tsx | 32 +++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/components/InstallationWizard/index.tsx b/src/components/InstallationWizard/index.tsx index 1ba707f23..0f14be6a2 100644 --- a/src/components/InstallationWizard/index.tsx +++ b/src/components/InstallationWizard/index.tsx @@ -1,5 +1,6 @@ import { useEffect, useState } from "react"; import { dispatcher } from "../../dispatcher"; +import { usePrevious } from "../../hooks/usePrevious"; import { getActions } from "../../utils/getActions"; import { actions as globalActions } from "../common/App"; import { Loader } from "../common/Loader"; @@ -23,6 +24,7 @@ const firstStep = window.wizardSkipInstallationStep === true ? 1 : 0; export const InstallationWizard = () => { const [currentStep, setCurrentStep] = useState(firstStep); + const previousStep = usePrevious(currentStep); const [isCollectorModified, setIsCollectorModified] = useState(false); const [isAlreadyUsingOtel, setIsAlreadyUsingOtel] = useState(false); @@ -30,6 +32,26 @@ export const InstallationWizard = () => { useState(); useEffect(() => { + if (previousStep === 0 && currentStep === 1) { + window.sendMessageToDigma({ + action: globalActions.sendTrackingEvent, + payload: { + id: "INSTALLATION_WIZARD_INSTALL_STEP_PASS" + } + }); + } + }, [previousStep, currentStep]); + + useEffect(() => { + if (firstStep === 1) { + window.sendMessageToDigma({ + action: globalActions.sendTrackingEvent, + payload: { + id: "INSTALLATION_WIZARD_INSTALL_STEP_AUTOMATIC_PASS" + } + }); + } + const handleConnectionCheckResultData = (data: unknown) => { const result = (data as ConnectionCheckResultData).result; setConnectionCheckStatus(result); @@ -66,6 +88,12 @@ export const InstallationWizard = () => { url: "https://open.docker.com/extensions/marketplace?extensionId=digmaai/digma-docker-extension" } }); + window.sendMessageToDigma({ + action: globalActions.sendTrackingEvent, + payload: { + id: "INSTALLATION_WIZARD_GET_DIGMA_DOCKER_EXTENSION_BUTTON_CLICK" + } + }); }; const handleContinueButtonClick = () => { @@ -107,7 +135,7 @@ export const InstallationWizard = () => { <> Install Digma Docker Extension - (You’ll need{" "} + (You'll need{" "} { backend: - (You’ll need{" "} + (You'll need{" "} Date: Mon, 3 Apr 2023 12:22:19 +0200 Subject: [PATCH 2/3] Add global action for tracking events --- src/components/common/App/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/common/App/index.tsx b/src/components/common/App/index.tsx index e1db74e5e..cf42f547f 100644 --- a/src/components/common/App/index.tsx +++ b/src/components/common/App/index.tsx @@ -31,7 +31,8 @@ export const actions = getActions(ACTION_PREFIX, { setColorMode: "SET_THEME", setMainFont: "SET_MAIN_FONT", setCodeFont: "SET_CODE_FONT", - openURLInDefaultBrowser: "OPEN_URL_IN_DEFAULT_BROWSER" + openURLInDefaultBrowser: "OPEN_URL_IN_DEFAULT_BROWSER", + sendTrackingEvent: "SEND_TRACKING_EVENT" }); export const App = (props: AppProps) => { From 3eaee7a83d6300bc99a9977a9502ad335ab9cc51 Mon Sep 17 00:00:00 2001 From: Kyrylo Shmidt Date: Tue, 4 Apr 2023 08:03:50 +0200 Subject: [PATCH 3/3] Rename treacking event names --- assets/recentActivity/index.ejs | 1 + src/components/InstallationWizard/index.tsx | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/assets/recentActivity/index.ejs b/assets/recentActivity/index.ejs index 1f10c634c..2e79cbe8d 100644 --- a/assets/recentActivity/index.ejs +++ b/assets/recentActivity/index.ejs @@ -19,6 +19,7 @@ window.theme; window.mainFont; window.codeFont; + window.isJaegerEnabled; window.recentActivityRefreshInterval; window.recentActivityExpirationLimit; window.recentActivityDocumentationURL; diff --git a/src/components/InstallationWizard/index.tsx b/src/components/InstallationWizard/index.tsx index 0f14be6a2..4ae55f299 100644 --- a/src/components/InstallationWizard/index.tsx +++ b/src/components/InstallationWizard/index.tsx @@ -36,7 +36,7 @@ export const InstallationWizard = () => { window.sendMessageToDigma({ action: globalActions.sendTrackingEvent, payload: { - id: "INSTALLATION_WIZARD_INSTALL_STEP_PASS" + event_name: "installation wizard install step passed" } }); } @@ -47,7 +47,7 @@ export const InstallationWizard = () => { window.sendMessageToDigma({ action: globalActions.sendTrackingEvent, payload: { - id: "INSTALLATION_WIZARD_INSTALL_STEP_AUTOMATIC_PASS" + event_name: "installation wizard install step automatically passed" } }); } @@ -91,7 +91,8 @@ export const InstallationWizard = () => { window.sendMessageToDigma({ action: globalActions.sendTrackingEvent, payload: { - id: "INSTALLATION_WIZARD_GET_DIGMA_DOCKER_EXTENSION_BUTTON_CLICK" + event_name: + "installation wizard get digma docker extension button clicked" } }); };