---
title: "Plausible Analytics · Nuxt Scripts"
description: "Use Plausible Analytics in your Nuxt app."
canonical_url: "https://scripts.nuxt.com/scripts/v0/analytics/plausible-analytics"
meta:
  "og:description": "Use Plausible Analytics in your Nuxt app."
  "og:image": "https://scripts.nuxt.com/_og/d/c_Docs%2Ctitle_Plausible%2BAnalytics%2Cdescription_Use%2BPlausible%2BAnalytics%2Bin%2Byour%2BNuxt%2Bapp.%2Cheadline_Analytics%2Cp_Ii9zY3JpcHRzL3YwL2FuYWx5dGljcy9wbGF1c2libGUtYW5hbHl0aWNzIg%2Cs_XDPqp4zBYQaIM_9B.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Plausible Analytics · Nuxt Scripts"
  "twitter:image": "https://scripts.nuxt.com/_og/d/c_Docs%2Ctitle_Plausible%2BAnalytics%2Cdescription_Use%2BPlausible%2BAnalytics%2Bin%2Byour%2BNuxt%2Bapp.%2Cheadline_Analytics%2Cp_Ii9zY3JpcHRzL3YwL2FuYWx5dGljcy9wbGF1c2libGUtYW5hbHl0aWNzIg%2Cs_XDPqp4zBYQaIM_9B.png"
---

> Index of every page on this site: [llms.txt](https://scripts.nuxt.com/llms.txt)

**Analytics**

# **Plausible Analytics**

[Copy for LLMs](https://scripts.nuxt.com/scripts/v0/analytics/plausible-analytics.md)

[**Plausible Analytics**](https://plausible.io/) is a privacy-friendly analytics solution for Nuxt Apps, allowing you to track your website's traffic without compromising your users' privacy.

The simplest way to load Plausible Analytics globally in your Nuxt App is to use Nuxt config. Alternatively you can directly use the **useScriptPlausibleAnalytics** composable.

## Loading Globally

If you don't plan to send custom events you can use the [**Environment overrides**](https://nuxt.com/docs/getting-started/configuration#environment-overrides) to disable the script in development.

```ts
export default defineNuxtConfig({
  scripts: {
    registry: {
      plausibleAnalytics: {
        // Get this from your Plausible script URL:
        // https://plausible.io/js/pa-gYyxvZhkMzdzXBAtSeSNz.js
        //                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
        scriptId: 'gYyxvZhkMzdzXBAtSeSNz'
      }
    }
  }
})
```

## useScriptPlausibleAnalytics

The `**useScriptPlausibleAnalytics**` composable lets you have fine-grain control over when and how Plausible Analytics is loaded on your site.

```ts
// New October 2025 format
const plausible = useScriptPlausibleAnalytics({
  // Extract from: https://plausible.io/js/pa-gYyxvZhkMzdzXBAtSeSNz.js
  //                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  scriptId: 'gYyxvZhkMzdzXBAtSeSNz'
})
```

Please follow the [**Registry Scripts**](https://scripts.nuxt.com/docs/v0/guides/registry-scripts) guide to learn more about advanced usage.

### Self-hosted Plausible

If you are using a self-hosted version of Plausible, you will need to provide an explicit src for the script so that the API events are sent to the correct endpoint.

```ts
useScriptPlausibleAnalytics({
  scriptInput: {
    src: 'https://my-self-hosted-plausible.io/js/script.js'
  }
})
```

### PlausibleAnalyticsApi

```ts
export interface PlausibleAnalyticsApi {
  plausible: ((event: '404', options: Record<string, any>) => void) &
  ((event: 'event', options: Record<string, any>) => void) &
  ((...params: any[]) => void) & {
    q: any[]
  }
}
```

### Config Schema

You must provide the options when setting up the script for the first time.

```ts
export interface PlausibleAnalyticsOptions {
  /**
   * Unique script ID for your site (recommended - new format as of October 2025)
   * Extract from: <script src="https://plausible.io/js/pa-{scriptId}.js"></script>
   */
  scriptId?: string
  /** Custom properties to track with every pageview */
  customProperties?: Record<string, any>
  /** Custom tracking endpoint URL */
  endpoint?: string
  /** Configure file download tracking */
  fileDownloads?: {
    fileExtensions?: string[]
  }
  /** Enable hash-based routing for single-page apps */
  hashBasedRouting?: boolean
  /** Set to false to manually trigger pageviews */
  autoCapturePageviews?: boolean
  /** Enable tracking on localhost */
  captureOnLocalhost?: boolean
  /** Enable form submission tracking */
  trackForms?: boolean
}
```

```ts
export interface PlausibleAnalyticsDeprecatedOptions {
  /**
   * Your site domain
   * @deprecated Use `scriptId` instead (new October 2025 format)
   */
  domain?: string
  /**
   * Script extensions for additional features
   * @deprecated Use init options like `hashBasedRouting`, `captureOnLocalhost`, etc. instead
   */
  extension?: 'hash' | 'outbound-links' | 'file-downloads' | 'tagged-events' | 'revenue' | 'pageview-props' | 'compat' | 'local' | 'manual'
}
```

**Note:** The `**scriptId**` is found in your Plausible dashboard under **Site Installation** in your site settings.

**Extracting your Script ID:**

Plausible provides you with a script tag like this:

```html
<script async src="https://plausible.io/js/pa-gYyxvZhkMzdzXBAtSeSNz.js"></script>
```

Your `**scriptId**` is the part after `**pa-**` and before `**.js**`:

```ts
scriptId: 'gYyxvZhkMzdzXBAtSeSNz'
//         ^^^^^^^^^^^^^^^^^^^^^^^
//         Extract from: pa-{scriptId}.js
```

## Example

Using Plausible Analytics only in production while using `**plausible**` to send a conversion event.

```vue
<script setup lang="ts">
const { proxy } = useScriptPlausibleAnalytics()

// noop in development, ssr
// just works in production, client
proxy.plausible('event', { name: 'conversion-step' })
function sendConversion() {
  proxy.plausible('event', { name: 'conversion' })
}
</script>

<template>
  <div>
    <button @click="sendConversion">
      Send Conversion
    </button>
  </div>
</template>
```

[Edit this page](https://github.com/nuxt/scripts/edit/0.x/docs/content/analytics/plausible-analytics.md)

[Markdown For LLMs](https://scripts.nuxt.com/scripts/v0/analytics/plausible-analytics.md)

[**Matomo Analytics** Use Matomo Analytics in your Nuxt app.](https://scripts.nuxt.com/scripts/v0/analytics/matomo-analytics) [**Rybbit Analytics** Use Rybbit Analytics in your Nuxt app.](https://scripts.nuxt.com/scripts/v0/analytics/rybbit-analytics)

**On this page **

- [Loading Globally](#loading-globally)
- [useScriptPlausibleAnalytics](#usescriptplausibleanalytics)
- [Example](#example)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://scripts.nuxt.com/#website","@type":"WebSite","description":"Nuxt Scripts lets you load third-party scripts with better performance, privacy, security and DX. It includes many popular third-parties out of the box.","name":"Nuxt Scripts","url":"https://scripts.nuxt.com/","publisher":{"@id":"https://scripts.nuxt.com/#identity"}},{"@id":"https://scripts.nuxt.com/scripts/v0/analytics/plausible-analytics#webpage","@type":"WebPage","description":"Use Plausible Analytics in your Nuxt app.","name":"Plausible Analytics","url":"https://scripts.nuxt.com/scripts/v0/analytics/plausible-analytics","breadcrumb":{"@id":"https://scripts.nuxt.com/scripts/v0/analytics/plausible-analytics#breadcrumb"},"isPartOf":{"@id":"https://scripts.nuxt.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://scripts.nuxt.com/scripts/v0/analytics/plausible-analytics"]}],"primaryImageOfPage":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/#identity","@type":"Organization","name":"Nuxt Scripts","url":"https://scripts.nuxt.com","logo":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/scripts/v0/analytics/plausible-analytics#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Nuxt Scripts","item":"https://scripts.nuxt.com/","position":1},{"@type":"ListItem","name":"Scripts","item":"https://scripts.nuxt.com/scripts","position":2},{"@type":"ListItem","name":"V0","item":"https://scripts.nuxt.com/scripts/v0","position":3},{"@type":"ListItem","name":"Analytics","item":"https://scripts.nuxt.com/scripts/v0/analytics","position":4},{"@type":"ListItem","name":"Plausible Analytics","item":"https://scripts.nuxt.com/scripts/v0/analytics/plausible-analytics","position":5}]},{"@id":"https://scripts.nuxt.com/#logo","@type":"ImageObject","caption":"Nuxt Scripts","contentUrl":"https://scripts.nuxt.com/logo.svg","inLanguage":"en","url":"https://scripts.nuxt.com/logo.svg"}]}
```

## Sitemap

See the full [sitemap](https://scripts.nuxt.com/sitemap.md) for all pages.
