DEV Community

Cassidy Williams for Netlify

Posted on • Originally published at netlify.com on

How to turn off telemetry in Next.js

Welcome to Blogvent, day 15!

Next.js, through its CLI, collects anonymous telemetry data about general usage by default. The data collected includes:

  • CLI command invoked (next build, next dev, or next export)
  • The version of Next.js you’re using
  • Your operating system
  • Next.js plugins used in your project
  • Duration of next build and size of application

This information doesn’t identify you in any way, but you might not want it to be collected. To disable this data collection, run this command at the root of your project:

npx next telemetry disable
# to re-enable, turn "disable" into "enable"
Enter fullscreen mode Exit fullscreen mode

Similarly, you can check the status of telemetry data collection with this command:

npx next telemetry status
Enter fullscreen mode Exit fullscreen mode

If you want to ensure this is a change in your codebase, you can also set an environment variable (here’s more details how!) in your project:

NEXT_TELEMETRY_DISABLED=1
Enter fullscreen mode Exit fullscreen mode

I want to start a new project!

Who doesn’t? Here’s a starter application to to try this out:

Deploy to Netlify

(Clicking this button will deploy a Next.js starter project to Netlify, and clone it to your chosen Git provider)

Top comments (2)

Collapse
 
stevetaylor profile image
Steve Taylor

It's worth noting that Next.js telemetry opt-out in Docker and CI environments is ephemeral by design. Your best bet is to assume that Next.js analytics will be enabled somewhere in your workflow despite your best efforts to disable it. If you can't live with that, either fork Next.js or try something else, such as Astro, Remix, or even SvelteKit.

Collapse
 
avisek profile image
Avisek Das

Add "postinstall": "pnpm next telemetry disable" in package.json.

Works flawless for me.