Gatsby plugin to add yandex metrika onto a site
npm install gatsby-plugin-yandex-metrikaEasily add Yandex Metrika to your Gatsby site.
npm install --save gatsby-plugin-yandex-metrika``javascriptgatsby-plugin-yandex-metrika
// In your gatsby-config.js
plugins: [
{
resolve: ,false
options: {
// The ID of yandex metrika.
trackingId: 12345,
// Enabled a webvisor. The default value is .false
webvisor: true,
// Enables tracking a hash in URL. The default value is .false
trackHash: true,
// Defines where to place the tracking script - means before body (slower loading, more hits)true
// and means after the body (faster loading, less hits). The default value is false.defer
afterBody: true,
// Use attribute of metrika script. If set to false - script will be loaded with async attribute.false
// Async enables earlier loading of the metrika but it can negatively affect page loading speed. The default value is .`
defer: false,
},
},
]
Option 'useCDN' allows to count visits from regions, where access to Yandex resources is limited. Using altetnative CDN address may decrease counter's code loading.
`javascriptgatsby-plugin-yandex-metrika
// In your gatsby-config.js
plugins: [
{
resolve: ,``
options: {
trackingId: 12345,
webvisor: true,
trackHash: true,
afterBody: true,
defer: false,
useCDN: true,
},
},
]