Skip to main content
July 1, 2015
Respondido

Munchkin code injection in single pages?

  • July 1, 2015
  • 3 comentários
  • 1615 Visualizações

Hi all,

Is there a possibility to inject the Marketo munchkin code in single pages rather than in the main header/footer?

Thank you

Michael

Este tópico foi fechado para respostas.
Melhor resposta por SanfordWhiteman

Sure, just remove it from the template and then add it in the HEAD of a particular page.  But why?

3 comentários

SanfordWhiteman
Level 10
July 1, 2015

Sure, just remove it from the template and then add it in the HEAD of a particular page.  But why?

July 1, 2015

We have a common platform for microsites around the world. Not all the regions have Marketo.

SanfordWhiteman
Level 10
July 1, 2015

I'd recommend you still only include it once. In that common code block, check the current domain and decide whether or not to call Munchkin.init(), for example:

     /(^|\.)(exclude-domain.com|exclude-another.net)$/.test(document.location.hostname) || Munchkin.init('XXX-YYY-ZZZ')

(This is a simple one-liner; in practice I would put the excluded -- or included, depending on the count of each -- domains in an array because it's easier to read.)