Skip to content

Install Statsdot on Vue.js

Updated October 17, 2026

Add the script to the <head> of index.html at the root of your Vite project:

<head>
  <!-- ... -->
  <script defer data-domain="yoursite.com" src="https://statsdot.com/js/script.js"></script>
</head>

Vue Router in history mode (createWebHistory) changes the address with the history API, which Statsdot listens to, so every route counts. In hash mode (createWebHashHistory) the part after # is not part of the page path, so all routes count as one page: switch to history mode to see them separately.

Track events from a component:

window.statsdot?.track('Signup')

For Nuxt, see the Nuxt guide.