logo

How to disable telemetry in Astro project?

Posted on
Authors

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

OSConfig
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