Skip to main content
September 26, 2014
Question

Check cookie to see if user has filled a form before JS

  • September 26, 2014
  • 3 replies
  • 2022 views
Hi everyone,

I'm currently combining Forms 2.0 with some JS inside an onSuccess callback, that will append a download link once the form has been submitted (I've achieved this okay!)

What I'm looking to do is check for a marketo cookie when a user visits the form to see if they've filled out the form in the past:

Does marketo set a cookie that contains this information once a form is submitted?
How would I access that if so?

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

3 replies

Kenny_Elkington
Adobe Employee
Adobe Employee
September 26, 2014
Hi Stan,

We do not set a cookie in the browser automatically if a lead has filled out a form, but it should be quite simple to implement one yourself.  You can also use getLeadActivity from our SOAP to check for Form Fillouts on a records, but that'll require some servers-side work.  Setting the cookie in the browser is probably simpler.
September 26, 2014
You can check if the Marketo cookie exists, but this would not indicate if they have a filled out a certain form. This StackOverflow questions shows how to check for a Marketo cookie with jQuery:

http://stackoverflow.com/questions/6362688/jquery-check-if-cookie-exists-if-not-create-it

A
s Kenny described, getLeadActivty is the best way to check for form fill activity. You can query this API with the value of the user's cookie. So it possible to do this in real-time when a visitor is on your website. 
September 26, 2014
A second approach, which would be easier, is to put your own cookie on a user's browser when the form is filled out. Then check if the cookie exists before loading a form.