Using Multiple Munchkin Tracking Codes on a Single Page | Community
Skip to main content
December 22, 2014

Using Multiple Munchkin Tracking Codes on a Single Page

  • December 22, 2014
  • 2 replies
  • 4635 views

Please ensure that you have access to an experienced JavaScript developer. 

Marketo Technical Support is not set up to assist with troubleshooting JavaScript.

With a change to the Munchkin javascript, you can send web tracking events like page visits or clicked links to multiple instances of Marketo.

The code below is for sending Munchkin events to two or more Marketo accounts. If the events need to go to only one Marketo account, you can use the Munchkin tracking code as-is from the Munchkin Setup part of the Admin section.

Note: Marketo tracks visitors to your website by domain (ex. "marketo.com"). If your hosting this Munchkin script on a domain that's different than your primary domain (ex. "company.com"), those visitors will appear as anonymous leads until they fill out a form on that other domain.

Add a parameter to the mktoMunchkin call -- altIds -- and include an array of the additional Munchkin IDs where these web events should go, as in the example below. You can include any number of altIds in the array, each separated by commas.

In the example below, replace the highlighted Munchkin IDs ("XXX-XXX-XXX", "YYY-YYY-YYY") with the Munchkin IDs from each Marketo account where the tracking information should be sent.

<script src="http://munchkin.marketo.net/munchkin.js" type="text/javascript"></script>
<script>mktoMunchkin("XXX-XXX-XXX", { altIds: ['YYY-YYY-YYY', 'ZZZ-ZZZ-ZZZ'] });</script>

Related Articles

Adding Javascript Tracking Code to your Website (Munchkin)

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

2 replies

Kenny_Elkington
Adobe Employee
Adobe Employee
June 12, 2015

mktoMunchkin() is not recommend for use any longer.  The current recommendation would be to use the async munchkin with tis as an additional argument:

<script type="text/javascript">

(function() {

  var didInit = false;

  function initMunchkin() {

    if(didInit === false) {

      didInit = true;

      Munchkin.init("XXX-XXX-XXX", { altIds: ['YYY-YYY-YYY', 'ZZZ-ZZZ-ZZZ'] });

    }

  }

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

  s.type = 'text/javascript';

  s.async = true;

  s.src = '//munchkin.marketo.net/munchkin-beta.js';

  s.onreadystatechange = function() {

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

      initMunchkin();

    }

  };

  s.onload = initMunchkin;

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

})();

</script>

Edward_Unthank_
Level 7
July 21, 2015

Also, if you have workspace/partitions, here's some more information.

Multiple Marketo instances without a specific lead partition: Munchkin.init("XXX-XXX-XXX", { altIds: ['YYY-YYY-YYY', 'ZZZ-ZZZ-ZZZ'] });

Multiple Marketo instances with a defined partition for the default instance: Munchkin.init("XXX-XXX-XXX", {'wsInfo':'j1RQ', altIds: ['YYY-YYY-YYY', 'ZZZ-ZZZ-ZZZ'] });

You can write to a specific workspace/partition for the primary Munchkin tracking, but cannot specify a workspace/partition for the additional Munchkin instances.

Cheers,

Edward Unthank | Founder, Etumos