fix: Respect "Do Not Track" settings

Don't offer telemetry as option if DNT is set in browser.

https://developer.mozilla.org/en-US/docs/Web/API/Navigator/doNotTrack
This commit is contained in:
Ankush Menat 2023-11-01 15:03:45 +05:30
parent b56cbdfff8
commit 86e4a3a6e1
2 changed files with 2 additions and 2 deletions

View file

@ -404,7 +404,7 @@ frappe.setup.slides_settings = [
fieldname: "enable_telemetry",
label: __("Allow sending usage data for improving applications"),
fieldtype: "Check",
default: 1,
default: cint(frappe.telemetry.can_enable()),
depends_on: "eval:frappe.telemetry.can_enable()",
},
{

View file

@ -43,7 +43,7 @@ class TelemetryManager {
}
can_enable() {
return Boolean(this.telemetry_host && this.project_id);
return Boolean(this.telemetry_host && this.project_id && !cint(navigator.doNotTrack));
}
send_heartbeat() {