result link event metrica

This commit is contained in:
Nastya 2024-05-12 02:54:10 +03:00
parent d32ca8dc3c
commit 1422ab9edd
4 changed files with 82 additions and 70 deletions

@ -191,8 +191,7 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
<Box
component={Link}
target={"_blank"}
href={`https://${
window.location.hostname.includes("s") ? "s" : ""
href={`https://${window.location.hostname.includes("s") ? "s" : ""
}quiz.pena.digital/squiz/quiz/logo?q=${quizId}`}
sx={{
display: "flex",
@ -250,11 +249,16 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
{settings.cfg.resultInfo.showResultForm === "after" &&
resultQuestion.content.redirect && (
<Button
href={
resultQuestion.content.redirect.includes("https")
onClick={() => {
vkMetrics.resultLink();
yandexMetrics.resultLink();
setTimeout(() => {
location.href =
(resultQuestion.content.redirect.includes("https")
? resultQuestion.content.redirect
: `https://${resultQuestion.content.redirect}`
}
: `https://${resultQuestion.content.redirect}`).replace(/\s+/g, "");
}, 1000)
}}
variant="contained"
sx={{ p: "10px 20px", width: "auto", height: "50px" }}
>

@ -164,8 +164,7 @@ export const StartPageViewPublication = () => {
<Box
component={Link}
target={"_blank"}
href={`https://${
window.location.hostname.includes("s") ? "s" : ""
href={`https://${window.location.hostname.includes("s") ? "s" : ""
}quiz.pena.digital/squiz/quiz/logo?q=${quizId}`}
sx={{
display: "flex",
@ -224,11 +223,14 @@ export const StartPageViewPublication = () => {
vkMetrics.emailOpened();
yandexMetrics.emailOpened();
setTimeout(() => {
location.href = (
settings.cfg.info.site.includes("https")
? settings.cfg.info.site
: `https://${settings.cfg.info.site}`
).replace(/\s+/g, "");
}, 1000)
};
return (

@ -34,6 +34,9 @@ export const useVkMetricsGoals = (vkId: number | undefined) => {
// Посетитель увидел результат
resultShown: () =>
sendMetrics(vkId, `penaquiz-finish`),
// Посетитель нажал на ссылку в результате
resultLink: () =>
sendMetrics(vkId, `penaquiz-resultlink`),
// Посетитель дошёл до формы контактов
contactsFormOpened: () => sendMetrics(vkId, "penaquiz-form"),
// Посетитель заполнил форму контактов

@ -26,6 +26,9 @@ export const useYandexMetricsGoals = (id: number | undefined) => {
// Посетитель увидел результат
resultShown: () =>
sendMetrics(id, `penaquiz-finish`),
// Посетитель нажал на ссылку в результате
resultLink: () =>
sendMetrics(id, `penaquiz-resultlink`),
// Посетитель дошёл до формы контактов
contactsFormOpened: () => sendMetrics(id, "penaquiz-form"),
// Посетитель заполнил форму контактов