Typescript обертка для работы с Yandex Metrika
yarn add typescript-yandex-metrica
Использование
Параметры инициализации счетчика
https://yandex.ru/support/metrica/code/counter-initialize.html
Доступные методы
https://yandex.ru/support/metrica/objects/method-reference.html
import { Metrika } from "typescript-yandex-metrica"
conts metrika = new Metrica(0000000);
counter.fireEvent('CUSTOM_JS_EVENT').then(() => {});
counter.hit('http://example.domain/index.html').then(() => {});
metrika.getCounter().then((counter) => {
counter.notBounce()
});
(async function() {
const counter = await metrika.getCounter();
counter.notBounce();
})()