-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Просмотрена только одна страница #3
Comments
Вообще данный код инкапсулирует в себе элемент пикселя и скрипта метрики, но вероятно нужно получше посмотреть работу, в данном случае либо какие то вопросы не со стороны библиотеки, либо кэширование. |
Я решил это так в app добавил: import { sendMetrik } from '@lib/metriks' useEffect(() => {
const handleRouteChange = (url) => {
sendMetrik('hit', url);
}
router.events.on('routeChangeStart', handleRouteChange)
return () => {
router.events.off('routeChangeStart', handleRouteChange)
}
}, []) файл lib/metriks: export const sendMetrik = (type, value) => {
ym(process.env.NEXT_PUBLIC_YM, type, value);
} |
Отлично, спасибо за пример решения. Вероятно как я и сказал Next кеширует, добавлю / опишу данный кейс внутри библиотеки. |
Looks like this library does it right: https://github.com/futpib/next-ym. But it's really outdated, so perhaps we should just take some ideas from there and update this library. |
Anyway I see lack of features related to goals / hits and some other related to that. There is need in that features inside current library. |
Здравствуйте! Я столкнулся с той же проблемой и решил создать простой пакет, который решает эту проблему: https://github.com/olegkorol/next-yandex-metrika Отзывы приветствуются. |
Данный код показывает только одну просмотренную страницу.
Поставил по инструкции, посмотрел 10 страниц, в отчете Яндекса только 1 просмотренная страница (первая)
The text was updated successfully, but these errors were encountered: