Merge branch 'hotfix-yandex-metric-2' into 'main'

hotfix-yandex-metric-2

See merge request witapp/aura-webapp!143
This commit is contained in:
Daniil Chemerkin 2024-05-21 11:12:55 +00:00
commit 2d4a44459c
7 changed files with 16 additions and 1 deletions

View File

@ -109,6 +109,7 @@ function EmailEnterPage({
const handleClick = () => { const handleClick = () => {
authorize(); authorize();
window.ym(95799066, "reachGoal", "EnteredEmail");
}; };
const authorize = async () => { const authorize = async () => {

View File

@ -6,6 +6,7 @@ import Title from "@/components/Title";
import MainButton from "@/components/MainButton"; import MainButton from "@/components/MainButton";
import { useDispatch } from "react-redux"; import { useDispatch } from "react-redux";
import { actions } from "@/store"; import { actions } from "@/store";
import { useEffect } from "react";
function PaymentSuccessPage(): JSX.Element { function PaymentSuccessPage(): JSX.Element {
const { t } = useTranslation(); const { t } = useTranslation();
@ -16,6 +17,10 @@ function PaymentSuccessPage(): JSX.Element {
navigate(routes.client.addReport()); navigate(routes.client.addReport());
}; };
useEffect(() => {
window.ym(95799066, "reachGoal", "PaymentSuccess");
}, []);
return ( return (
<section className={`${styles.page} page`}> <section className={`${styles.page} page`}>
<img <img

View File

@ -114,6 +114,7 @@ function EmailEnterPage({
const handleClick = () => { const handleClick = () => {
authorize(); authorize();
window.ym(95799066, "reachGoal", "EnteredEmail");
}; };
const authorize = async () => { const authorize = async () => {

View File

@ -4,6 +4,7 @@ import Title from "@/components/Title";
import MainButton from "@/components/MainButton"; import MainButton from "@/components/MainButton";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import routes from "@/routes"; import routes from "@/routes";
import { useEffect } from "react";
function SuccessPaymentPage(): JSX.Element { function SuccessPaymentPage(): JSX.Element {
const { t } = useTranslation(); const { t } = useTranslation();
@ -13,6 +14,10 @@ function SuccessPaymentPage(): JSX.Element {
? "The payment was successful" ? "The payment was successful"
: "The information has been sent to your email"; : "The information has been sent to your email";
useEffect(() => {
window.ym(95799066, "reachGoal", "PaymentSuccess");
}, []);
return ( return (
<section className={`${styles.page} page`}> <section className={`${styles.page} page`}>
<img <img

View File

@ -134,6 +134,7 @@ function PaymentWithEmailPage() {
return; return;
} }
const { user, token } = authData; const { user, token } = authData;
window.ym(95799066, "reachGoal", "EnteredEmail");
await createSinglePayment({ await createSinglePayment({
user, user,

View File

@ -43,6 +43,7 @@ export default function StepEmail() {
const authorize = async () => { const authorize = async () => {
await authorization(email, ESourceAuthorization["aura.palmistry"]); await authorization(email, ESourceAuthorization["aura.palmistry"]);
window.ym(95799066, "reachGoal", "EnteredEmail");
setIsAuth(true); setIsAuth(true);
}; };

View File

@ -115,13 +115,14 @@ export const useAuthentication = () => {
setIsLoading(true); setIsLoading(true);
const payload = getAuthorizationPayload(email, source); const payload = getAuthorizationPayload(email, source);
const { token, userId } = await api.authorization(payload); const { token, userId } = await api.authorization(payload);
const { user } = await api.getUser({ token });
if (userId?.length && !!window.ym) { if (userId?.length && !!window.ym) {
window.ym(95799066, 'userParams', { window.ym(95799066, 'userParams', {
email: user.email,
UserID: userId UserID: userId
}) })
window.ym(95799066, 'setUserID', userId); window.ym(95799066, 'setUserID', userId);
} }
const { user } = await api.getUser({ token });
signUp(token, user); signUp(token, user);
setToken(token); setToken(token);
dispatch(actions.status.update("registred")); dispatch(actions.status.update("registred"));