Munchkin code injection in single pages? | Community
Skip to main content
July 1, 2015
Solved

Munchkin code injection in single pages?

  • July 1, 2015
  • 2 replies
  • 1590 views

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

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

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

2 replies

SanfordWhiteman
SanfordWhitemanAccepted solution
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.)