Adding Munchkin to GTM

Anonymous
Not applicable

Adding Munchkin to GTM

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

24 REPLIES 24
Grégoire_Miche2
Level 10

Re: Adding Munchkin to GTM

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

Anonymous
Not applicable

Re: Adding Munchkin to GTM

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
Marketo Employee

Re: Adding Munchkin to GTM

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.

Anonymous
Not applicable

Re: Adding Munchkin to GTM

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 - Community Moderator

Re: Adding Munchkin to GTM

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.

Anonymous
Not applicable

Re: Adding Munchkin to GTM

I probably understand why you say you don't recommend it, but the appeal of managing it all under one roof has a strong appeal - is it worth possibly losing the 0.09% accuracy? Maybe yes, maybe no - guess it depends who you ask. A post on that hackish (ie., poetic!) solution would be an interesting read. Although, I have resolved to the fact that munchkin gets added to the Landing Pages by unicorn magic and if there's one thing life has taught me, it's not to mess with the unicorns.

SanfordWhiteman
Level 10 - Community Moderator

Re: Adding Munchkin to GTM

If you get 10000 unique visitors a day, you could be losing source information for 9 of them; if you get 100,000 unique page views per day, you could be missing 90 of them from your Marketo logs, triggers, etc.  (The actual numbers can be significantly higher depending on the geographic distribution of your leads.)

Now, the optimist decides those you can't see would be the ones you wouldn't want to see (by pure coincidence, of course, as there's no relationship!). The pessimist says there's no way to know this.

Grégoire_Miche2
Level 10

Re: Adding Munchkin to GTM

Hi Sanford Whiteman and Kenny Elkington

I observe that more and more companies will want to use GTM to handle the munchkin in order to comply with the cookie opt-in directives: GTM handles it and either activate or deactivate all cookies, including Marketo's, when the visitor chooses to opt-out.

-Greg

SanfordWhiteman
Level 10 - Community Moderator

Re: Adding Munchkin to GTM

I know they are!  They're not thinking about the impact, though, piling on the ill-advised notion of "indirection everywhere." Then they wonder why they lose data! Of course if you use my Munchkin Enhanced adapter you can deal with a lot of that...