Umami and vue router #1685
-
I have a SPA developed with Vue.js (2) and enabled router animations (router is in history mode). Is there something I could do to avoid these reloads / full page renderings? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
So, in Vue.js - similar to Angular - it is necessary to disable auto-tracking in Javascript frameworks.
In your router (i.e. router/index.js) you can track the views in the router.beforeEach method:
Hope this helps someone in a similar scenario. Let me know if you have any feedback or a better solution. -- |
Beta Was this translation helpful? Give feedback.
-
How to introduce umami in a vue project? router.beforeEach((to, from, next) => {
// set your website id according to your umami settings
window.umami.trackView(to.path, null, '94db1cb1-74f4-4a40-ad6c-962362670409')
next()
} My vue project uses vite, which has been introduced in index.html
|
Beta Was this translation helpful? Give feedback.
-
@v2.10
|
Beta Was this translation helpful? Give feedback.
So, in Vue.js - similar to Angular - it is necessary to disable auto-tracking in Javascript frameworks.
In the index.html set the
data-auto-track="false"
In your router (i.e. router/index.js) you can track the views in the router.beforeEach method:
Hope this helps someone in a similar scenario. Let me know if you have any feedback or a better solution.
--
…