Adding Munchkin to GTM

Grégoire_Miche2
Level 10

Re: Adding Munchkin to GTM

I should have known you also had this one covered

You need to tell us more on this now. It's either too much or too little...

-Greg

SanfordWhiteman
Level 10 - Community Moderator

Re: Adding Munchkin to GTM

If only someone else cared besides you, Greg!

Liliana_Cheng1
Level 4

Re: Adding Munchkin to GTM

Hey Sanford Whiteman​, I'm interested in hearing more about GTM disadvantages. We don't use Marketo LPs at all, only wordpress and GTM, but we are considering hardcoding the munchkin and removing GTM. Would like to understand the benefits and disadvantages before we make the move though.

SanfordWhiteman
Level 10 - Community Moderator

Re: Adding Munchkin to GTM

There's no accuracy advantage to running Munchkin via GTM, only disadvantages.  There are (to some people) manageability advantages, but I care about accuracy first.

What people fail to reason through when adding analytics scripts (I detest the term "tags") is that if analytics is mission-critical -- and every CMO says it is -- pageviews, especially the first pageview on a device, must be logged before the lead navigates away from the page.  Yet the more preconditions and dependencies you add before Munchkin can finally load its tracking pixel, the less seriously you're taking analytics.

So these are clearly conflicting priorities.  If you want processes to complete before the person leaves the page, you want them closer to the synchronous, must-complete foreground.  If you don't want scripts to ever interfere with page rendering, nor vice versa, then you want them in the asychronous, best-effort background. You can't have it both ways.

There's rarely a practical problem on high-speed, low-latency connections, though.  The devil is in low-speed, high-latency connections.  The 3G connection, the train in a tunnel, the spotty shared wifi, long geographic distances. Built-in network limitations of mobile devices make it even worse.  If you serve 30 asynchronous scripts to a smart phone on a low-quality connection, don't expect all the tags to their jobs.

GA has some techniques that make background analytics more reliable (but then GA's servers are more reliable in general).  My Munchkin Enhanced library adds some of those extensions to Munchkin, but it can't cover all the bases. I always recommend that my clients use the simple embed code (which removes only one async layer -- there are still two required async calls), or, even better, load the tracking pixel directly (this requires server-side coordination).

In all, we may be talking about the difference between 99.99% and 99.999% of requests not completing.  However, if you're generating 100K requests per day, that's 900 misses, and the failures are going to be weighted toward first-time visitors with unprimed caches -- people you definitely want to see.

Look, it's not the end of the world, but I think once you're aware of the risks, you want to mitigate them.

Grégoire_Miche2
Level 10

Re: Adding Munchkin to GTM

Hi Sanford,

The reason people most often use to justify the use of GTM to run munchkin is that they use GTM to control cookie opt-in and therefore will want to also control munchkin with the same cookie opt-in controller.

We do not want to have 2 cookie opt-in mechanisms and prompts, obviously, one for the Marketo munchkin and another one for the other cookies.

How would you approach this then?

-Greg

SanfordWhiteman
Level 10 - Community Moderator

Re: Adding Munchkin to GTM

The mechanism is still using a cookie or the Storage API to persist the opt-in/opt-out value, right? So trigger on that value directly.

Grégoire_Miche2
Level 10

Re: Adding Munchkin to GTM

HI Sanford,

This makes sense, but how do I refire the munchkin once the visitor has accepted cookies?

-Greg

SanfordWhiteman
Level 10 - Community Moderator

Re: Adding Munchkin to GTM

Munchkin.init().

This still means you're adding a level of indirection, but you can at least still load the Munchkin bootstrapper initially.

With Munchkin Enhanced you can delay the cookie creation while still preloading the small bootstrapper and the real library.

Liliana_Cheng1
Level 4

Re: Adding Munchkin to GTM

Thanks, Sanford. Helpful as usual!

Dan_Stevens_
Level 10 - Champion Alumni

Re: Adding Munchkin to GTM

Hi Kenny Elkington​ - we use GTM on our Marketo LPs and are able to filter/trigger on the Marketo LP name (vs. the URL) in our smart lists.  For example:

pastedImage_0.png

Are you referring to something different?