Excluding Anonymous Visitors from being Cookied by Munchkin | Community
Skip to main content
John_M
Adobe Employee
Adobe Employee
June 8, 2015

Excluding Anonymous Visitors from being Cookied by Munchkin

  • June 8, 2015
  • 0 replies
  • 945 views

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>

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.