SOLVED

Munchkin code injection in single pages?

Go to solution
Anonymous
Not applicable

Munchkin code injection in single pages?

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

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Munchkin code injection in single pages?

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

View solution in original post

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Munchkin code injection in single pages?

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

Anonymous
Not applicable

Re: Munchkin code injection in single pages?

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

SanfordWhiteman
Level 10 - Community Moderator

Re: Munchkin code injection in single pages?

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.)