Pro-Tip: Disable Cookies on a Landing Page

Joe_Reitz
Level 10 - Champion Alumni

I've been trying to figure out a way to disable cookies on certain forms. I had browsed around the community and Marketo Docs​, but couldn't find a straight answer to my question. Probably operator error... whatever. I ended up getting a great solution directly from our Marketo consultant, so I thought I'd share to hopefully save someone else the hassle.

In the course of time, you may have created a landing page that you didn't want to capture cookie from. The most common example would be an on-site registration form for a tradeshow visitor, but we've also had it happen where a sales rep would log on to a landing page and utilize our appointment setting forms on behalf of their customers. In either scenario, you don't necessarily want Marketo to assume that the person that filled out the form was actually the same person entered into the fields. Simply by inserting the below script onto your landing page, you can effectively block your forms from capturing cookie data.

<script>

MktoForms2.whenReady(function (form){

form.addHiddenFields({"_mkt_trk":""});

form.onSubmit(function (){

   form.vals({"_mkt_trk":""});

});

});

</script>

On a standard landing page, you can just drag in the HTML widget, paste this script in, and you're done. On a guided landing page, you'll have to create a duplicate non-cookied template, and throw that script into the header like you normally would.

If it doesn't look cool, you're probably doing it wrong.
13 REPLIES 13
Justin_Cooperm2
Level 10

Isn't it easier to just disable form pre-fill for some (or all) of the form by going into the Form Editor and selecting the fields you'd like to disable and choosing "Form-Prefill = Disabled"

Anonymous
Not applicable

Disabling pre-fill still doesn't prevent the munchkin from tracking & scoring engagements after the fact. What I am looking for, is disabling munchkin tracking on a specific landing page, as opposed to the template itself --but thanks for sharing!

Justin_Cooperm2
Level 10

The best thing to do is to disable munchkin at the template level and disable pre-fill.

If you don't do that, then Munchkin will still be active on the page and will be tracking page views and clicks, it just won't associate the cookie with the form submission. So, if someone was cookied earlier on some other page on that machine you are using, it would be tracking page views and clicks, which you say you do not want.

Justin_Cooperm2
Level 10

Forgot to mention:

If you are using a "Mobile Compatible" Free-form LP Template or a Guided LP Template, you can also easily disable Munchkin tracking code entirely. Click "Edit Draft" on the LP Template you are using and then click Template Actions > Disable Munchkin Tracking. This will prevent leads from being tracked/cookied on this page.

Kenny_Elkington
Marketo Employee

Both of these actually have slightly different behaviors than what is accomplished by what Joe noted.  Disabling prefill or per-page/template doesn't prevent the swapping of cookies over to the submitted lead, while this one does.

Justin_Cooperm2
Level 10

True, but in the use-case of different people walking up to the machine to submit a form, you also want pre-fill disabled. I think the cleanest way to accomplish this would be entirely from the form editor. Disable pre-fill for all the fields in the form and also add a hidden field for _mkt_trk and make the default value empty.

Kenny_Elkington
Marketo Employee

I'd like this, but it's not currently possible since you cannot select _mkt_trk as a field in the editor.

Anonymous
Not applicable

Thank you so much for this! Saved me time and headache from looking for the same answer

Joe_Reitz
Level 10 - Champion Alumni

my pleasure

If it doesn't look cool, you're probably doing it wrong.
Anonymous
Not applicable

I just wanted to point out that another avenue of great resources is the Developer's page. You'll actually find the above (http://developers.marketo.com/blog/clearing-marketo-tracking-cookie-from-forms-2-0-submission/,)​​ and more cool stuff.

Stephen_Jeong1
Level 3

Hi Jim,

I've actually tried using the code that's provided on that page but the cookie isn't being cleared even with that code. Have you seen any other solutions for this?

SanfordWhiteman
Level 10 - Community Moderator

Further to Justin's comment, please create a new thread in Products​ and include the URL of your page w/form. It's almost always necessary to include a link to your actual deployed code so we can troubleshoot, catch syntax errors, etc.

Justin_Cooperm2
Level 10

That code won't clear the cookie, it just makes sure the form submission will not be linked to an existing cookie on the machine.

Since the user may have been cookied by a separate page on the same domain earlier, what you'd want to do is:

- Disable munchkin on that specific landing page (see other replies in this thread) so that web activities like visit webpage won't be logged for existing known previously cookied users and new visitors won't be cookied

-Disable pre-fill so that the form isn't filled with info from existing known previously cookied users (if you're using a Marketo LP, form pre-fill is not done via Munchkin)

-Add the script posted by Joe above (or Jim) so that an existing cookie value is not submitted with the form submission, linking the submitted data to that known cookied lead.

Alternatively, you can certainly delete the cookie via JavaScript, but I'm not sure if you'd want to do that (or if it'd even be the right approach).