Skip to main content
For a Vue app built with Vite, with Vue Router. Tested by the example examples/vue-spa (Vue 3.5.45, Vue Router 5.4.0, @vitejs/plugin-vue 6.0.10, Vite 8), which runs in the browser test matrix.

Where the tag goes

Put the tag in index.html at the root of the project, not in a component:
The example replaces the comment with the tag at build time so that tests can use their own site id. In your app the tag from the console stands there:

Route changes

Vue Router’s createWebHistory() changes the address with history.pushState, which the tracker watches, so every route change is one pageview without a router hook:
With createWebHashHistory() the routes live in the fragment (/#/pricing); those are counted too, because fragments that start with #/ are sent.

Custom events

A data-umami-event attribute in a template sends an event when the element is clicked:
From a component’s code, call window.umami?.track(); the visitor may block the tracker, so the call is optional:
For TypeScript, declare the global once:

What the browser tests check

The same matrix as for every client-routed example: one pageview per route change, back and forward, the previous route as referrer, an external referrer on the first pageview, both kinds of custom event, Global Privacy Control and a tampered tracker refused (tests/e2e/specs).