Navigator.doNotTrack

The Navigator.doNotTrack property returns the user's Do Not Track setting, which indicates whether the user is requesting web sites and advertisers to not track them.

The value of the property reflects that of the DNT HTTP header, i.e. values of "1", "0", or "unspecified".

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.
Obsolete Initial definition

Browser compatibility

BCD tables only load in the browser

See also