You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bit late to respond but tracking in this module is done using vue-router guards, but when an error occurs in Nuxt then loading the error page doesnt trigger a navigation event as Nuxt just loads the error page component instead of your actual page component.
The only way to resolve this is probably to call this.$matomo.trackPageView() manually in the mounted hook of the error page.
Thanks for the reply! I have the following in layouts/error.vue now, which works well enough to be logging some error pages, although I haven't checked if it's "perfect".
created(){// An error has happened, so $matomo is not necessarily available.if(this.$matomo){// Source: https://matomo.org/faq/how-to/faq_60/this.$matomo.setDocumentTitle(`${this.error.statusCode}${this.$route&&`/URL = ${encodeURIComponent(this.$route.fullPath)}`}`)this.$matomo.trackPageView()}}
Would it make sense to make a PR with an addition to the README about this? In my case, reporting 404s is one of the main reasons I use Matomo at all.
I followed https://nuxtjs.org/guide/async-data#handling-errors and https://nuxtjs.org/guide/views#error-page. In a page component
pages/Page.vue
I have:And in
layouts/error.vue
:It seems that
matomo()
is not being called forerror.vue
. How can I achieve this?The text was updated successfully, but these errors were encountered: