
JavaScript
- 2 ответа
- 0 вопросов
1
Вклад в тег
import { YMInitializer } from 'react-yandex-metrika';
class MyComponent extends React.Component {
render() {
return (
<div>
// SNIP
<YMInitializer accounts={[987654321]} />
// SNIP
</div>
);
}
});
// Потом подписываемся на событие истории и делаем что-то вроде:
import ym from 'react-yandex-metrika';
history.listen((location) => {
ym('hit', localhost.pathname);
})
import { YMInitializer } from 'react-yandex-metrika';
class MyComponent extends React.Component {
render() {
return (
<div>
// SNIP
<YMInitializer accounts={[987654321]} />
// SNIP
</div>
);
}
});
// И потом используем так:
import ym from 'react-yandex-metrika';
ym('hit', '/cart');
ym('reachGoal', 'whateverGoal', {awesomeParameter: 42});