From 5f8bf9aeb2630f95f0f06974c33f68f90771cb6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B5=D0=BD=D0=B8=D1=81=20=D0=9A=D0=B0=D1=82=D0=B0?= =?UTF-8?q?=D0=B5=D0=B2?= Date: Tue, 21 May 2024 11:12:55 +0000 Subject: [PATCH] hotfix-yandex-metric-2 --- src/components/EmailEnterPage/index.tsx | 1 + src/components/PaymentPage/results/SuccessPage/index.tsx | 5 +++++ .../pages/ABDesign/v1/pages/EmailEnterPage/index.tsx | 1 + .../ResultPayment/SuccessPaymentPage/index.tsx | 5 +++++ src/components/pages/PaymentWithEmailPage/index.tsx | 1 + src/components/palmistry/step-email/step-email.tsx | 1 + src/hooks/authentication/use-authentication.ts | 3 ++- 7 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/components/EmailEnterPage/index.tsx b/src/components/EmailEnterPage/index.tsx index 8ee524c..9aa911a 100755 --- a/src/components/EmailEnterPage/index.tsx +++ b/src/components/EmailEnterPage/index.tsx @@ -109,6 +109,7 @@ function EmailEnterPage({ const handleClick = () => { authorize(); + window.ym(95799066, "reachGoal", "EnteredEmail"); }; const authorize = async () => { diff --git a/src/components/PaymentPage/results/SuccessPage/index.tsx b/src/components/PaymentPage/results/SuccessPage/index.tsx index 603b597..9ec17ba 100644 --- a/src/components/PaymentPage/results/SuccessPage/index.tsx +++ b/src/components/PaymentPage/results/SuccessPage/index.tsx @@ -6,6 +6,7 @@ import Title from "@/components/Title"; import MainButton from "@/components/MainButton"; import { useDispatch } from "react-redux"; import { actions } from "@/store"; +import { useEffect } from "react"; function PaymentSuccessPage(): JSX.Element { const { t } = useTranslation(); @@ -16,6 +17,10 @@ function PaymentSuccessPage(): JSX.Element { navigate(routes.client.addReport()); }; + useEffect(() => { + window.ym(95799066, "reachGoal", "PaymentSuccess"); + }, []); + return (
{ authorize(); + window.ym(95799066, "reachGoal", "EnteredEmail"); }; const authorize = async () => { diff --git a/src/components/pages/PaymentWithEmailPage/ResultPayment/SuccessPaymentPage/index.tsx b/src/components/pages/PaymentWithEmailPage/ResultPayment/SuccessPaymentPage/index.tsx index 5168b8b..9ab12ed 100644 --- a/src/components/pages/PaymentWithEmailPage/ResultPayment/SuccessPaymentPage/index.tsx +++ b/src/components/pages/PaymentWithEmailPage/ResultPayment/SuccessPaymentPage/index.tsx @@ -4,6 +4,7 @@ import Title from "@/components/Title"; import MainButton from "@/components/MainButton"; import { useNavigate } from "react-router-dom"; import routes from "@/routes"; +import { useEffect } from "react"; function SuccessPaymentPage(): JSX.Element { const { t } = useTranslation(); @@ -13,6 +14,10 @@ function SuccessPaymentPage(): JSX.Element { ? "The payment was successful" : "The information has been sent to your email"; + useEffect(() => { + window.ym(95799066, "reachGoal", "PaymentSuccess"); + }, []); + return (
{ await authorization(email, ESourceAuthorization["aura.palmistry"]); + window.ym(95799066, "reachGoal", "EnteredEmail"); setIsAuth(true); }; diff --git a/src/hooks/authentication/use-authentication.ts b/src/hooks/authentication/use-authentication.ts index abcf26c..289eff7 100644 --- a/src/hooks/authentication/use-authentication.ts +++ b/src/hooks/authentication/use-authentication.ts @@ -115,13 +115,14 @@ export const useAuthentication = () => { setIsLoading(true); const payload = getAuthorizationPayload(email, source); const { token, userId } = await api.authorization(payload); + const { user } = await api.getUser({ token }); if (userId?.length && !!window.ym) { window.ym(95799066, 'userParams', { + email: user.email, UserID: userId }) window.ym(95799066, 'setUserID', userId); } - const { user } = await api.getUser({ token }); signUp(token, user); setToken(token); dispatch(actions.status.update("registred"));