See Vue Yandex Metrika for other options.
npm install gridsome-plugin-yandex-metrika --save
yarn add gridsome-plugin-yandex-metrika
module.exports = {
plugins: [
{
use: 'gridsome-plugin-yandex-metrika',
options: {
id: 12345678
}
}
]
}