Complying to "Do Not Track" browser settings

Do Not Track (DNT) is a privacy preference that users can set in their web browsers. Twitter has announced support for this new standard.

If you care about privacy, you would want to implement this on your websites. This is really simple because a browser that supports it will send a HTTP header "DNT". Value 1 means opt out and 0 opt in.

So just read the header and do your magic (or not according to the setting).

In PHP you can do the following:


if( empty($_SERVER['HTTP_DNT']) ) {
  // Put your tracking code here
}

Do Not Track is supported by Firefox 5+, Internet Explorer 9+, and Safari 5.1+.

More information on DNT: