Description
react-yandex-metrika is a React component package for Yandex.Metrika, the web analytics service. It adds the Yandex.Metrika tracking script to your page and exposes the ym tracking function as a module you can call from anywhere in your app. You place the YMInitializer component once, at a level that will not be remounted, such as outside the router, because the tracker only needs to be initialised once. Tracking starts when YMInitializer mounts. Options such as Webvisor 2.0 are set with props on the initializer, and you can pass tracker options from Yandex's own documentation the same way. You can also create several identical trackers, which can be useful for splitting statistics by domain. The package was inspired by react-google-analytics. The README includes a migration guide from version 1.0, where the Initializer import and the ym.init call were replaced by YMInitializer and props.…
Highlights
- Adds the Yandex.Metrika script to a React app
- ym tracking function as a module
- Webvisor 2.0 support
- Multiple trackers for segmentation
- Migration guide from version 1.0
Ratings & Reviews
No ratings yet
Be the first to rate react-yandex-metrika.
People also visit
react-yandex-metrika FAQ
What is react-yandex-metrika?
A React package for Yandex.Metrika analytics. It loads the tracking script and provides a ym function for sending events and page views.
Where should I put the initializer?
Once, at a level that is not remounted, such as outside the router. The tracker only needs to be initialised one time.
How do I turn on Webvisor?
Pass options={{webvisor: true}} to YMInitializer.
Is there a migration guide?
Yes. Replace the Initializer import with YMInitializer and move the arguments of ym.init into props on the component, which removes the ym.init call.
Is it open source?
Yes. The code is public on GitHub.
What are the best react-yandex-metrika alternatives?
Popular alternatives to react-yandex-metrika include @sooro-io/react-gtm-module, @pbe/react-yandex-maps and react-gtm-module. See all react-yandex-metrika alternatives



















