This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Returns the user's do-not-track setting. This is "1" if the user has requested not to be tracked by web sites, content, or advertising.

Syntax

dnt = navigator.doNotTrack;

The value reflects that of the do-not-track header, i.e. values of {"1", "0", "unspecified" }. Note: Prior to Gecko 32, Gecko used the values { "yes", "no", "unspecified"} (bug 887703).

Example

console.log(navigator.doNotTrack); 
// prints "1" if DNT is enabled; "0" if the user opted-in for tracking; otherwise this is "unspecified"

Specifications

Specification Status Comment
Tracking Preference Expression (DNT)
The definition of 'Navigator.doNotTrack' in that specification.
Candidate Recommendation Initial definition

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic support
Experimental
Chrome Full support 23Edge No support No
Notes
No support No
Notes
Notes Use window.doNotTrack instead.
Firefox Full support 9
Notes
Full support 9
Notes
Notes Prior to Firefox 32, navigator.doNotTrack would report values of yes and no rather than 1 and 0.
IE No support 9 — 11
Prefixed Notes
No support 9 — 11
Prefixed Notes
Prefixed Implemented with the vendor prefix: ms
Notes For IE11 and subsequent versions, use window.doNotTrack
Opera Full support 12Safari No support 5.1 — 7
Notes
No support 5.1 — 7
Notes
Notes Safari 7.1.3+ uses window.doNotTrack rather than navigator.doNotTrack.
WebView Android Full support YesChrome Android Full support YesEdge Mobile No support No
Notes
No support No
Notes
Notes Use window.doNotTrack instead.
Firefox Android Full support 9
Notes
Full support 9
Notes
Notes Prior to Firefox 32, navigator.doNotTrack would report values of yes and no rather than 1 and 0.
Opera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
See implementation notes.
See implementation notes.
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

See also

Document Tags and Contributors

Last updated by: connorshea,