Created
August 29, 2012 11:04
-
-
Save rolandinsh/3510701 to your computer and use it in GitHub Desktop.
Do Not Track (DNT) detect with PHP code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_smc_dnt() { | |
/* | |
* Do Not Track for privacy. | |
* When this feature is enabled, webpage should exclude all tracking tools, | |
* like Google Analytic and advertising networks | |
*/ | |
// returns TRUE if DNT is on and is equal to 1, | |
// returns FALSE if DNT is unset OR not equal to 1 | |
return (isset($_SERVER['HTTP_DNT']) && $_SERVER['HTTP_DNT'] == 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or,
$_SERVER['HTTP_DNT'] === "1"
to avoid type coercion.