npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

yandex-metrica-ab-vue

v0.1.0

Published

[Русский](#yandex-metrica-ab-vue-ru) | [English](#yandex-metrica-ab-vue-en)

Readme

Русский | English

yandex-metrica-ab-vue ru

Vue библиотека для проведения АБ-тестов varioqub (yandex metrica)

Документация varioqub: https://yandex.com/support/varioqub/index.html

Установка

npm install @avto-dev/yandex-metrica-ab-vue

API

useExperiment

Описание: Композабл для инициализации и работы с экспериментом Varioqub.

Аргументы:

useExperiment(params: IUseExperimentsParams)

IUseExperimentsParams:

interface IUseExperimentsParams {
  /**
   * Идентификатор клиента Varioqub (metrika.XXXX)
   * Подробнее в документации (https://yandex.com/support/varioqub/en/objects/ymab)
   */
  clientId: string;
  /**
   * Идентификатор пользователя сайта.
   * "icookie" в документации (https://yandex.com/support/varioqub/en/objects/ymab)
   * Будет установлен и прочитан кодом экспериментов, если не указан
   */
  param?: string;
  /**
   * Расширяет настройку эксперимента, а также включает возможность создания эксперимента в режиме JS визуального редактора.
   * https://yandex.com/support/varioqub/en/objects/set-config
   */
  config?: Partial<IConfig>;
  /**
   * Параметры пользователей*.
   * В параметрах можно передавать свойства пользователей вашего сайта. Например, признак авторизации на сайте.
   * https://yandex.ru/support/varioqub/ru/objects/init
   */
  clientFeatures?: Record<string, string>;
}

Возвращает:

  • ymabResponse: Ref<IYmabAnswer | null> — ответ от Varioqub (флаги, эксперименты и т.д.)
  • ymabReady: Ref<boolean> — признак готовности данных эксперимента
  • initializeVarioqub(router: Router): Promise<void> — функция для инициализации (регистрирует хук роутера)

setupVarioqubAbTests

Описание: Функция для provide/inject — удобный способ шарить данные эксперимента через Vue приложение.

Аргументы:

setupVarioqubAbTests(app: App, data: { ymabResponse: Ref<IYmabAnswer | null>, ymabReady: Ref<boolean> })
  • app: App — экземпляр приложения Vue
  • data: { ymabResponse, ymabReady } — реактивные данные эксперимента

useVarioqubAbTests

Описание: inject-хук для получения данных эксперимента в любом компоненте.

Возвращает: Объект { ymabResponse, ymabReady }


Пример использования:

// main.ts
const ymClientId = 12345; // id счетчика yandex metrica

function initYourApp() {
  const app = createApp();
  const router = createRouter();

  const clientId = `metrika.${ymClientId}`;
  const { initializeVarioqub, ymabResponse, ymabReady } = useExperiment({ clientId });

  initializeVarioqub(router); // регистрирует хук для отправки ymab.init
  setupVarioqubAbTests(app, { ymabResponse, ymabReady });
}

VarioqubAntiflicker

Описание: Vue-компонент, который убирает мерцание до инициализации эксперимента.

Пропсы:

  • ready: boolean (обязательный) Признак готовности эксперимента

  • timeout: number (необязательный, по умолчанию 3000) Максимальное время ожидания (мс), после которого контент будет показан даже если ready=false

Слоты:

  • default — основной контент, который будет скрыт до готовности

Пример:

<VarioqubAntiflicker :ready="ymabReady">
  <App />
</VarioqubAntiflicker>

Типы

IYmabAnswer

interface IYmabAnswer {
  flags: Record<string, string[]>;
  i: string;
  experiments: string;
  testids: number[];
}

IConfig

interface IConfig {
  nonce?: string;
  enableVisual: boolean;
  enableHTML: boolean;
  enableJS: boolean;
  enableRedir: boolean;
  enableWatch: boolean;
  storeRedirParam: boolean | 'localstorage' | 'cookie' | 'get';
  metrikaTimeout: number;
  enableAdv: boolean;
  enableSendYmUid: boolean;
  enableSetYmUid: boolean;
  cookieDomain?: string;
  storeReferer: boolean;
  removeAbRedirParam: boolean;
}

yandex-metrica-ab-vue en

Vue library for running A/B tests with varioqub (yandex metrica)

Varioqub documentation: https://yandex.com/support/varioqub/index.html

Installation

npm install @avto-dev/yandex-metrica-ab-vue

API

useExperiment

Description: Composable for initializing and working with a Varioqub experiment.

Arguments:

useExperiment(params: IUseExperimentsParams)

IUseExperimentsParams:

interface IUseExperimentsParams {
  /**
   * Varioqub client identifier (metrika.XXXX)
   * More details in the documentation (https://yandex.com/support/varioqub/en/objects/ymab)
   */
  clientId: string;
  /**
   * Website user identifier.
   * "icookie" in the documentation (https://yandex.com/support/varioqub/en/objects/ymab)
   * Will be set and read by the experiment code if not specified
   */
  param?: string;
  /**
   * Extends the experiment configuration and enables the ability to create an experiment in JS visual editor mode.
   * https://yandex.com/support/varioqub/en/objects/set-config
   */
  config?: Partial<IConfig>;
  /**
   * User parameters*.
   * You can pass your website user's properties in the parameters. For example, the sign of user authorization on the site.
   * https://yandex.ru/support/varioqub/ru/objects/init
   */
  clientFeatures?: Record<string, string>;
}

Returns:

  • ymabResponse: Ref<IYmabAnswer | null> — response from Varioqub (flags, experiments, etc.)
  • ymabReady: Ref<boolean> — experiment data readiness flag
  • initializeVarioqub(router: Router): Promise<void> — initialization function (registers router hook)

setupVarioqubAbTests

Description: Function for provide/inject — a convenient way to share experiment data through the Vue application.

Arguments:

setupVarioqubAbTests(app: App, data: { ymabResponse: Ref<IYmabAnswer | null>, ymabReady: Ref<boolean> })
  • app: App — Vue application instance
  • data: { ymabResponse, ymabReady } — reactive experiment data

useVarioqubAbTests

Description: Inject hook to get experiment data in any component.

Returns: Object { ymabResponse, ymabReady }


Usage example:

// main.ts
const ymClientId = 12345; // yandex metrica counter id

function initYourApp() {
  const app = createApp();
  const router = createRouter();

  const clientId = `metrika.${ymClientId}`;
  const { initializeVarioqub, ymabResponse, ymabReady } = useExperiment({ clientId });

  initializeVarioqub(router); // registers hook for sending ymab.init
  setupVarioqubAbTests(app, { ymabResponse, ymabReady });
}

VarioqubAntiflicker

Description: Vue component that removes flicker before the experiment is initialized.

Props:

  • ready: boolean (required) Experiment readiness flag

  • timeout: number (optional, default 3000) Maximum waiting time (ms) after which the content will be shown even if ready=false

Slots:

  • default — main content that will be hidden until ready

Example:

<VarioqubAntiflicker :ready="ymabReady">
  <App />
</VarioqubAntiflicker>

Types

IYmabAnswer

interface IYmabAnswer {
  flags: Record<string, string[]>;
  i: string;
  experiments: string;
  testids: number[];
}

IConfig

interface IConfig {
  nonce?: string;
  enableVisual: boolean;
  enableHTML: boolean;
  enableJS: boolean;
  enableRedir: boolean;
  enableWatch: boolean;
  storeRedirParam: boolean | 'localstorage' | 'cookie' | 'get';
  metrikaTimeout: number;
  enableAdv: boolean;
  enableSendYmUid: boolean;
  enableSetYmUid: boolean;
  cookieDomain?: string;
  storeReferer: boolean;
  removeAbRedirParam: boolean;
}