Excluding Anonymous Visitors from being Cookied by Munchkin

John_M
Marketo Employee
Marketo Employee

In some cases you may not want to cookie all anonymous users to your website. You might have 100s of millions of anonymous website visits on a daily basis, few of whom ever convert. In that case, you could choose to only place the munchkin code on key pages, or you could choose to place the munchkin on most pages, but only track users once they convert.

To change the Munchkin code so that it will not drop a cookie or track for anonymous users, but will continue tracking known users, add "cookieAnon" as shown below.

<script type="text/javascript">

(function() {

  function initMunchkin() {

    Munchkin.init('XXX-XXX-XXX',  {cookieAnon: false});

  }

  var s = document.createElement('script');

  s.type = 'text/javascript';

  s.async = true;

  s.src = document.location.protocol + '//munchkin.marketo.net/munchkin.js';

  s.onreadystatechange = function() {

    if (this.readyState == 'complete' || this.readyState == 'loaded') {

      initMunchkin();

    }

  };

  s.onload = initMunchkin;

  document.getElementsByTagName('body')[0].appendChild(s);

})();

</script>

704
0