Adding Munchkin to GTM | Community
Skip to main content
June 22, 2016
Question

Adding Munchkin to GTM

  • June 22, 2016
  • 2 replies
  • 5337 views

At the end of our Marketo landing pages, we have a parameterized Munchkin init function:

<script type="text/javascript" src="//munchkin.marketo.net//munchkin.js"></script><script>Munchkin.init('123-xxx-456', {parameter1: 'foo', parameter2: 'bar'});

</script>

We use Google Tag Manager across our sites (including our Marketo landing pages), and we would like to include the Munchkin code snippet in it, ie:

<script type="text/javascript">

(function() {

  var didInit = false;

  function initMunchkin() {

    if(didInit === false) {

      didInit = true;

      Munchkin.init('123-xxx-456');

    }

  }

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

  s.type = 'text/javascript';

  s.async = true;

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

  s.onreadystatechange = function() {

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

      initMunchkin();

    }

  };

  s.onload = initMunchkin;

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

})();

</script>

Would that override/break the parameterized Munchkin code that is already being included on our pages?

Thanks in advance!

Mary

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

2 replies

Grégoire_Miche2
Level 10
June 22, 2016

Hi Mary,

You should not have the munchkin fired twice. You may want to make sure that the version in GTM is the parameterized one and remove the one from the pages.

-Greg

June 22, 2016

Thank you, Greg. How would I remove munchkin from marketo landing pages? I have checked the form, template and landing page itself, and it doesn't seem to be hard-coded. Maybe there's a setting I'm overlooking.

Kenny_Elkington
Adobe Employee
Adobe Employee
June 22, 2016

It's highly recommended that you do not use GTM for munchkin on your Marketo LPs.  You will lose the ability to filter web page visits on your landing pages names if you do so.

June 22, 2016

Thanks Kenny, we have decided to use GTM to serve Munchkin everywhere except our Marketo landing pages - it seemed to be the most intuitive solution.

SanfordWhiteman
Level 10
June 22, 2016

I don't recommend using GTM for Munchkin in either case if you want the greatest tracking accuracy.  You may be dealing with the difference between 99.9% accuracy and 99.99% -- but with high-traffic sites that difference is significant.

Outside of GTM, it is sometimes necessary to remove Munchkin from Marketo LPs and re-add it manually in order for tracking to work as expected. To do this safely (without losing friendly names as Kenny mentions) requires a little hackwork that maybe I should blog about sometime.