Another case where you should disable (automatic) Munchkin on a Marketo LP and manually load it instead
You should already know a non-default domainLevel (for example, an .io or .ai domain) requires customizing the Munchkin embed code. Easy on a 3rd-party site, where you already control the embed code; on a Marketo LP, you must disable Munchkin at the template level (Template Actions » Disable Munchkin Tracking) and substitute your custom version.[1]
Another case for disabling auto-Munchkin and injecting it yourself is managing cookie consent.[2]
And today’s case: if you’re using (as everyone should) a Redirector LP for email links to downloads, where the next-hop URL is passed via the URL hash, you must use custom Munchkin to see the logs you expect.
Why use the hash, though?
First of all, using the hash, like
https://pages.example.com/download#https://assets.example.com/my.pdfoffers better caching than using a query param. The hash is never sent outside the browser, so a cached version of https://pages.example.com/download can be used.[3]
But more important, Marketo defines the “web page” in a Visit Web Page activity as the hostname + pathname + hash, but not the query string. When reading the logs, it’s easier to see the “real” URL (i.e. download URL) if it’s not buried in the details.
The relevant diff between auto-Munchkin and custom Munchkin
The wrinkle is that the desired behavior, where the hash is shown in the Visit Web Page activity, doesn’t work by default on Marketo LPs! When customName and wsInfo options are passed, as is the case with auto-injected Munchkin, the hash is removed from the logs completely:
Munchkin.init('123-ABC-456', {customName: 'RedirectorPage', wsInfo: 'j1RR'})
But manual Munchkin doesn’t know/use those values, so Marketo treats the pageview as if it’s on a 3rd-party site and does log the hash:
Munchkin.init('123-ABC-456');Notes
[1] Oversimplifying a bit: to get the benefits of automatic Munchkin while customizing options, you can’t just switch from automatic → embed code but need to merge the two. However, for the redirector page case, you deliberately don’t want to merge, just switch.
[2] Venture 50%+ of people who think they don’t load Munchkin if someone rejects cookies are failing to observe the user’s choices due to a race condition on Marketo LPs, i.e. the cookie’s already been set when the banner pops up. Custom code lets you use the consent software’s declarative syntax like <script type="conditional:tracking">.
[3] In fairness, the mkt_tok is always changing in this case too, which counteracts the caching part, but it’s still worth doing.