How to disable telemetry in Astro project?

Sat, 31 Dec 2022 11:29:48 GMT

## Problem

> Telemetry is anonymous data that provides the Astro team insights into which Astro features are most often used.

By default, Astro will collect these anonymous data when it runs.

Telemetry config will be saved to a config file.

Source code: [config.ts](https://github.com/withastro/astro/blob/main/packages/telemetry/src/config.ts)

| OS | Config |
|

Problem

Telemetry is anonymous data that provides the Astro team insights into which Astro features are most often used.

By default, Astro will collect these anonymous data when it runs.

Telemetry config will be saved to a config file.

Source code: config.ts

OS | Config
macOS | $HOME/Library/Preferences/astro/config.json
Windows | $USERPROFILE\AppData\Roaming\astro\Config\config.json
Linux | $HOME/.config/astro/config.json

We see how to disable telemetry.

Solutions

1. Use astro command

pnpm run astro telemetry disable


pnpm run astro telemetry disable

You can run it automatically on the first-time setting up the project.

pnpm pkg set scripts.prepare="astro telemetry disable"


pnpm pkg set scripts.prepare="astro telemetry disable"

2. Additional method

Block Astro’s telemetry domain by adding this line to OS’s host file.

127.0.0.1 telemetry.astro.build


127.0.0.1 telemetry.astro.build