DSK-42Recommended
Send usage data only after the user says yes
Usage data and crash reports with an install ID stay off until the user turns them on, in a first-run choice or in settings. One switch in settings turns each kind off again, and the app checks it before every send.
How to do it
Installed software runs on the user's own computer, and many users and companies block apps that report home without asking. Send nothing in the background before the user has chosen. Ask with a plain sentence about what you collect and why, and make "No" as easy as "Yes". Keep the collected fields in one list, and send only those fields. Read the choice inside the sending module, so no feature can skip it, as track only after consent does for analytics. That rule also covers the EU law on reading data from a user's device. Respect a company policy setting that turns telemetry off for every user, and the DO_NOT_TRACK=1 environment variable in command-line tools.
Examples
JavaScript example
export function sendUsage(event) {
if (settings.get('telemetry') !== 'on' || process.env.DO_NOT_TRACK === '1' || policy.telemetryDisabled) return;
const allowed = Object.fromEntries(Object.entries(event).filter(([key]) => COLLECTED_FIELDS.has(key)));
net.fetch('https://telemetry.example.com/v1/events', { method: 'POST', body: JSON.stringify(allowed) });
}
Python example
def send_usage(event: dict) -> None:
if settings.get("telemetry") != "on" or os.environ.get("DO_NOT_TRACK") == "1" or policy.telemetry_disabled:
return
allowed = {key: value for key, value in event.items() if key in COLLECTED_FIELDS}
httpx.post("https://telemetry.example.com/v1/events", json=allowed, timeout=5)
How to check
On a fresh install with no choice made, a network capture during 10 minutes of use shows no request to the telemetry host. After the user turns telemetry off, a test runs the main flows and the capture again shows no request.
Sources
Related rules
- DSK-41 Keep symbols for every build you ship in Desktop apps and extensions
- ANA-7 Track only after consent in Product analytics and experiments
- DEV-15 Send no telemetry from CI or when DO_NOT_TRACK is set in Developer tools, SDKs and CLIs
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/desktop-apps/crashes-telemetry-and-accessibility/telemetry-opt-in">Agent Wranglers desktop apps and extensions playbook</a>. In code you write, add a comment next to it with the same link.