Skip to content
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

Open
YauhenDev opened this issue May 2, 2023 · 5 comments
Open

Просмотрена только одна страница #3

YauhenDev opened this issue May 2, 2023 · 5 comments
Assignees
Labels
good first issue Good for newcomers invalid This doesn't seem right

Comments

@YauhenDev
Copy link

Данный код показывает только одну просмотренную страницу.
Поставил по инструкции, посмотрел 10 страниц, в отчете Яндекса только 1 просмотренная страница (первая)

@kirillzhosul
Copy link
Owner

Вообще данный код инкапсулирует в себе элемент пикселя и скрипта метрики, но вероятно нужно получше посмотреть работу, в данном случае либо какие то вопросы не со стороны библиотеки, либо кэширование.

@YauhenDev
Copy link
Author

YauhenDev commented May 17, 2023

Я решил это так в 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);
}

@kirillzhosul
Copy link
Owner

Отлично, спасибо за пример решения.

Вероятно как я и сказал Next кеширует, добавлю / опишу данный кейс внутри библиотеки.

@kirillzhosul kirillzhosul pinned this issue May 19, 2023
@artginzburg
Copy link

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.

@kirillzhosul kirillzhosul self-assigned this May 29, 2023
@kirillzhosul kirillzhosul added good first issue Good for newcomers invalid This doesn't seem right labels May 29, 2023
@kirillzhosul
Copy link
Owner

Looks like this library does it right: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants