DNT Header
Table of Content
The DNT (Do Not Track) header is a Hypertext Transfer Protocol (HTTP) header field that requests that a web application disables either its tracking or cross-site user tracking of an individual user. When the DNT header is set, it communicates to websites and online services that the user does not want their browsing behavior tracked. Its main purposes are for user-privacy related tools aiming to alleviate the potential infringement of a user's privacy rights.
Syntax
The syntax for the DNT header is quite straightforward:
DNT: 1
or
DNT: 0
The '1' value indicates that the user does not want to be tracked (opt-out), whilst '0' indicates the opposite.
Directives
There are only two directives for the DNT header:
0
: This signifies that the user consents to being tracked.1
: This shows that the user has explicitly expressed they do not wish to be tracked.
Examples
The examples below demonstrate how the DNT header can be implemented in an HTTP request:
For opting out of tracking:
GET /index.html HTTP/1.1
Host: example.com
DNT: 1
For consenting to tracking:
GET /index.html HTTP/1.1
Host: example.com
DNT: 0
Browser Compatibility
Browser | Compatibility |
---|---|
Chrome | Supported |
Firefox | Supported |
Safari | Supported |
Opera | Supported |
Edge | Supported |
Different browsers may have different default settings for DNT. Users can usually find the option to enable or disable DNT in their browser's privacy settings.
How to modify DNT header
ModHeader is an extension for Google Chrome that allows users to modify HTTP headers. It can be used to change the DNT setting, providing more control to users over their privacy.
Once you have installed ModHeader, follow these steps:
Click on the ModHeader icon in the top right corner of Google Chrome to open it.
In the
Response headers
section, click on the+
button.Enter
DNT
in theName
field.Enter
1
in theValue
field to opt out of tracking, or0
to allow it.Close the ModHeader tab. The settings will be saved and applied to all HTTP requests until you change them.
By using ModHeader to modify the DNT header, you can easily change your tracking preference at any time, providing flexibility and control over your online privacy.