hotfix-yandex-metric-loading
This commit is contained in:
parent
2d4a44459c
commit
fb26f56598
49
index.html
49
index.html
@ -2,7 +2,10 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
<meta
|
||||||
|
name="viewport"
|
||||||
|
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
|
||||||
|
/>
|
||||||
<link rel="preload" as="image" href="/leo.png" fetchpriority="high" />
|
<link rel="preload" as="image" href="/leo.png" fetchpriority="high" />
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
|
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
|
||||||
@ -65,6 +68,50 @@
|
|||||||
></script> -->
|
></script> -->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<!-- Yandex.Metrika counter -->
|
||||||
|
<script type="text/javascript" async="async">
|
||||||
|
(function (m, e, t, r, i, k, a) {
|
||||||
|
m[i] =
|
||||||
|
m[i] ||
|
||||||
|
function () {
|
||||||
|
(m[i].a = m[i].a || []).push(arguments);
|
||||||
|
};
|
||||||
|
m[i].l = 1 * new Date();
|
||||||
|
for (var j = 0; j < document.scripts.length; j++) {
|
||||||
|
if (document.scripts[j].src === r) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(k = e.createElement(t)),
|
||||||
|
(a = e.getElementsByTagName(t)[0]),
|
||||||
|
(k.async = 1),
|
||||||
|
(k.src = r),
|
||||||
|
a.parentNode.insertBefore(k, a);
|
||||||
|
})(
|
||||||
|
window,
|
||||||
|
document,
|
||||||
|
"script",
|
||||||
|
"https://mc.yandex.ru/metrika/tag.js",
|
||||||
|
"ym"
|
||||||
|
);
|
||||||
|
|
||||||
|
ym(95799066, "init", {
|
||||||
|
clickmap: true,
|
||||||
|
trackLinks: true,
|
||||||
|
accurateTrackBounce: true,
|
||||||
|
webvisor: true,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<noscript>
|
||||||
|
<div>
|
||||||
|
<img
|
||||||
|
src="https://mc.yandex.ru/watch/95799066"
|
||||||
|
style="position: absolute; left: -9999px"
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</noscript>
|
||||||
|
<!-- /Yandex.Metrika counter -->
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
<noscript
|
<noscript
|
||||||
><div>
|
><div>
|
||||||
|
|||||||
@ -109,7 +109,8 @@ function EmailEnterPage({
|
|||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
authorize();
|
authorize();
|
||||||
window.ym(95799066, "reachGoal", "EnteredEmail");
|
if (typeof window.ym === "function")
|
||||||
|
window.ym(95799066, "reachGoal", "EnteredEmail");
|
||||||
};
|
};
|
||||||
|
|
||||||
const authorize = async () => {
|
const authorize = async () => {
|
||||||
|
|||||||
@ -18,7 +18,8 @@ function PaymentSuccessPage(): JSX.Element {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.ym(95799066, "reachGoal", "PaymentSuccess");
|
if (typeof window.ym === "function")
|
||||||
|
window.ym(95799066, "reachGoal", "PaymentSuccess");
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -114,7 +114,8 @@ function EmailEnterPage({
|
|||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
authorize();
|
authorize();
|
||||||
window.ym(95799066, "reachGoal", "EnteredEmail");
|
if (typeof window.ym === "function")
|
||||||
|
window.ym(95799066, "reachGoal", "EnteredEmail");
|
||||||
};
|
};
|
||||||
|
|
||||||
const authorize = async () => {
|
const authorize = async () => {
|
||||||
|
|||||||
@ -15,7 +15,8 @@ function SuccessPaymentPage(): JSX.Element {
|
|||||||
: "The information has been sent to your email";
|
: "The information has been sent to your email";
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.ym(95799066, "reachGoal", "PaymentSuccess");
|
if (typeof window.ym === "function")
|
||||||
|
window.ym(95799066, "reachGoal", "PaymentSuccess");
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -134,7 +134,8 @@ function PaymentWithEmailPage() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { user, token } = authData;
|
const { user, token } = authData;
|
||||||
window.ym(95799066, "reachGoal", "EnteredEmail");
|
if (typeof window.ym === "function")
|
||||||
|
window.ym(95799066, "reachGoal", "EnteredEmail");
|
||||||
|
|
||||||
await createSinglePayment({
|
await createSinglePayment({
|
||||||
user,
|
user,
|
||||||
|
|||||||
@ -43,7 +43,8 @@ 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");
|
if (typeof window.ym === "function")
|
||||||
|
window.ym(95799066, "reachGoal", "EnteredEmail");
|
||||||
setIsAuth(true);
|
setIsAuth(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -116,7 +116,7 @@ export const useAuthentication = () => {
|
|||||||
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 });
|
const { user } = await api.getUser({ token });
|
||||||
if (userId?.length && !!window.ym) {
|
if (userId?.length && !!window.ym && typeof window.ym === 'function') {
|
||||||
window.ym(95799066, 'userParams', {
|
window.ym(95799066, 'userParams', {
|
||||||
email: user.email,
|
email: user.email,
|
||||||
UserID: userId
|
UserID: userId
|
||||||
|
|||||||
12
src/init.tsx
12
src/init.tsx
@ -38,11 +38,11 @@ const init = async () => {
|
|||||||
const isProduction = import.meta.env.MODE === "production";
|
const isProduction = import.meta.env.MODE === "production";
|
||||||
|
|
||||||
// SCRIPTS TO HEAD
|
// SCRIPTS TO HEAD
|
||||||
const yandexMetric = () => {
|
// const yandexMetric = () => {
|
||||||
const script = document.createElement("script");
|
// const script = document.createElement("script");
|
||||||
script.setAttribute("src", "/metrics/yandex.js");
|
// script.setAttribute("src", "/metrics/yandex.js");
|
||||||
document.head.appendChild(script);
|
// document.head.appendChild(script);
|
||||||
};
|
// };
|
||||||
|
|
||||||
const smartLook = () => {
|
const smartLook = () => {
|
||||||
if (!config.smartlook_manage) return;
|
if (!config.smartlook_manage) return;
|
||||||
@ -51,7 +51,7 @@ const init = async () => {
|
|||||||
document.head.appendChild(script);
|
document.head.appendChild(script);
|
||||||
};
|
};
|
||||||
if (isProduction) {
|
if (isProduction) {
|
||||||
yandexMetric();
|
// yandexMetric();
|
||||||
smartLook();
|
smartLook();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user