Munchkin on TLD with subfolders

Highlighted
Level 2

Munchkin on TLD with subfolders

Hello everyone,

We have recently included the Marketo Munchkin cookie on our company's website. However, it doesn't seem to track web visits properly.

Some records are properly updated with web visits, while others don't seem te be updated at all. When I compare my own record against that of my colleague, Marketo hasn't recorded any web visits on mine, while it did record all of my colleague's web visits.

I've experimented with different records, browsers and networks, but nothing seems to explain the discrepancy. The only thing that I think may influence the unpredictability may be that we're using a quite unusual domain strucuture:

www2.example.com/nl/

www2.example.com/en/

and so on...

Also, since each country has it's own Marketo intance, each subfolder contains a different version of the Marketo Munchkin cookie.

I'm not sure how to debug this problem any further. Hope anyone can point me into the right direction.

6 REPLIES 6
Highlighted
Level 4

Re: Munchkin on TLD with subfolders

Hi Frank,

How did you add your multiple marketo munchkin codes to your website? Is each instance on your webpage, or do you have a single script with all the munchkin id's? Can you send me a sample page with your munchkin code on it? Are you sure you are cookied? I have run into a similar situation and may be able to help you solve for it with a little more information.

'

Highlighted
Level 10 - Community Moderator

Re: Munchkin on TLD with subfolders

First, let's use the right terms.

  • The TLD of www2.example.com is com.
  • The TLD of www2.example.co.uk is technically uk.
  • The effective TLD (which is based on the Public Suffix List) of www2.example.co.uk is co.uk. (The eTLD represents the level at which new names can be registered.)

Now, there's nothing unusual about your URL structure at all. You're just using regional pathnames. The Munchkin cookie is set for the root path ( / ) and cascades to all the paths under the root. In other words, that's not your problem.

Munchkin does have a problem with 2-letter TLDs out-of-the-box, as described here: https://blog.teknkl.com/munchkin-2-letter-tlds-broken/. But if you don't have a 2-letter TLD this does not apply.

I can only help you more if you provide your real DNS domain(s) and sample URLs.

Highlighted
Level 2

Re: Munchkin on TLD with subfolders

Thanks for the elaborate response.

Our domain is www2.deloitte.com. However, because we're a local office, we only manage www2.deloitte.com/nl/nl.html. Here we have implemented the Munckin cookie of our Marketo instance. However, our colleagues in the UK manage their own Marketo instance and have their own Munchkin cookie set at https://www2.deloitte.com/uk/en.html.

Hope this helps to investigate the problem. Let me know if you have questions.

Highlighted
Level 10 - Community Moderator

Re: Munchkin on TLD with subfolders

Ah, 2 different Munchkin IDs. There isn't a built-in way to create path-bound cookies. I'll post custom code later that shows you how to do it.

Highlighted
Level 2

Re: Munchkin on TLD with subfolders

Hi Sanford,

That would be very helpful Hope it will solve our problem! Let me know if you need additional info.

Highlighted
Level 10 - Community Moderator

Re: Munchkin on TLD with subfolders

Frank Oprel​ sorry to make you wait on this. Had the code ready since Friday, decided it deserved to be elevated to a blog post... but haven't found the time to write the couple of intro paragraphs!

So for now let's keep it in this thread, will move to the blog later with fuller explanation.

The code is in the JS pane of the CodePen here:

MktoMunchkin :: Per-Path Cookies

You'll need a copy of the FormsPlus::Util 1.0.6 JS library as linked in the first line. (Download and reupload the .js file to your Marketo server and change the URL, don't try to load it directly from the demo URL.)

Then directly after that include the inline <script> also in the JS pane. Substitute your Munchkin ID for "123-ABC-456".

After that, continue with your standard Munchkin embed. That is, use the exact same script order as in the demo: FormsPlus::Util JS, then the special code to allow per-path cookies, then the standard Munchkin embed.