Pro-Tip: Disable Cookies on a Landing Page | Community
Skip to main content
Joe_Reitz
Level 8
August 28, 2015
Question

Pro-Tip: Disable Cookies on a Landing Page

  • August 28, 2015
  • 3 replies
  • 8163 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

September 13, 2015

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
May 31, 2017

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
June 1, 2017

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

October 7, 2015

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

Joe_Reitz
Joe_ReitzAuthor
Level 8
October 7, 2015

my pleasure

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

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
October 7, 2015

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
Adobe Employee
Adobe Employee
October 7, 2015

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.