> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openrevenue.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Vue.js installation

> Install OpenRevenue analytics in a Vue app with the HTML script tag or a Vue plugin approach.

## Via index.html

The quickest way: add the script to your `index.html` before `</body>`:

```html index.html theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
<body>
  <div id="app"></div>

  <script
    src="https://api.openrevenue.com/tracker.js"
    data-site="your-project-id"
    defer
  ></script>
</body>
```

## Via Vue plugin

For Vue Router apps, register a simple plugin in `main.ts` so pageviews are tracked on every route change:

```ts main.ts theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
import { createApp } from "vue"
import { createRouter } from "vue-router"
import App from "./App.vue"

const router = createRouter({ /* your routes */ })

const app = createApp(App)
app.use(router)

// Load tracker once
const script = document.createElement("script")
script.src = "https://api.openrevenue.com/tracker.js"
script.dataset.site = "your-project-id"
script.defer = true
document.head.appendChild(script)

app.mount("#app")
```

> [!NOTE]
>
> OpenRevenue's tracker automatically listens to `history.pushState` and `popstate` so route changes in Vue Router are tracked without any extra config.

## Verify

Deploy your app and visit it in a browser. A pageview should appear in your [OpenRevenue dashboard](https://www.openrevenue.com/dashboard) within seconds.

> [!NOTE]
>
> OpenRevenue ignores `localhost` automatically. Always test on your deployed URL.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.