> ## 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.

# Nuxt installation

> Install OpenRevenue analytics in Nuxt with a plugin or Nuxt config script setup.

## Via plugin

Create `plugins/openrevenue.client.ts` (the `.client` suffix ensures it only runs in the browser):

```ts plugins/openrevenue.client.ts theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
export default defineNuxtPlugin(() => {
  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)
})
```

> [!NOTE]
>
> Nuxt plugins ending in `.client.ts` are automatically excluded from SSR; no need for `process.client` guards.

## Via nuxt.config

Alternatively, inject the script directly from `nuxt.config.ts`:

```ts nuxt.config.ts theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
export default defineNuxtConfig({
  app: {
    head: {
      script: [
        {
          src: "https://api.openrevenue.com/tracker.js",
          "data-site": "your-project-id",
          defer: true,
        },
      ],
    },
  },
})
```

## Verify

Deploy and open your site. A pageview should appear in your [OpenRevenue dashboard](https://www.openrevenue.com/dashboard) within seconds.

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


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