SOLVED

Munchkin code injection in single pages?

Go to solution
Anonymous
Not applicable

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
SanfordWhiteman
Level 10 - Community Moderator

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
Anonymous
Not applicable

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

SanfordWhiteman
Level 10 - Community Moderator

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

SanfordWhiteman
Level 10 - Community Moderator

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