Form "Not You?" functionality

Go to solution
Level 5

Re: Form "Not You?" functionality


I am sure it is possible even with those templates because the solution is not dependent on the template used. The Marketo cookie is "_mkto_trk" no matter what template you use and the prefilled values leverage the mktoPreFillFields array always. As long as you can destroy the cookie, it should work and clear the prefill values, you should be ok. Try putting the code below on one of your pages and visit the URL appending "?userId=guest" right after the page address. Make sure to replace the part that says "insert_your_domain_here" with your Marketo page URL domain name.



if(Mkto.getUrlParam("userId") == "guest"){


         mktoPreFillFields = {};


         document.cookie = '_mkto_trk=NULL; expires=-1; path=/;';




By the way, there might be some tweaks needed for this code to work depending on the form you are using on the page.

If you have any problems implementing it, feel free to drop me a line at

Good luck!


Level 10 - Community Moderator

Re: Form "Not You?" functionality

Rafael, really shouldn't use NULL here because misleadingly implies it has a special value, but it's just a literal four-letter string "NULL" in the cookie context.  For example, if I do document.cookie='abc123=NULL ... ' I'll then have a cookie named abc123 with value "NULL".  Instead, when deleting a cookie, use an empty value to signify your intent to delete it: document.cookie='_mkto_trk=; ... ';

Also, Forms 2.0 doesn't have the #_mkt_trk field, so you don't need to clear its value, though I suppose it's harmless to use it.

Perhaps more important than the above, your code has a race condition if you try to use it with embedded forms (including when the external embed code is used on Marketo-hosted LPs).  It'll sometimes work and sometimes not.  You should use the Marketo Forms 2.0 API (the whenReady event) to ensure that the form actually exists in the DOM at the point you try to reset it.  Don't try to guess when the form is in the page, let the form itself tell you when it is ready to be filled/reset/modified.

Not applicable

Re: Form "Not You?" functionality

Thanks for the help and responses.

Still having some difficulty...

Here's what I got;

<script type="text/javascript">


    function resetMktoForm() {


        mktoPreFillFields = {};


        document.cookie = '_mkto_trk=; expires=-1; path=/;';



    if("userID=guest") > -1){





I'm no coder but after looking at this, I actually think the reset function is no longer defined in the version of jQuery I'm using.

It is causing this error:

TypeError: $(...)[0].reset is not a function

Old Jquery

I used to use in old land pages before Guided Templates

New Jquery

Required for Guided Landing Pages because of Bootstrap

I have tried various things to no avail.

Level 10 - Community Moderator

Re: Form "Not You?" functionality

Use the code from the link in my post. 

My code never relies on jQuery (because I know native JS and because jQuery is unnecessary for something so minor).

Level 10 - Community Moderator

Re: Form "Not You?" functionality

Matthew, the most accurate way to do this (on any page, including a GLP) is illustrated in the script at the bottom of this page:

As noted above, you should use the Forms 2.0 API. The API has a whenReady event that tells you when the form is ready for use.  Any other attempt to time when the form is ready (and therefore ready to be reset) relies on luck.

Level 4

Re: Form "Not You?" functionality

Small plug for LaunchPoint Partner Marketera who can help with things like this - aka a Resource Center

Marketing Design: Web, Email, Social, & Print – Marketo LaunchPoint