Pro-Tip: Disable Cookies on a Landing Page

Joe_Reitz
Level 10 - Champion Alumni

Pro-Tip: Disable Cookies on a Landing Page

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
Anonymous
Not applicable

Re: Pro-Tip: Disable Cookies on a Landing Page

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

Re: Pro-Tip: Disable Cookies on a Landing Page

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?

Justin_Cooperm2
Level 10

Re: Pro-Tip: Disable Cookies on a Landing Page

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).

SanfordWhiteman
Level 10 - Community Moderator

Re: Pro-Tip: Disable Cookies on a Landing Page

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.

Anonymous
Not applicable

Re: Pro-Tip: Disable Cookies on a Landing Page

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

Joe_Reitz
Level 10 - Champion Alumni

Re: Pro-Tip: Disable Cookies on a Landing Page

my pleasure

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

Re: Pro-Tip: Disable Cookies on a Landing Page

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"

Justin_Cooperm2
Level 10

Re: Pro-Tip: Disable Cookies on a Landing Page

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

Re: Pro-Tip: Disable Cookies on a Landing Page

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.