V
V
Vladislav2021-05-25 08:08:24
Vue.js
Vladislav, 2021-05-25 08:08:24

Where to insert the Yandex metrics code?

Tell me where can I insert the Yandex metrics code so that it is global on all pages in Vue + Nuxt?
Tried in mounted in dev it works but in the consoles there are errors and it is no longer going to the prod.
Doesn't work in app.html JS is not executed

Extensions I don't need just a place where I can stick the code that Yandex metric gives?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Kuznetsov, 2021-05-25
@cr1gger

If you are talking about HTML code, then insert the template into vue, in the . Or create a component and insert only the component itself, so that there is less code.
If you are talking about meta tags, then like Nuxt.config.js allows you to enter, so write there. Yes, and without SSR it will hardly work normally.
If you are talking about JS code, then you already need to read the documentation in more detail. Since many do not know what code is inserted there at all.

I
Ilya, 2021-05-25
@rpsv

In the main index.html, where the html, head and body tags are. They don't change as far as I know.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question