Skip to content

Commit 1e229ac

Browse files
feat!: set default proxy path to _plausible
1 parent 3369a9c commit 1e229ac

File tree

8 files changed

+527
-544
lines changed

8 files changed

+527
-544
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export default defineNuxtConfig({
8383
```
8484

8585
> [!NOTE]
86-
> When enabled, all Plausible events will be sent to your server first, which then forwards them to Plausible's API. The default proxy endpoint is `/api/__plausible_event__`, but you can customize the path using the `proxyBaseURL` module option.
86+
> When enabled, all Plausible events will be sent to your server first, which then forwards them to Plausible's API. The default proxy endpoint is `/_plausible`, but you can customize the path using the `proxyBaseEndpoint` module option.
8787
8888
## Module Options
8989

@@ -99,7 +99,7 @@ export default defineNuxtConfig({
9999
| `autoOutboundTracking` | `boolean` | `false` | Track all outbound link clicks automatically. If enabled, a [MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) automagically detects link nodes throughout the application and binds `click` events to them. |
100100
| `logIgnoredEvents` | `boolean` | `false` | Log events to the console if they are ignored. |
101101
| `proxy` | `boolean` | `false` | Whether to proxy the event endpoint through the current origin. |
102-
| `proxyBaseURL` | `string` | `'/api/__plausible_event__'` | The base URL to proxy the event endpoint through. |
102+
| `proxyBaseEndpoint` | `string` | `'/_plausible'` | The base endpoint to proxy the Plausible event endpoint through. |
103103

104104
## Composables
105105

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@nuxtjs/plausible",
33
"type": "module",
44
"version": "1.1.1",
5-
"packageManager": "pnpm@9.13.2",
5+
"packageManager": "pnpm@9.14.2",
66
"description": "Natively integrates Plausible Analytics into Nuxt",
77
"author": "Johann Schopplich <[email protected]>",
88
"license": "MIT",
@@ -41,19 +41,19 @@
4141
"release": "bumpp"
4242
},
4343
"dependencies": {
44-
"@barbapapazes/plausible-tracker": "^0.5.3",
45-
"@nuxt/kit": "^3.14.159",
44+
"@barbapapazes/plausible-tracker": "^0.5.6",
45+
"@nuxt/kit": "^3.14.1592",
4646
"defu": "^6.1.4"
4747
},
4848
"devDependencies": {
49-
"@nuxt/eslint-config": "^0.7.0",
49+
"@nuxt/eslint-config": "^0.7.1",
5050
"@nuxt/module-builder": "^0.8.4",
51-
"@nuxt/schema": "^3.14.159",
52-
"@types/node": "^20.17.6",
51+
"@nuxt/schema": "^3.14.1592",
52+
"@types/node": "^20.17.7",
5353
"bumpp": "^9.8.1",
5454
"eslint": "^9.15.0",
55-
"eslint-plugin-perfectionist": "^3.9.1",
56-
"nuxt": "^3.14.159",
55+
"eslint-plugin-perfectionist": "^4.0.3",
56+
"nuxt": "^3.14.1592",
5757
"typescript": "^5.6.3",
5858
"vue-tsc": "^2.1.10"
5959
}

playground/app.vue

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,23 @@ function pushRoute() {
3535
<h3>Configuration</h3>
3636
<details>
3737
<summary>Public Runtime Options</summary>
38-
<pre>{{ JSON.stringify(plausible, null, 2) }}</pre>
38+
<pre>{{ JSON.stringify(plausible, undefined, 2) }}</pre>
3939
</details>
4040

4141
<h3>Composables</h3>
42-
<button @click="trackEvent">
43-
useTrackEvent
44-
</button>
45-
&nbsp;
46-
<button @click="trackPageview">
47-
useTrackPageview
48-
</button>
49-
&nbsp;
50-
<button @click="pushRoute">
51-
navigateTo
52-
</button>
42+
<p>
43+
<button @click="trackEvent">
44+
useTrackEvent
45+
</button>
46+
&nbsp;
47+
<button @click="trackPageview">
48+
useTrackPageview
49+
</button>
50+
&nbsp;
51+
<button @click="pushRoute">
52+
navigateTo
53+
</button>
54+
</p>
5355

5456
<h3>Links</h3>
5557
<ul>

playground/nuxt.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
import NuxtPlausible from '../src/module'
2+
13
export default defineNuxtConfig({
2-
modules: ['@nuxtjs/plausible'],
4+
modules: [NuxtPlausible],
35

46
compatibilityDate: '2024-04-03',
57

68
plausible: {
9+
// Enable tracking events on localhost
10+
ignoredHostnames: [],
711
autoPageviews: false,
812
autoOutboundTracking: false,
913
proxy: true,

playground/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,5 @@
66
"dev": "nuxi dev",
77
"build": "nuxi build",
88
"generate": "nuxi generate"
9-
},
10-
"dependencies": {
11-
"@nuxtjs/plausible": "workspace:"
129
}
1310
}

0 commit comments

Comments
 (0)