File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -47,9 +47,27 @@ export class Telemetry {
4747 /**
4848 * Checks if telemetry is currently enabled
4949 * This is a method rather than a constant to capture runtime config changes
50+ *
51+ * Follows the Console Do Not Track standard (https://consoledonottrack.com/)
52+ * by respecting the DO_NOT_TRACK environment variable
5053 */
5154 private static isTelemetryEnabled ( ) : boolean {
52- return config . telemetry !== "disabled" ;
55+ // Check if telemetry is explicitly disabled in config
56+ if ( config . telemetry === "disabled" ) {
57+ return false ;
58+ }
59+
60+ // Check for DO_NOT_TRACK environment variable as per https://consoledonottrack.com/
61+ const doNotTrack = process . env . DO_NOT_TRACK ;
62+ if ( doNotTrack ) {
63+ const value = doNotTrack . toLowerCase ( ) ;
64+ // Telemetry should be disabled if DO_NOT_TRACK is "1", "true", or "yes"
65+ if ( value === "1" || value === "true" || value === "yes" ) {
66+ return false ;
67+ }
68+ }
69+
70+ return true ;
5371 }
5472
5573 /**
You can’t perform that action at this time.
0 commit comments