Skip to content

Commit e96735c

Browse files
committed
feat: load plugin if env is prod or if localhost tracking explicitly enabled
1 parent 4c6c0bc commit e96735c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

modules/nuxt-module-plausible/plugin.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ import { defineNuxtPlugin } from '#imports'
77
export default defineNuxtPlugin((nuxtApp) => {
88

99
// Do not fire Plausible if not in production mode
10+
// unless tracking localhost is explicitly enabled in the config
1011
if (process.env.NODE_ENV !== 'production') {
11-
return
12+
if (!nuxtApp.$config.public.plausible.trackLocalhost) {
13+
return
14+
}
1215
}
1316

1417
const router = nuxtApp.$router

0 commit comments

Comments
 (0)