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.


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).


// prints "1" if DNT is enabled; "0" if the user opted-in for tracking; otherwise this is "unspecified"


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

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support23 No1929 — 11 ms 3125.1 — 74
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes Yes No192 ? ? ?

1. Use window.doNotTrack instead.

2. Prior to Firefox 32, navigator.doNotTrack would report values of yes and no rather than 1 and 0.

3. For IE11 and subsequent versions, use window.doNotTrack

4. Safari 7.1.3+ uses window.doNotTrack rather than navigator.doNotTrack.

See also

Document Tags and Contributors

Last updated by: connorshea,