Plausible Integration
Plausible is a lightweight, privacy-friendly, open-source website analytics tool (available as a hosted SaaS or self-hosted). Compared to GA, it’s usually simpler and a better fit for products with stricter privacy/compliance requirements.
NEXTY.DEV already includes Plausible script injection. Once you set the environment variables, the script will be loaded automatically in production.
Good to know
- NEXTY.DEV disables tracking scripts in development to avoid polluting analytics data.
- To verify locally, open
app/[locale]/layout.tsxand remove theprocess.env.NODE_ENV === "development"check.- If you don’t need local verification, just set the production environment variables and the scripts will be enabled automatically.
Step 1: Create a website in Plausible
- Open Plausible:
https://plausible.io/(or your self-hosted instance) - Sign up / sign in, then click Add a website
- Enter your domain (usually without protocol, e.g.
example.com) - After creation, you’ll see the installation instructions
Step 2: Configure NEXTY.DEV environment variables
NEXTY.DEV uses two environment variables for Plausible:
NEXT_PUBLIC_PLAUSIBLE_SRC: Plausible script URL (e.g.https://your_plausible_address/js/script.file-downloads.outbound-links.pageview-props.revenue.tagged-events.js)NEXT_PUBLIC_PLAUSIBLE_DOMAIN: your site domain (e.g.nexty.dev)
Example using Plausible Cloud:
.env
NEXT_PUBLIC_PLAUSIBLE_SRC=https://plausible.io/js/script.js
NEXT_PUBLIC_PLAUSIBLE_DOMAIN=example.comUsing the Plausible API
The NEXTY.DEV template supports fetching Plausible data via API. The helper actions are in actions/plausible/index.ts.
In your Plausible dashboard, go to API Keys, create an API key, and copy it into your environment variables:
.env
PLAUSIBLE_API_KEY=your_api_key
PLAUSIBLE_URL=your_plausible_address
NEXT_PUBLIC_PLAUSIBLE_DOMAIN=your_site_domain