From e13fa38d32842629479df5910bcfcb9241b45599 Mon Sep 17 00:00:00 2001 From: Ana Maksimovskikh Date: Thu, 15 Aug 2024 16:15:51 +0100 Subject: [PATCH] [web] Add GA tracking for some onboarding actions --- apps/web/src/components/Footer/Footer.tsx | 7 ++- .../ImportWallet/ImportBackupTab.tsx | 2 + .../OnboardOptions/OnboardOptions.tsx | 20 +++++-- .../OnboardOptions/useOnboardWithSocial.tsx | 7 +++ apps/web/src/utils/analytics.ts | 60 +++++++++++++++++++ 5 files changed, 90 insertions(+), 6 deletions(-) create mode 100644 apps/web/src/utils/analytics.ts diff --git a/apps/web/src/components/Footer/Footer.tsx b/apps/web/src/components/Footer/Footer.tsx index 58705694c3..2809e5d5e6 100644 --- a/apps/web/src/components/Footer/Footer.tsx +++ b/apps/web/src/components/Footer/Footer.tsx @@ -1,6 +1,7 @@ import { Flex, Link, Text } from "@chakra-ui/react"; import { useColor } from "../../styles/useColor"; +import { trackButtonClick } from "../../utils/analytics"; export const Footer = () => { const color = useColor(); @@ -29,7 +30,11 @@ export const Footer = () => { > Terms - + trackButtonClick("onboarding", "open_terms_of_use")} + > Privacy diff --git a/apps/web/src/components/Onboarding/ImportWallet/ImportBackupTab.tsx b/apps/web/src/components/Onboarding/ImportWallet/ImportBackupTab.tsx index ad8f23e727..144025b002 100644 --- a/apps/web/src/components/Onboarding/ImportWallet/ImportBackupTab.tsx +++ b/apps/web/src/components/Onboarding/ImportWallet/ImportBackupTab.tsx @@ -15,6 +15,7 @@ import { FormProvider } from "react-hook-form"; import { CheckmarkIcon, CloseIcon, FileUploadIcon } from "../../../assets/icons"; import { useColor } from "../../../styles/useColor"; +import { trackSuccessfulConnection } from "../../../utils/analytics"; import { persistor } from "../../../utils/persistor"; import { PasswordInput } from "../../PasswordInput"; @@ -42,6 +43,7 @@ export const ImportBackupTab = () => { } const backup = JSON.parse(await file[0].text()); await restoreBackup(backup, password, persistor); + trackSuccessfulConnection("onboarding", "restore_from_backup"); }); const { ref, ...inputRegisterProps } = register("file", { diff --git a/apps/web/src/components/Onboarding/OnboardOptions/OnboardOptions.tsx b/apps/web/src/components/Onboarding/OnboardOptions/OnboardOptions.tsx index 8ec26e02d8..118b0c35f4 100644 --- a/apps/web/src/components/Onboarding/OnboardOptions/OnboardOptions.tsx +++ b/apps/web/src/components/Onboarding/OnboardOptions/OnboardOptions.tsx @@ -7,6 +7,7 @@ import { OnboardWithGoogleButton } from "./OnboardWithGoogleButton"; import { OnboardWithRedditButton } from "./OnboardWithRedditButton"; import { OnboardWithTwitterButton } from "./OnboardWithTwitterButton"; import { useColor } from "../../../styles/useColor"; +import { trackButtonClick } from "../../../utils/analytics"; import { AccountTileWrapper } from "../../AccountTile"; import { NameAccountModal } from "../../NameAccountModal"; import { ImportWallet } from "../ImportWallet"; @@ -68,17 +69,26 @@ export const OnboardOptions = ({ children }: PropsWithChildren) => { -