1.5.3 • Published 1 year ago

yandex-metrika-module-nuxt3 v1.5.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Yandex Metrika for Nuxt 3

npm version npm downloads License

Disclaimer

This package is a fork for those who don't want to wait for the official release of a Yandex Metrika module.

The module was created by Nuxt Community and rewritten by dankerow to support Nuxt 3. All credit belongs to:

This package includes precompiled scripts to let people integrate Yandex Metrika into their project. There's no need to compile anything, it is ready to be used out of the box.

Route change events by default

This module automatically sends first page and route change events to Yandex Metrika.

Note: Yandex Metrika is not enabled in dev mode. You can set environment variable NODE_ENV to production for testing in dev mode.

Setup

  • Add yandex-metrika-module-nuxt3 dependency using yarn or npm to your project
  • Add yandex-metrika-module-nuxt3 to modules section of nuxt.config.js
{
  modules: ['yandex-metrika-module-nuxt3']
}

Configure

You can pass options directly in module declaration:

{
  modules: [
    [
      'yandex-metrika-module-nuxt3',
      {
        id: 'XXXXXX',
        webvisor: true,
        // consoleLog: true,
        // clickmap: true,
        // useCDN: false,
        // trackLinks: true,
        // accurateTrackBounce: true,
      }
    ]
  ]
}

Or you can specify yandexMetrika key:

{
  modules: ['yandex-metrika-module-nuxt3'],
  yandexMetrika: {
    id: 'XXXXXX',
    // ...
  }
}

In Nuxt 2.13+, you can also use public runtime config:

{
  modules: ['yandex-metrika-module-nuxt3'],
  publicRuntimeConfig: {
    yandexMetrika: {
      id: process.env.YANDEX_METRIKA_ID,
      // ...
    }
  }
}

Options

For more information:

NameDefault valueTypeDescription
accurateTrackBouncetrueBooleanNumberAccurate bounce rate The parameter can accept these values: true — Enable the accurate bounce rate, with a non-bounce event registered after 15000 ms (15 s). false — Don't enable the accurate bounce rate. (integer) — Enable the accurate bounce rate. Non-bounce events are recorded after ms.
childIframefalseBooleanWhether to record iframe contents without a tag in a child window
clickmaptrueBooleanWhether to collect data for a click map
deferfalseBooleanWhether to disable automatically sending data during tag initialization
ecommercefalseBooleanStringArrayCollect data for e-commerce — Ecommerce. true — Enable e-commerce data collection. Data is transmitted via a JavaScript array named dataLayer in the global namespace (window.dataLayer) false — Disable Ecommerce data collection. (String) — Enable Ecommerce data collection. Data is transmitted via a JavaScript array named in the global namespace (window.) (Array) — Enable Ecommerce data collection. Data is transmitted via a JavaScript
paramsObjectArraySession parameters transmitted during tag initialization To transmit session parameters at any other time, use the params method
userParamsObjectParameters of site users that are transmitted when initializing the tag To transmit user parameters at any other time, use the userParams method
trackHashfalseBooleanHash tracking in the browser's address bar
trackLinkstrueBooleanTrack clicks on outbound links
trustedDomainsArrayIndicates a trusted domain for recording the contents of a child iframe. Contains the domain address of the parent window
type0NumberTag type. 1 for YAN
webvisorfalseBooleanWhether to use Session Replay
triggerEventfalseBooleanWhether to check if the tag is ready

Development

  • Clone this repository
  • Install dependencies using yarn install
  • Run yarn dev:prepare to generate type stubs.
  • Use yarn dev to start playground in development mode.

License

MIT License

1.5.3

1 year ago

1.5.2

1 year ago

1.5.1

1 year ago

1.5.0

1 year ago

1.4.9

1 year ago

1.4.8

1 year ago

1.4.7

1 year ago

1.4.6

1 year ago

1.4.5

1 year ago

1.4.4

1 year ago

1.4.3

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago