A Plausible Analytics module for use with nuxt.js 2
npm i @agency-undone/nuxt-module-plausible --save
First, add the nuxt-plausible-module to the modules block of nuxt.config.js
export default {
modules: [
'nuxt-plausible-module'
],
}Next, add a plausible section to nuxt.config.js
export default {
plausible: {
include: true
}
}The NODE_ENV environment variable toggles Plausible based on environment. Plausible will be loaded when "NODE_ENV" = "production".
NODE_ENV=productionWhen working in any other environment Plausible will only be loaded if localhost tracking is explicitly enabled in the nuxt.config
export default {
plausible: {
include: true,
trackLocalhost: true
}
}