SOLVED

Re: How to delete _mkto_trk on Marketo 2.0 form submit

Go to solution
Opine_Consulti4
Level 2

How to delete _mkto_trk on Marketo 2.0 form submit

We are in the process of implementing EU cookie privacy directive on the main website and also Marketo landing pages. I've seen some references to Marketo automatically creating the _mkto_trk cookie on form submit if it isn't already there. Can anyone verify if this is true? Just trying to figure out the best way to deal with this situation:

- User indicates no tracking 

- munchkin.init is not run and _mkto_trk is not set.

- On page load, if _mkto_trk is set, it is deleted

- Marketo Form 2.0 is submitted and goes to a follow-up page so even if the _mkto_trk is set, it is deleted on page load (per above)

Here's the part I'm really asking about:

If the Marketo Form 2.0 is shown in a modal or in a lightbox, after submission there is no page load generated. If the cookie is really automatically created, then it needs to be deleted. Would you delete _mkto_trk in an on success handler or is there a better way to manage this?

Any tidbits for implementation would be much appreciated!

Thanks,

Sheila

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: How to delete _mkto_trk on Marketo 2.0 form submit

The Forms 2.0 library does not create cookies itself. Only Munchkin creates Munchkin cookies, so if you are preventing Munchkin from loading (i.e. not including the script) you do not need to do anything else, since when the Forms library looks for the global Munchkin object, it won't find it.

I've found that even if you do load the Munchkin bootstrapper, if you skip Munchkin.init() you will be fine.  However, there appears to be a difference of opinion (see below) about whether this latter case relies on a buggy implementation or not.  So I'd recommend skipping the script entirely to be future-proof.

View solution in original post

5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

Re: How to delete _mkto_trk on Marketo 2.0 form submit

The Forms 2.0 library does not create cookies itself. Only Munchkin creates Munchkin cookies, so if you are preventing Munchkin from loading (i.e. not including the script) you do not need to do anything else, since when the Forms library looks for the global Munchkin object, it won't find it.

I've found that even if you do load the Munchkin bootstrapper, if you skip Munchkin.init() you will be fine.  However, there appears to be a difference of opinion (see below) about whether this latter case relies on a buggy implementation or not.  So I'd recommend skipping the script entirely to be future-proof.

Kenny_Elkington
Marketo Employee

Re: How to delete _mkto_trk on Marketo 2.0 form submit

Sanford's answer isn't correct, for uncookied leads, the cookie will be created during submission.  You can delete it during the success handler as you indicated.

SanfordWhiteman
Level 10 - Community Moderator

Re: How to delete _mkto_trk on Marketo 2.0 form submit

Not if you don't load the Munchkin library. I should have said "If you are preventing Munchkin from loading" as opposed to "initing".‎ 

EDIT: I take back my take-back.  My original phrasing was correct, because even if the Munchkin bootstrapper script (munchkin-beta.js) loads, the forms lib will not automatically run init() for you, so the cookie creation process will just sit on the callback stack waiting for init(). Forms may want to create the cookie, but it can't.  Perhaps there was a regression at some point, but right now I cannot see how this would work, let alone work safely.

Opine_Consulti4
Level 2

Re: How to delete _mkto_trk on Marketo 2.0 form submit

Thank you both. Exact information I was looking for!

Sheila

SanfordWhiteman
Level 10 - Community Moderator

Re: How to delete _mkto_trk on Marketo 2.0 form submit

Actually, Kenny, my original answer was correct. With the Munchkin bootstrapper loaded, but Munchkin.init() skipped, the cookie will still not be set. 

The cookie setter function createTrackingCookie is pushed onto the deferred execution stack, but it never runs, because the stack is only popped on init().

Maybe some functional spec included a forced init() on submit (a pretty bizarre design IMO, and better left abandoned) but it actually could not be implemented successfully. The user must have the ability to supply Munchkin initialization options such as domainLevel and cookieLifeDays.  (Of course most people don't realize how badly domainLevel may be needed.)