Skip to content

Instantly share code, notes, and snippets.

@kevinruscoe
Created September 10, 2015 09:55
Show Gist options
  • Save kevinruscoe/69ab1924e5f268742fd0 to your computer and use it in GitHub Desktop.
Save kevinruscoe/69ab1924e5f268742fd0 to your computer and use it in GitHub Desktop.
<?php
/**
* Set's a 'do-not-track' cookie that'll expire in 10 years, used in conjunction with Google Tag Manager
*
* @return void
* @author Kevin Ruscoe
*/
function setDoNotTrackCookie(){
setcookie('do-not-track', 'do-not-track', strtotime( '+10 years' ));
}
if(isset($_GET['dnt'])){ setDoNotTrackCookie(); }
?>
<!-- Google Tag Manager -->
... your tag manager code
<!-- End Google Tag Manager -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment