fix: vk pixel bug
This commit is contained in:
parent
09978ab7cc
commit
6e6df2114e
@ -1,5 +1,3 @@
|
|||||||
import { useEffect, useState } from "react";
|
|
||||||
|
|
||||||
import type { MetricsMessengers } from "@model/metrics";
|
import type { MetricsMessengers } from "@model/metrics";
|
||||||
|
|
||||||
type MetricsGoal = {
|
type MetricsGoal = {
|
||||||
@ -20,15 +18,7 @@ const sendMetrics = (vkPixelId: number | undefined, goal: string) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useVkMetricsGoals = (vkPixelId: number | undefined) => {
|
export const useVkMetricsGoals = (vkId: number | undefined) => {
|
||||||
const [vkId, setVkId] = useState<number | undefined>(undefined);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (vkPixelId) {
|
|
||||||
setVkId(vkPixelId);
|
|
||||||
}
|
|
||||||
}, [vkPixelId]);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// Посетитель открыл квиз
|
// Посетитель открыл квиз
|
||||||
quizOpened: () => sendMetrics(vkId, "penaquiz-start"),
|
quizOpened: () => sendMetrics(vkId, "penaquiz-start"),
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
import { useEffect, useState } from "react";
|
|
||||||
|
|
||||||
import type { MetricsMessengers } from "@model/metrics";
|
import type { MetricsMessengers } from "@model/metrics";
|
||||||
|
|
||||||
type ExtendedWindow = Window & {
|
type ExtendedWindow = Window & {
|
||||||
@ -12,15 +10,7 @@ const sendMetrics = (yandexMetricsId: number | undefined, goal: string) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useYandexMetricsGoals = (yandexMetricsId: number | undefined) => {
|
export const useYandexMetricsGoals = (id: number | undefined) => {
|
||||||
const [id, setId] = useState<number | undefined>(undefined);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (yandexMetricsId) {
|
|
||||||
setId(yandexMetricsId);
|
|
||||||
}
|
|
||||||
}, [yandexMetricsId]);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// Посетитель открыл квиз
|
// Посетитель открыл квиз
|
||||||
quizOpened: () => sendMetrics(id, "penaquiz-start"),
|
quizOpened: () => sendMetrics(id, "penaquiz-start"),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user